bigbluebutton-Github/bigbluebutton-html5/imports/api/pads/server/modifiers/deleteSession.js
2023-03-20 16:38:31 -03:00

31 lines
802 B
JavaScript

import { check } from 'meteor/check';
import { PadsSessions } from '/imports/api/pads';
import Logger from '/imports/startup/server/logger';
export default async function deleteSession(meetingId, externalId, userId, sessionId) {
try {
check(meetingId, String);
check(externalId, String);
check(userId, String);
check(sessionId, String);
const selector = {
meetingId,
userId,
};
const modifier = {
$pull: {
sessions: {
[externalId] : sessionId,
},
},
};
await PadsSessions.upsertAsync(selector, modifier);
Logger.debug(`Removed pad session=${sessionId} external=${externalId} user=${userId} meeting=${meetingId}`);
} catch (err) {
Logger.error(`Removing pad session to the collection: ${err}`);
}
}