2021-10-16 03:07:13 +08:00
|
|
|
import { check } from 'meteor/check';
|
|
|
|
import Pads from '/imports/api/pads';
|
|
|
|
import { extractCredentials } from '/imports/api/common/server/helpers';
|
|
|
|
|
2023-03-16 22:00:45 +08:00
|
|
|
export default async function getPadId(externalId) {
|
2021-10-16 03:07:13 +08:00
|
|
|
try {
|
|
|
|
const { meetingId } = extractCredentials(this.userId);
|
|
|
|
|
|
|
|
check(meetingId, String);
|
|
|
|
check(externalId, String);
|
|
|
|
|
2023-03-16 22:00:45 +08:00
|
|
|
const pad = await Pads.findOneAsync(
|
2021-10-16 03:07:13 +08:00
|
|
|
{
|
|
|
|
meetingId,
|
|
|
|
externalId,
|
|
|
|
},
|
|
|
|
{
|
|
|
|
fields: {
|
|
|
|
padId: 1,
|
2023-03-16 22:00:45 +08:00
|
|
|
},
|
2021-10-16 03:07:13 +08:00
|
|
|
},
|
|
|
|
);
|
|
|
|
|
|
|
|
if (pad && pad.padId) {
|
|
|
|
return pad.padId;
|
|
|
|
}
|
|
|
|
|
|
|
|
return null;
|
|
|
|
} catch (err) {
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|