Speed up issue search

This commit is contained in:
dotta 2026-04-06 20:30:50 -05:00
parent 0edac73a68
commit 5136381d8f
15 changed files with 13127 additions and 27 deletions

View file

@ -346,6 +346,9 @@ export function issueRoutes(
unreadForUserFilterRaw === "me" && req.actor.type === "board"
? req.actor.userId
: unreadForUserFilterRaw;
const rawLimit = req.query.limit as string | undefined;
const parsedLimit = rawLimit ? Number.parseInt(rawLimit, 10) : null;
const limit = parsedLimit ?? undefined;
if (assigneeUserFilterRaw === "me" && (!assigneeUserId || req.actor.type !== "board")) {
res.status(403).json({ error: "assigneeUserId=me requires board authentication" });
@ -363,6 +366,10 @@ export function issueRoutes(
res.status(403).json({ error: "unreadForUserId=me requires board authentication" });
return;
}
if (rawLimit !== undefined && (parsedLimit === null || !Number.isInteger(parsedLimit) || parsedLimit <= 0)) {
res.status(400).json({ error: "limit must be a positive integer" });
return;
}
const result = await svc.list(companyId, {
status: req.query.status as string | undefined,
@ -381,6 +388,7 @@ export function issueRoutes(
includeRoutineExecutions:
req.query.includeRoutineExecutions === "true" || req.query.includeRoutineExecutions === "1",
q: req.query.q as string | undefined,
limit,
});
res.json(result);
});