identity-admin 1.25.13 → 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
|
}
|
|
@@ -75,7 +75,8 @@ class SchemaGenerator {
|
|
|
75
75
|
return [model, populatedString];
|
|
76
76
|
}
|
|
77
77
|
static setNestedSchema(paths, modelName, model, field, populatedString, resource) {
|
|
78
|
-
var
|
|
78
|
+
var _a, _b;
|
|
79
|
+
var nestedSchema = (_b = (_a = model[field]) === null || _a === void 0 ? void 0 : _a.schema) !== null && _b !== void 0 ? _b : {};
|
|
79
80
|
var nestedSchemaKeys = [];
|
|
80
81
|
const nestedModelodelAndPopulatedString = this.generateSchema(paths, nestedSchema, modelName, resource);
|
|
81
82
|
model[field].schema = nestedModelodelAndPopulatedString[0];
|
|
@@ -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<{
|
|
@@ -266,6 +272,18 @@ export interface IFieldValue {
|
|
|
266
272
|
* @default undefined
|
|
267
273
|
*/
|
|
268
274
|
isClickable?: boolean;
|
|
275
|
+
/**
|
|
276
|
+
* Specify the keys that will be shown in the nested schema. Only used when the type is nested schema
|
|
277
|
+
* @default undefined
|
|
278
|
+
*/
|
|
279
|
+
keys?: string[];
|
|
280
|
+
/**
|
|
281
|
+
* Specify the nested schema. Only used if the type is nested schema.
|
|
282
|
+
* @default undefined
|
|
283
|
+
*/
|
|
284
|
+
schema?: IModel | {
|
|
285
|
+
[key: string]: IFieldValue;
|
|
286
|
+
};
|
|
269
287
|
}
|
|
270
288
|
export interface IVirtualValue {
|
|
271
289
|
/**
|