refactor(api-server): move work-graph SQL into db domain methods

Replace six inline queryAll calls in routes-work-graph.ts with domain
methods. db.entityCrud gains listGoals, getGoalForUpdate, listProjects,
getProjectForUpdate. db.knowledge gains listSprints. db.company gains
getDashboardSnapshot, which returns the raw agent/task/activity rows
the dashboard handler aggregates. The route-level row shapes are
preserved in the new GoalListRow / ProjectListRow / SprintListRow
types so HTTP responses remain identical.
This commit is contained in:
ZacharyZhang-NY committed 2026-04-16 22:34:46 -04:00
1 parent 2be1bd1612
commit efb9fdb8cc
6 files changed
+162 -60

No files matched your search

+5
View File
@@ -65,7 +65,11 @@ export class AppDatabase extends AppDatabaseBase {
// ─── Entity CRUD ───────────────────────────────────────────────────────────
saveGoal(input: { id?: string | null; companyId: string; title: string; description: string; parentId?: string | null; ownerAgentId?: string | null; status: string }) { return this.entityCrud.saveGoal(input); }
listGoals(companyId: string) { return this.entityCrud.listGoals(companyId); }
getGoalForUpdate(goalId: string, companyId: string) { return this.entityCrud.getGoalForUpdate(goalId, companyId); }
saveProject(input: { id?: string | null; companyId: string; goalId?: string | null; name: string; description: string; leadAgentId?: string | null; targetDate?: string | null; status: string }) { return this.entityCrud.saveProject(input); }
listProjects(companyId: string) { return this.entityCrud.listProjects(companyId); }
getProjectForUpdate(projectId: string, companyId: string) { return this.entityCrud.getProjectForUpdate(projectId, companyId); }
saveSecret(input: { id?: string | null; companyId: string; name: string; description: string; value: string }) { return this.entityCrud.saveSecret(input, this.vault); }
resolveSecretEnv(bindingText: string, companyId: string) { return this.entityCrud.resolveSecretEnv(bindingText, companyId, this.vault, listInvalidEnvBindingKeys, parseEnvBindingText); }
deleteGoal(id: string, companyId: string) { this.entityCrud.deleteGoal(id, companyId); }
@@ -118,6 +122,7 @@ export class AppDatabase extends AppDatabaseBase {
listKnowledgeEntries(companyId: string) { return this.knowledgeMod.listKnowledgeEntries(companyId); }
saveSprint(input: { id?: string | null; companyId: string; name: string; goal?: string; startDate: string; endDate: string; status?: string; retrospectiveNotes?: string; velocityPoints?: number; completedPoints?: number }) { return this.knowledgeMod.saveSprint(input); }
deleteSprint(id: string, companyId: string) { this.knowledgeMod.deleteSprint(id, companyId); }
listSprints(companyId: string) { return this.knowledgeMod.listSprints(companyId); }
// ─── Automation ────────────────────────────────────────────────────────────