feat: implement requiring call notification
parent
44e74de315
commit
66720c5b8b
|
@ -57,12 +57,16 @@ export class QueueAdminOrchestrator {
|
|||
|
||||
for (const queueItem of itemMasters) {
|
||||
const queueTimes = await this.queueTimeFormula.items(queueItem.id);
|
||||
const call_preparation = queueItem.call_preparation * 60 * 1000;
|
||||
if (!queueItem.use_notification) continue;
|
||||
|
||||
for (const queueId in queueTimes) {
|
||||
const callTime = queueTimes[queueId];
|
||||
|
||||
if (timeIsBefore(currentTime, callTime, queueItem.call_preparation)) {
|
||||
if (
|
||||
queueItem.requiring_notification ||
|
||||
timeIsBefore(currentTime, callTime, queueItem.call_preparation)
|
||||
) {
|
||||
const queueTicket = await this.service.queueTicket(queueId);
|
||||
const payload: WhatsappQueue = {
|
||||
id: queueId,
|
||||
|
@ -76,11 +80,10 @@ export class QueueAdminOrchestrator {
|
|||
console.log({
|
||||
currentTime: toTime(currentTime),
|
||||
callTime: toTime(callTime),
|
||||
last_notification: toTime(queueTicket.last_notification),
|
||||
queueId,
|
||||
lastNotification: toTime(queueTicket.last_notification),
|
||||
code: queueTicket.code,
|
||||
});
|
||||
|
||||
const call_preparation = queueItem.call_preparation * 60 * 1000;
|
||||
if (queueTicket.last_notification < currentTime - call_preparation) {
|
||||
await notification.queueProcess(payload);
|
||||
this.service.updateLastNotification(queueId, currentTime);
|
||||
|
|
Loading…
Reference in New Issue