2018-09-05 00:56:10 +08:00
|
|
|
import { check } from 'meteor/check';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
import PresentationUploadToken from '/imports/api/presentation-upload-token';
|
|
|
|
|
|
|
|
export default function handlePresentationUploadTokenFail({ body, header }, meetingId) {
|
|
|
|
check(body, Object);
|
|
|
|
|
|
|
|
const { userId } = header;
|
|
|
|
const { podId, filename } = body;
|
|
|
|
|
|
|
|
check(userId, String);
|
|
|
|
check(podId, String);
|
|
|
|
check(filename, String);
|
|
|
|
|
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
userId,
|
|
|
|
podId,
|
|
|
|
filename,
|
|
|
|
};
|
|
|
|
|
2020-11-25 21:54:18 +08:00
|
|
|
try {
|
|
|
|
const { numberAffected } = PresentationUploadToken.upsert(selector, { failed: true, authzToken: null });
|
2018-09-05 00:56:10 +08:00
|
|
|
|
2020-11-25 21:54:18 +08:00
|
|
|
if (numberAffected) {
|
|
|
|
Logger.info(`Removing presentationToken filename=${filename} podId=${podId} meeting=${meetingId}`);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Removing presentationToken from collection: ${err}`);
|
|
|
|
}
|
2018-09-05 00:56:10 +08:00
|
|
|
}
|