bigbluebutton-Github/bigbluebutton-html5/imports/api/ping-pong/server/methods/ping.js

31 lines
673 B
JavaScript
Raw Normal View History

2019-07-02 03:00:27 +08:00
import { check } from 'meteor/check';
import Users from '/imports/api/users';
2019-07-07 07:47:33 +08:00
import Logger from '/imports/startup/server/logger';
2019-07-02 03:00:27 +08:00
export default function ping(credentials) {
const { meetingId, requesterUserId, requesterToken } = credentials;
check(meetingId, String);
check(requesterUserId, String);
check(requesterToken, String);
2019-07-07 07:47:33 +08:00
const selector = {
2019-07-02 03:00:27 +08:00
meetingId,
userId: requesterUserId,
2019-07-07 07:47:33 +08:00
};
const modifier = {
2019-07-02 03:00:27 +08:00
$set: {
lastPing: Date.now(),
},
2019-07-07 07:47:33 +08:00
};
const cb = (err) => {
if (err) {
return Logger.error(`Error updating lastPing for ${requesterUserId}: ${err}`);
}
};
return Users.update(selector, modifier, cb);
2019-07-02 03:00:27 +08:00
}