refactor(api-server): move approvals SQL into db.approvals domain methods

Replace the ad-hoc getApproval helper and the filterable list query
in routes-approvals.ts with db.approvals methods. Add findApprovalById
(non-throwing lookup returning null) and listApprovalsForApi (accepts
requestedByAgentId / relatedTaskId / statuses filters and builds the
prepared statement inside the domain layer).
This commit is contained in:
ZacharyZhang-NY committed 2026-04-16 22:38:05 -04:00
1 parent 28296b3d5f
commit 4342cf3e2f
3 files changed
+26 -30

No files matched your search

+1
View File
@@ -291,6 +291,7 @@ export class AppDatabaseBase {
requestApproval(input: { companyId: string; relatedTaskId?: string | null; requestedByAgentId?: string | null; relatedAgentId?: string | null; type: string; payloadSummary: string; impactSummary: string; payloadJson?: string | null }) { return this.approvalsMod.requestApproval(input); }
decideApproval(input: { companyId?: string | null; approvalId: string; state: string; decisionNote: string }) { return this.approvalsMod.decideApproval(input); }
getApprovalRecord(id: string) { return this.approvalsMod.getApprovalRecord(id); }
findApprovalById(id: string) { return this.approvalsMod.findApprovalById(id); }
deleteApproval(id: string, companyId: string) { this.approvalsMod.deleteApproval(id, companyId); }
getBlockingApproval(companyId: string, agentId: string, taskId: string | null) { return this.approvalsMod.getBlockingApproval(companyId, agentId, taskId); }
resubmitApproval(approvalId: string, companyId: string) { this.approvalsMod.resubmitApproval(approvalId, companyId); }