Files
AgentCompany/src/main/database/company.ts
T
2026-04-04 12:03:50 -04:00

23 lines
920 B
TypeScript

import type { DatabaseSync } from "node:sqlite";
import type { ProfileSnapshot } from "@shared/types";
import type { ReadAll, Transaction } from "./helpers";
import { buildCompanyCrudMethods } from "./company-crud";
import { buildCompanySettingsMethods } from "./company-settings";
export function buildCompanyMethods(
getDb: () => DatabaseSync,
readAll: ReadAll,
transaction: Transaction,
deps: {
getSetting: (key: string) => string | null;
setSetting: (key: string, value: string) => void;
listSnapshot: (options: { companyId?: string | null }) => ProfileSnapshot;
addComment: (input: { companyId: string; taskId: string; authorAgentId: string | null; authorName: string; body: string }) => void;
},
) {
return {
...buildCompanyCrudMethods(getDb, readAll, transaction, deps),
...buildCompanySettingsMethods(getDb, readAll, transaction, { listSnapshot: deps.listSnapshot }),
};
}