Add initial file structure for breakouts api
This commit is contained in:
parent
9e86e95275
commit
e8974fe929
1
bigbluebutton-html5/imports/api/breakouts/index.js
Normal file
1
bigbluebutton-html5/imports/api/breakouts/index.js
Normal file
@ -0,0 +1 @@
|
||||
export default new Mongo.Collection('breakouts');
|
@ -0,0 +1,64 @@
|
||||
import RedisPubSub from '/imports/startup/server/redis';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
|
||||
// import handleChatMessage from './handlers/chatMessage';
|
||||
// import handleChatHistory from './handlers/chatHistory';
|
||||
|
||||
import Breakouts from '/imports/api/breakouts';
|
||||
|
||||
RedisPubSub.on('CreateBreakoutRoomRequest', ({ payload }) => {
|
||||
console.info('CreateBreakoutRoomRequest', payload);
|
||||
|
||||
const selector = {
|
||||
breakoutMeetingId: payload.breakoutMeetingId,
|
||||
};
|
||||
const modifier = payload;
|
||||
|
||||
const cb = (err, numChanged) => {
|
||||
if (err) {
|
||||
return Logger.error(`Adding breakout to collection: ${err}`);
|
||||
}
|
||||
|
||||
const { insertedId } = numChanged;
|
||||
if (insertedId) {
|
||||
return Logger.info(`Added breakout id=${payload.breakoutMeetingId}`);
|
||||
}
|
||||
|
||||
return Logger.info(`Upserted breakout id=${payload.breakoutMeetingId}`);
|
||||
};
|
||||
|
||||
Breakouts.upsert(selector, modifier, cb);
|
||||
});
|
||||
|
||||
RedisPubSub.on('BreakoutRoomStarted', ({ payload }) => {
|
||||
console.info('BreakoutRoomStarted', payload);
|
||||
|
||||
const selector = {
|
||||
breakoutMeetingId: payload.meetingId,
|
||||
};
|
||||
|
||||
modifier = {
|
||||
$set: {
|
||||
externalMeetingId: payload.externalMeetingId,
|
||||
},
|
||||
};
|
||||
|
||||
const cb = (err, numChanged) => {
|
||||
if (err) {
|
||||
return Logger.error(`Adding breakout to collection: ${err}`);
|
||||
}
|
||||
|
||||
const { insertedId } = numChanged;
|
||||
if (insertedId) {
|
||||
return Logger.info(`Added breakout id=${payload.meetingId}`);
|
||||
}
|
||||
|
||||
return Logger.info(`Upserted breakout id=${payload.meetingId}`);
|
||||
};
|
||||
|
||||
Breakouts.upsert(selector, modifier, cb);
|
||||
});
|
||||
|
||||
RedisPubSub.on('BreakoutRoomJoinURL', ({ payload }) => {
|
||||
console.info('BreakoutRoomJoinURL', payload);
|
||||
});
|
@ -0,0 +1,3 @@
|
||||
import './eventHandlers';
|
||||
import './methods';
|
||||
import './publishers';
|
@ -0,0 +1,3 @@
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
|
||||
Meteor.methods({});
|
@ -0,0 +1,12 @@
|
||||
import Breakouts from '/imports/api/breakouts';
|
||||
import { Meteor } from 'meteor/meteor';
|
||||
import { check } from 'meteor/check';
|
||||
import Logger from '/imports/startup/server/logger';
|
||||
import { isAllowedTo } from '/imports/startup/server/userPermissions';
|
||||
|
||||
Meteor.publish('breakouts', credentials => {
|
||||
Logger.info(credentials);
|
||||
Breakouts.find({
|
||||
parentMeetingId: credentials.meetingId,
|
||||
});
|
||||
});
|
@ -7,6 +7,8 @@ import Cursor from '/imports/api/cursor';
|
||||
import Captions from '/imports/api/captions';
|
||||
import Polls from '/imports/api/polls';
|
||||
|
||||
import Breakouts from '/imports/api/breakouts';
|
||||
|
||||
function setCredentials(nextState, replace) {
|
||||
if (nextState && nextState.params.authToken) {
|
||||
const { meetingID, userID, authToken } = nextState.params;
|
||||
@ -36,6 +38,8 @@ function subscribeForData() {
|
||||
};
|
||||
|
||||
function subscribeFor(collectionName) {
|
||||
window.Breakouts = Breakouts;
|
||||
console.log('Subscribe 4Head');
|
||||
const credentials = Auth.getCredentials();
|
||||
return new Promise((resolve, reject) => {
|
||||
Meteor.subscribe(collectionName, credentials, {
|
||||
|
@ -1,5 +1,6 @@
|
||||
import '/imports/startup/server';
|
||||
import '/imports/api/chat/server';
|
||||
import '/imports/api/breakouts/server';
|
||||
|
||||
import '/imports/api/cursor/server/publications';
|
||||
import '/imports/api/cursor/server/modifiers/clearCursorCollection';
|
||||
|
Loading…
Reference in New Issue
Block a user