identity-admin 1.4.3 → 1.4.4
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.
|
@@ -266,7 +266,7 @@ let DashboardController = DashboardController_1 = class DashboardController {
|
|
|
266
266
|
}
|
|
267
267
|
record = record.toObject();
|
|
268
268
|
//record = await this.getExtras(record._id.toString(), record, this.getExtraRepository())
|
|
269
|
-
record = yield ResourceHelper_1.default.addExtraFields(modifiedResource.showProperties, modifiedResource.properties.model, record, StringUtils_1.default.lowerCaseFirstLetter(modifiedResource.properties.modelName));
|
|
269
|
+
record = yield ResourceHelper_1.default.addExtraFields(modifiedResource.showProperties, modifiedResource.properties.model, record, StringUtils_1.default.lowerCaseFirstLetter(modifiedResource.properties.modelName), resource);
|
|
270
270
|
return ResponseUtils_1.default.ok(res, {
|
|
271
271
|
record: record ? record : null,
|
|
272
272
|
// options: modifiedResource
|
|
@@ -10,7 +10,7 @@ export default class ResourcesHelper {
|
|
|
10
10
|
scopes: {};
|
|
11
11
|
searchBar: {};
|
|
12
12
|
};
|
|
13
|
-
static addExtraFields(showProperties: any, model: any, record: any, filterBy: string): Promise<any>;
|
|
13
|
+
static addExtraFields(showProperties: any, model: any, record: any, filterBy: string, resource: IResourceFile): Promise<any>;
|
|
14
14
|
static getTitle(schema: any): "title" | "name" | "_id" | "email";
|
|
15
15
|
static exchangeFirstFieldWithTitle(arrayOfFields: any, title: string): any;
|
|
16
16
|
static addVirtualFields(arrayOfFields: string[], model: any): any[];
|
|
@@ -123,7 +123,7 @@ class ResourcesHelper {
|
|
|
123
123
|
}
|
|
124
124
|
return filterObject;
|
|
125
125
|
}
|
|
126
|
-
static addExtraFields(showProperties, model, record, filterBy) {
|
|
126
|
+
static addExtraFields(showProperties, model, record, filterBy, resource) {
|
|
127
127
|
return __awaiter(this, void 0, void 0, function* () {
|
|
128
128
|
for (var i = 0; i < showProperties.length; i++) {
|
|
129
129
|
// if (!model.hasOwnProperty(showProperties[i].key)) {
|
|
@@ -139,8 +139,19 @@ class ResourcesHelper {
|
|
|
139
139
|
// }
|
|
140
140
|
const key = showProperties[i].key;
|
|
141
141
|
if ((model[key].type === 'ref' && model.virtuals && model.virtuals[key]) || (model[key].type === 'Array' && model.virtuals && model.virtuals[key] && model[key].arrayType === 'ref')) {
|
|
142
|
-
const resourceModel =
|
|
143
|
-
|
|
142
|
+
const resourceModel = resource.properties.model;
|
|
143
|
+
if (!resourceModel) {
|
|
144
|
+
return;
|
|
145
|
+
}
|
|
146
|
+
const virtuals = resourceModel.virtuals;
|
|
147
|
+
if (!virtuals) {
|
|
148
|
+
return;
|
|
149
|
+
}
|
|
150
|
+
const virtualModel = virtuals[key].resource;
|
|
151
|
+
if (!virtualModel) {
|
|
152
|
+
return;
|
|
153
|
+
}
|
|
154
|
+
const repository = new Repository_1.default(virtualModel);
|
|
144
155
|
filterBy = filterBy + "Id";
|
|
145
156
|
const filterQuery = {};
|
|
146
157
|
filterQuery[filterBy] = record._id;
|