Skip to content

Commit ceaa106

Browse files
committed
fix: reporting metaData to the alert object
1 parent 834a2c1 commit ceaa106

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

src/classes/alert.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@ import { v4 } from 'uuid';
22
import { TADPResult } from './tadp-result';
33

44
export class Alert {
5+
metaData?: { prcgTmDp: number; prcgTmCRSP: number };
56
evaluationID = v4();
67
status = ''; // eg ALRT
78
prcgTmCRSP = 0;

src/services/logic.service.ts

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,13 +14,19 @@ const calculateDuration = (startHrTime: Array<number>, endHrTime: Array<number>)
1414
return (endHrTime[0] - startHrTime[0]) * 1000 + (endHrTime[1] - startHrTime[1]) / 1000000;
1515
};
1616

17+
interface MetaData {
18+
prcgTmDp: number;
19+
prcgTmCRSP: number;
20+
}
21+
1722
export const handleExecute = async (rawTransaction: any): Promise<any> => {
1823
try {
1924
const startHrTime = process.hrtime();
2025
// Get the request body and parse it to variables
2126
const transaction = rawTransaction.transaction;
2227
const networkMap = rawTransaction.networkMap as NetworkMap;
2328
const channelResult = rawTransaction.channelResult as ChannelResult;
29+
const metaData = rawTransaction?.metaData as MetaData;
2430

2531
// Send every channel request to the service function
2632
const toReturn: TADPResult = {
@@ -44,8 +50,7 @@ export const handleExecute = async (rawTransaction: any): Promise<any> => {
4450
const alert = new Alert();
4551
alert.tadpResult = toReturn;
4652
alert.status = review === true ? 'ALRT' : 'NALT';
47-
alert.prcgTmCRSP = rawTransaction.prcgTmCRSP;
48-
alert.prcgTmDP = rawTransaction.prcgTmDP;
53+
alert.metaData = metaData;
4954

5055
const result: CMSRequest = {
5156
message: `Successfully completed ${channelResults.length} channels`,

0 commit comments

Comments
 (0)