backend: enhance auto-deletion policy validation to disallow 'FAIL' options
This commit is contained in:
parent
0b3c0e9e42
commit
5b17efc5a2
@ -127,10 +127,29 @@ const RoomRequestOptionsSchema: z.ZodType<MeetRoomOptions> = z.object({
|
||||
`autoDeletionDate must be at least ${INTERNAL_CONFIG.MIN_FUTURE_TIME_FOR_ROOM_AUTODELETION_DATE} in the future`
|
||||
)
|
||||
.optional(),
|
||||
autoDeletionPolicy: RoomAutoDeletionPolicySchema.optional().default({
|
||||
autoDeletionPolicy: RoomAutoDeletionPolicySchema.optional()
|
||||
.default({
|
||||
withMeeting: MeetRoomDeletionPolicyWithMeeting.WHEN_MEETING_ENDS,
|
||||
withRecordings: MeetRoomDeletionPolicyWithRecordings.CLOSE
|
||||
}),
|
||||
})
|
||||
.refine(
|
||||
(policy) => {
|
||||
return !policy || policy.withMeeting !== MeetRoomDeletionPolicyWithMeeting.FAIL;
|
||||
},
|
||||
{
|
||||
message: 'FAIL policy is not allowed for withMeeting auto-deletion policy',
|
||||
path: ['withMeeting']
|
||||
}
|
||||
)
|
||||
.refine(
|
||||
(policy) => {
|
||||
return !policy || policy.withRecordings !== MeetRoomDeletionPolicyWithRecordings.FAIL;
|
||||
},
|
||||
{
|
||||
message: 'FAIL policy is not allowed for withRecordings auto-deletion policy',
|
||||
path: ['withRecordings']
|
||||
}
|
||||
),
|
||||
preferences: RoomPreferencesSchema.optional().default({
|
||||
recordingPreferences: { enabled: true, allowAccessTo: MeetRecordingAccess.ADMIN_MODERATOR_SPEAKER },
|
||||
chatPreferences: { enabled: true },
|
||||
|
||||
@ -243,7 +243,7 @@ export class LivekitWebhookService {
|
||||
`Deleting room '${roomId}' (and its recordings if any) after meeting finished because it was scheduled to be deleted`
|
||||
);
|
||||
await this.recordingService.deleteAllRoomRecordings(roomId); // This operation must complete before deleting the room
|
||||
tasks.push(this.roomService.bulkDeleteRooms([roomId], true));
|
||||
tasks.push(this.storageService.deleteMeetRooms([roomId]));
|
||||
break;
|
||||
case MeetingEndAction.CLOSE:
|
||||
this.logger.info(
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user