@estgbue/mezgeb 0.0.50 → 0.0.52
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/mezgeb/listener/controllers/audit-log-command.controller.d.ts +6 -2
- package/dist/mezgeb/listener/controllers/audit-log-command.controller.d.ts.map +1 -1
- package/dist/mezgeb/listener/controllers/audit-log-command.controller.js +43 -14
- package/dist/mezgeb/listener/services/audit-log-command.service.d.ts +9 -2
- package/dist/mezgeb/listener/services/audit-log-command.service.d.ts.map +1 -1
- package/dist/mezgeb/listener/services/audit-log-command.service.js +26 -7
- package/package.json +1 -1
|
@@ -6,11 +6,15 @@ export declare class AuditLogCommandController {
|
|
|
6
6
|
handleAuditLog(data: CreateEventDTO): Promise<void>;
|
|
7
7
|
handleApproveTransaction(payload: ChangeEventDTO): Promise<void>;
|
|
8
8
|
handleRollbackTransaction(payload: ChangeEventDTO): Promise<void>;
|
|
9
|
-
|
|
9
|
+
getAllAuditLogs(application: string, req: any, skip: number, take: number): Promise<{
|
|
10
10
|
count: number;
|
|
11
11
|
items: import("../entities/audit-log-command.entity").AuditLogCommand[];
|
|
12
12
|
}>;
|
|
13
|
-
|
|
13
|
+
getAllMyAuditLogs(application: string, req: any, skip: number, take: number): Promise<{
|
|
14
|
+
count: number;
|
|
15
|
+
items: import("../entities/audit-log-command.entity").AuditLogCommand[];
|
|
16
|
+
}>;
|
|
17
|
+
getAuditLogs(entityId: string, application: string, req: any, skip: number, take: number): Promise<{
|
|
14
18
|
count: number;
|
|
15
19
|
items: import("../entities/audit-log-command.entity").AuditLogCommand[];
|
|
16
20
|
}>;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit-log-command.controller.d.ts","sourceRoot":"","sources":["../../../../libs/mezgeb/src/mezgeb/listener/controllers/audit-log-command.controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAI/E,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElE,qBAGa,yBAAyB;IACxB,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAAf,eAAe,EAAE,sBAAsB;IAI9D,cAAc,CAAC,IAAI,EAAE,cAAc;IAMnC,wBAAwB,CAAC,OAAO,EAAE,cAAc;IAMhD,yBAAyB,CAAC,OAAO,EAAE,cAAc;
|
|
1
|
+
{"version":3,"file":"audit-log-command.controller.d.ts","sourceRoot":"","sources":["../../../../libs/mezgeb/src/mezgeb/listener/controllers/audit-log-command.controller.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,sBAAsB,EAAE,MAAM,uCAAuC,CAAC;AAI/E,OAAO,EAAE,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAElE,qBAGa,yBAAyB;IACxB,OAAO,CAAC,QAAQ,CAAC,eAAe;gBAAf,eAAe,EAAE,sBAAsB;IAI9D,cAAc,CAAC,IAAI,EAAE,cAAc;IAMnC,wBAAwB,CAAC,OAAO,EAAE,cAAc;IAMhD,yBAAyB,CAAC,OAAO,EAAE,cAAc;IAkBjD,eAAe,CACG,WAAW,EAAE,MAAM,EAClC,GAAG,EAAE,GAAG,EACA,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM;;;;IAuBvB,iBAAiB,CACC,WAAW,EAAE,MAAM,EAClC,GAAG,EAAE,GAAG,EACA,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM;;;;IAsBvB,YAAY,CACG,QAAQ,EAAE,MAAM,EACb,WAAW,EAAE,MAAM,EAClC,GAAG,EAAE,GAAG,EACA,IAAI,EAAE,MAAM,EACZ,IAAI,EAAE,MAAM;;;;CAS9B"}
|
|
@@ -48,14 +48,19 @@ let AuditLogCommandController = class AuditLogCommandController {
|
|
|
48
48
|
yield this.auditLogService.delete(payload);
|
|
49
49
|
});
|
|
50
50
|
}
|
|
51
|
-
|
|
51
|
+
getAllAuditLogs(application, req, skip, take) {
|
|
52
52
|
return __awaiter(this, void 0, void 0, function* () {
|
|
53
|
-
return yield this.auditLogService.
|
|
53
|
+
return yield this.auditLogService.getAllAuditLogs(application, req, { skip, take });
|
|
54
54
|
});
|
|
55
55
|
}
|
|
56
|
-
|
|
56
|
+
getAllMyAuditLogs(application, req, skip, take) {
|
|
57
57
|
return __awaiter(this, void 0, void 0, function* () {
|
|
58
|
-
return yield this.auditLogService.
|
|
58
|
+
return yield this.auditLogService.getMyAllAuditLogs(application, req, { skip, take });
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
getAuditLogs(entityId, application, req, skip, take) {
|
|
62
|
+
return __awaiter(this, void 0, void 0, function* () {
|
|
63
|
+
return yield this.auditLogService.getAuditLogs(entityId, application, req, { skip, take });
|
|
59
64
|
});
|
|
60
65
|
}
|
|
61
66
|
};
|
|
@@ -82,7 +87,7 @@ __decorate([
|
|
|
82
87
|
__metadata("design:returntype", Promise)
|
|
83
88
|
], AuditLogCommandController.prototype, "handleRollbackTransaction", null);
|
|
84
89
|
__decorate([
|
|
85
|
-
(0, common_1.Get)('/:
|
|
90
|
+
(0, common_1.Get)('all/:application'),
|
|
86
91
|
(0, swagger_1.ApiQuery)({
|
|
87
92
|
name: 'skip',
|
|
88
93
|
type: Number,
|
|
@@ -95,16 +100,16 @@ __decorate([
|
|
|
95
100
|
description: 'Number of records to take for pagination. Optional',
|
|
96
101
|
required: false,
|
|
97
102
|
}),
|
|
98
|
-
__param(0, (0, common_1.Param)('
|
|
99
|
-
__param(1, (0, common_1.
|
|
103
|
+
__param(0, (0, common_1.Param)('application')),
|
|
104
|
+
__param(1, (0, common_1.Req)()),
|
|
100
105
|
__param(2, (0, common_1.Query)('skip')),
|
|
101
106
|
__param(3, (0, common_1.Query)('take')),
|
|
102
107
|
__metadata("design:type", Function),
|
|
103
|
-
__metadata("design:paramtypes", [String,
|
|
108
|
+
__metadata("design:paramtypes", [String, Object, Number, Number]),
|
|
104
109
|
__metadata("design:returntype", Promise)
|
|
105
|
-
], AuditLogCommandController.prototype, "
|
|
110
|
+
], AuditLogCommandController.prototype, "getAllAuditLogs", null);
|
|
106
111
|
__decorate([
|
|
107
|
-
(0, common_1.Get)('
|
|
112
|
+
(0, common_1.Get)('mine/:application'),
|
|
108
113
|
(0, swagger_1.ApiQuery)({
|
|
109
114
|
name: 'skip',
|
|
110
115
|
type: Number,
|
|
@@ -118,12 +123,36 @@ __decorate([
|
|
|
118
123
|
required: false,
|
|
119
124
|
}),
|
|
120
125
|
__param(0, (0, common_1.Param)('application')),
|
|
121
|
-
__param(1, (0, common_1.
|
|
122
|
-
__param(2, (0, common_1.Query)('
|
|
126
|
+
__param(1, (0, common_1.Req)()),
|
|
127
|
+
__param(2, (0, common_1.Query)('skip')),
|
|
128
|
+
__param(3, (0, common_1.Query)('take')),
|
|
123
129
|
__metadata("design:type", Function),
|
|
124
|
-
__metadata("design:paramtypes", [String, Number, Number]),
|
|
130
|
+
__metadata("design:paramtypes", [String, Object, Number, Number]),
|
|
125
131
|
__metadata("design:returntype", Promise)
|
|
126
|
-
], AuditLogCommandController.prototype, "
|
|
132
|
+
], AuditLogCommandController.prototype, "getAllMyAuditLogs", null);
|
|
133
|
+
__decorate([
|
|
134
|
+
(0, common_1.Get)('/:entityId/:application'),
|
|
135
|
+
(0, swagger_1.ApiQuery)({
|
|
136
|
+
name: 'skip',
|
|
137
|
+
type: Number,
|
|
138
|
+
description: 'Number of records to skip for pagination. Optional',
|
|
139
|
+
required: false,
|
|
140
|
+
}),
|
|
141
|
+
(0, swagger_1.ApiQuery)({
|
|
142
|
+
name: 'take',
|
|
143
|
+
type: Number,
|
|
144
|
+
description: 'Number of records to take for pagination. Optional',
|
|
145
|
+
required: false,
|
|
146
|
+
}),
|
|
147
|
+
__param(0, (0, common_1.Param)('entityId')),
|
|
148
|
+
__param(1, (0, common_1.Param)('application')),
|
|
149
|
+
__param(2, (0, common_1.Req)()),
|
|
150
|
+
__param(3, (0, common_1.Query)('skip')),
|
|
151
|
+
__param(4, (0, common_1.Query)('take')),
|
|
152
|
+
__metadata("design:type", Function),
|
|
153
|
+
__metadata("design:paramtypes", [String, String, Object, Number, Number]),
|
|
154
|
+
__metadata("design:returntype", Promise)
|
|
155
|
+
], AuditLogCommandController.prototype, "getAuditLogs", null);
|
|
127
156
|
exports.AuditLogCommandController = AuditLogCommandController = __decorate([
|
|
128
157
|
(0, common_1.Controller)('audit-log-commands'),
|
|
129
158
|
(0, swagger_1.ApiTags)('Audit Log'),
|
|
@@ -13,14 +13,21 @@ export declare class AuditLogCommandService {
|
|
|
13
13
|
private changeCamelToSnakeCase;
|
|
14
14
|
pluralizeAndChangeCase(word: string): string;
|
|
15
15
|
private buildAuditLogQuery;
|
|
16
|
-
getAllAuditLogs(application: string, paginate?: {
|
|
16
|
+
getAllAuditLogs(application: string, req: any, paginate?: {
|
|
17
17
|
skip?: number;
|
|
18
18
|
take?: number;
|
|
19
19
|
}): Promise<{
|
|
20
20
|
count: number;
|
|
21
21
|
items: AuditLogCommand[];
|
|
22
22
|
}>;
|
|
23
|
-
|
|
23
|
+
getMyAllAuditLogs(application: string, req: any, paginate?: {
|
|
24
|
+
skip?: number;
|
|
25
|
+
take?: number;
|
|
26
|
+
}): Promise<{
|
|
27
|
+
count: number;
|
|
28
|
+
items: AuditLogCommand[];
|
|
29
|
+
}>;
|
|
30
|
+
getAuditLogs(entityId: string, application: string, req: any, paginate?: {
|
|
24
31
|
skip?: number;
|
|
25
32
|
take?: number;
|
|
26
33
|
}): Promise<{
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"audit-log-command.service.d.ts","sourceRoot":"","sources":["../../../../libs/mezgeb/src/mezgeb/listener/services/audit-log-command.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAiB,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEjF,qBACa,sBAAsB;IAG/B,OAAO,CAAC,kBAAkB;IAE1B,OAAO,CAAC,yBAAyB;gBAFzB,kBAAkB,EAAE,UAAU,CAAC,QAAQ,CAAC,EAExC,yBAAyB,EAAE,UAAU,CAAC,eAAe,CAAC;IAG1D,MAAM,CAAC,QAAQ,EAAE,cAAc;IAgB/B,MAAM,CAAC,QAAQ,EAAE,cAAc;IA+D/B,MAAM,CAAC,QAAQ,EAAE,cAAc;IAiC/B,YAAY,CAChB,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,cAAc,GAAG,cAAc,EACvC,eAAe,EAAE,MAAM,EACvB,UAAU,EAAE,MAAM;IA0CpB,OAAO,CAAC,sBAAsB;IAI9B,sBAAsB,CAAC,IAAI,EAAE,MAAM;IAsBnC,OAAO,CAAC,kBAAkB;
|
|
1
|
+
{"version":3,"file":"audit-log-command.service.d.ts","sourceRoot":"","sources":["../../../../libs/mezgeb/src/mezgeb/listener/services/audit-log-command.service.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,UAAU,EAAE,MAAM,SAAS,CAAC;AACrC,OAAO,EAAE,QAAQ,EAAE,MAAM,8BAA8B,CAAC;AACxD,OAAO,EAAE,eAAe,EAAE,MAAM,sCAAsC,CAAC;AACvE,OAAO,EAAiB,cAAc,EAAE,cAAc,EAAE,MAAM,kBAAkB,CAAC;AAEjF,qBACa,sBAAsB;IAG/B,OAAO,CAAC,kBAAkB;IAE1B,OAAO,CAAC,yBAAyB;gBAFzB,kBAAkB,EAAE,UAAU,CAAC,QAAQ,CAAC,EAExC,yBAAyB,EAAE,UAAU,CAAC,eAAe,CAAC;IAG1D,MAAM,CAAC,QAAQ,EAAE,cAAc;IAgB/B,MAAM,CAAC,QAAQ,EAAE,cAAc;IA+D/B,MAAM,CAAC,QAAQ,EAAE,cAAc;IAiC/B,YAAY,CAChB,MAAM,EAAE,GAAG,EACX,MAAM,EAAE,cAAc,GAAG,cAAc,EACvC,eAAe,EAAE,MAAM,EACvB,UAAU,EAAE,MAAM;IA0CpB,OAAO,CAAC,sBAAsB;IAI9B,sBAAsB,CAAC,IAAI,EAAE,MAAM;IAsBnC,OAAO,CAAC,kBAAkB;IAoDpB,eAAe,CACnB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,GAAG,EACR,QAAQ,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAO;;;;IAQ3C,iBAAiB,CACrB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,GAAG,EACR,QAAQ,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAO;;;;IAQ3C,YAAY,CAChB,QAAQ,EAAE,MAAM,EAChB,WAAW,EAAE,MAAM,EACnB,GAAG,EAAE,GAAG,EACR,QAAQ,GAAE;QAAE,IAAI,CAAC,EAAE,MAAM,CAAC;QAAC,IAAI,CAAC,EAAE,MAAM,CAAA;KAAO;;;;YAQnC,gBAAgB;IAgB9B,OAAO,CAAC,UAAU;CAWnB"}
|
|
@@ -151,7 +151,7 @@ let AuditLogCommandService = class AuditLogCommandService {
|
|
|
151
151
|
}
|
|
152
152
|
return word + 's';
|
|
153
153
|
}
|
|
154
|
-
buildAuditLogQuery(application, entityId, paginate = {}) {
|
|
154
|
+
buildAuditLogQuery(application, userFilter, entityId, paginate = {}) {
|
|
155
155
|
var _a, _b;
|
|
156
156
|
const dataQuery = this.auditLogCommandRepository.createQueryBuilder('audit_log_commands');
|
|
157
157
|
dataQuery
|
|
@@ -173,21 +173,40 @@ let AuditLogCommandService = class AuditLogCommandService {
|
|
|
173
173
|
if (entityId) {
|
|
174
174
|
dataQuery.andWhere('audit_log_commands.entityId = :entityId', { entityId });
|
|
175
175
|
}
|
|
176
|
+
for (const [key, value] of Object.entries(userFilter !== null && userFilter !== void 0 ? userFilter : {}).filter(([, value]) => value !== undefined)) {
|
|
177
|
+
dataQuery.andWhere(`auditLog.user ->> :key = :value`, {
|
|
178
|
+
key,
|
|
179
|
+
value: String(value),
|
|
180
|
+
});
|
|
181
|
+
}
|
|
176
182
|
if (paginate) {
|
|
177
183
|
dataQuery.skip((_a = paginate.skip) !== null && _a !== void 0 ? _a : 0).take((_b = paginate.take) !== null && _b !== void 0 ? _b : 10);
|
|
178
184
|
}
|
|
179
185
|
return dataQuery;
|
|
180
186
|
}
|
|
181
|
-
getAllAuditLogs(application_1) {
|
|
182
|
-
return __awaiter(this, arguments, void 0, function* (application, paginate = {}) {
|
|
183
|
-
|
|
187
|
+
getAllAuditLogs(application_1, req_1) {
|
|
188
|
+
return __awaiter(this, arguments, void 0, function* (application, req, paginate = {}) {
|
|
189
|
+
var _a;
|
|
190
|
+
const userFilter = (_a = req.auditFilter) !== null && _a !== void 0 ? _a : req.auditUser;
|
|
191
|
+
const dataQuery = this.buildAuditLogQuery(application, undefined, undefined, paginate);
|
|
192
|
+
const [items, count] = yield dataQuery.getManyAndCount();
|
|
193
|
+
return { count, items };
|
|
194
|
+
});
|
|
195
|
+
}
|
|
196
|
+
getMyAllAuditLogs(application_1, req_1) {
|
|
197
|
+
return __awaiter(this, arguments, void 0, function* (application, req, paginate = {}) {
|
|
198
|
+
var _a;
|
|
199
|
+
const userFilter = (_a = req.auditFilter) !== null && _a !== void 0 ? _a : req.auditUser;
|
|
200
|
+
const dataQuery = this.buildAuditLogQuery(application, userFilter, undefined, paginate);
|
|
184
201
|
const [items, count] = yield dataQuery.getManyAndCount();
|
|
185
202
|
return { count, items };
|
|
186
203
|
});
|
|
187
204
|
}
|
|
188
|
-
getAuditLogs(entityId_1, application_1) {
|
|
189
|
-
return __awaiter(this, arguments, void 0, function* (entityId, application, paginate = {}) {
|
|
190
|
-
|
|
205
|
+
getAuditLogs(entityId_1, application_1, req_1) {
|
|
206
|
+
return __awaiter(this, arguments, void 0, function* (entityId, application, req, paginate = {}) {
|
|
207
|
+
var _a;
|
|
208
|
+
const userFilter = (_a = req.auditFilter) !== null && _a !== void 0 ? _a : req.auditUser;
|
|
209
|
+
const dataQuery = this.buildAuditLogQuery(application, userFilter, entityId, paginate);
|
|
191
210
|
const [items, count] = yield dataQuery.getManyAndCount();
|
|
192
211
|
return { count, items };
|
|
193
212
|
});
|