import { db } from "@pkg/db"; import { type Err } from "@pkg/result"; import { FlowExecCtx } from "@core/flow.execution.context"; import { ResultAsync } from "neverthrow"; import { CreateSupportedApp, SupportedApp, UpdateSupportedApp, } from "./data"; import { SupportedAppRepository } from "./repository"; export class SupportedAppController { constructor(private repo: SupportedAppRepository) {} list(fctx: FlowExecCtx): ResultAsync { return this.repo.list(fctx); } getById(fctx: FlowExecCtx, id: number): ResultAsync { return this.repo.getById(fctx, id); } create( fctx: FlowExecCtx, data: CreateSupportedApp, ): ResultAsync { return this.repo.create(fctx, data); } update( fctx: FlowExecCtx, id: number, data: UpdateSupportedApp, ): ResultAsync { return this.repo.update(fctx, id, data); } delete(fctx: FlowExecCtx, id: number): ResultAsync { return this.repo.delete(fctx, id); } } export function getSupportedAppController(): SupportedAppController { return new SupportedAppController(new SupportedAppRepository(db)); }