identity-admin 1.25.14 → 1.25.15
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.
|
@@ -287,7 +287,7 @@ let DashboardController = DashboardController_1 = class DashboardController {
|
|
|
287
287
|
});
|
|
288
288
|
}
|
|
289
289
|
update(req, res) {
|
|
290
|
-
var _a, _b, _c, _d;
|
|
290
|
+
var _a, _b, _c, _d, _e;
|
|
291
291
|
return __awaiter(this, void 0, void 0, function* () {
|
|
292
292
|
if (!this.validateRequest(req, res)) {
|
|
293
293
|
return;
|
|
@@ -325,7 +325,13 @@ let DashboardController = DashboardController_1 = class DashboardController {
|
|
|
325
325
|
crudOperations.update.before) {
|
|
326
326
|
recordParams = yield crudOperations.update.before(req, recordParams, currentUser);
|
|
327
327
|
}
|
|
328
|
-
var recordSaveResult =
|
|
328
|
+
var recordSaveResult = {};
|
|
329
|
+
if ((_e = crudOperations === null || crudOperations === void 0 ? void 0 : crudOperations.update) === null || _e === void 0 ? void 0 : _e.update) {
|
|
330
|
+
recordSaveResult = yield crudOperations.update.update(req, record, recordParams, currentUser);
|
|
331
|
+
}
|
|
332
|
+
else {
|
|
333
|
+
recordSaveResult = yield repository.update(record, recordParams);
|
|
334
|
+
}
|
|
329
335
|
if (!recordSaveResult.isValid()) {
|
|
330
336
|
return ResponseUtils_1.default.unprocessable(res, "Invalid Data", recordSaveResult.getErrors());
|
|
331
337
|
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { Document, Model } from "mongoose";
|
|
2
2
|
import { IRequest } from "../middlewares/isAuth";
|
|
3
3
|
import { IRepository } from "../repositories/Repository";
|
|
4
|
+
import SaveResult from "../repositories/SaveResult";
|
|
4
5
|
import { ActionNames, ActionTypes, FieldTypes, FileTypes, HandlerStrategy, Virtuals } from "./helpers";
|
|
5
6
|
declare type orderTypes = "asc" | "desc";
|
|
6
7
|
declare type VirtualFieldTypes = "password" | "ref" | "Array";
|
|
@@ -98,6 +99,11 @@ interface ICrudOperations {
|
|
|
98
99
|
* @returns the updated document
|
|
99
100
|
*/
|
|
100
101
|
after?: (req: IRequest, document: Document, params: any, currentUser: Document) => Promise<Document>;
|
|
102
|
+
/**
|
|
103
|
+
* update handler that gives you the access to the run custom update method with custom query.
|
|
104
|
+
* @returns saved result with updated document
|
|
105
|
+
*/
|
|
106
|
+
update?: (req: IRequest, record: Document, recordParams: any, currentUser: Document) => Promise<SaveResult<any>>;
|
|
101
107
|
};
|
|
102
108
|
show?: {
|
|
103
109
|
after?: (req: IRequest, record: Document) => Promise<{
|
|
@@ -272,9 +278,9 @@ export interface IFieldValue {
|
|
|
272
278
|
*/
|
|
273
279
|
keys?: string[];
|
|
274
280
|
/**
|
|
275
|
-
|
|
276
|
-
|
|
277
|
-
|
|
281
|
+
* Specify the nested schema. Only used if the type is nested schema.
|
|
282
|
+
* @default undefined
|
|
283
|
+
*/
|
|
278
284
|
schema?: IModel | {
|
|
279
285
|
[key: string]: IFieldValue;
|
|
280
286
|
};
|