2023-04-20 19:48:43 +08:00
|
|
|
import { check } from 'meteor/check';
|
|
|
|
import Presentations from '/imports/api/presentations';
|
|
|
|
import Logger from '/imports/startup/server/logger';
|
|
|
|
|
|
|
|
export default async function setOriginalUriDownload(meetingId, presentationId, fileURI) {
|
|
|
|
check(meetingId, String);
|
|
|
|
check(presentationId, String);
|
|
|
|
check(fileURI, String);
|
|
|
|
|
|
|
|
const selector = {
|
|
|
|
meetingId,
|
|
|
|
id: presentationId,
|
|
|
|
};
|
|
|
|
|
|
|
|
const modifier = {
|
|
|
|
$set: {
|
2023-05-12 05:06:48 +08:00
|
|
|
originalFileURI: fileURI,
|
2023-04-20 19:48:43 +08:00
|
|
|
},
|
|
|
|
};
|
|
|
|
|
|
|
|
try {
|
|
|
|
const { numberAffected } = await Presentations.upsertAsync(selector, modifier);
|
|
|
|
|
2023-05-12 05:06:48 +08:00
|
|
|
if (numberAffected) {
|
2023-04-20 19:48:43 +08:00
|
|
|
Logger.info(`Set URI for file ${presentationId} in meeting ${meetingId} URI=${fileURI}`);
|
|
|
|
}
|
|
|
|
} catch (err) {
|
|
|
|
Logger.error(`Could not set URI for file ${presentationId} in meeting ${meetingId} ${err}`);
|
|
|
|
}
|
|
|
|
}
|