refactor(api-server): move tasks SQL into db.tasks/db.documents domain methods

Replace inline queryAll calls in routes-tasks.ts with two new domain
methods: tasks.listTasksByStatuses (used by GET /api/companies/:id/issues)
and documents.listImportantDocsForReview (used by the deliverable-review
gate). Routes now hold no SQL or column-mapping logic; the
TaskListByStatusesRow shape preserves the existing HTTP response fields
including requiresUserReview as a boolean.
This commit is contained in:
ZacharyZhang-NY committed 2026-04-16 22:29:36 -04:00
1 parent 555d8e59eb
commit 7f097e3319
5 files changed
+85 -24

No files matched your search

+1
View File
@@ -82,6 +82,7 @@ export class AppDatabase extends AppDatabaseBase {
// ─── Documents & Work Products ─────────────────────────────────────────────
saveDocument(input: { id?: string | null; companyId: string; type: string; title: string; content?: string; authorAgentId?: string | null; reviewerAgentId?: string | null; projectId?: string | null; goalId?: string | null; parentDocId?: string | null; version?: number; status?: string; tagsJson?: string; sourceRunId?: string | null }) { return this.documentsMod.saveDocument(input); }
listImportantDocsForReview(input: { companyId: string; types: readonly string[]; authorAgentId: string | null; taskId: string; limit?: number }) { return this.documentsMod.listImportantDocsForReview(input); }
updateDocumentStatus(id: string, companyId: string, status: string) { this.documentsMod.updateDocumentStatus(id, companyId, status); }
deleteDocument(id: string, companyId: string) { this.documentsMod.deleteDocument(id, companyId); }
createDocumentRevision(input: { documentId: string; companyId: string; body: string; changeSummary?: string | null; createdByAgentId?: string | null; createdByUserId?: string | null }) { return this.documentsMod.createDocumentRevision(input); }