identity-admin 1.28.8 → 1.28.9
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.
|
@@ -69,7 +69,7 @@ let ActionController = class ActionController {
|
|
|
69
69
|
});
|
|
70
70
|
}
|
|
71
71
|
execute(req, res) {
|
|
72
|
-
var _a, _b;
|
|
72
|
+
var _a, _b, _c;
|
|
73
73
|
return __awaiter(this, void 0, void 0, function* () {
|
|
74
74
|
const record = req.body.record;
|
|
75
75
|
const modelName = req.body.modelName;
|
|
@@ -98,18 +98,23 @@ let ActionController = class ActionController {
|
|
|
98
98
|
for (var i = 0; i < extraActions.length; i++) {
|
|
99
99
|
const extraAction = extraActions[i];
|
|
100
100
|
if (extraAction.key === actionKey) {
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
101
|
+
if ((_c = resource.properties) === null || _c === void 0 ? void 0 : _c.enableLog) {
|
|
102
|
+
const oldRecord = yield repository.findById(record._id);
|
|
103
|
+
response = yield extraAction.handler(req, res, data);
|
|
104
|
+
const newRecord = yield repository.findById(record._id);
|
|
105
|
+
const userActionsLog = new UserActionsLog_1.default({
|
|
106
|
+
action: extraAction.name,
|
|
107
|
+
modelName,
|
|
108
|
+
userId: req.user._id,
|
|
109
|
+
dataBefore: JSON.stringify(oldRecord),
|
|
110
|
+
dataAfter: JSON.stringify(newRecord),
|
|
111
|
+
resourceId: record._id,
|
|
112
|
+
});
|
|
113
|
+
yield userActionsLog.save();
|
|
114
|
+
}
|
|
115
|
+
else {
|
|
116
|
+
response = yield extraAction.handler(req, res, data);
|
|
117
|
+
}
|
|
113
118
|
break;
|
|
114
119
|
}
|
|
115
120
|
}
|