fix: wire parentId query filter into issues list endpoint
The parentId parameter on GET /api/companies/:companyId/issues was silently ignored — the filter was never extracted from the query string, never passed to the service layer, and the IssueFilters type did not include it. All other filters (status, assigneeAgentId, projectId, etc.) worked correctly. This caused subtask lookups to return every issue in the company instead of only children of the specified parent. Changes: - Add parentId to IssueFilters interface - Add eq(issues.parentId, filters.parentId) condition in list() - Extract parentId from req.query in the route handler Fixes: LAS-101
This commit is contained in:
@@ -230,6 +230,7 @@ export function issueRoutes(db: Db, storage: StorageService) {
|
||||
touchedByUserId,
|
||||
unreadForUserId,
|
||||
projectId: req.query.projectId as string | undefined,
|
||||
parentId: req.query.parentId as string | undefined,
|
||||
labelId: req.query.labelId as string | undefined,
|
||||
q: req.query.q as string | undefined,
|
||||
});
|
||||
|
||||
@@ -53,6 +53,7 @@ export interface IssueFilters {
|
||||
touchedByUserId?: string;
|
||||
unreadForUserId?: string;
|
||||
projectId?: string;
|
||||
parentId?: string;
|
||||
labelId?: string;
|
||||
q?: string;
|
||||
}
|
||||
@@ -458,6 +459,7 @@ export function issueService(db: Db) {
|
||||
conditions.push(unreadForUserCondition(companyId, unreadForUserId));
|
||||
}
|
||||
if (filters?.projectId) conditions.push(eq(issues.projectId, filters.projectId));
|
||||
if (filters?.parentId) conditions.push(eq(issues.parentId, filters.parentId));
|
||||
if (filters?.labelId) {
|
||||
const labeledIssueIds = await db
|
||||
.select({ issueId: issueLabels.issueId })
|
||||
|
||||
Reference in New Issue
Block a user