Collapse the GET /api/agents/me/standup duplicate to one module
Two registrations of the same route lived in the codebase: one inline in routes-agents.ts that filtered three full company-wide SELECTs in memory, and the dedicated routes-agents-standup.ts that uses targeted standup-shaped DB queries. The router keeps the first match so the inline copy was serving every request and the focused module was dead code — any future fix to standup would have silently missed production. Remove the inline standup handler and its three companion helpers (`listAgentsForStandup`, `listTasksForStandup`, `listApprovalsForStandup`) plus the unused `AgentStandupRow` type. The dedicated standup module is now the single source of truth.
This commit is contained in:
1 parent
efb4bddab6
commit
1a0fdc6f31
5 files changed
+4
-167
No files matched your search
@@ -35,18 +35,6 @@ export type AgentApiRow = {
|
||||
updatedAt: string;
|
||||
};
|
||||
|
||||
/**
|
||||
* Slim agent projection used by the me/standup aggregation.
|
||||
*/
|
||||
export type AgentStandupRow = {
|
||||
id: string;
|
||||
companyId: string;
|
||||
name: string;
|
||||
role: string;
|
||||
status: string;
|
||||
reportsTo: string | null;
|
||||
department: string | null;
|
||||
};
|
||||
|
||||
export function buildAgentHierarchyMethods(
|
||||
getDb: () => DatabaseSync,
|
||||
@@ -126,18 +114,6 @@ export function buildAgentHierarchyMethods(
|
||||
).map((a) => ({ ...a, heartbeatEnabled: Boolean(a.heartbeatEnabled) })) as AgentApiRow[];
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the slim standup projection used by
|
||||
* GET /api/agents/me/standup — only the fields that feed the
|
||||
* aggregation (id, name, role, status, reportsTo, department).
|
||||
*/
|
||||
listAgentsForStandup(companyId: string): AgentStandupRow[] {
|
||||
return readAll<AgentStandupRow>(
|
||||
"select id, company_id as companyId, name, role, status, reports_to as reportsTo, department from agents where company_id = ? order by created_at asc",
|
||||
companyId,
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the slim direct-reports projection used by
|
||||
* GET /api/agents/me/standup — only (id, name, role, status).
|
||||
|
||||
@@ -179,25 +179,6 @@ export function buildApprovalMethods(
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the slim approval projection used by
|
||||
* GET /api/agents/me/standup. Ordered by created_at desc.
|
||||
*/
|
||||
listApprovalsForStandup(companyId: string): Array<{
|
||||
id: string;
|
||||
companyId: string;
|
||||
type: string;
|
||||
requestedByAgentId: string | null;
|
||||
state: string;
|
||||
payloadSummary: string | null;
|
||||
decisionNote: string | null;
|
||||
}> {
|
||||
return readAll(
|
||||
"select id, company_id as companyId, type, requested_by_agent_id as requestedByAgentId, state, payload_summary as payloadSummary, decision_note as decisionNote from approvals where company_id = ? order by created_at desc",
|
||||
companyId,
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns pending `hire_agent` approval payloads for a company, used
|
||||
* during hire-request creation to detect duplicate names across
|
||||
|
||||
@@ -82,24 +82,6 @@ export function buildTaskQueryMethods(
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns the slim task projection used by the me/standup aggregation.
|
||||
* Ordered by created_at desc.
|
||||
*/
|
||||
listTasksForStandup(companyId: string): Array<{
|
||||
id: string;
|
||||
companyId: string;
|
||||
title: string;
|
||||
assigneeAgentId: string | null;
|
||||
status: string;
|
||||
priority: string;
|
||||
}> {
|
||||
return readAll(
|
||||
"select id, company_id as companyId, title, assignee_agent_id as assigneeAgentId, status, priority from tasks where company_id = ? order by created_at desc",
|
||||
companyId,
|
||||
);
|
||||
},
|
||||
|
||||
/**
|
||||
* Returns tasks filtered by status.
|
||||
*/
|
||||
|
||||
Reference in new issue
Block a user