identity-admin 1.25.20 → 1.25.22
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.
|
@@ -271,6 +271,15 @@ let DashboardController = DashboardController_1 = class DashboardController {
|
|
|
271
271
|
crudOperations.create.before) {
|
|
272
272
|
recordParams = yield crudOperations.create.before(req, recordParams, currentUser);
|
|
273
273
|
}
|
|
274
|
+
if (crudOperations && crudOperations.create && crudOperations.create.validators) {
|
|
275
|
+
for (let index = 0; index < crudOperations.create.validators.length; index++) {
|
|
276
|
+
const validation = crudOperations.create.validators[index];
|
|
277
|
+
const result = yield validation.run(req);
|
|
278
|
+
if (!result.isEmpty()) {
|
|
279
|
+
return ResponseUtils_1.default.unprocessable(res, 'Invalid data', result.array());
|
|
280
|
+
}
|
|
281
|
+
}
|
|
282
|
+
}
|
|
274
283
|
var record;
|
|
275
284
|
if (recordParams.password) {
|
|
276
285
|
//const user = new Mongoose.prototype.model(modifiedResource.properties.modelName)(recordParams);
|
|
@@ -333,6 +342,15 @@ let DashboardController = DashboardController_1 = class DashboardController {
|
|
|
333
342
|
crudOperations.update.before) {
|
|
334
343
|
recordParams = yield crudOperations.update.before(req, recordParams, currentUser);
|
|
335
344
|
}
|
|
345
|
+
if (crudOperations && crudOperations.update && crudOperations.update.validators) {
|
|
346
|
+
for (let index = 0; index < crudOperations.update.validators.length; index++) {
|
|
347
|
+
const validation = crudOperations.update.validators[index];
|
|
348
|
+
const result = yield validation.run(req);
|
|
349
|
+
if (!result.isEmpty()) {
|
|
350
|
+
return ResponseUtils_1.default.unprocessable(res, 'Invalid data', result.array());
|
|
351
|
+
}
|
|
352
|
+
}
|
|
353
|
+
}
|
|
336
354
|
var recordSaveResult = {};
|
|
337
355
|
if ((_e = crudOperations === null || crudOperations === void 0 ? void 0 : crudOperations.update) === null || _e === void 0 ? void 0 : _e.update) {
|
|
338
356
|
recordSaveResult = yield crudOperations.update.update(req, record, recordParams, currentUser);
|
|
@@ -48,7 +48,7 @@ class ReportsGenerator {
|
|
|
48
48
|
columns.map((field) => header.cell(field.label));
|
|
49
49
|
rows.forEach(row => {
|
|
50
50
|
const tableRow = table.row();
|
|
51
|
-
row.map(cell => tableRow.cell(`${cell}`));
|
|
51
|
+
row.map(cell => tableRow.cell(`${cell !== null && cell !== void 0 ? cell : '---'}`));
|
|
52
52
|
});
|
|
53
53
|
return yield doc.asBuffer();
|
|
54
54
|
});
|
|
@@ -1,14 +1,15 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
declare type
|
|
8
|
-
declare type
|
|
9
|
-
declare type
|
|
10
|
-
declare type
|
|
11
|
-
declare type
|
|
1
|
+
import { ValidationChain } from 'express-validator';
|
|
2
|
+
import { Document, Model } from 'mongoose';
|
|
3
|
+
import { IRequest } from '../middlewares/isAuth';
|
|
4
|
+
import { IRepository, PageInfo, PaginateParams } from '../repositories/Repository';
|
|
5
|
+
import SaveResult from '../repositories/SaveResult';
|
|
6
|
+
import { ActionNames, ActionTypes, FieldTypes, FileTypes, HandlerStrategy, Virtuals } from './helpers';
|
|
7
|
+
declare type orderTypes = 'asc' | 'desc';
|
|
8
|
+
declare type VirtualFieldTypes = 'password' | 'ref' | 'Array';
|
|
9
|
+
declare type Severity = 'success' | 'info' | 'warning' | 'error';
|
|
10
|
+
declare type ButtonColors = 'inherit' | 'primary' | 'secondary' | 'success' | 'error' | 'info' | 'warning';
|
|
11
|
+
declare type ButtonVariants = 'text' | 'outlined' | 'contained';
|
|
12
|
+
declare type ButtonSizes = 'small' | 'medium' | 'large';
|
|
12
13
|
declare type PopulateFunction = (populatedString: any) => Promise<any>;
|
|
13
14
|
interface Parent {
|
|
14
15
|
/**
|
|
@@ -103,6 +104,10 @@ interface ICrudOperations {
|
|
|
103
104
|
* @returns the saved document
|
|
104
105
|
*/
|
|
105
106
|
after?: (req: IRequest, document: Document, currentUser: Document, params: any) => Promise<Document>;
|
|
107
|
+
/**
|
|
108
|
+
* Validators consist of an array of Express ValidationChain, each comprising validation functions that are executed before triggering the save query.
|
|
109
|
+
*/
|
|
110
|
+
validators?: ValidationChain[];
|
|
106
111
|
};
|
|
107
112
|
update?: {
|
|
108
113
|
/**
|
|
@@ -121,6 +126,10 @@ interface ICrudOperations {
|
|
|
121
126
|
* @returns saved result with updated document
|
|
122
127
|
*/
|
|
123
128
|
update?: (req: IRequest, record: Document, recordParams: any, currentUser: Document) => Promise<SaveResult<any>>;
|
|
129
|
+
/**
|
|
130
|
+
* Validators consist of an array of Express ValidationChain, each comprising validation functions that are executed before triggering the update query.
|
|
131
|
+
*/
|
|
132
|
+
validators?: ValidationChain[];
|
|
124
133
|
};
|
|
125
134
|
show?: {
|
|
126
135
|
after?: (req: IRequest, record: Document) => Promise<{
|