feat: update text desc scheduling loh #177
|
@ -8,6 +8,7 @@ import {
|
|||
} from '../../entities/data-scheduling.entity';
|
||||
import { Logger } from '@nestjs/common';
|
||||
import { DataSchedulingLogDataService } from '../../../data/services/data-scheduling-log-data.service';
|
||||
import { decryptionTotal } from '../../../infrastructure/helpers';
|
||||
|
||||
@EventsHandler(DataSchedulingChangeStatusEvent)
|
||||
export class DataSchedulingChangeStatusHandler
|
||||
|
@ -28,7 +29,9 @@ export class DataSchedulingChangeStatusHandler
|
|||
|
||||
const scheduleName = newData?.name || 'an item';
|
||||
const editorName = newData.editor_name || 'System';
|
||||
const description = `<div><b>${editorName}</b> changed the status of <b><i>${scheduleName}</i></b> from <b><i>${oldStatus}</i></b> to <b><i>${newStatus}</i></b>.</div>`;
|
||||
const totalPercentage = decryptionTotal(newData?.indexing_key);
|
||||
|
||||
const description = `<div><b>${editorName}</b> changed the status of <b><i>${scheduleName} (${totalPercentage}%)</i></b> from <b><i>${oldStatus}</i></b> to <b><i>${newStatus}</i></b>.</div>`;
|
||||
|
||||
const payload: DataSchedulingLogEntity = {
|
||||
type: SCHEDULING_LOG_TYPE_ENUM.DATA_SCHEDULING,
|
||||
|
|
|
@ -7,6 +7,7 @@ import {
|
|||
} from '../../entities/data-scheduling.entity';
|
||||
import { Logger } from '@nestjs/common';
|
||||
import { DataSchedulingLogDataService } from '../../../data/services/data-scheduling-log-data.service';
|
||||
import { decryptionTotal } from '../../../infrastructure/helpers';
|
||||
|
||||
@EventsHandler(DataSchedulingDeletedEvent)
|
||||
export class DataSchedulingDeletedHandler
|
||||
|
@ -27,8 +28,8 @@ export class DataSchedulingDeletedHandler
|
|||
'System';
|
||||
|
||||
const scheduleName = deletedData?.name || 'an item';
|
||||
|
||||
const description = `<div><b>${deleterName}</b> deleted schedule: <b><i>${scheduleName}</i></b>.</div>`;
|
||||
const totalPercentage = decryptionTotal(deletedData?.indexing_key);
|
||||
const description = `<div><b>${deleterName}</b> deleted schedule: <b><i>${scheduleName} (${totalPercentage}%)</i></b>.</div>`;
|
||||
|
||||
const payload: DataSchedulingLogEntity = {
|
||||
type: SCHEDULING_LOG_TYPE_ENUM.DATA_SCHEDULING,
|
||||
|
|
|
@ -119,7 +119,16 @@ export class DataSchedulingUpdatedHandler
|
|||
const editorName = newData.editor_name || 'System';
|
||||
const itemName = oldData?.name || 'an item';
|
||||
|
||||
let description = `<div><b>${editorName}</b> has updated schedule for <b><i>${itemName}</i></b>.`;
|
||||
const totalPercentageOld = decryptionTotal(oldData?.indexing_key);
|
||||
const totalPercentageNew = decryptionTotal(newData?.indexing_key);
|
||||
const isTotalSame = totalPercentageOld === totalPercentageNew;
|
||||
const labelName = `${
|
||||
isTotalSame
|
||||
? `${totalPercentageNew}%`
|
||||
: `${totalPercentageOld}% to ${totalPercentageNew}%`
|
||||
}`;
|
||||
|
||||
let description = `<div><b>${editorName}</b> has updated schedule for <b><i>${itemName} (${labelName})</i></b>.`;
|
||||
|
||||
if (Object.keys(changingData.old).length > 0) {
|
||||
description += ` Change details:<ul>`;
|
||||
|
|
Loading…
Reference in New Issue