2021-02-10 23:24:24 +08:00
|
|
|
import RedisPubSub from '/imports/startup/server/redis';
|
|
|
|
import { Meteor } from 'meteor/meteor';
|
|
|
|
import { check } from 'meteor/check';
|
2021-05-05 01:34:31 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
2021-02-10 23:24:24 +08:00
|
|
|
|
2021-10-16 03:07:13 +08:00
|
|
|
export default function createPad(meetingId, userId, externalId, name) {
|
2021-02-10 23:24:24 +08:00
|
|
|
const REDIS_CONFIG = Meteor.settings.private.redis;
|
|
|
|
const CHANNEL = REDIS_CONFIG.channels.toAkkaApps;
|
2021-10-16 03:07:13 +08:00
|
|
|
const EVENT_NAME = 'PadCreateReqMsg';
|
2021-02-10 23:24:24 +08:00
|
|
|
|
2021-05-05 01:34:31 +08:00
|
|
|
try {
|
|
|
|
check(meetingId, String);
|
2021-10-16 03:07:13 +08:00
|
|
|
check(userId, String);
|
|
|
|
check(externalId, String);
|
|
|
|
check(name, String);
|
2021-02-10 23:24:24 +08:00
|
|
|
|
2021-05-05 01:34:31 +08:00
|
|
|
const payload = {
|
2021-10-16 03:07:13 +08:00
|
|
|
externalId,
|
|
|
|
name,
|
2021-05-05 01:34:31 +08:00
|
|
|
};
|
2021-02-10 23:24:24 +08:00
|
|
|
|
2021-10-16 03:07:13 +08:00
|
|
|
RedisPubSub.publishUserMessage(CHANNEL, EVENT_NAME, meetingId, userId, payload);
|
2021-05-05 01:34:31 +08:00
|
|
|
} catch (err) {
|
2021-10-16 03:07:13 +08:00
|
|
|
Logger.error(`Exception while invoking method createPad ${err.stack}`);
|
2021-05-05 01:34:31 +08:00
|
|
|
}
|
2021-02-10 23:24:24 +08:00
|
|
|
}
|