Handle CreateNewPresentationPod message
This commit is contained in:
parent
eef2d65d93
commit
e5a4bd09b4
12
bigbluebutton-html5/imports/api/presentation-pods/index.js
Normal file
12
bigbluebutton-html5/imports/api/presentation-pods/index.js
Normal file
@ -0,0 +1,12 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
|
||||
const PresentationPods = new Mongo.Collection('presentation-pods');
|
||||
|
||||
if (Meteor.isServer) {
|
||||
// types of queries for the presentation pods:
|
||||
// 1. meetingId, podId
|
||||
// 2. meetingId
|
||||
PresentationPods._ensureIndex({ meetingId: 1, podId: 1 });
|
||||
}
|
||||
|
||||
export default PresentationPods;
|
12
bigbluebutton-html5/imports/api/presentation-pods/server/eventHandlers.js
Executable file
12
bigbluebutton-html5/imports/api/presentation-pods/server/eventHandlers.js
Executable file
@ -0,0 +1,12 @@
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import handleCreateNewPresentationPod from './handlers/createNewPresentationPod';
|
||||
import handleRemovePresentationPod from './handlers/removePresentationPod';
|
||||
import handleGetAllPresentationPods from './handlers/getAllPresentationPods';
|
||||
import handleSetPresenterInPod from './handlers/setPresenterInPod';
|
||||
// import handleSyncGetPresentationPods from './handlers/syncGetPresentationPods';
|
||||
|
||||
RedisPubSub.on('CreateNewPresentationPodEvtMsg', handleCreateNewPresentationPod);
|
||||
RedisPubSub.on('RemovePresentationPodEvtMsg', handleRemovePresentationPod);
|
||||
// RedisPubSub.on('GetAllPresentationPodsRespMsg', handleGetAllPresentationPods);
|
||||
RedisPubSub.on('SetPresenterInPodRespMsg', handleSetPresenterInPod);
|
||||
RedisPubSub.on('SyncGetPresentationPodsRespMsg', handleGetAllPresentationPods);
|
@ -0,0 +1,19 @@
|
||||
import { check } from 'meteor/check';
|
||||
import addPresentationPod from '../modifiers/addPresentationPod';
|
||||
|
||||
export default function handleCreateNewPresentationPod({ body }, meetingId) {
|
||||
check(body, {
|
||||
currentPresenterId: String,
|
||||
podId: String,
|
||||
});
|
||||
check(meetingId, String);
|
||||
|
||||
const { currentPresenterId, podId } = body;
|
||||
|
||||
const pod = {
|
||||
currentPresenterId,
|
||||
podId,
|
||||
};
|
||||
|
||||
addPresentationPod(meetingId, pod);
|
||||
}
|
3
bigbluebutton-html5/imports/api/presentation-pods/server/index.js
Executable file
3
bigbluebutton-html5/imports/api/presentation-pods/server/index.js
Executable file
@ -0,0 +1,3 @@
|
||||
import './eventHandlers';
|
||||
// import './methods';
|
||||
import './publishers';
|
@ -0,0 +1,39 @@
|
||||
import { Match, check } from 'meteor/check';
|
||||
import PresentationPods from '/imports/api/presentation-pods';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
|
||||
export default function addPresentationPod(meetingId, pod, presentation = null /* ?? */) {
|
||||
check(meetingId, String);
|
||||
check(presentation, Match.Maybe(Object));
|
||||
check(pod, {
|
||||
currentPresenterId: String,
|
||||
podId: String,
|
||||
});
|
||||
|
||||
const { currentPresenterId, podId } = pod;
|
||||
|
||||
const selector = {
|
||||
meetingId,
|
||||
podId,
|
||||
};
|
||||
|
||||
const modifier = {
|
||||
meetingId,
|
||||
podId,
|
||||
currentPresenterId,
|
||||
};
|
||||
|
||||
const cb = (err, numChanged) => {
|
||||
if (err) {
|
||||
return Logger.error(`Adding presentation pod to the collection: ${err}`);
|
||||
}
|
||||
|
||||
if (numChanged) {
|
||||
return Logger.info(`Added presentation pod id=${podId} meeting=${meetingId}`);
|
||||
}
|
||||
|
||||
return Logger.info(`Upserted presentation pod id=${podId} meeting=${meetingId}`);
|
||||
};
|
||||
|
||||
return PresentationPods.upsert(selector, modifier, cb);
|
||||
}
|
24
bigbluebutton-html5/imports/api/presentation-pods/server/publishers.js
Executable file
24
bigbluebutton-html5/imports/api/presentation-pods/server/publishers.js
Executable file
@ -0,0 +1,24 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import PresentationPods from '/imports/api/presentations';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import mapToAcl from '/imports/startup/mapToAcl';
|
||||
|
||||
function presentationPods(credentials) {
|
||||
const { meetingId, requesterUserId, requesterToken } = credentials;
|
||||
|
||||
check(meetingId, String);
|
||||
check(requesterUserId, String);
|
||||
check(requesterToken, String);
|
||||
|
||||
Logger.info(`Publishing PresentationPods for ${meetingId} ${requesterUserId} ${requesterToken}`);
|
||||
|
||||
return PresentationPods.find({ meetingId });
|
||||
}
|
||||
|
||||
function publish(...args) {
|
||||
const boundPresentationPods = presentationPods.bind(this);
|
||||
return mapToAcl('subscriptions.presentationPods', boundPresentationPods)(args);
|
||||
}
|
||||
|
||||
Meteor.publish('presentationPods', publish);
|
Loading…
Reference in New Issue
Block a user