@estgbue/mezgeb 0.0.47 → 0.0.48
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.
|
@@ -41,7 +41,7 @@ let AuditLogCommandService = class AuditLogCommandService {
|
|
|
41
41
|
}
|
|
42
42
|
update(itemData) {
|
|
43
43
|
return __awaiter(this, void 0, void 0, function* () {
|
|
44
|
-
var _a, _b, _c, _d
|
|
44
|
+
var _a, _b, _c, _d;
|
|
45
45
|
const before = (_a = itemData.before) !== null && _a !== void 0 ? _a : {};
|
|
46
46
|
const after = (_b = itemData.after) !== null && _b !== void 0 ? _b : {};
|
|
47
47
|
const entityId = (_d = (_c = itemData.entityId) !== null && _c !== void 0 ? _c : before === null || before === void 0 ? void 0 : before.id) !== null && _d !== void 0 ? _d : after === null || after === void 0 ? void 0 : after.id;
|
|
@@ -75,7 +75,7 @@ let AuditLogCommandService = class AuditLogCommandService {
|
|
|
75
75
|
}
|
|
76
76
|
if (changes.length === 0)
|
|
77
77
|
return;
|
|
78
|
-
const newAuditItem = this.auditLogCommandRepository.create(Object.assign(Object.assign({}, auditItem), { entity: after, entityId, auditLogId: itemData.requestId, parentId: auditItem.id, id: undefined, createdAt: new Date(
|
|
78
|
+
const newAuditItem = this.auditLogCommandRepository.create(Object.assign(Object.assign({}, auditItem), { entity: after, entityId, auditLogId: itemData.requestId, parentId: auditItem.id, id: undefined, createdAt: new Date(), queryMethod: 'UPDATE', changes }));
|
|
79
79
|
console.log({ changes });
|
|
80
80
|
common_1.Logger.log(`Creating update audit log command for ${itemData.entityName} with ID ${entityId} from ${itemData.before} to ${itemData.after}`);
|
|
81
81
|
yield this.auditLogCommandRepository.insert(newAuditItem);
|
|
@@ -83,7 +83,7 @@ let AuditLogCommandService = class AuditLogCommandService {
|
|
|
83
83
|
}
|
|
84
84
|
delete(itemData) {
|
|
85
85
|
return __awaiter(this, void 0, void 0, function* () {
|
|
86
|
-
var _a, _b
|
|
86
|
+
var _a, _b;
|
|
87
87
|
const before = (_a = itemData.before) !== null && _a !== void 0 ? _a : {};
|
|
88
88
|
const entityId = (_b = itemData.entityId) !== null && _b !== void 0 ? _b : before === null || before === void 0 ? void 0 : before.id;
|
|
89
89
|
common_1.Logger.log(`Creating delete audit log command for ${itemData.entityName} with ID ${entityId}`);
|
|
@@ -92,7 +92,7 @@ let AuditLogCommandService = class AuditLogCommandService {
|
|
|
92
92
|
const auditItem = yield this.getAuditItemById(itemData.entityName, entityId);
|
|
93
93
|
if (!auditItem)
|
|
94
94
|
return;
|
|
95
|
-
const newAuditItem = this.auditLogCommandRepository.create(Object.assign(Object.assign({}, auditItem), { entity: before, entityId, auditLogId: itemData.requestId, parentId: auditItem.id, id: undefined, createdAt: new Date(
|
|
95
|
+
const newAuditItem = this.auditLogCommandRepository.create(Object.assign(Object.assign({}, auditItem), { entity: before, entityId, auditLogId: itemData.requestId, parentId: auditItem.id, id: undefined, createdAt: new Date(), queryMethod: 'DELETE' }));
|
|
96
96
|
yield this.auditLogCommandRepository.insert(newAuditItem);
|
|
97
97
|
});
|
|
98
98
|
}
|