Skip to content

Commit 2e32257

Browse files
committed
fix: include default search params for project_id filters
1 parent 9d9dccb commit 2e32257

1 file changed

Lines changed: 5 additions & 0 deletions

File tree

src/routes/admin/apisearcher.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -241,6 +241,7 @@ export const setupAPISearchRoutes = function(app: Express, prisma: PrismaClient)
241241
const pageNum = getPageNumber(req, NaN);
242242
const api = await getAPIClient();
243243
const teams = await fetchSingleApiPage(api, '/teams/', {
244+
...API_DEFAULT_FILTERS_PROJECTS,
244245
'filter[project_id]': projectId,
245246
'page[size]': itemsPerPage.toString(),
246247
}, pageNum);
@@ -349,10 +350,14 @@ export const setupAPISearchRoutes = function(app: Express, prisma: PrismaClient)
349350
app.get('/admin/apisearch/exams/project_id/:projectId', async (req, res) => {
350351
try {
351352
const projectId = req.params.projectId;
353+
if (!EXAM_PROJECT_IDS.includes(parseInt(projectId))) {
354+
return res.status(400).json({ error: 'Invalid exam project ID' });
355+
}
352356
const itemsPerPage = 50;
353357
const pageNum = getPageNumber(req, NaN);
354358
const api = await getAPIClient();
355359
const teams = await fetchSingleApiPage(api, '/teams/', {
360+
...API_DEFAULT_FILTERS_EXAMS,
356361
'filter[project_id]': projectId,
357362
'page[size]': itemsPerPage.toString(),
358363
}, pageNum);

0 commit comments

Comments
 (0)