apf-node-common 1.0.109 → 1.0.111

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/ApplicationContextService.js +103 -103
  2. package/CoreUtils.js +59 -59
  3. package/Logger/index.js +93 -93
  4. package/Logger/loggerTransports.js +137 -137
  5. package/SSMConfig.js +44 -44
  6. package/ScheduleCalculationService.js +0 -0
  7. package/auditlog/AuditLogger.js +58 -58
  8. package/auditlog/AuditLoggerRepository.js +38 -38
  9. package/auditlog/AuditLoggerService.js +37 -37
  10. package/config/SSMParameters.js +16 -16
  11. package/constants/CommonMessages.js +14 -14
  12. package/constants/Frequency.js +8 -8
  13. package/constants/TimeZone.js +11 -11
  14. package/constants/UserType.js +9 -9
  15. package/exception/CustomException.js +36 -36
  16. package/exception/SendResponse.js +139 -139
  17. package/index.js +187 -187
  18. package/package.json +29 -29
  19. package/test/AWSUtilityIntegrationTest.js +94 -94
  20. package/test/FrequencyValidatorTest.js +0 -0
  21. package/test/LambdaCommunicationServiceTest.js +83 -83
  22. package/test/ScheduleCalculationServiceTest.js +0 -0
  23. package/utils/HashIds.js +139 -139
  24. package/utils/NumberFormatter.js +253 -253
  25. package/utils/aws/AESEncryptionUsingKMS.js +106 -106
  26. package/utils/aws/AWSAPIKeyGenerator.js +307 -307
  27. package/utils/aws/AWSS3Utils.js +128 -128
  28. package/utils/aws/AWSSMSUtils.js +63 -63
  29. package/utils/aws/AWSSNSBasedEmailDispatcher.js +37 -37
  30. package/utils/aws/AWSSNSBasedSMSDispatcher.js +37 -37
  31. package/utils/aws/AWSSNSUtils.js +35 -38
  32. package/utils/aws/LambdaCommunicationService.js +232 -232
  33. package/utils/enumHelper.js +7 -7
  34. package/utils/thirdparty/URLShorteningService.js +25 -25
  35. package/validation/CoreValidations.js +45 -45
  36. package/validation/FrequencyValidator.js +0 -0
  37. package/validation/SchemaValidation.js +106 -106
@@ -1,137 +1,137 @@
1
- 'use strict'
2
-
3
- //const elasticsearch = require('elasticsearch');
4
- const AWS = require('aws-sdk');
5
- const winstonAwsCloudWatch = require('winston-aws-cloudwatch');
6
- const winston = require('winston');
7
- //const awses = require('http-aws-es');
8
- //const WinstonElasticsearch = require('winston-elasticsearch');
9
- const fs = require('fs');
10
- const path = require('path');
11
-
12
- const logDir = 'log';
13
- // Create the log directory if it does not exist
14
- // if (!fs.existsSync(logDir)) {
15
- // fs.mkdirSync(logDir);
16
- // }
17
- // const filename = path.join(logDir, 'results.log');
18
-
19
- //const region = 'us-east-1';
20
- //const hosts = ['https://search-aws-es-v-n67kab4wame7fzgneuw7qzehia.us-east-1.es.amazonaws.com'];
21
- //rachna
22
- const awsEnv = (process.env.NODE_ENVIRONMENT || "dev");
23
- const awsRegion = (process.env.AWS_DEFAULT_REGION || "us-east-2");
24
- AWS.config.update({ region: awsRegion });
25
- //const logGroup = process.env.AWS_LAMBDA_LOG_GROUP_NAME;
26
- //const functionName = process.env.AWS_LAMBDA_FUNCTION_NAME;
27
- module.exports.offTransport = () => {
28
- return {
29
- transports: []
30
- };
31
- }
32
-
33
- module.exports.consoleTransport = () => {
34
- return {
35
- transports: [
36
- new (winston.transports.Console)({ level: 'info' })
37
- /*,
38
- new (winstonAwsCloudWatch)({
39
- level: 'info',
40
- timestamp: () => {
41
- return new Date().toString()
42
- },
43
- json: true,
44
- //logGroupName: 'apfTest', // REQUIRED
45
- logGroupName: logGroup,//rachna
46
- logStreamName: functionName,//rachna
47
- // logStreamName: module, // REQUIRED
48
- //logStreamName: 'invoicing', // REQUIRED
49
-
50
- createLogGroup: true,
51
- createLogStream: true,
52
- awsRegion: awsRegion,
53
- formatLog: function (item) {
54
- return item.level + ': ' + item.message + ' ' + JSON.stringify(item.meta)
55
- }
56
- })*/
57
- /* new (winston.transports.Console)({ level: 'info' ,format: winston.format.combine(
58
- winston.format.timestamp(),
59
- winston.format.colorize(),
60
- winston.format.simple(),
61
- winston.format.printf(info => `${info.timestamp} ${info.level}: ${info.message}`)
62
- )}),*/
63
- ]
64
- };
65
- }
66
-
67
-
68
-
69
- // Replaces the previous transports with those in the
70
- // new configuration wholesale.
71
- //
72
- // const DailyRotateFile = require('winston-daily-rotate-file');
73
- // logger.configure({
74
- // level: 'verbose',
75
- // transports: [
76
- // new DailyRotateFile(opts)
77
- // ]
78
- // });
79
-
80
- module.exports.fileTransport = () => {
81
- return {
82
- transports: [
83
- // - Write to all logs with level `info` and below to `combined.log`
84
- // - Write all logs error (and below) to `error.log`.
85
- new winston.transports.File({ filename: 'error.log', level: 'error' }),
86
- new winston.transports.File({ filename: 'invoicing.log' }),
87
- ]
88
- };
89
- }
90
-
91
- module.exports.awsTransport = (module) => {
92
- const awsConfig = {
93
- region: region
94
- }
95
-
96
- // const client = elasticsearch.Client({
97
- // hosts: hosts,
98
- // connectionClass: awses,
99
- // log: 'trace'
100
- // });
101
-
102
- //Configuring AWS Credentials once
103
- AWS.config.update({
104
- region: region
105
- });
106
-
107
- return {
108
- transports: [
109
- new (winstonAwsCloudWatch)({
110
- level: 'info',
111
- timestamp: () => {
112
- return new Date().toString()
113
- },
114
- json: true,
115
- logGroupName: 'apfTest', // REQUIRED
116
-
117
-
118
- logStreamName: module, // REQUIRED
119
- //logStreamName: 'invoicing', // REQUIRED
120
-
121
- createLogGroup: true,
122
- createLogStream: true,
123
- awsRegion: awsRegion,
124
- formatLog: function (item) {
125
- return item.level + ': ' + item.message + ' ' + JSON.stringify(item.meta)
126
- }
127
- }),
128
- // new (WinstonElasticsearch)({
129
- // level: 'info',
130
- // client: client,
131
- // formatLog: function (item) {
132
- // return item.level + ': ' + item.message + ' ' + JSON.stringify(item.meta)
133
- // }
134
- // })
135
- ]
136
- };
137
- }
1
+ 'use strict'
2
+
3
+ //const elasticsearch = require('elasticsearch');
4
+ const AWS = require('aws-sdk');
5
+ const winstonAwsCloudWatch = require('winston-aws-cloudwatch');
6
+ const winston = require('winston');
7
+ //const awses = require('http-aws-es');
8
+ //const WinstonElasticsearch = require('winston-elasticsearch');
9
+ const fs = require('fs');
10
+ const path = require('path');
11
+
12
+ const logDir = 'log';
13
+ // Create the log directory if it does not exist
14
+ // if (!fs.existsSync(logDir)) {
15
+ // fs.mkdirSync(logDir);
16
+ // }
17
+ // const filename = path.join(logDir, 'results.log');
18
+
19
+ //const region = 'us-east-1';
20
+ //const hosts = ['https://search-aws-es-v-n67kab4wame7fzgneuw7qzehia.us-east-1.es.amazonaws.com'];
21
+ //rachna
22
+ const awsEnv = (process.env.NODE_ENVIRONMENT || "dev");
23
+ const awsRegion = (process.env.AWS_DEFAULT_REGION || "us-east-2");
24
+ AWS.config.update({ region: awsRegion });
25
+ //const logGroup = process.env.AWS_LAMBDA_LOG_GROUP_NAME;
26
+ //const functionName = process.env.AWS_LAMBDA_FUNCTION_NAME;
27
+ module.exports.offTransport = () => {
28
+ return {
29
+ transports: []
30
+ };
31
+ }
32
+
33
+ module.exports.consoleTransport = () => {
34
+ return {
35
+ transports: [
36
+ new (winston.transports.Console)({ level: 'info' })
37
+ /*,
38
+ new (winstonAwsCloudWatch)({
39
+ level: 'info',
40
+ timestamp: () => {
41
+ return new Date().toString()
42
+ },
43
+ json: true,
44
+ //logGroupName: 'apfTest', // REQUIRED
45
+ logGroupName: logGroup,//rachna
46
+ logStreamName: functionName,//rachna
47
+ // logStreamName: module, // REQUIRED
48
+ //logStreamName: 'invoicing', // REQUIRED
49
+
50
+ createLogGroup: true,
51
+ createLogStream: true,
52
+ awsRegion: awsRegion,
53
+ formatLog: function (item) {
54
+ return item.level + ': ' + item.message + ' ' + JSON.stringify(item.meta)
55
+ }
56
+ })*/
57
+ /* new (winston.transports.Console)({ level: 'info' ,format: winston.format.combine(
58
+ winston.format.timestamp(),
59
+ winston.format.colorize(),
60
+ winston.format.simple(),
61
+ winston.format.printf(info => `${info.timestamp} ${info.level}: ${info.message}`)
62
+ )}),*/
63
+ ]
64
+ };
65
+ }
66
+
67
+
68
+
69
+ // Replaces the previous transports with those in the
70
+ // new configuration wholesale.
71
+ //
72
+ // const DailyRotateFile = require('winston-daily-rotate-file');
73
+ // logger.configure({
74
+ // level: 'verbose',
75
+ // transports: [
76
+ // new DailyRotateFile(opts)
77
+ // ]
78
+ // });
79
+
80
+ module.exports.fileTransport = () => {
81
+ return {
82
+ transports: [
83
+ // - Write to all logs with level `info` and below to `combined.log`
84
+ // - Write all logs error (and below) to `error.log`.
85
+ new winston.transports.File({ filename: 'error.log', level: 'error' }),
86
+ new winston.transports.File({ filename: 'invoicing.log' }),
87
+ ]
88
+ };
89
+ }
90
+
91
+ module.exports.awsTransport = (module) => {
92
+ const awsConfig = {
93
+ region: region
94
+ }
95
+
96
+ // const client = elasticsearch.Client({
97
+ // hosts: hosts,
98
+ // connectionClass: awses,
99
+ // log: 'trace'
100
+ // });
101
+
102
+ //Configuring AWS Credentials once
103
+ AWS.config.update({
104
+ region: region
105
+ });
106
+
107
+ return {
108
+ transports: [
109
+ new (winstonAwsCloudWatch)({
110
+ level: 'info',
111
+ timestamp: () => {
112
+ return new Date().toString()
113
+ },
114
+ json: true,
115
+ logGroupName: 'apfTest', // REQUIRED
116
+
117
+
118
+ logStreamName: module, // REQUIRED
119
+ //logStreamName: 'invoicing', // REQUIRED
120
+
121
+ createLogGroup: true,
122
+ createLogStream: true,
123
+ awsRegion: awsRegion,
124
+ formatLog: function (item) {
125
+ return item.level + ': ' + item.message + ' ' + JSON.stringify(item.meta)
126
+ }
127
+ }),
128
+ // new (WinstonElasticsearch)({
129
+ // level: 'info',
130
+ // client: client,
131
+ // formatLog: function (item) {
132
+ // return item.level + ': ' + item.message + ' ' + JSON.stringify(item.meta)
133
+ // }
134
+ // })
135
+ ]
136
+ };
137
+ }
package/SSMConfig.js CHANGED
@@ -1,44 +1,44 @@
1
- //const log = require('./Logger/index').getLogger();
2
-
3
- module.exports.ssmConfig = async (ssmParameters) => {
4
- const log = require('./index').Logger;
5
- log.info('Input SSM Parameters::');
6
- log.info(JSON.stringify(ssmParameters.ssmMap));
7
-
8
- const AWS = require('aws-sdk');
9
-
10
- const awsEnv = (process.env.NODE_ENVIRONMENT || ssmParameters.awsEnvt);
11
- const awsRegion = (process.env.AWS_DEFAULT_REGION || ssmParameters.awsRegion);
12
- AWS.config.update({ region: awsRegion });
13
-
14
- var ssm = new AWS.SSM();
15
- var ssmConfiguration = {};
16
- var namesArray = [];
17
- var parameterStoreJSON = {};
18
-
19
- for (var param of ssmParameters.ssmMap) {
20
- namesArray.push('/' + awsEnv + '/' + param.Name);
21
- }
22
- const paramater = await ssm.getParameters({
23
- Names: namesArray,
24
- WithDecryption: true
25
- }).promise()
26
-
27
- paramater.Parameters.forEach(record => {
28
- const key = record.Name.substring(1).split('/').shift();
29
- const ssnName = record.Name.substring(1).replace(key, '').substring(1);
30
- for (var param of ssmParameters.ssmMap) {
31
- if (ssnName === param.Name) {
32
- parameterStoreJSON[param.Value] = record.Value;
33
- break;
34
- }
35
- }
36
- });
37
- log.info('Fetching Output SSM Parameters::');
38
- //log.info(JSON.stringify(parameterStoreJSON));
39
-
40
- return parameterStoreJSON;
41
- }
42
-
43
-
44
- //ssmConfig(require('../utils/SSMParameters.js')['ssm']);
1
+ //const log = require('./Logger/index').getLogger();
2
+
3
+ module.exports.ssmConfig = async (ssmParameters) => {
4
+ const log = require('./index').Logger;
5
+ log.info('Input SSM Parameters::');
6
+ log.info(JSON.stringify(ssmParameters.ssmMap));
7
+
8
+ const AWS = require('aws-sdk');
9
+
10
+ const awsEnv = (process.env.NODE_ENVIRONMENT || ssmParameters.awsEnvt);
11
+ const awsRegion = (process.env.AWS_DEFAULT_REGION || ssmParameters.awsRegion);
12
+ AWS.config.update({ region: awsRegion });
13
+
14
+ var ssm = new AWS.SSM();
15
+ var ssmConfiguration = {};
16
+ var namesArray = [];
17
+ var parameterStoreJSON = {};
18
+
19
+ for (var param of ssmParameters.ssmMap) {
20
+ namesArray.push('/' + awsEnv + '/' + param.Name);
21
+ }
22
+ const paramater = await ssm.getParameters({
23
+ Names: namesArray,
24
+ WithDecryption: true
25
+ }).promise()
26
+
27
+ paramater.Parameters.forEach(record => {
28
+ const key = record.Name.substring(1).split('/').shift();
29
+ const ssnName = record.Name.substring(1).replace(key, '').substring(1);
30
+ for (var param of ssmParameters.ssmMap) {
31
+ if (ssnName === param.Name) {
32
+ parameterStoreJSON[param.Value] = record.Value;
33
+ break;
34
+ }
35
+ }
36
+ });
37
+ log.info('Fetching Output SSM Parameters::');
38
+ //log.info(JSON.stringify(parameterStoreJSON));
39
+
40
+ return parameterStoreJSON;
41
+ }
42
+
43
+
44
+ //ssmConfig(require('../utils/SSMParameters.js')['ssm']);
File without changes
@@ -1,59 +1,59 @@
1
- const DATE_TIME_DB_FORMAT = "YYYY-MM-DD HH:mm:ss";
2
- const moment = require("moment");
3
- AuditLoggerService = require("./AuditLoggerService");
4
-
5
- class AuditLogger {
6
-
7
- constructor() {
8
- this.auditLoggerService = new AuditLoggerService();
9
- }
10
-
11
- getPropertyValue(obj, property) {
12
- let entityId;
13
- for (let key of Object.keys(obj)) {
14
- if (typeof obj[key] === 'object') {
15
- return this.getPropertyValue(obj[key], property)
16
- }
17
- if (typeof obj[key] === 'string' && key === property) {
18
- entityId = obj[key];
19
- break;
20
-
21
- } else if (typeof obj[key] === 'number' && key === property) {
22
- entityId = String(obj[key]);
23
- break;
24
- }
25
-
26
- }
27
- return entityId;
28
- }
29
-
30
- UTC() {
31
- return moment().utc().format(DATE_TIME_DB_FORMAT);
32
- }
33
-
34
-
35
- async audit(message, subject, messageAttributes) {
36
- try {
37
-
38
-
39
-
40
- const entityId = this.getPropertyValue(JSON.parse(message), "id");
41
- const currentTime = this.UTC();
42
- const userName = (messageAttributes && messageAttributes.CurrentUserName) ? messageAttributes.CurrentUserName.Value : "system";
43
- const ipaddress = (messageAttributes && messageAttributes.IPAddress) ? messageAttributes.IPAddress.Value : "255.255.255.255";
44
- if (entityId === undefined) {
45
- return;
46
- }
47
- console.log("Event Received : EntityId = " + entityId + ", Topic Name = " + subject +
48
- ", UserName = " + userName + ", IP Address = " + ipaddress);
49
-
50
-
51
- await this.auditLoggerService.addAuditLog(entityId, subject, message, userName, ipaddress, currentTime);
52
- } catch (error) {
53
- console.log(`AuditLogger - Logs Not Added due to Error : ${error}`);
54
- }
55
-
56
- }
57
-
58
- }
1
+ const DATE_TIME_DB_FORMAT = "YYYY-MM-DD HH:mm:ss";
2
+ const moment = require("moment");
3
+ AuditLoggerService = require("./AuditLoggerService");
4
+
5
+ class AuditLogger {
6
+
7
+ constructor() {
8
+ this.auditLoggerService = new AuditLoggerService();
9
+ }
10
+
11
+ getPropertyValue(obj, property) {
12
+ let entityId;
13
+ for (let key of Object.keys(obj)) {
14
+ if (typeof obj[key] === 'object') {
15
+ return this.getPropertyValue(obj[key], property)
16
+ }
17
+ if (typeof obj[key] === 'string' && key === property) {
18
+ entityId = obj[key];
19
+ break;
20
+
21
+ } else if (typeof obj[key] === 'number' && key === property) {
22
+ entityId = String(obj[key]);
23
+ break;
24
+ }
25
+
26
+ }
27
+ return entityId;
28
+ }
29
+
30
+ UTC() {
31
+ return moment().utc().format(DATE_TIME_DB_FORMAT);
32
+ }
33
+
34
+
35
+ async audit(message, subject, messageAttributes) {
36
+ try {
37
+
38
+
39
+
40
+ const entityId = this.getPropertyValue(JSON.parse(message), "id");
41
+ const currentTime = this.UTC();
42
+ const userName = (messageAttributes && messageAttributes.CurrentUserName) ? messageAttributes.CurrentUserName.Value : "system";
43
+ const ipaddress = (messageAttributes && messageAttributes.IPAddress) ? messageAttributes.IPAddress.Value : "255.255.255.255";
44
+ if (entityId === undefined) {
45
+ return;
46
+ }
47
+ console.log("Event Received : EntityId = " + entityId + ", Topic Name = " + subject +
48
+ ", UserName = " + userName + ", IP Address = " + ipaddress);
49
+
50
+
51
+ await this.auditLoggerService.addAuditLog(entityId, subject, message, userName, ipaddress, currentTime);
52
+ } catch (error) {
53
+ console.log(`AuditLogger - Logs Not Added due to Error : ${error}`);
54
+ }
55
+
56
+ }
57
+
58
+ }
59
59
  module.exports = AuditLogger;
@@ -1,38 +1,38 @@
1
- const DATE_TIME_DB_FORMAT = "YYYY-MM-DD HH:mm:ss";
2
- const moment = require( "moment" );
3
- const TABLE_NAME = "AuditLog";
4
- var AWS = require('aws-sdk');
5
- const awsEnvironment = (process.env.CORE_ENVIRONMENT || 'dev');
6
- const awsRegion = (process.env.AWS_DEFAULT_REGION || 'us-east-2');
7
-
8
- class AuditLoggerRepository{
9
-
10
- constructor() {
11
- /*AWS.config.update({
12
- accessKeyId: "7grldc",
13
- secretAccessKey:"04fxu",
14
- region: "localhost",
15
- endpoint: "http://localhost:8000"
16
- });
17
- this.docClient = new AWS.DynamoDB.DocumentClient();*/
18
- this.docClient = new AWS.DynamoDB.DocumentClient({ region: awsRegion });
19
- }
20
-
21
- async add(auditLog){
22
- var params = {
23
- TableName: TABLE_NAME,
24
- Item: auditLog
25
- }
26
- try {
27
- let res = await this.docClient.put(params).promise();
28
- console.log(`AuditLoggerRepository - add -end `)
29
-
30
- } catch (error) {
31
- console.log(`AuditLoggerRepository - error occured while adding in audit log - ${JSON.stringify(auditLog)} ${error}`)
32
- //throw new DatabaseException(error);
33
- }
34
- }
35
-
36
- }
37
-
38
- module.exports = AuditLoggerRepository;
1
+ const DATE_TIME_DB_FORMAT = "YYYY-MM-DD HH:mm:ss";
2
+ const moment = require( "moment" );
3
+ const TABLE_NAME = "AuditLog";
4
+ var AWS = require('aws-sdk');
5
+ const awsEnvironment = (process.env.CORE_ENVIRONMENT || 'dev');
6
+ const awsRegion = (process.env.AWS_DEFAULT_REGION || 'us-east-2');
7
+
8
+ class AuditLoggerRepository{
9
+
10
+ constructor() {
11
+ /*AWS.config.update({
12
+ accessKeyId: "7grldc",
13
+ secretAccessKey:"04fxu",
14
+ region: "localhost",
15
+ endpoint: "http://localhost:8000"
16
+ });
17
+ this.docClient = new AWS.DynamoDB.DocumentClient();*/
18
+ this.docClient = new AWS.DynamoDB.DocumentClient({ region: awsRegion });
19
+ }
20
+
21
+ async add(auditLog){
22
+ var params = {
23
+ TableName: TABLE_NAME,
24
+ Item: auditLog
25
+ }
26
+ try {
27
+ let res = await this.docClient.put(params).promise();
28
+ console.log(`AuditLoggerRepository - add -end `)
29
+
30
+ } catch (error) {
31
+ console.log(`AuditLoggerRepository - error occured while adding in audit log - ${JSON.stringify(auditLog)} ${error}`)
32
+ //throw new DatabaseException(error);
33
+ }
34
+ }
35
+
36
+ }
37
+
38
+ module.exports = AuditLoggerRepository;
@@ -1,38 +1,38 @@
1
- const DATE_TIME_DB_FORMAT = "YYYY-MM-DD HH:mm:ss";
2
- const moment = require("moment");
3
- const AuditLogRepository = require("./AuditLoggerRepository");
4
-
5
- class AuditLoggerService {
6
-
7
- constructor() {
8
- this.auditLogRepository = new AuditLogRepository();
9
- }
10
-
11
- async addAuditLog(entityId = 0, subject = "", message = "", currentUserName = "", ipAddress = "", currentTime = "") {
12
-
13
- try {
14
- const auditLog = {
15
- Id: entityId,
16
- CurrentUserName: currentUserName,
17
- EntityType: subject,
18
- EventData: message,
19
- CurrentTime: currentTime,
20
- IPAddress: ipAddress
21
- }
22
-
23
- await this.auditLogRepository.add(auditLog);
24
-
25
- } catch (error) {
26
- console.log(` AuditLoggerService - Error occured while adding Auding Log- subject - ${subject} ${error}`)
27
- }
28
- }
29
-
30
- UTC() {
31
- return moment().utc().format(DATE_TIME_DB_FORMAT);
32
- }
33
-
34
-
35
-
36
- }
37
-
1
+ const DATE_TIME_DB_FORMAT = "YYYY-MM-DD HH:mm:ss";
2
+ const moment = require("moment");
3
+ const AuditLogRepository = require("./AuditLoggerRepository");
4
+
5
+ class AuditLoggerService {
6
+
7
+ constructor() {
8
+ this.auditLogRepository = new AuditLogRepository();
9
+ }
10
+
11
+ async addAuditLog(entityId = 0, subject = "", message = "", currentUserName = "", ipAddress = "", currentTime = "") {
12
+
13
+ try {
14
+ const auditLog = {
15
+ Id: entityId,
16
+ CurrentUserName: currentUserName,
17
+ EntityType: subject,
18
+ EventData: message,
19
+ CurrentTime: currentTime,
20
+ IPAddress: ipAddress
21
+ }
22
+
23
+ await this.auditLogRepository.add(auditLog);
24
+
25
+ } catch (error) {
26
+ console.log(` AuditLoggerService - Error occured while adding Auding Log- subject - ${subject} ${error}`)
27
+ }
28
+ }
29
+
30
+ UTC() {
31
+ return moment().utc().format(DATE_TIME_DB_FORMAT);
32
+ }
33
+
34
+
35
+
36
+ }
37
+
38
38
  module.exports = AuditLoggerService;