backend: Update getRecordings to filter by roomId when recording token is present
This commit is contained in:
parent
f1c59526e0
commit
bc326ba707
@ -33,7 +33,16 @@ export const getRecordings = async (req: Request, res: Response) => {
|
|||||||
const recordingService = container.get(RecordingService);
|
const recordingService = container.get(RecordingService);
|
||||||
const queryParams = req.query;
|
const queryParams = req.query;
|
||||||
|
|
||||||
logger.verbose('Getting all recordings');
|
// If recording token is present, retrieve only recordings for the room associated with the token
|
||||||
|
const payload = req.session?.tokenClaims;
|
||||||
|
|
||||||
|
if (payload && payload.video) {
|
||||||
|
const roomId = payload.video.room;
|
||||||
|
queryParams.roomId = roomId;
|
||||||
|
logger.debug(`Getting recordings for room ${roomId}`);
|
||||||
|
} else {
|
||||||
|
logger.verbose('Getting all recordings');
|
||||||
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
const { recordings, isTruncated, nextPageToken } = await recordingService.getAllRecordings(queryParams);
|
const { recordings, isTruncated, nextPageToken } = await recordingService.getAllRecordings(queryParams);
|
||||||
@ -67,7 +76,8 @@ export const bulkDeleteRecordings = async (req: Request, res: Response) => {
|
|||||||
try {
|
try {
|
||||||
// TODO: Check role to determine if the request is from an admin or a participant
|
// TODO: Check role to determine if the request is from an admin or a participant
|
||||||
const recordingIdsArray = (recordingIds as string).split(',');
|
const recordingIdsArray = (recordingIds as string).split(',');
|
||||||
const { deleted, notDeleted } = await recordingService.bulkDeleteRecordingsAndAssociatedFiles(recordingIdsArray);
|
const { deleted, notDeleted } =
|
||||||
|
await recordingService.bulkDeleteRecordingsAndAssociatedFiles(recordingIdsArray);
|
||||||
|
|
||||||
// All recordings were successfully deleted
|
// All recordings were successfully deleted
|
||||||
if (deleted.length > 0 && notDeleted.length === 0) {
|
if (deleted.length > 0 && notDeleted.length === 0) {
|
||||||
@ -200,5 +210,3 @@ export const getRecordingMedia = async (req: Request, res: Response) => {
|
|||||||
return res.status(500).json({ name: 'Recording Error', message: 'Unexpected error streaming recording' });
|
return res.status(500).json({ name: 'Recording Error', message: 'Unexpected error streaming recording' });
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
// Internal Recording methods
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user