2019-05-17 04:11:10 +08:00
|
|
|
import Captions from '/imports/api/captions';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
2019-05-22 03:21:46 +08:00
|
|
|
import updateOwner from '/imports/api/captions/server/methods/updateOwner';
|
2019-05-17 04:11:10 +08:00
|
|
|
import { check } from 'meteor/check';
|
|
|
|
|
|
|
|
export default function updateOwnerId(meetingId, userId, padId) {
|
|
|
|
check(meetingId, String);
|
|
|
|
check(userId, String);
|
|
|
|
check(padId, String);
|
|
|
|
|
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
padId,
|
|
|
|
};
|
|
|
|
|
|
|
|
const modifier = {
|
|
|
|
$set: {
|
|
|
|
ownerId: userId,
|
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
const cb = (err) => {
|
|
|
|
if (err) {
|
|
|
|
return Logger.error(`Updating captions pad: ${err}`);
|
|
|
|
}
|
2019-05-22 03:21:46 +08:00
|
|
|
updateOwner(meetingId, userId, padId);
|
2019-05-17 04:11:10 +08:00
|
|
|
return Logger.verbose(`Update captions pad=${padId} ownerId=${userId}`);
|
|
|
|
};
|
|
|
|
|
|
|
|
return Captions.update(selector, modifier, { multi: true }, cb);
|
|
|
|
}
|