bigbluebutton-Github/bigbluebutton-html5/imports/api/pads/server/methods/getPadId.js

33 lines
621 B
JavaScript
Raw Normal View History

import { check } from 'meteor/check';
import Pads from '/imports/api/pads';
import { extractCredentials } from '/imports/api/common/server/helpers';
export default async function getPadId(externalId) {
try {
const { meetingId } = extractCredentials(this.userId);
check(meetingId, String);
check(externalId, String);
const pad = await Pads.findOneAsync(
{
meetingId,
externalId,
},
{
fields: {
padId: 1,
},
},
);
if (pad && pad.padId) {
return pad.padId;
}
return null;
} catch (err) {
return null;
}
}