identity-admin 1.4.4 → 1.5.0

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.
@@ -242,7 +242,7 @@ let DashboardController = DashboardController_1 = class DashboardController {
242
242
  });
243
243
  }
244
244
  show(req, res) {
245
- var _a, _b, _c;
245
+ var _a, _b, _c, _d, _e;
246
246
  return __awaiter(this, void 0, void 0, function* () {
247
247
  if (!this.validateRequest(req, res)) {
248
248
  return;
@@ -267,10 +267,12 @@ let DashboardController = DashboardController_1 = class DashboardController {
267
267
  record = record.toObject();
268
268
  //record = await this.getExtras(record._id.toString(), record, this.getExtraRepository())
269
269
  record = yield ResourceHelper_1.default.addExtraFields(modifiedResource.showProperties, modifiedResource.properties.model, record, StringUtils_1.default.lowerCaseFirstLetter(modifiedResource.properties.modelName), resource);
270
- return ResponseUtils_1.default.ok(res, {
271
- record: record ? record : null,
272
- // options: modifiedResource
273
- });
270
+ const afterMethod = (_e = (_d = resource.properties.crudOperations) === null || _d === void 0 ? void 0 : _d.show) === null || _e === void 0 ? void 0 : _e.after;
271
+ let extras = {};
272
+ if (afterMethod && record) {
273
+ extras = yield afterMethod(record);
274
+ }
275
+ return ResponseUtils_1.default.ok(res, Object.assign(Object.assign({}, extras), { record: record ? record : null }));
274
276
  });
275
277
  }
276
278
  delete(req, res) {
@@ -22,6 +22,12 @@ interface ICrudOperations {
22
22
  create?: {
23
23
  before: (params: any, currentUser: Document) => any;
24
24
  };
25
+ show?: {
26
+ after: (record: Document) => Promise<{
27
+ record: Document;
28
+ [key: string]: any;
29
+ }>;
30
+ };
25
31
  }
26
32
  export interface ActionData {
27
33
  record: any;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "identity-admin",
3
- "version": "1.4.4",
3
+ "version": "1.5.0",
4
4
  "description": "",
5
5
  "main": "lib/Dashboard.js",
6
6
  "types": "lib/Dashbord.d.ts",