2019-02-21 01:17:17 +08:00
|
|
|
import RedisPubSub from '/imports/startup/server/redis';
|
|
|
|
import { check } from 'meteor/check';
|
2020-02-07 04:47:28 +08:00
|
|
|
import { extractCredentials } from '/imports/api/common/server/helpers';
|
2021-05-05 22:34:36 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
2019-02-21 01:17:17 +08:00
|
|
|
|
2023-08-16 22:18:51 +08:00
|
|
|
export default function setPresentationDownloadable(presentationId, downloadable, typeOfExport) {
|
2019-02-21 01:17:17 +08:00
|
|
|
const REDIS_CONFIG = Meteor.settings.private.redis;
|
|
|
|
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
2019-02-21 06:20:04 +08:00
|
|
|
const EVENT_NAME = 'SetPresentationDownloadablePubMsg';
|
2019-02-21 01:17:17 +08:00
|
|
|
|
2021-05-05 22:34:36 +08:00
|
|
|
try {
|
|
|
|
const { meetingId, requesterUserId } = extractCredentials(this.userId);
|
2019-02-21 01:17:17 +08:00
|
|
|
|
2021-05-05 22:34:36 +08:00
|
|
|
check(meetingId, String);
|
|
|
|
check(requesterUserId, String);
|
2022-09-27 21:05:27 +08:00
|
|
|
check(downloadable, Match.Maybe(Boolean));
|
2021-05-05 22:34:36 +08:00
|
|
|
check(presentationId, String);
|
2023-08-16 22:18:51 +08:00
|
|
|
check(typeOfExport, Match.Maybe(String));
|
2019-02-21 01:17:17 +08:00
|
|
|
|
2021-05-05 22:34:36 +08:00
|
|
|
const payload = {
|
|
|
|
presentationId,
|
|
|
|
podId: 'DEFAULT_PRESENTATION_POD',
|
|
|
|
downloadable,
|
2023-08-16 22:18:51 +08:00
|
|
|
typeOfExport,
|
2021-05-05 22:34:36 +08:00
|
|
|
};
|
2019-02-21 01:17:17 +08:00
|
|
|
|
2021-05-05 22:34:36 +08:00
|
|
|
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, requesterUserId, payload);
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Exception while invoking method setPresentationDownloadable ${err.stack}`);
|
|
|
|
}
|
2019-02-21 01:17:17 +08:00
|
|
|
}
|