backend: Remove status filter from recording API and related validation

This commit is contained in:
Carlos Santos 2025-03-28 11:11:03 +01:00
parent 94de7d6610
commit 195b56a4b4
3 changed files with 24 additions and 37 deletions

View File

@ -505,27 +505,27 @@ paths:
security: security:
- apiKeyInHeader: [] - apiKeyInHeader: []
parameters: parameters:
- name: status # - name: status
in: query # in: query
required: false # required: false
description: | # description: |
Filter recordings by their status. # Filter recordings by their status.
Possible values: # Possible values:
- `STARTING` # - `STARTING`
- `ACTIVE` # - `ACTIVE`
- `ENDING` # - `ENDING`
- `COMPLETE` # - `COMPLETE`
- `FAILED` # - `FAILED`
- `ABORTED` # - `ABORTED`
- `LIMITED_REACHED` # - `LIMITED_REACHED`
You can provide multiple statuses as a comma-separated list (e.g., `status=ACTIVE,FAILED`). # You can provide multiple statuses as a comma-separated list (e.g., `status=ACTIVE,FAILED`).
If not specified, recordings with any status will be returned. # If not specified, recordings with any status will be returned.
> ⚠️ **Note:** Using this filter may impact performance for large datasets. # > ⚠️ **Note:** Using this filter may impact performance for large datasets.
schema: # schema:
type: string # type: string
- name: roomId - name: roomId
in: query in: query
required: false required: false

View File

@ -50,7 +50,7 @@ const GetRecordingsFiltersSchema: z.ZodType<MeetRecordingFilters> = z.object({
.optional() .optional()
.transform((val = 10) => (val > 100 ? 100 : val)) .transform((val = 10) => (val > 100 ? 100 : val))
.default(10), .default(10),
status: z.string().optional(), // status: z.string().optional(),
roomId: z.string().optional(), roomId: z.string().optional(),
nextPageToken: z.string().optional() nextPageToken: z.string().optional()
}); });

View File

@ -224,7 +224,7 @@ export class RecordingService {
* - `nextPageToken`: (Optional) A token to retrieve the next page of results, if available. * - `nextPageToken`: (Optional) A token to retrieve the next page of results, if available.
* @throws Will throw an error if there is an issue retrieving the recordings. * @throws Will throw an error if there is an issue retrieving the recordings.
*/ */
async getAllRecordings({ maxItems, nextPageToken, roomId, status }: MeetRecordingFilters): Promise<{ async getAllRecordings({ maxItems, nextPageToken, roomId }: MeetRecordingFilters): Promise<{
recordings: MeetRecordingInfo[]; recordings: MeetRecordingInfo[];
isTruncated: boolean; isTruncated: boolean;
nextPageToken?: string; nextPageToken?: string;
@ -253,22 +253,7 @@ export class RecordingService {
} }
}); });
let recordings: MeetRecordingInfo[] = await Promise.all(promises); const recordings: MeetRecordingInfo[] = await Promise.all(promises);
if (status) {
// Filter recordings by status if a status filter is provided
// status is already an array of RegExp after middleware validation.
const statusArray = status
.split(',')
.map((s) => s.trim())
.filter(Boolean)
.map((s) => new RegExp(this.sanitizeRegExp(s)));
recordings = recordings.filter((recording) =>
statusArray.some((regex) => regex.test(recording.status))
);
}
this.logger.info(`Retrieved ${recordings.length} recordings.`); this.logger.info(`Retrieved ${recordings.length} recordings.`);
// Return the paginated list of recordings // Return the paginated list of recordings
@ -513,7 +498,9 @@ export class RecordingService {
} }
// Reject the REST request with a timeout error. // Reject the REST request with a timeout error.
rejectRequest(new Error(`Timeout waiting for '${SystemEventType.RECORDING_ACTIVE}' event in room '${roomId}'`)); rejectRequest(
new Error(`Timeout waiting for '${SystemEventType.RECORDING_ACTIVE}' event in room '${roomId}'`)
);
} }
} }