supported apps domain + some refactor of data types redundancy

This commit is contained in:
user
2026-03-28 16:19:24 +02:00
parent 6639bcd799
commit 671a712b08
26 changed files with 2052 additions and 169 deletions

View File

@@ -0,0 +1,45 @@
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<SupportedApp[], Err> {
return this.repo.list(fctx);
}
getById(fctx: FlowExecCtx, id: number): ResultAsync<SupportedApp, Err> {
return this.repo.getById(fctx, id);
}
create(
fctx: FlowExecCtx,
data: CreateSupportedApp,
): ResultAsync<SupportedApp, Err> {
return this.repo.create(fctx, data);
}
update(
fctx: FlowExecCtx,
id: number,
data: UpdateSupportedApp,
): ResultAsync<SupportedApp, Err> {
return this.repo.update(fctx, id, data);
}
delete(fctx: FlowExecCtx, id: number): ResultAsync<boolean, Err> {
return this.repo.delete(fctx, id);
}
}
export function getSupportedAppController(): SupportedAppController {
return new SupportedAppController(new SupportedAppRepository(db));
}