2022-08-09 04:42:06 +08:00
|
|
|
import Presentations from '/imports/api/presentations';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
import { extractCredentials } from '/imports/api/common/server/helpers';
|
|
|
|
import { check } from 'meteor/check';
|
|
|
|
|
2023-03-15 01:27:52 +08:00
|
|
|
export default async function setPresentationRenderedInToast() {
|
2022-08-09 04:42:06 +08:00
|
|
|
try {
|
|
|
|
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
|
|
|
|
|
|
|
check(meetingId, String);
|
|
|
|
check(requesterUserId, String);
|
|
|
|
|
|
|
|
const payload = {
|
2023-03-15 01:27:52 +08:00
|
|
|
$set: { renderedInToast: true },
|
2022-08-09 04:42:06 +08:00
|
|
|
};
|
|
|
|
|
2023-03-15 01:27:52 +08:00
|
|
|
const numberAffected = await Presentations.updateAsync({
|
2022-08-10 22:57:53 +08:00
|
|
|
renderedInToast: false,
|
|
|
|
meetingId,
|
2022-09-17 04:36:23 +08:00
|
|
|
}, payload, {multi: true});
|
2022-08-09 04:42:06 +08:00
|
|
|
|
|
|
|
if (numberAffected) {
|
2022-09-17 04:36:23 +08:00
|
|
|
Logger.info(`Presentations have been set as rendered in the toast within meeting=${meetingId}, ${numberAffected} documents affected.`);
|
2022-08-09 04:42:06 +08:00
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Exception while invoking method setPresentationRenderedInToast ${err.stack}`);
|
|
|
|
}
|
|
|
|
}
|