identity-admin 1.26.11 → 1.26.12
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.
|
@@ -236,7 +236,7 @@ let DashboardController = DashboardController_1 = class DashboardController {
|
|
|
236
236
|
});
|
|
237
237
|
}
|
|
238
238
|
create(req, res) {
|
|
239
|
-
var _a, _b, _c, _d, _e, _f;
|
|
239
|
+
var _a, _b, _c, _d, _e, _f, _g, _h;
|
|
240
240
|
return __awaiter(this, void 0, void 0, function* () {
|
|
241
241
|
if (!this.validateRequest(req, res)) {
|
|
242
242
|
return;
|
|
@@ -272,7 +272,7 @@ let DashboardController = DashboardController_1 = class DashboardController {
|
|
|
272
272
|
const validation = crudOperations.create.validators[index];
|
|
273
273
|
const result = yield validation.run(req);
|
|
274
274
|
if (!result.isEmpty()) {
|
|
275
|
-
return ResponseUtils_1.default.unprocessable(res, 'Invalid data', result.array());
|
|
275
|
+
return ResponseUtils_1.default.unprocessable(res, (_f = (result.array() && ((_e = result.array()[0]) === null || _e === void 0 ? void 0 : _e.msg))) !== null && _f !== void 0 ? _f : 'Invalid data', result.array());
|
|
276
276
|
}
|
|
277
277
|
}
|
|
278
278
|
}
|
|
@@ -289,11 +289,11 @@ let DashboardController = DashboardController_1 = class DashboardController {
|
|
|
289
289
|
if (!record.isValid() || !record.document) {
|
|
290
290
|
return ResponseUtils_1.default.unprocessable(res, 'Invalid Data', record.getErrors());
|
|
291
291
|
}
|
|
292
|
-
if ((
|
|
292
|
+
if ((_g = resource.properties) === null || _g === void 0 ? void 0 : _g.enableLog) {
|
|
293
293
|
const newRecord = yield repository.findById(record.getDocument()._id);
|
|
294
294
|
const userActionsLog = new UserActionsLog_1.default({
|
|
295
295
|
action: IUserActionsLog_1.UserActions.CREATE,
|
|
296
|
-
modelName: (
|
|
296
|
+
modelName: (_h = resource === null || resource === void 0 ? void 0 : resource.properties) === null || _h === void 0 ? void 0 : _h.modelName,
|
|
297
297
|
userId: req.user._id,
|
|
298
298
|
dataAfter: JSON.stringify(newRecord),
|
|
299
299
|
resourceId: newRecord === null || newRecord === void 0 ? void 0 : newRecord._id,
|
|
@@ -309,7 +309,7 @@ let DashboardController = DashboardController_1 = class DashboardController {
|
|
|
309
309
|
});
|
|
310
310
|
}
|
|
311
311
|
update(req, res) {
|
|
312
|
-
var _a, _b, _c, _d, _e, _f, _g;
|
|
312
|
+
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
313
313
|
return __awaiter(this, void 0, void 0, function* () {
|
|
314
314
|
if (!this.validateRequest(req, res)) {
|
|
315
315
|
return;
|
|
@@ -349,12 +349,12 @@ let DashboardController = DashboardController_1 = class DashboardController {
|
|
|
349
349
|
const validation = crudOperations.update.validators[index];
|
|
350
350
|
const result = yield validation.run(req);
|
|
351
351
|
if (!result.isEmpty()) {
|
|
352
|
-
return ResponseUtils_1.default.unprocessable(res, 'Invalid data', result.array());
|
|
352
|
+
return ResponseUtils_1.default.unprocessable(res, (_f = (result.array() && ((_e = result.array()[0]) === null || _e === void 0 ? void 0 : _e.msg))) !== null && _f !== void 0 ? _f : 'Invalid data', result.array());
|
|
353
353
|
}
|
|
354
354
|
}
|
|
355
355
|
}
|
|
356
356
|
var recordSaveResult = {};
|
|
357
|
-
if ((
|
|
357
|
+
if ((_g = crudOperations === null || crudOperations === void 0 ? void 0 : crudOperations.update) === null || _g === void 0 ? void 0 : _g.update) {
|
|
358
358
|
recordSaveResult = yield crudOperations.update.update(req, record, recordParams, currentUser);
|
|
359
359
|
}
|
|
360
360
|
else {
|
|
@@ -366,11 +366,11 @@ let DashboardController = DashboardController_1 = class DashboardController {
|
|
|
366
366
|
// if (resource.properties.modelName === ModelNames.Settings) {
|
|
367
367
|
// await AppSettings.run()
|
|
368
368
|
// }
|
|
369
|
-
if ((
|
|
369
|
+
if ((_h = resource.properties) === null || _h === void 0 ? void 0 : _h.enableLog) {
|
|
370
370
|
const newRecord = yield repository.findById(record._id);
|
|
371
371
|
const userActionsLog = new UserActionsLog_1.default({
|
|
372
372
|
action: IUserActionsLog_1.UserActions.EDIT,
|
|
373
|
-
modelName: (
|
|
373
|
+
modelName: (_j = resource === null || resource === void 0 ? void 0 : resource.properties) === null || _j === void 0 ? void 0 : _j.modelName,
|
|
374
374
|
userId: req.user._id,
|
|
375
375
|
dataBefore: JSON.stringify(record),
|
|
376
376
|
dataAfter: JSON.stringify(newRecord),
|