feat: add pending manual compliance notifications

This commit is contained in:
siiky 2024-04-10 11:34:36 +01:00
parent 068f68e838
commit 3dbf10183e
4 changed files with 175 additions and 58 deletions

View file

@ -173,7 +173,8 @@ function complianceNotify (settings, customer, deviceId, action, period) {
const msgCore = {
BLOCKED: `was blocked`,
SUSPENDED: `was suspended for ${!!period && period} days`
SUSPENDED: `was suspended for ${!!period && period} days`,
PENDING_COMPLIANCE: `is waiting for your manual approval`,
}
const rec = {

View file

@ -38,7 +38,9 @@ const customerComplianceNotify = (customer, deviceId, code, days = null) => {
if (days) {
date.setDate(date.getDate() + days)
}
const message = code === 'SUSPENDED' ? `Customer suspended until ${date.toLocaleString()}` : `Customer blocked`
const message = code === 'SUSPENDED' ? `Customer ${customer.phone} suspended until ${date.toLocaleString()}` :
code === 'BLOCKED' ? `Customer ${customer.phone} blocked` :
`Customer ${customer.phone} has pending compliance`
return clearOldCustomerSuspendedNotifications(customer.id, deviceId)
.then(() => queries.getValidNotifications(COMPLIANCE, detailB))