refactor(api-server): move files SQL into db.documents domain methods
Replace raw queryAll calls in routes-files.ts with two new domain methods on db.documents: listDocuments (powers GET /api/companies/:companyId/documents) and getDocumentForUpdate (used by the PATCH document handler). The DocumentListRow / DocumentLookupRow shapes preserve the historical inline-SQL projections so HTTP responses remain identical.
This commit is contained in:
1 parent
7f097e3319
commit
79e57567b2
3 files changed
+74
-22
No files matched your search
@@ -83,6 +83,8 @@ export class AppDatabase extends AppDatabaseBase {
|
||||
|
||||
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); }
|
||||
listDocuments(companyId: string) { return this.documentsMod.listDocuments(companyId); }
|
||||
getDocumentForUpdate(documentId: string, companyId: string) { return this.documentsMod.getDocumentForUpdate(documentId, companyId); }
|
||||
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); }
|
||||
|
||||
Reference in new issue
Block a user