2022-12-19 02:43:14 +08:00
|
|
|
const config = require('../../config');
|
|
|
|
|
|
|
|
const EXPORT_STATUSES = Object.freeze({
|
|
|
|
COLLECTING: 'COLLECTING',
|
|
|
|
PROCESSING: 'PROCESSING',
|
|
|
|
});
|
|
|
|
|
|
|
|
class PresAnnStatusMsg {
|
|
|
|
constructor(exportJob, status = EXPORT_STATUSES.COLLECTING) {
|
|
|
|
this.message = {
|
|
|
|
envelope: {
|
|
|
|
name: config.log.msgName,
|
|
|
|
routing: {
|
|
|
|
sender: exportJob.module,
|
|
|
|
},
|
|
|
|
timestamp: (new Date()).getTime(),
|
|
|
|
},
|
|
|
|
core: {
|
|
|
|
header: {
|
|
|
|
name: config.log.msgName,
|
|
|
|
meetingId: exportJob.parentMeetingId,
|
|
|
|
userId: '',
|
|
|
|
},
|
|
|
|
body: {
|
|
|
|
presId: exportJob.presId,
|
|
|
|
pageNumber: 1,
|
|
|
|
totalPages: JSON.parse(exportJob.pages).length,
|
|
|
|
status,
|
|
|
|
error: false,
|
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
build = (pageNumber = 1) => {
|
|
|
|
this.message.core.body.pageNumber = pageNumber;
|
|
|
|
this.message.envelope.timestamp = (new Date()).getTime();
|
|
|
|
const event = JSON.stringify(this.message);
|
|
|
|
this.message.core.body.error = false;
|
|
|
|
return event;
|
|
|
|
};
|
|
|
|
|
|
|
|
setError = (error = true) => {
|
|
|
|
this.message.core.body.error = error;
|
|
|
|
};
|
|
|
|
|
|
|
|
setStatus = (status) => {
|
|
|
|
this.message.core.body.status = status;
|
|
|
|
};
|
|
|
|
|
|
|
|
static get EXPORT_STATUSES() {
|
|
|
|
return EXPORT_STATUSES;
|
|
|
|
}
|
|
|
|
};
|
|
|
|
|
2023-04-17 20:04:58 +08:00
|
|
|
class NewPresFileAvailableMsg {
|
2022-12-19 02:43:14 +08:00
|
|
|
constructor(exportJob, link) {
|
|
|
|
this.message = {
|
|
|
|
envelope: {
|
|
|
|
name: config.notifier.msgName,
|
|
|
|
routing: {
|
|
|
|
sender: exportJob.module,
|
|
|
|
},
|
|
|
|
timestamp: (new Date()).getTime(),
|
|
|
|
},
|
|
|
|
core: {
|
|
|
|
header: {
|
|
|
|
name: config.notifier.msgName,
|
|
|
|
meetingId: exportJob.parentMeetingId,
|
|
|
|
userId: '',
|
|
|
|
},
|
|
|
|
body: {
|
2023-08-10 23:18:59 +08:00
|
|
|
annotatedFileURI: link,
|
|
|
|
originalFileURI: '',
|
|
|
|
convertedFileURI: '',
|
2022-12-19 02:43:14 +08:00
|
|
|
presId: exportJob.presId,
|
2023-08-18 21:57:50 +08:00
|
|
|
fileStateType: 'Annotated',
|
2022-12-19 02:43:14 +08:00
|
|
|
},
|
|
|
|
},
|
|
|
|
};
|
|
|
|
}
|
|
|
|
|
|
|
|
build = () => {
|
|
|
|
return JSON.stringify(this.message);
|
|
|
|
};
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = {
|
|
|
|
PresAnnStatusMsg,
|
2023-04-17 20:04:58 +08:00
|
|
|
NewPresFileAvailableMsg,
|
2022-12-19 02:43:14 +08:00
|
|
|
};
|