2022-05-20 04:07:58 +08:00
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
import { LayoutMeetings } from '/imports/api/meetings';
|
|
|
|
import { check } from 'meteor/check';
|
|
|
|
|
2023-03-14 00:59:52 +08:00
|
|
|
export default async function setPushLayout(meetingId, pushLayout, requesterUserId) {
|
2022-05-20 04:07:58 +08:00
|
|
|
try {
|
|
|
|
check(meetingId, String);
|
|
|
|
check(requesterUserId, String);
|
|
|
|
|
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
};
|
|
|
|
|
|
|
|
// TODO: create a exclusive collection for layout changes
|
|
|
|
const modifier = {
|
|
|
|
$set: {
|
|
|
|
pushLayout,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
2023-03-14 00:59:52 +08:00
|
|
|
const numberAffected = await LayoutMeetings.updateAsync(selector, modifier);
|
2022-05-20 04:07:58 +08:00
|
|
|
|
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`MeetingLayout pushLayout changed to ${pushLayout} for meeting=${meetingId} requested by user=${requesterUserId}`);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Exception while invoking method setPushLayout ${err.stack}`);
|
|
|
|
}
|
|
|
|
}
|