backend: Update bulk delete recordings response to handle mixed results and add appropriate status codes
This commit is contained in:
parent
2207b7651f
commit
817135433a
@ -1,4 +1,4 @@
|
||||
description: Bulk deletion completed. Includes lists of successfully deleted IDs and errors.
|
||||
description: Mixed results for bulk deletion operation
|
||||
content:
|
||||
application/json:
|
||||
schema:
|
||||
@ -8,10 +8,7 @@ content:
|
||||
type: array
|
||||
items:
|
||||
type: string
|
||||
description: List of successfully deleted recording IDs.
|
||||
example:
|
||||
- 'room-123--EG_XYZ--XX445'
|
||||
- 'room-123--EG_ZYX--XX446'
|
||||
description: List of recordings that were deleted successfully.
|
||||
notDeleted:
|
||||
type: array
|
||||
description: List of recordings that could not be deleted along with the corresponding error messages.
|
||||
@ -27,14 +24,6 @@ content:
|
||||
description: A message explaining why the deletion failed.
|
||||
example: 'Recording not found'
|
||||
examples:
|
||||
successful_deletion:
|
||||
summary: All recordings were successfully deleted
|
||||
value:
|
||||
deleted:
|
||||
- 'room-123--EG_XYZ--XX445'
|
||||
- 'room-123--EG_ZYX--XX446'
|
||||
notDeleted: []
|
||||
|
||||
partial_deletion_with_errors:
|
||||
summary: Some recordings were deleted successfully, others failed
|
||||
value:
|
||||
|
||||
@ -60,6 +60,13 @@
|
||||
responses:
|
||||
'200':
|
||||
$ref: '../components/responses/success-bulk-delete-recordings.yaml'
|
||||
description: >
|
||||
**Mixed results**. Some recordings were deleted successfully while others
|
||||
could not be deleted (e.g., due to being in progress or not found).
|
||||
'204':
|
||||
description: >
|
||||
All specified recordings were deleted successfully.
|
||||
No content is returned.
|
||||
'401':
|
||||
$ref: '../components/responses/unauthorized-error.yaml'
|
||||
'403':
|
||||
|
||||
@ -61,6 +61,12 @@ export const bulkDeleteRecordings = async (req: Request, res: Response) => {
|
||||
const recordingIdsArray = (recordingIds as string).split(',');
|
||||
const { deleted, notDeleted } = await recordingService.bulkDeleteRecordings(recordingIdsArray);
|
||||
|
||||
// All recordings were successfully deleted
|
||||
if (deleted.length > 0 && notDeleted.length === 0) {
|
||||
return res.sendStatus(204);
|
||||
}
|
||||
|
||||
// Some or all recordings could not be deleted
|
||||
return res.status(200).json({ deleted, notDeleted });
|
||||
} catch (error) {
|
||||
if (error instanceof OpenViduMeetError) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user