Skip to content

Commit c4863b8

Browse files
committed
Add instanceId to logs endpoint's filter
1 parent 3067736 commit c4863b8

File tree

3 files changed

+15
-0
lines changed

3 files changed

+15
-0
lines changed

apps/meteor/ee/server/apps/communication/endpoints/lib/makeAppLogsQuery.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,10 @@ export function makeAppLogsQuery(queryParams: AppLogsProps) {
3636
query.method = queryParams.method;
3737
}
3838

39+
if (queryParams.instanceId) {
40+
query.instanceId = queryParams.instanceId;
41+
}
42+
3943
if (queryParams.startDate) {
4044
query._updatedAt = {
4145
$gte: new Date(queryParams.startDate),

apps/meteor/ee/tests/unit/server/apps/endpoints/lib/makeAppLogsQuery.spec.ts

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -46,6 +46,15 @@ describe('makeAppLogsQuery', () => {
4646
});
4747
});
4848

49+
it('should include instanceId filter when instanceId is provided', () => {
50+
const queryParams: AppLogsProps = { instanceId: 'instance123' };
51+
const result = makeAppLogsQuery(queryParams);
52+
53+
expect(result).to.deep.equal({
54+
instanceId: 'instance123',
55+
});
56+
});
57+
4958
it('should include start date filter when startDate is provided', () => {
5059
const startDate = '2024-01-01T00:00:00.000Z';
5160
const queryParams: AppLogsProps = { startDate };

packages/rest-typings/src/apps/appLogsProps.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import { ajv } from '../v1/Ajv';
44
export type AppLogsProps = PaginatedRequest<{
55
appId?: string;
66
logLevel?: '0' | '1' | '2';
7+
instanceId?: string;
78
method?: string;
89
startDate?: string;
910
endDate?: string;
@@ -14,6 +15,7 @@ const AppLogsPropsSchema = {
1415
properties: {
1516
appId: { type: 'string', nullable: true },
1617
logLevel: { type: 'string', enum: ['0', '1', '2'], nullable: true },
18+
instanceId: { type: 'string', nullable: true },
1719
method: { type: 'string', nullable: true },
1820
startDate: { type: 'string', format: 'date-time', nullable: true },
1921
endDate: { type: 'string', format: 'date-time', nullable: true },

0 commit comments

Comments
 (0)