From a6070afdda29631fd36e5213f52bf815268bcda4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Iv=C3=A1n=20Ovejero?= Date: Wed, 6 Nov 2024 13:50:41 +0100 Subject: [PATCH] fix(core): Include `projectId` in range query middleware (#11590) --- .../parse-range-query.middleware.test.ts | 16 ++++++++++++++++ packages/cli/src/executions/execution.service.ts | 1 + 2 files changed, 17 insertions(+) diff --git a/packages/cli/src/executions/__tests__/parse-range-query.middleware.test.ts b/packages/cli/src/executions/__tests__/parse-range-query.middleware.test.ts index 8b3395b226165..3c8fa930533cd 100644 --- a/packages/cli/src/executions/__tests__/parse-range-query.middleware.test.ts +++ b/packages/cli/src/executions/__tests__/parse-range-query.middleware.test.ts @@ -108,6 +108,22 @@ describe('`parseRangeQuery` middleware', () => { expect(nextFn).toBeCalledTimes(1); }); + test('should parse `projectId` field', () => { + const req = mock({ + query: { + filter: '{ "projectId": "123" }', + limit: undefined, + firstId: undefined, + lastId: undefined, + }, + }); + + parseRangeQuery(req, res, nextFn); + + expect(req.rangeQuery.projectId).toBe('123'); + expect(nextFn).toBeCalledTimes(1); + }); + test('should delete invalid fields', () => { const req = mock({ query: { diff --git a/packages/cli/src/executions/execution.service.ts b/packages/cli/src/executions/execution.service.ts index 5f4ec0c5350ae..60dadfdc1b925 100644 --- a/packages/cli/src/executions/execution.service.ts +++ b/packages/cli/src/executions/execution.service.ts @@ -66,6 +66,7 @@ export const schemaGetExecutionsQueryFilter = { startedBefore: { type: 'date-time' }, annotationTags: { type: 'array', items: { type: 'string' } }, vote: { type: 'string' }, + projectId: { type: 'string' }, }, $defs: { metadata: {