FAMBL 1 anno fa
parent
commit
f4341f03d3

+ 1 - 0
.env

@@ -0,0 +1 @@
+CheckAudit = Yes

+ 2 - 2
documentations/notificationSynchronization.plantuml

@@ -14,7 +14,7 @@ package Primary {
     database FISdatabase as fisdb1 #d0b0ff;line:Black;text:Black
     card "**UCP**" as ucp1 #d0b0ff;line:Black;line.bold;text:Black 
     frame "FingerPrint UI" as fp1
-    card "**ProjectWorkflow**" as pw1 <<FisObserver>> #91adfa;line:Blue;line.bold;text:Black;
+    card "**ProgramWorkflow**" as pw1 <<FisObserver>> #91adfa;line:Blue;line.bold;text:Black;
 }
 
 package Secondary {
@@ -24,7 +24,7 @@ package Secondary {
     database FISdatabase as fisdb2 #d0b0ff;line:Black;text:Black
     card "**UCP**" as ucp2 #d0b0ff;line:Black;line.bold;text:Black
     frame "FingerPrint UI" as fp2
-    card "**ProjectWorkflow**" as pw2 <<FisObserver>> #91adfa;line:Blue;line.bold;text:Black
+    card "**ProgramWorkflow**" as pw2 <<FisObserver>> #91adfa;line:Blue;line.bold;text:Black
 } 
 
 ' Primary Side

+ 10 - 7
package-lock.json

@@ -10,7 +10,7 @@
       "license": "ISC",
       "dependencies": {
         "@types/node": "^18.11.18",
-        "dotenv": "^16.0.3",
+        "dotenv": "^16.3.1",
         "jsonschema": "^1.4.1",
         "lodash": "^4.17.21",
         "mongoose": "^6.9.0",
@@ -1193,11 +1193,14 @@
       "integrity": "sha512-sGkPx+VjMtmA6MX27oA4FBFELFCZZ4S4XqeGOXCv68tT+jb3vk/RyaKWP0PTKyWtmLSM0b+adUTEvbs1PEaH2w=="
     },
     "node_modules/dotenv": {
-      "version": "16.0.3",
-      "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz",
-      "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ==",
+      "version": "16.3.1",
+      "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz",
+      "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ==",
       "engines": {
         "node": ">=12"
+      },
+      "funding": {
+        "url": "https://github.com/motdotla/dotenv?sponsor=1"
       }
     },
     "node_modules/fast-xml-parser": {
@@ -2446,9 +2449,9 @@
       }
     },
     "dotenv": {
-      "version": "16.0.3",
-      "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.0.3.tgz",
-      "integrity": "sha512-7GO6HghkA5fYG9TYnNxi14/7K9f5occMlp3zXAuSxn7CKCxt9xbNWG7yF8hTCSUchlfWSe3uLmlPfigevRItzQ=="
+      "version": "16.3.1",
+      "resolved": "https://registry.npmjs.org/dotenv/-/dotenv-16.3.1.tgz",
+      "integrity": "sha512-IPzF4w4/Rd94bA9imS68tZBaYyBWSCE47V1RGuMrB94iyTOIEwRmVL2x/4An+6mETpLrKJ5hQkB8W4kFAadeIQ=="
     },
     "fast-xml-parser": {
       "version": "4.0.11",

+ 1 - 1
package.json

@@ -26,7 +26,7 @@
   "license": "ISC",
   "dependencies": {
     "@types/node": "^18.11.18",
-    "dotenv": "^16.0.3",
+    "dotenv": "^16.3.1",
     "jsonschema": "^1.4.1",
     "lodash": "^4.17.21",
     "mongoose": "^6.9.0",

+ 10 - 9
services/message-auditor.service.ts

@@ -5,6 +5,8 @@ import * as _ from 'lodash'
 import { LoggingService } from "../dependencies/log/interface/export";
 import { BaseMessage } from "../dependencies/log/dependencies/msgutil/interface/export";
 let processedMsgIds = new Set();
+require('dotenv').config();
+
 export class MessageAuditorService implements MessageAuditorServiceInterface {
     private settings: MessageSynchronisationServiceSetting
     private sourceSrc: LoggingService = new LoggingService()
@@ -90,6 +92,13 @@ export class MessageAuditorService implements MessageAuditorServiceInterface {
             // In the case where there are differences in the array length, then extensive comparison
             // will be carried out to filters out the differences. Differences are the missing data.
 
+            if(process.env.CheckAudit)
+            {
+                console.log("Record set 1: ", _.keys(_.countBy(data.arr1,function(data:MessageLog){return data.appData['msgId']})).length);
+                console.log("Record set 2: ", _.keys(_.countBy(data.arr2,function(data:MessageLog){return data.appData['msgId']})).length);
+            }
+
+
             if(process.env.CheckAudit)
             {
                 console.log("[CheckAudit] Record set 1: ", _.keys(_.countBy(data.arr1,function(data:MessageLog){return data.appData['msgId']})).length);
@@ -100,17 +109,9 @@ export class MessageAuditorService implements MessageAuditorServiceInterface {
 
                 if(process.env.CheckAudit)
                 {
-                    console.log("[CheckAudit] Difference: ", _.keys(_.countBy(data,function(msg:MessageLog){return msg.appData['msgId']})).length);
-                    console.log("[CheckAudit] Missing msgId: ", _.keys(_.countBy(data, function (msg: MessageLog) { return msg.appData['msgId'] })));
+                    console.log("Difference: ",data.length);
                 }
 
-                // filter out the duplicate record and only emit the first record
-                let missingMsgIdArray = _.keys(_.countBy(data, function (msg: MessageLog) { return msg.appData['msgId'] }));
-                let uniqueRecords = missingMsgIdArray.map(msgId => {
-                    let dataForMsgId = data.find(msg => msg.appData['msgId'] === msgId);
-                    return dataForMsgId;
-                });
-                data = uniqueRecords;
                 data.forEach(msgElement => {
                     let refined = JSON.parse(JSON.stringify(msgElement))
                     // Once the missing data has been weeded out, it is then passed into the Subject