@servicelabsco/nestjs-utility-services 1.1.15 → 1.1.17
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.
- package/dist/app.controller.js +7 -24
- package/dist/app.controller.js.map +1 -1
- package/dist/app.module.js +2 -0
- package/dist/app.module.js.map +1 -1
- package/dist/app.service.js +8 -23
- package/dist/app.service.js.map +1 -1
- package/dist/auth/controllers/auth.controller.js +54 -75
- package/dist/auth/controllers/auth.controller.js.map +1 -1
- package/dist/auth/controllers/social.controller.js +7 -20
- package/dist/auth/controllers/social.controller.js.map +1 -1
- package/dist/auth/controllers/user.controller.js +6 -17
- package/dist/auth/controllers/user.controller.js.map +1 -1
- package/dist/auth/es6.classes.d.ts +2 -1
- package/dist/auth/es6.classes.js +2 -1
- package/dist/auth/es6.classes.js.map +1 -1
- package/dist/auth/middlewares/basic.auth.middleware.js +14 -25
- package/dist/auth/middlewares/basic.auth.middleware.js.map +1 -1
- package/dist/auth/middlewares/index.d.ts +1 -0
- package/dist/auth/middlewares/index.js +1 -0
- package/dist/auth/middlewares/index.js.map +1 -1
- package/dist/auth/middlewares/internal.middleware.d.ts +10 -0
- package/dist/auth/middlewares/internal.middleware.js +48 -0
- package/dist/auth/middlewares/internal.middleware.js.map +1 -0
- package/dist/auth/middlewares/jwt.middleware.js +19 -32
- package/dist/auth/middlewares/jwt.middleware.js.map +1 -1
- package/dist/auth/services/auth.service.js +42 -63
- package/dist/auth/services/auth.service.js.map +1 -1
- package/dist/auth/services/device.token.service.js +34 -47
- package/dist/auth/services/device.token.service.js.map +1 -1
- package/dist/auth/services/refresh.token.service.js +17 -30
- package/dist/auth/services/refresh.token.service.js.map +1 -1
- package/dist/auth/services/social.service.js +20 -33
- package/dist/auth/services/social.service.js.map +1 -1
- package/dist/auth/services/user.service.js +29 -46
- package/dist/auth/services/user.service.js.map +1 -1
- package/dist/auth/strategies/fb.strategy.js +8 -19
- package/dist/auth/strategies/fb.strategy.js.map +1 -1
- package/dist/auth/strategies/google.strategy.js +8 -19
- package/dist/auth/strategies/google.strategy.js.map +1 -1
- package/dist/cli.js +12 -23
- package/dist/cli.js.map +1 -1
- package/dist/common/guards/login.guard.js +5 -20
- package/dist/common/guards/login.guard.js.map +1 -1
- package/dist/common/libraries/base.migration.utility.js +106 -145
- package/dist/common/libraries/base.migration.utility.js.map +1 -1
- package/dist/common/libraries/common.entity.js +42 -63
- package/dist/common/libraries/common.entity.js.map +1 -1
- package/dist/common/libraries/common.job.js +31 -46
- package/dist/common/libraries/common.job.js.map +1 -1
- package/dist/common/libraries/common.mapper.job.js +20 -35
- package/dist/common/libraries/common.mapper.job.js.map +1 -1
- package/dist/common/libraries/common.subscriber.d.ts +1 -0
- package/dist/common/libraries/common.subscriber.js +10 -17
- package/dist/common/libraries/common.subscriber.js.map +1 -1
- package/dist/common/libraries/data.manager.js +85 -112
- package/dist/common/libraries/data.manager.js.map +1 -1
- package/dist/common/libraries/list.manager.js +62 -85
- package/dist/common/libraries/list.manager.js.map +1 -1
- package/dist/common/libraries/migration.utility.js +10 -31
- package/dist/common/libraries/migration.utility.js.map +1 -1
- package/dist/common/libraries/platform.utility.js +2 -13
- package/dist/common/libraries/platform.utility.js.map +1 -1
- package/dist/common/libraries/record.manager.js +106 -127
- package/dist/common/libraries/record.manager.js.map +1 -1
- package/dist/common/libraries/report.data.manager.js +66 -93
- package/dist/common/libraries/report.data.manager.js.map +1 -1
- package/dist/common/libraries/report.list.manager.js +69 -92
- package/dist/common/libraries/report.list.manager.js.map +1 -1
- package/dist/common/libraries/reverse.migration.utility.js +4 -23
- package/dist/common/libraries/reverse.migration.utility.js.map +1 -1
- package/dist/common/libraries/seeder.utility.js +51 -70
- package/dist/common/libraries/seeder.utility.js.map +1 -1
- package/dist/console.js +4 -13
- package/dist/console.js.map +1 -1
- package/dist/main.js +15 -26
- package/dist/main.js.map +1 -1
- package/dist/migrations/1599567001962-AddUserSequence.js +3 -16
- package/dist/migrations/1599567001962-AddUserSequence.js.map +1 -1
- package/dist/migrations/1607944291609-AddUniqueIndexDeviceToken.js +7 -20
- package/dist/migrations/1607944291609-AddUniqueIndexDeviceToken.js.map +1 -1
- package/dist/platformUtility/commands/entity.generator.command.js +81 -108
- package/dist/platformUtility/commands/entity.generator.command.js.map +1 -1
- package/dist/platformUtility/commands/maintenance.command.js +16 -35
- package/dist/platformUtility/commands/maintenance.command.js.map +1 -1
- package/dist/platformUtility/commands/sqs.worker.command.js +49 -72
- package/dist/platformUtility/commands/sqs.worker.command.js.map +1 -1
- package/dist/platformUtility/commands/sync.class.command.js +14 -25
- package/dist/platformUtility/commands/sync.class.command.js.map +1 -1
- package/dist/platformUtility/consumers/event.consumer.js +21 -42
- package/dist/platformUtility/consumers/event.consumer.js.map +1 -1
- package/dist/platformUtility/consumers/job.consumer.js +8 -19
- package/dist/platformUtility/consumers/job.consumer.js.map +1 -1
- package/dist/platformUtility/controllers/queue.controller.js +47 -76
- package/dist/platformUtility/controllers/queue.controller.js.map +1 -1
- package/dist/platformUtility/dtos/common.attributes.dto.d.ts +1 -0
- package/dist/platformUtility/dtos/common.attributes.dto.js +6 -0
- package/dist/platformUtility/dtos/common.attributes.dto.js.map +1 -1
- package/dist/platformUtility/jobs/record.watcher.job.js +5 -18
- package/dist/platformUtility/jobs/record.watcher.job.js.map +1 -1
- package/dist/platformUtility/jobs/test.job.js +1 -12
- package/dist/platformUtility/jobs/test.job.js.map +1 -1
- package/dist/platformUtility/libraries/process.common.mail.js +27 -44
- package/dist/platformUtility/libraries/process.common.mail.js.map +1 -1
- package/dist/platformUtility/libraries/process.postmark.mail.js +22 -37
- package/dist/platformUtility/libraries/process.postmark.mail.js.map +1 -1
- package/dist/platformUtility/services/audit.service.js +50 -67
- package/dist/platformUtility/services/audit.service.js.map +1 -1
- package/dist/platformUtility/services/cache.service.js +21 -36
- package/dist/platformUtility/services/cache.service.js.map +1 -1
- package/dist/platformUtility/services/dynamo.service.js +16 -29
- package/dist/platformUtility/services/dynamo.service.js.map +1 -1
- package/dist/platformUtility/services/fcm.notification.service.js +42 -63
- package/dist/platformUtility/services/fcm.notification.service.js.map +1 -1
- package/dist/platformUtility/services/mail.service.js +8 -19
- package/dist/platformUtility/services/mail.service.js.map +1 -1
- package/dist/platformUtility/services/queue.service.js +105 -158
- package/dist/platformUtility/services/queue.service.js.map +1 -1
- package/dist/platformUtility/services/remote.request.service.js +8 -19
- package/dist/platformUtility/services/remote.request.service.js.map +1 -1
- package/dist/platformUtility/services/sql.service.js +17 -38
- package/dist/platformUtility/services/sql.service.js.map +1 -1
- package/dist/platformUtility/services/sqs.service.js +39 -56
- package/dist/platformUtility/services/sqs.service.js.map +1 -1
- package/dist/platformUtility/services/startup.service.js +8 -21
- package/dist/platformUtility/services/startup.service.js.map +1 -1
- package/dist/platformUtility/subscribers/base.subscriber.js +6 -19
- package/dist/platformUtility/subscribers/base.subscriber.js.map +1 -1
- package/dist/system/commands/db.scanner.command.js +182 -221
- package/dist/system/commands/db.scanner.command.js.map +1 -1
- package/dist/system/commands/event.queue.command.js +30 -47
- package/dist/system/commands/event.queue.command.js.map +1 -1
- package/dist/system/commands/jobs.scanner.command.js +7 -18
- package/dist/system/commands/jobs.scanner.command.js.map +1 -1
- package/dist/system/commands/model.scanner.command.js +15 -30
- package/dist/system/commands/model.scanner.command.js.map +1 -1
- package/dist/system/commands/report.scanner.command.js +9 -20
- package/dist/system/commands/report.scanner.command.js.map +1 -1
- package/dist/system/commands/service.scanner.command.js +7 -18
- package/dist/system/commands/service.scanner.command.js.map +1 -1
- package/dist/system/commands/sync.all.command.js +13 -24
- package/dist/system/commands/sync.all.command.js.map +1 -1
- package/dist/system/controllers/base.controller.js +62 -87
- package/dist/system/controllers/base.controller.js.map +1 -1
- package/dist/system/controllers/data.controller.js +10 -23
- package/dist/system/controllers/data.controller.js.map +1 -1
- package/dist/system/controllers/form.controller.js +9 -20
- package/dist/system/controllers/form.controller.js.map +1 -1
- package/dist/system/controllers/menu.controller.js +4 -17
- package/dist/system/controllers/menu.controller.js.map +1 -1
- package/dist/system/controllers/preference.controller.js +51 -74
- package/dist/system/controllers/preference.controller.js.map +1 -1
- package/dist/system/controllers/report.controller.js +29 -46
- package/dist/system/controllers/report.controller.js.map +1 -1
- package/dist/system/controllers/upload.controller.js +11 -26
- package/dist/system/controllers/upload.controller.js.map +1 -1
- package/dist/system/controllers/user.preference.controller.js +9 -22
- package/dist/system/controllers/user.preference.controller.js.map +1 -1
- package/dist/system/es6.classes.d.ts +1 -1
- package/dist/system/jobs/clean.scheduled.event.job.js +3 -14
- package/dist/system/jobs/clean.scheduled.event.job.js.map +1 -1
- package/dist/system/jobs/column.mapper.job.js +18 -33
- package/dist/system/jobs/column.mapper.job.js.map +1 -1
- package/dist/system/jobs/model.scanner.job.js +106 -133
- package/dist/system/jobs/model.scanner.job.js.map +1 -1
- package/dist/system/jobs/property.job.js +5 -16
- package/dist/system/jobs/property.job.js.map +1 -1
- package/dist/system/jobs/relationship.mapper.job.js +18 -33
- package/dist/system/jobs/relationship.mapper.job.js.map +1 -1
- package/dist/system/jobs/report.column.sync.job.js +71 -94
- package/dist/system/jobs/report.column.sync.job.js.map +1 -1
- package/dist/system/jobs/scheduled.event.job.js +15 -28
- package/dist/system/jobs/scheduled.event.job.js.map +1 -1
- package/dist/system/jobs/scheduled.events.job.js +11 -22
- package/dist/system/jobs/scheduled.events.job.js.map +1 -1
- package/dist/system/jobs/user.group.member.job.js +56 -79
- package/dist/system/jobs/user.group.member.job.js.map +1 -1
- package/dist/system/jobs/user.group.permission.job.js +24 -39
- package/dist/system/jobs/user.group.permission.job.js.map +1 -1
- package/dist/system/jobs/user.group.role.job.js +24 -39
- package/dist/system/jobs/user.group.role.job.js.map +1 -1
- package/dist/system/libraries/business.rule.filter.validator.js +20 -37
- package/dist/system/libraries/business.rule.filter.validator.js.map +1 -1
- package/dist/system/libraries/business.rule.query.evaluator.js +24 -39
- package/dist/system/libraries/business.rule.query.evaluator.js.map +1 -1
- package/dist/system/libraries/column.manager.js +42 -61
- package/dist/system/libraries/column.manager.js.map +1 -1
- package/dist/system/libraries/model.sync.js +64 -87
- package/dist/system/libraries/model.sync.js.map +1 -1
- package/dist/system/libraries/security.rule.evaluator.js +13 -26
- package/dist/system/libraries/security.rule.evaluator.js.map +1 -1
- package/dist/system/services/business.rule.service.js +23 -36
- package/dist/system/services/business.rule.service.js.map +1 -1
- package/dist/system/services/client.script.service.js +17 -28
- package/dist/system/services/client.script.service.js.map +1 -1
- package/dist/system/services/column.service.js +12 -23
- package/dist/system/services/column.service.js.map +1 -1
- package/dist/system/services/comment.service.js +2 -13
- package/dist/system/services/comment.service.js.map +1 -1
- package/dist/system/services/common.service.js +27 -44
- package/dist/system/services/common.service.js.map +1 -1
- package/dist/system/services/document.service.js +3 -14
- package/dist/system/services/document.service.js.map +1 -1
- package/dist/system/services/event.detail.service.js +10 -21
- package/dist/system/services/event.detail.service.js.map +1 -1
- package/dist/system/services/event.queue.service.js +21 -34
- package/dist/system/services/event.queue.service.js.map +1 -1
- package/dist/system/services/form.service.js +6 -17
- package/dist/system/services/form.service.js.map +1 -1
- package/dist/system/services/list.service.js +20 -35
- package/dist/system/services/list.service.js.map +1 -1
- package/dist/system/services/menu.service.js +50 -69
- package/dist/system/services/menu.service.js.map +1 -1
- package/dist/system/services/model.service.js +60 -81
- package/dist/system/services/model.service.js.map +1 -1
- package/dist/system/services/preference.service.js +32 -53
- package/dist/system/services/preference.service.js.map +1 -1
- package/dist/system/services/property.service.js +23 -36
- package/dist/system/services/property.service.js.map +1 -1
- package/dist/system/services/report.service.js +19 -32
- package/dist/system/services/report.service.js.map +1 -1
- package/dist/system/services/scheduled.event.service.js +69 -90
- package/dist/system/services/scheduled.event.service.js.map +1 -1
- package/dist/system/services/security.rule.service.js +23 -40
- package/dist/system/services/security.rule.service.js.map +1 -1
- package/dist/system/services/ui.action.service.js +13 -24
- package/dist/system/services/ui.action.service.js.map +1 -1
- package/dist/system/services/upload.service.js +33 -48
- package/dist/system/services/upload.service.js.map +1 -1
- package/dist/system/services/user.preference.service.js +38 -57
- package/dist/system/services/user.preference.service.js.map +1 -1
- package/dist/system/subscribers/column.subscriber.js +4 -17
- package/dist/system/subscribers/column.subscriber.js.map +1 -1
- package/dist/system/subscribers/property.subscriber.js +4 -17
- package/dist/system/subscribers/property.subscriber.js.map +1 -1
- package/dist/system/subscribers/relationship.subscriber.js +4 -17
- package/dist/system/subscribers/relationship.subscriber.js.map +1 -1
- package/dist/system/subscribers/scheduled.event.subscriber.js +6 -19
- package/dist/system/subscribers/scheduled.event.subscriber.js.map +1 -1
- package/dist/system/subscribers/user.group.member.subscriber.js +4 -17
- package/dist/system/subscribers/user.group.member.subscriber.js.map +1 -1
- package/dist/system/subscribers/user.group.permission.subscriber.js +4 -17
- package/dist/system/subscribers/user.group.permission.subscriber.js.map +1 -1
- package/dist/system/subscribers/user.group.role.subscriber.js +4 -17
- package/dist/system/subscribers/user.group.role.subscriber.js.map +1 -1
- package/dist/worker.js +6 -17
- package/dist/worker.js.map +1 -1
- package/package.json +2 -1
@@ -11,15 +11,6 @@ var __metadata = (this && this.__metadata) || function (k, v) {
|
|
11
11
|
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
12
12
|
return function (target, key) { decorator(target, key, paramIndex); }
|
13
13
|
};
|
14
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
15
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
16
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
17
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
18
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
19
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
20
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
21
|
-
});
|
22
|
-
};
|
23
14
|
Object.defineProperty(exports, "__esModule", { value: true });
|
24
15
|
exports.QueueController = void 0;
|
25
16
|
const common_1 = require("@nestjs/common");
|
@@ -32,82 +23,62 @@ let QueueController = class QueueController {
|
|
32
23
|
this.queueService = queueService;
|
33
24
|
this.accessManager = accessManager;
|
34
25
|
}
|
35
|
-
get() {
|
36
|
-
|
37
|
-
|
38
|
-
return this.queueService.getStats();
|
39
|
-
});
|
26
|
+
async get() {
|
27
|
+
await this.validate();
|
28
|
+
return this.queueService.getStats();
|
40
29
|
}
|
41
|
-
show(id) {
|
42
|
-
|
43
|
-
|
44
|
-
return this.queueService.getJobDetails(id);
|
45
|
-
});
|
30
|
+
async show(id) {
|
31
|
+
await this.validate();
|
32
|
+
return this.queueService.getJobDetails(id);
|
46
33
|
}
|
47
|
-
workers() {
|
48
|
-
|
49
|
-
|
50
|
-
return this.queueService.getWorkers();
|
51
|
-
});
|
34
|
+
async workers() {
|
35
|
+
await this.validate();
|
36
|
+
return this.queueService.getWorkers();
|
52
37
|
}
|
53
|
-
completed(param) {
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
return this.queueService.getCompletedJobs(start, end);
|
61
|
-
});
|
38
|
+
async completed(param) {
|
39
|
+
await this.validate();
|
40
|
+
const page = param.page || 1;
|
41
|
+
const limit = param.limit || 20;
|
42
|
+
const start = (page - 1) * limit;
|
43
|
+
const end = page * limit;
|
44
|
+
return this.queueService.getCompletedJobs(start, end);
|
62
45
|
}
|
63
|
-
failed(param) {
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
return this.queueService.getFailedJobs(start, end);
|
71
|
-
});
|
46
|
+
async failed(param) {
|
47
|
+
await this.validate();
|
48
|
+
const page = param.page || 1;
|
49
|
+
const limit = param.limit || 20;
|
50
|
+
const start = (page - 1) * limit;
|
51
|
+
const end = page * limit;
|
52
|
+
return this.queueService.getFailedJobs(start, end);
|
72
53
|
}
|
73
|
-
waiting(param) {
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
return this.queueService.getWaitingJobs(start, end);
|
81
|
-
});
|
54
|
+
async waiting(param) {
|
55
|
+
await this.validate();
|
56
|
+
const page = param.page || 1;
|
57
|
+
const limit = param.limit || 20;
|
58
|
+
const start = (page - 1) * limit;
|
59
|
+
const end = page * limit;
|
60
|
+
return this.queueService.getWaitingJobs(start, end);
|
82
61
|
}
|
83
|
-
delayed(param) {
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
return this.queueService.getDelayedJobs(start, end);
|
91
|
-
});
|
62
|
+
async delayed(param) {
|
63
|
+
await this.validate();
|
64
|
+
const page = param.page || 1;
|
65
|
+
const limit = param.limit || 20;
|
66
|
+
const start = (page - 1) * limit;
|
67
|
+
const end = page * limit;
|
68
|
+
return this.queueService.getDelayedJobs(start, end);
|
92
69
|
}
|
93
|
-
delete(id) {
|
94
|
-
|
95
|
-
|
96
|
-
return this.queueService.removeJob(id);
|
97
|
-
});
|
70
|
+
async delete(id) {
|
71
|
+
await this.validate();
|
72
|
+
return this.queueService.removeJob(id);
|
98
73
|
}
|
99
|
-
retry(id) {
|
100
|
-
|
101
|
-
|
102
|
-
return this.queueService.retryJob(id);
|
103
|
-
});
|
74
|
+
async retry(id) {
|
75
|
+
await this.validate();
|
76
|
+
return this.queueService.retryJob(id);
|
104
77
|
}
|
105
|
-
validate() {
|
106
|
-
|
107
|
-
|
108
|
-
|
109
|
-
throw new access_exception_1.AccessException('You dont have access to queue manager');
|
110
|
-
});
|
78
|
+
async validate() {
|
79
|
+
const hasAccess = await this.accessManager.hasRoleId(1);
|
80
|
+
if (!hasAccess)
|
81
|
+
throw new access_exception_1.AccessException('You dont have access to queue manager');
|
111
82
|
}
|
112
83
|
};
|
113
84
|
__decorate([
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"queue.controller.js","sourceRoot":"","sources":["../../../src/platformUtility/controllers/queue.controller.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"queue.controller.js","sourceRoot":"","sources":["../../../src/platformUtility/controllers/queue.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAmD;AACnD,uEAAmE;AACnE,yEAAoE;AACpE,6DAAyD;AACzD,+EAA2E;AAGpE,IAAM,eAAe,GAArB,MAAM,eAAe;IACxB,YAA6B,YAA0B,EAAmB,aAA4B;QAAzE,iBAAY,GAAZ,YAAY,CAAc;QAAmB,kBAAa,GAAb,aAAa,CAAe;IAAG,CAAC;IAE1G,KAAK,CAAC,GAAG;QACL,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,EAAE,CAAC;IACxC,CAAC;IAED,KAAK,CAAC,IAAI,CAAC,EAAU;QACjB,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC,YAAY,CAAC,aAAa,CAAC,EAAE,CAAC,CAAC;IAC/C,CAAC;IAED,KAAK,CAAC,OAAO;QACT,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC,YAAY,CAAC,UAAU,EAAE,CAAC;IAC1C,CAAC;IAEK,AAAN,KAAK,CAAC,SAAS,CAAU,KAAqB;QAC1C,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QAEtB,MAAM,IAAI,GAAG,KAAK,CAAC,IAAI,IAAI,CAAC,CAAC;QAC7B,MAAM,KAAK,GAAG,KAAK,CAAC,KAAK,IAAI,EAAE,CAAC;QAChC,MAAM,KAAK,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,GAAG,KAAK,CAAC;QACjC,MAAM,GAAG,GAAG,IAAI,GAAG,KAAK,CAAC;QAEzB,OAAO,IAAI,CAAC,YAAY,CAAC,gBAAgB,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC1D,CAAC;IAEK,AAAN,KAAK,CAAC,MAAM,CAAU,KAAqB;QACv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AM,CAAC,EAAU;QACnB,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC,YAAY,CAAC,SAAS,CAAC,EAAE,CAAC,CAAC;IAC3C,CAAC;IAED,KAAK,CAAC,KAAK,CAAC,EAAU;QAClB,MAAM,IAAI,CAAC,QAAQ,EAAE,CAAC;QACtB,OAAO,IAAI,CAAC,YAAY,CAAC,QAAQ,CAAC,EAAE,CAAC,CAAC;IAC1C,CAAC;IAED,KAAK,CAAC,QAAQ;QACV,MAAM,SAAS,GAAG,MAAM,IAAI,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;QACxD,IAAI,CAAC,SAAS;YAAE,MAAM,IAAI,kCAAe,CAAC,uCAAuC,CAAC,CAAC;IACvF,CAAC;CACJ,CAAA;AAvDS;IAAW,WAAA,IAAA,cAAK,GAAE,CAAA;;qCAAQ,iCAAc;;gDAS7C;AAEK;IAAQ,WAAA,IAAA,cAAK,GAAE,CAAA;;qCAAQ,iCAAc;;6CAQ1C;AAEK;IAAS,WAAA,IAAA,cAAK,GAAE,CAAA;;qCAAQ,iCAAc;;8CAQ3C;AAEK;IAAS,WAAA,IAAA,cAAK,GAAE,CAAA;;qCAAQ,iCAAc;;8CAQ3C;AAzDQ,eAAe;IAD3B,IAAA,mBAAU,EAAC,iBAAiB,CAAC;qCAEiB,4BAAY,EAAkC,8BAAa;GAD7F,eAAe,CAyE3B;AAzEY,0CAAe"}
|
@@ -26,5 +26,11 @@ __decorate([
|
|
26
26
|
(0, class_validator_1.IsBoolean)(),
|
27
27
|
__metadata("design:type", Boolean)
|
28
28
|
], CommonAttributesDto.prototype, "enable_delete", void 0);
|
29
|
+
__decorate([
|
30
|
+
(0, class_transformer_1.Expose)(),
|
31
|
+
(0, class_validator_1.IsOptional)(),
|
32
|
+
(0, class_validator_1.IsBoolean)(),
|
33
|
+
__metadata("design:type", Boolean)
|
34
|
+
], CommonAttributesDto.prototype, "no_details", void 0);
|
29
35
|
exports.CommonAttributesDto = CommonAttributesDto;
|
30
36
|
//# sourceMappingURL=common.attributes.dto.js.map
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"common.attributes.dto.js","sourceRoot":"","sources":["../../../src/platformUtility/dtos/common.attributes.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA2C;AAC3C,qDAAwD;AACxD,MAAa,mBAAmB;
|
1
|
+
{"version":3,"file":"common.attributes.dto.js","sourceRoot":"","sources":["../../../src/platformUtility/dtos/common.attributes.dto.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,yDAA2C;AAC3C,qDAAwD;AACxD,MAAa,mBAAmB;CAe/B;AAdG;IAAC,IAAA,0BAAM,GAAE;IACR,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,GAAE;;oDACM;AAElB;IAAC,IAAA,0BAAM,GAAE;IACR,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,GAAE;;0DACY;AAExB;IAAC,IAAA,0BAAM,GAAE;IACR,IAAA,4BAAU,GAAE;IACZ,IAAA,2BAAS,GAAE;;uDACS;AAdzB,kDAeC"}
|
@@ -8,15 +8,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
10
|
};
|
11
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
12
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
13
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
14
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
15
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
16
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
17
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
18
|
-
});
|
19
|
-
};
|
20
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
21
12
|
exports.RecordWatcherJob = void 0;
|
22
13
|
const common_1 = require("@nestjs/common");
|
@@ -29,16 +20,12 @@ let RecordWatcherJob = class RecordWatcherJob extends common_job_1.CommonJob {
|
|
29
20
|
this.queueService = queueService;
|
30
21
|
this.auditService = auditService;
|
31
22
|
}
|
32
|
-
handle(event) {
|
33
|
-
|
34
|
-
yield this.setAuditLog(event);
|
35
|
-
});
|
23
|
+
async handle(event) {
|
24
|
+
await this.setAuditLog(event);
|
36
25
|
}
|
37
|
-
setAuditLog(event) {
|
38
|
-
|
39
|
-
|
40
|
-
yield this.auditService.setAuditRecord(event);
|
41
|
-
});
|
26
|
+
async setAuditLog(event) {
|
27
|
+
if (event.updatedColumns)
|
28
|
+
await this.auditService.setAuditRecord(event);
|
42
29
|
}
|
43
30
|
};
|
44
31
|
RecordWatcherJob = __decorate([
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"record.watcher.job.js","sourceRoot":"","sources":["../../../src/platformUtility/jobs/record.watcher.job.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"record.watcher.job.js","sourceRoot":"","sources":["../../../src/platformUtility/jobs/record.watcher.job.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAE5C,kEAA8D;AAC9D,6DAAyD;AACzD,+DAA2D;AAWpD,IAAM,gBAAgB,GAAtB,MAAM,gBAAiB,SAAQ,sBAAS;IAO3C,YAA+B,YAA0B,EAAmB,YAA0B;QAClG,KAAK,EAAE,CAAC;QADmB,iBAAY,GAAZ,YAAY,CAAc;QAAmB,iBAAY,GAAZ,YAAY,CAAc;IAEtG,CAAC;IAOD,KAAK,CAAC,MAAM,CAAC,KAA4B;QACrC,MAAM,IAAI,CAAC,WAAW,CAAC,KAAK,CAAC,CAAC;IAClC,CAAC;IASO,KAAK,CAAC,WAAW,CAAC,KAAK;QAE3B,IAAI,KAAK,CAAC,cAAc;YAAE,MAAM,IAAI,CAAC,YAAY,CAAC,cAAc,CAAC,KAAK,CAAC,CAAC;IAC5E,CAAC;CACJ,CAAA;AA/BY,gBAAgB;IAD5B,IAAA,mBAAU,GAAE;qCAQoC,4BAAY,EAAiC,4BAAY;GAP7F,gBAAgB,CA+B5B;AA/BY,4CAAgB"}
|
@@ -8,15 +8,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
10
|
};
|
11
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
12
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
13
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
14
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
15
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
16
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
17
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
18
|
-
});
|
19
|
-
};
|
20
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
21
12
|
exports.TestJob = void 0;
|
22
13
|
const common_1 = require("@nestjs/common");
|
@@ -27,9 +18,7 @@ let TestJob = class TestJob extends common_job_1.CommonJob {
|
|
27
18
|
super();
|
28
19
|
this.queueService = queueService;
|
29
20
|
}
|
30
|
-
handle(data) {
|
31
|
-
return __awaiter(this, void 0, void 0, function* () {
|
32
|
-
});
|
21
|
+
async handle(data) {
|
33
22
|
}
|
34
23
|
};
|
35
24
|
TestJob = __decorate([
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"test.job.js","sourceRoot":"","sources":["../../../src/platformUtility/jobs/test.job.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"test.job.js","sourceRoot":"","sources":["../../../src/platformUtility/jobs/test.job.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,2CAA4C;AAC5C,oEAAgE;AAChE,+DAA2D;AAGpD,IAAM,OAAO,GAAb,MAAM,OAAQ,SAAQ,sBAAS;IAClC,YAA+B,YAA0B;QACrD,KAAK,EAAE,CAAC;QADmB,iBAAY,GAAZ,YAAY,CAAc;IAEzD,CAAC;IAED,KAAK,CAAC,MAAM,CAAC,IAAS;IAEtB,CAAC;CACJ,CAAA;AARY,OAAO;IADnB,IAAA,mBAAU,GAAE;qCAEoC,4BAAY;GADhD,OAAO,CAQnB;AARY,0BAAO"}
|
@@ -1,59 +1,42 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
3
|
exports.ProcessCommonMail = void 0;
|
13
4
|
const axios_1 = require("axios");
|
14
5
|
const class_validator_1 = require("class-validator");
|
15
6
|
const fs_1 = require("fs");
|
16
7
|
class ProcessCommonMail {
|
17
|
-
getAttachments(files) {
|
8
|
+
async getAttachments(files) {
|
18
9
|
var _a;
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
return attachments;
|
34
|
-
});
|
10
|
+
if (!files)
|
11
|
+
return [];
|
12
|
+
const attachments = [];
|
13
|
+
for (const file of files) {
|
14
|
+
const content = await this.getFileBuffer(file.file);
|
15
|
+
const filename = (_a = file.name) !== null && _a !== void 0 ? _a : file.file.split('/').pop();
|
16
|
+
attachments.push({
|
17
|
+
content,
|
18
|
+
filename,
|
19
|
+
type: 'application/pdf',
|
20
|
+
disposition: 'attachment',
|
21
|
+
});
|
22
|
+
}
|
23
|
+
return attachments;
|
35
24
|
}
|
36
|
-
getFileBuffer(file) {
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
return this.getLocalFileBuffer(file);
|
41
|
-
});
|
25
|
+
async getFileBuffer(file) {
|
26
|
+
if ((0, class_validator_1.isURL)(file))
|
27
|
+
return this.getNetworkFileBuffer(file);
|
28
|
+
return this.getLocalFileBuffer(file);
|
42
29
|
}
|
43
|
-
getLocalFileBuffer(file) {
|
44
|
-
return
|
45
|
-
return (0, fs_1.readFileSync)(file).toString('base64');
|
46
|
-
});
|
30
|
+
async getLocalFileBuffer(file) {
|
31
|
+
return (0, fs_1.readFileSync)(file).toString('base64');
|
47
32
|
}
|
48
|
-
getNetworkFileBuffer(url) {
|
49
|
-
|
50
|
-
|
51
|
-
|
52
|
-
|
53
|
-
responseType: 'arraybuffer',
|
54
|
-
});
|
55
|
-
return Buffer.from(response.data, 'binary').toString('base64');
|
33
|
+
async getNetworkFileBuffer(url) {
|
34
|
+
const response = await (0, axios_1.default)({
|
35
|
+
url,
|
36
|
+
method: 'GET',
|
37
|
+
responseType: 'arraybuffer',
|
56
38
|
});
|
39
|
+
return Buffer.from(response.data, 'binary').toString('base64');
|
57
40
|
}
|
58
41
|
}
|
59
42
|
exports.ProcessCommonMail = ProcessCommonMail;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"process.common.mail.js","sourceRoot":"","sources":["../../../src/platformUtility/libraries/process.common.mail.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"process.common.mail.js","source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,QAAQ,CAAC,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;IACnE,CAAC;CACJ;AApED,8CAoEC"}
|
@@ -1,13 +1,4 @@
|
|
1
1
|
"use strict";
|
2
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
3
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
4
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
5
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
6
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
7
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
8
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
9
|
-
});
|
10
|
-
};
|
11
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
12
3
|
exports.ProcessPostmarkMail = void 0;
|
13
4
|
const config = require("config");
|
@@ -19,39 +10,33 @@ class ProcessPostmarkMail extends process_common_mail_1.ProcessCommonMail {
|
|
19
10
|
super();
|
20
11
|
this.options = options;
|
21
12
|
}
|
22
|
-
process() {
|
23
|
-
|
24
|
-
|
25
|
-
return response.MessageID;
|
26
|
-
});
|
13
|
+
async process() {
|
14
|
+
const response = await this.send();
|
15
|
+
return response.MessageID;
|
27
16
|
}
|
28
|
-
send() {
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
Attachments: attachments,
|
39
|
-
});
|
17
|
+
async send() {
|
18
|
+
const client = new postmark.ServerClient(mailConfig.postmark);
|
19
|
+
const attachments = await this.setAttachments();
|
20
|
+
return client.sendEmail({
|
21
|
+
From: mailConfig.from,
|
22
|
+
To: this.options.to,
|
23
|
+
Subject: this.options.subject,
|
24
|
+
HtmlBody: this.options.html,
|
25
|
+
TrackOpens: true,
|
26
|
+
Attachments: attachments,
|
40
27
|
});
|
41
28
|
}
|
42
|
-
setAttachments() {
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
ContentType: file.type,
|
51
|
-
});
|
29
|
+
async setAttachments() {
|
30
|
+
const files = await this.getAttachments(this.options.files);
|
31
|
+
const attachments = [];
|
32
|
+
files.forEach((file) => {
|
33
|
+
attachments.push({
|
34
|
+
Name: file.filename,
|
35
|
+
Content: file.content,
|
36
|
+
ContentType: file.type,
|
52
37
|
});
|
53
|
-
return attachments;
|
54
38
|
});
|
39
|
+
return attachments;
|
55
40
|
}
|
56
41
|
}
|
57
42
|
exports.ProcessPostmarkMail = ProcessPostmarkMail;
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"process.postmark.mail.js","sourceRoot":"","sources":["../../../src/platformUtility/libraries/process.postmark.mail.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"process.postmark.mail.js","sourceRoot":"","sources":["../../../src/platformUtility/libraries/process.postmark.mail.ts"],"names":[],"mappings":";;;AAAA,iCAAiC;AACjC,qCAAqC;AAGrC,+DAA0D;AAE1D,MAAM,UAAU,GAAG,MAAM,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC;AAQtC,MAAa,mBAAoB,SAAQ,uCAAiB;IAMtD,YAAoB,OAAuB;QACvC,KAAK,EAAE,CAAC;QADQ,YAAO,GAAP,OAAO,CAAgB;IAE3C,CAAC;IAOD,KAAK,CAAC,OAAO;QACT,MAAM,QAAQ,GAAG,MAAM,IAAI,CAAC,IAAI,EAAE,CAAC;QACnC,OAAO,QAAQ,CAAC,SAAS,CAAC;IAC9B,CAAC;IAQO,KAAK,CAAC,IAAI;QACd,MAAM,MAAM,GAAG,IAAI,QAAQ,CAAC,YAAY,CAAC,UAAU,CAAC,QAAQ,CAAC,CAAC;QAC9D,MAAM,WAAW,GAAG,MAAM,IAAI,CAAC,cAAc,EAAE,CAAC;QAEhD,OAAO,MAAM,CAAC,SAAS,CAAC;YACpB,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,EAAE,EAAE,IAAI,CAAC,OAAO,CAAC,EAAE;YACnB,OAAO,EAAE,IAAI,CAAC,OAAO,CAAC,OAAO;YAC7B,QAAQ,EAAE,IAAI,CAAC,OAAO,CAAC,IAAI;YAC3B,UAAU,EAAE,IAAI;YAChB,WAAW,EAAE,WAAW;SAC3B,CAAC,CAAC;IACP,CAAC;IAQO,KAAK,CAAC,cAAc;QACxB,MAAM,KAAK,GAAG,MAAM,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC;QAC5D,MAAM,WAAW,GAAG,EAAE,CAAC;QAEvB,KAAK,CAAC,OAAO,CAAC,CAAC,IAAI,EAAE,EAAE;YACnB,WAAW,CAAC,IAAI,CAAC;gBACb,IAAI,EAAE,IAAI,CAAC,QAAQ;gBACnB,OAAO,EAAE,IAAI,CAAC,OAAO;gBACrB,WAAW,EAAE,IAAI,CAAC,IAAI;aACzB,CAAC,CAAC;QACP,CAAC,CAAC,CAAC;QAEH,OAAO,WAAW,CAAC;IACvB,CAAC;CACJ;AA5DD,kDA4DC"}
|
@@ -8,15 +8,6 @@ var __decorate = (this && this.__decorate) || function (decorators, target, key,
|
|
8
8
|
var __metadata = (this && this.__metadata) || function (k, v) {
|
9
9
|
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
10
10
|
};
|
11
|
-
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
12
|
-
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
13
|
-
return new (P || (P = Promise))(function (resolve, reject) {
|
14
|
-
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
15
|
-
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
|
16
|
-
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
17
|
-
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
18
|
-
});
|
19
|
-
};
|
20
11
|
Object.defineProperty(exports, "__esModule", { value: true });
|
21
12
|
exports.AuditService = void 0;
|
22
13
|
const operation_exception_1 = require("./../../common/exceptions/operation.exception");
|
@@ -33,71 +24,63 @@ let AuditService = class AuditService {
|
|
33
24
|
this.auditTable = null;
|
34
25
|
this.init();
|
35
26
|
}
|
36
|
-
setAuditRecord(event) {
|
37
|
-
|
38
|
-
|
27
|
+
async setAuditRecord(event) {
|
28
|
+
if (!this.auditTable)
|
29
|
+
return;
|
30
|
+
const promises = [];
|
31
|
+
event.updatedColumns.forEach((column) => {
|
32
|
+
var _a, _b;
|
33
|
+
if (this.toIgnore.indexOf(column) !== -1)
|
39
34
|
return;
|
40
|
-
const
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
46
|
-
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
51
|
-
old_value: event.databaseEntity[column],
|
52
|
-
new_value: event.entity[column],
|
53
|
-
user: (_b = (_a = event.user) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : 2,
|
54
|
-
};
|
55
|
-
promises.push(this.dynamoService.setItem(this.auditTable, item));
|
56
|
-
});
|
57
|
-
return Promise.all(promises).then((res) => {
|
58
|
-
return res;
|
59
|
-
});
|
35
|
+
const identifier = `${event.metadata.tableName}-${event.entity.id}`;
|
36
|
+
const timestamp = Date.now() * 1000 + platform_utility_1.PlatformUtility.generateRandomNumber(3);
|
37
|
+
const item = {
|
38
|
+
identifier,
|
39
|
+
timestamp,
|
40
|
+
column,
|
41
|
+
old_value: event.databaseEntity[column],
|
42
|
+
new_value: event.entity[column],
|
43
|
+
user: (_b = (_a = event.user) === null || _a === void 0 ? void 0 : _a.id) !== null && _b !== void 0 ? _b : 2,
|
44
|
+
};
|
45
|
+
promises.push(this.dynamoService.setItem(this.auditTable, item));
|
60
46
|
});
|
61
|
-
|
62
|
-
|
63
|
-
return __awaiter(this, void 0, void 0, function* () {
|
64
|
-
const items = yield this.getDataFromDynamo(model.table_name, id);
|
65
|
-
const promises = [];
|
66
|
-
items.forEach((item) => {
|
67
|
-
promises.push(this.addUserRecord(item));
|
68
|
-
});
|
69
|
-
return Promise.all(promises).then((res) => {
|
70
|
-
return res;
|
71
|
-
});
|
47
|
+
return Promise.all(promises).then((res) => {
|
48
|
+
return res;
|
72
49
|
});
|
73
50
|
}
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
return item;
|
51
|
+
async getAuditLogs(model, id) {
|
52
|
+
const items = await this.getDataFromDynamo(model.table_name, id);
|
53
|
+
const promises = [];
|
54
|
+
items.forEach((item) => {
|
55
|
+
promises.push(this.addUserRecord(item));
|
80
56
|
});
|
81
|
-
|
82
|
-
|
83
|
-
return __awaiter(this, void 0, void 0, function* () {
|
84
|
-
if (!this.auditTable)
|
85
|
-
throw new operation_exception_1.OperationException('Audit table is not properly setup in configuration');
|
86
|
-
const params = {
|
87
|
-
TableName: this.auditTable,
|
88
|
-
KeyConditionExpression: '#key = :identifier and #sort > :value',
|
89
|
-
ExpressionAttributeNames: {
|
90
|
-
'#key': 'identifier',
|
91
|
-
'#sort': 'timestamp',
|
92
|
-
},
|
93
|
-
ExpressionAttributeValues: {
|
94
|
-
':identifier': `${tableName}-${id}`,
|
95
|
-
':value': 0,
|
96
|
-
},
|
97
|
-
};
|
98
|
-
return this.dynamoService.queryItem(params);
|
57
|
+
return Promise.all(promises).then((res) => {
|
58
|
+
return res;
|
99
59
|
});
|
100
60
|
}
|
61
|
+
async addUserRecord(item) {
|
62
|
+
item.user = item.user === 2 ? null : await creator_entity_1.CreatorEntity.findOne({ where: { id: item.user } });
|
63
|
+
item.timestamp = new Date((0, lodash_1.floor)(item.timestamp / 1000));
|
64
|
+
delete item.identifier;
|
65
|
+
return item;
|
66
|
+
}
|
67
|
+
async getDataFromDynamo(tableName, id) {
|
68
|
+
if (!this.auditTable)
|
69
|
+
throw new operation_exception_1.OperationException('Audit table is not properly setup in configuration');
|
70
|
+
const params = {
|
71
|
+
TableName: this.auditTable,
|
72
|
+
KeyConditionExpression: '#key = :identifier and #sort > :value',
|
73
|
+
ExpressionAttributeNames: {
|
74
|
+
'#key': 'identifier',
|
75
|
+
'#sort': 'timestamp',
|
76
|
+
},
|
77
|
+
ExpressionAttributeValues: {
|
78
|
+
':identifier': `${tableName}-${id}`,
|
79
|
+
':value': 0,
|
80
|
+
},
|
81
|
+
};
|
82
|
+
return this.dynamoService.queryItem(params);
|
83
|
+
}
|
101
84
|
init() {
|
102
85
|
if (config.has('audit.table'))
|
103
86
|
this.auditTable = config.get('audit.table');
|
@@ -1 +1 @@
|
|
1
|
-
{"version":3,"file":"audit.service.js","sourceRoot":"","sources":["../../../src/platformUtility/services/audit.service.ts"],"names":[],"mappings":"
|
1
|
+
{"version":3,"file":"audit.service.js","sourceRoot":"","sources":["../../../src/platformUtility/services/audit.service.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA,uFAAmF;AACnF,2CAA4C;AAC5C,mCAA+B;AAC/B,8EAA0E;AAC1E,yEAAqE;AAErE,qDAAiD;AACjD,iCAAiC;AAS1B,IAAM,YAAY,GAAlB,MAAM,YAAY;IAoBrB,YAA6B,aAA4B;QAA5B,kBAAa,GAAb,aAAa,CAAe;QAdjD,aAAQ,GAAG,CAAC,YAAY,EAAE,YAAY,EAAE,YAAY,EAAE,YAAY,CAAC,CAAC;QAOpE,eAAU,GAAG,IAAI,CAAC;QAQtB,IAAI,CAAC,IAAI,EAAE,CAAC;IAChB,CAAC;IAQD,KAAK,CAAC,cAAc,CAAC,KAA4B;QAE7C,IAAI,CAAC,IAAI,CAAC,UAAU;YAAE,OAAO;QAE7B,MAAM,QAAQ,GAAG,EAAE,CAAC;QAEpB,KAAK,CAAC,cAAc,CAAC,OAAO,CAAC,CAAC,MAAM,EAAE,EAAE;;YAEpC,IAAI,IAAI,CAAC,QAAQ,CAAC,OAAO,CAAC,MAAM,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