bigbluebutton-Github/bigbluebutton-html5/imports/api/pads/server/methods/getPadId.js
2023-03-20 16:38:31 -03:00

33 lines
621 B
JavaScript

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;
}
}