rez_core 5.0.199 → 5.0.200
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.
- package/dist/module/enterprise/repository/school.repository.js +8 -8
- package/dist/module/enterprise/repository/school.repository.js.map +1 -1
- package/dist/module/filter/service/filter.service.js +28 -29
- package/dist/module/filter/service/filter.service.js.map +1 -1
- package/dist/module/meta/service/resolver.service.js +20 -10
- package/dist/module/meta/service/resolver.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/enterprise/repository/school.repository.ts +16 -33
- package/src/module/filter/service/filter.service.ts +65 -99
- package/src/module/meta/service/resolver.service.ts +54 -31
- package/.idea/250218_nodejs_core.iml +0 -12
- package/.idea/codeStyles/Project.xml +0 -59
- package/.idea/codeStyles/codeStyleConfig.xml +0 -5
- package/.idea/inspectionProfiles/Project_Default.xml +0 -6
- package/.idea/modules.xml +0 -8
- package/.idea/prettier.xml +0 -6
- package/.idea/vcs.xml +0 -6
package/package.json
CHANGED
|
@@ -4,7 +4,8 @@ import { ReflectionHelper } from '../../../utils/service/reflection-helper.servi
|
|
|
4
4
|
|
|
5
5
|
@Injectable()
|
|
6
6
|
export class SchoolRepository {
|
|
7
|
-
constructor(private readonly reflectionHelper: ReflectionHelper) {
|
|
7
|
+
constructor(private readonly reflectionHelper: ReflectionHelper) {
|
|
8
|
+
}
|
|
8
9
|
|
|
9
10
|
async findAllByOrgId(orgId: number): Promise<any[]> {
|
|
10
11
|
const schoolRepo = this.reflectionHelper.getRepoService('SSOSchool');
|
|
@@ -25,12 +26,11 @@ export class SchoolRepository {
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
async getUserContextDropdown(userId: number, appCode: string, org_id) {
|
|
28
|
-
const userRoleRepo =
|
|
29
|
-
this.reflectionHelper.getRepoService('UserRoleMapping');
|
|
29
|
+
const userRoleRepo = this.reflectionHelper.getRepoService('UserRoleMapping');
|
|
30
30
|
|
|
31
31
|
const hasOrgAccess = await userRoleRepo
|
|
32
32
|
.createQueryBuilder('urm')
|
|
33
|
-
.where('urm.user_id
|
|
33
|
+
.where('urm.user_id = :userId', { userId })
|
|
34
34
|
.andWhere('urm.appcode = :appCode', { appCode })
|
|
35
35
|
.andWhere('urm.level_type = :levelType', { levelType: 'ORG' })
|
|
36
36
|
.getRawMany();
|
|
@@ -40,8 +40,7 @@ export class SchoolRepository {
|
|
|
40
40
|
currentORGLevel_id = org_id;
|
|
41
41
|
}
|
|
42
42
|
|
|
43
|
-
const listMasterItemsRepo =
|
|
44
|
-
this.reflectionHelper.getRepoService('ListMasterItems');
|
|
43
|
+
const listMasterItemsRepo = this.reflectionHelper.getRepoService('ListMasterItems');
|
|
45
44
|
const resolvedInactiveStatus = await listMasterItemsRepo.findOne({
|
|
46
45
|
where: {
|
|
47
46
|
code: STATUS_INACTIVE,
|
|
@@ -50,8 +49,7 @@ export class SchoolRepository {
|
|
|
50
49
|
});
|
|
51
50
|
|
|
52
51
|
if (hasOrgAccess.length > 0) {
|
|
53
|
-
const organizationRepo =
|
|
54
|
-
this.reflectionHelper.getRepoService('OrganizationData');
|
|
52
|
+
const organizationRepo = this.reflectionHelper.getRepoService('OrganizationData');
|
|
55
53
|
|
|
56
54
|
const schools = await organizationRepo
|
|
57
55
|
.createQueryBuilder('org')
|
|
@@ -74,7 +72,7 @@ export class SchoolRepository {
|
|
|
74
72
|
.innerJoin(
|
|
75
73
|
'sso_organization',
|
|
76
74
|
'brn',
|
|
77
|
-
|
|
75
|
+
'brn.type = \'BRN\' AND brn.parent_id::varchar = org.id::varchar',
|
|
78
76
|
)
|
|
79
77
|
// JOIN school table
|
|
80
78
|
.innerJoin(
|
|
@@ -163,6 +161,7 @@ export class SchoolRepository {
|
|
|
163
161
|
brands: Object.values(org.brands),
|
|
164
162
|
}));
|
|
165
163
|
} else {
|
|
164
|
+
|
|
166
165
|
const orgResult = await organizationRepo.findOne({
|
|
167
166
|
where: {
|
|
168
167
|
id: currentORGLevel_id,
|
|
@@ -181,8 +180,8 @@ export class SchoolRepository {
|
|
|
181
180
|
];
|
|
182
181
|
}
|
|
183
182
|
} else {
|
|
184
|
-
|
|
185
|
-
|
|
183
|
+
|
|
184
|
+
const userRoleMappingRepo = this.reflectionHelper.getRepoService('UserRoleMapping');
|
|
186
185
|
|
|
187
186
|
const brnMappings = await userRoleMappingRepo
|
|
188
187
|
.createQueryBuilder('urm')
|
|
@@ -196,17 +195,9 @@ export class SchoolRepository {
|
|
|
196
195
|
'school.location AS school_location',
|
|
197
196
|
'school.status AS school_status',
|
|
198
197
|
])
|
|
199
|
-
.innerJoin(
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
'brand.id::text = urm.level_id::text',
|
|
203
|
-
)
|
|
204
|
-
.innerJoin(
|
|
205
|
-
'sso_school',
|
|
206
|
-
'school',
|
|
207
|
-
'school.brand_id::text = brand.id::text',
|
|
208
|
-
)
|
|
209
|
-
.where('urm.user_id::text = :userId', { userId: String(userId) })
|
|
198
|
+
.innerJoin('sso_organization', 'brand', 'brand.id = urm.level_id')
|
|
199
|
+
.innerJoin('sso_school', 'school', 'school.brand_id = brand.id')
|
|
200
|
+
.where('urm.user_id = :userId', { userId })
|
|
210
201
|
.andWhere('urm.appcode = :appCode', { appCode })
|
|
211
202
|
.andWhere('urm.level_type = :levelType', { levelType: 'BRN' })
|
|
212
203
|
.distinct(true)
|
|
@@ -224,17 +215,9 @@ export class SchoolRepository {
|
|
|
224
215
|
'school.location AS school_location',
|
|
225
216
|
'school.status AS school_status',
|
|
226
217
|
])
|
|
227
|
-
.innerJoin(
|
|
228
|
-
|
|
229
|
-
|
|
230
|
-
'school.id::text = urm.level_id::text',
|
|
231
|
-
)
|
|
232
|
-
.innerJoin(
|
|
233
|
-
'sso_organization',
|
|
234
|
-
'brand',
|
|
235
|
-
'brand.id::text = school.brand_id::text',
|
|
236
|
-
)
|
|
237
|
-
.where('urm.user_id::text = :userId', { userId: String(userId) })
|
|
218
|
+
.innerJoin('sso_school', 'school', 'school.id = urm.level_id')
|
|
219
|
+
.innerJoin('sso_organization', 'brand', 'brand.id = school.brand_id')
|
|
220
|
+
.where('urm.user_id = :userId', { userId })
|
|
238
221
|
.andWhere('urm.appcode = :appCode', { appCode })
|
|
239
222
|
.andWhere('urm.level_type = :levelType', { levelType: 'SCH' })
|
|
240
223
|
.distinct(true)
|
|
@@ -26,7 +26,8 @@ export class FilterService {
|
|
|
26
26
|
@Inject() protected readonly loggingService: LoggingService,
|
|
27
27
|
private readonly configService: ConfigService,
|
|
28
28
|
private readonly reflectionHelper: ReflectionHelper,
|
|
29
|
-
) {
|
|
29
|
+
) {
|
|
30
|
+
}
|
|
30
31
|
|
|
31
32
|
schema = this.configService.get('DB_SCHEMA');
|
|
32
33
|
|
|
@@ -81,6 +82,7 @@ export class FilterService {
|
|
|
81
82
|
GROUP BY ${column}
|
|
82
83
|
`;
|
|
83
84
|
|
|
85
|
+
|
|
84
86
|
const rows = await this.entityManager.query(rawSQL, values);
|
|
85
87
|
|
|
86
88
|
const total = rows.reduce(
|
|
@@ -282,6 +284,7 @@ export class FilterService {
|
|
|
282
284
|
|
|
283
285
|
// Handle TEMPLATE entity special condition
|
|
284
286
|
if (entity_type === 'TEMP' || entity_type === 'TEM') {
|
|
287
|
+
|
|
285
288
|
if (level_type === 'ORG') {
|
|
286
289
|
baseWhere.push({
|
|
287
290
|
query: ` ((e.level_type = 'ORG' AND e.level_id = '${loggedInUser.enterprise_id}'))`,
|
|
@@ -322,7 +325,8 @@ export class FilterService {
|
|
|
322
325
|
!customLevelId
|
|
323
326
|
) {
|
|
324
327
|
baseWhere.push({
|
|
325
|
-
query:
|
|
328
|
+
query:
|
|
329
|
+
'e.level_type = :level_type AND e.level_id = :level_id',
|
|
326
330
|
params: {
|
|
327
331
|
level_type,
|
|
328
332
|
level_id,
|
|
@@ -899,39 +903,28 @@ export class FilterService {
|
|
|
899
903
|
// convert to number when needed
|
|
900
904
|
const numVal = Number(val);
|
|
901
905
|
|
|
902
|
-
//
|
|
903
|
-
|
|
904
|
-
// let count = 0;
|
|
905
|
-
|
|
906
|
-
// while (count < days) {
|
|
907
|
-
// d.setDate(d.getDate() - 1);
|
|
908
|
-
|
|
909
|
-
// const day = d.getDay(); // 0 = Sunday, 6 = Saturday
|
|
910
|
-
|
|
911
|
-
// if (day !== 0 && day !== 6) {
|
|
912
|
-
// count++;
|
|
913
|
-
// }
|
|
914
|
-
// }
|
|
915
|
-
|
|
916
|
-
// return d.toISOString().split('T')[0];
|
|
917
|
-
// };
|
|
918
|
-
|
|
919
|
-
const moveBusinessDays = (offset: number): string => {
|
|
906
|
+
// INSIDE buildDateCondition
|
|
907
|
+
const subtractBusinessDays = (days: number): string => {
|
|
920
908
|
let d = new Date();
|
|
921
|
-
const abs = Math.abs(offset);
|
|
922
909
|
let count = 0;
|
|
923
910
|
|
|
924
|
-
while (count <
|
|
925
|
-
d.setDate(d.getDate()
|
|
926
|
-
|
|
927
|
-
|
|
911
|
+
while (count < days) {
|
|
912
|
+
d.setDate(d.getDate() - 1);
|
|
913
|
+
|
|
914
|
+
const day = d.getDay(); // 0 = Sunday, 6 = Saturday
|
|
915
|
+
|
|
916
|
+
if (day !== 0 && day !== 6) {
|
|
917
|
+
count++;
|
|
918
|
+
}
|
|
928
919
|
}
|
|
929
920
|
|
|
930
921
|
return d.toISOString().split('T')[0];
|
|
931
922
|
};
|
|
932
923
|
|
|
933
924
|
switch (op) {
|
|
925
|
+
// ============================================
|
|
934
926
|
// BASIC COMPARISONS
|
|
927
|
+
// ============================================
|
|
935
928
|
case 'equal':
|
|
936
929
|
case 'is':
|
|
937
930
|
return {
|
|
@@ -965,11 +958,13 @@ export class FilterService {
|
|
|
965
958
|
params: { [key]: val },
|
|
966
959
|
};
|
|
967
960
|
|
|
961
|
+
// ============================================
|
|
968
962
|
// EMPTY / NOT EMPTY
|
|
963
|
+
// ============================================
|
|
969
964
|
case 'empty':
|
|
970
965
|
return {
|
|
971
966
|
query: `e.${attr} IS NULL`,
|
|
972
|
-
params: {
|
|
967
|
+
params: {},
|
|
973
968
|
};
|
|
974
969
|
|
|
975
970
|
case 'not_empty':
|
|
@@ -978,11 +973,10 @@ export class FilterService {
|
|
|
978
973
|
params: {},
|
|
979
974
|
};
|
|
980
975
|
|
|
981
|
-
//
|
|
982
|
-
//
|
|
983
|
-
//
|
|
984
|
-
|
|
985
|
-
case 'is_day_before': {
|
|
976
|
+
// ============================================
|
|
977
|
+
// DAY OFFSET LOGIC (ALWAYS ADJUST -1 DAY)
|
|
978
|
+
// ============================================
|
|
979
|
+
case 'is_day_before':
|
|
986
980
|
if (isNaN(numVal)) {
|
|
987
981
|
throw new BadRequestException(
|
|
988
982
|
'Value must be a number for is_day_before',
|
|
@@ -991,25 +985,18 @@ export class FilterService {
|
|
|
991
985
|
|
|
992
986
|
const dayBefore = (() => {
|
|
993
987
|
const d = new Date();
|
|
988
|
+
d.setDate(d.getDate() - numVal);
|
|
994
989
|
|
|
995
|
-
|
|
996
|
-
|
|
997
|
-
d.setDate(d.getDate() + numVal);
|
|
998
|
-
} else {
|
|
999
|
-
// negative → go backward
|
|
1000
|
-
d.setDate(d.getDate() - Math.abs(numVal));
|
|
1001
|
-
}
|
|
1002
|
-
|
|
1003
|
-
return d.toISOString().split('T')[0];
|
|
990
|
+
// Format as YYYY-MM-DD in IST
|
|
991
|
+
return d.toLocaleDateString('en-CA', { timeZone: 'Asia/Kolkata' });
|
|
1004
992
|
})();
|
|
1005
993
|
|
|
1006
994
|
return {
|
|
1007
|
-
query: `${dateColumn}
|
|
995
|
+
query: `${dateColumn} <= :${key}`,
|
|
1008
996
|
params: { [key]: dayBefore },
|
|
1009
997
|
};
|
|
1010
|
-
}
|
|
1011
998
|
|
|
1012
|
-
case 'is_day_after':
|
|
999
|
+
case 'is_day_after':
|
|
1013
1000
|
if (isNaN(numVal)) {
|
|
1014
1001
|
throw new BadRequestException(
|
|
1015
1002
|
'Value must be a number for is_day_after',
|
|
@@ -1018,15 +1005,7 @@ export class FilterService {
|
|
|
1018
1005
|
|
|
1019
1006
|
const dayAfter = (() => {
|
|
1020
1007
|
const d = new Date();
|
|
1021
|
-
|
|
1022
|
-
if (numVal >= 0) {
|
|
1023
|
-
// positive → go forward
|
|
1024
|
-
d.setDate(d.getDate() + numVal);
|
|
1025
|
-
} else {
|
|
1026
|
-
// negative → go backward
|
|
1027
|
-
d.setDate(d.getDate() - Math.abs(numVal));
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1008
|
+
d.setDate(d.getDate() - 1 + numVal); // -1 because DB stores previous day
|
|
1030
1009
|
return d.toISOString().split('T')[0];
|
|
1031
1010
|
})();
|
|
1032
1011
|
|
|
@@ -1034,9 +1013,10 @@ export class FilterService {
|
|
|
1034
1013
|
query: `${dateColumn} > :${key}`,
|
|
1035
1014
|
params: { [key]: dayAfter },
|
|
1036
1015
|
};
|
|
1037
|
-
}
|
|
1038
1016
|
|
|
1017
|
+
// ============================================
|
|
1039
1018
|
// MONTH OFFSET LOGIC
|
|
1019
|
+
// ============================================
|
|
1040
1020
|
case 'is_month_before':
|
|
1041
1021
|
if (isNaN(numVal)) {
|
|
1042
1022
|
throw new BadRequestException(
|
|
@@ -1077,7 +1057,7 @@ export class FilterService {
|
|
|
1077
1057
|
params: { [key]: monthAfter },
|
|
1078
1058
|
};
|
|
1079
1059
|
|
|
1080
|
-
//
|
|
1060
|
+
// ===== BETWEEN =====
|
|
1081
1061
|
case 'between': {
|
|
1082
1062
|
if (typeof val === 'string') {
|
|
1083
1063
|
val = val.split(',').map((v) => v.trim());
|
|
@@ -1102,7 +1082,7 @@ export class FilterService {
|
|
|
1102
1082
|
};
|
|
1103
1083
|
}
|
|
1104
1084
|
|
|
1105
|
-
// TODAY
|
|
1085
|
+
// ===== TODAY =====
|
|
1106
1086
|
case 'today': {
|
|
1107
1087
|
const today = moment().format('YYYY-MM-DD');
|
|
1108
1088
|
return {
|
|
@@ -1111,72 +1091,56 @@ export class FilterService {
|
|
|
1111
1091
|
};
|
|
1112
1092
|
}
|
|
1113
1093
|
|
|
1094
|
+
// ============================================
|
|
1095
|
+
// BUSINESS DAY OFFSET LOGIC (SKIPS WEEKENDS)
|
|
1096
|
+
// ALWAYS ADJUST -1 DAY FOR DB SHIFT
|
|
1097
|
+
// ============================================
|
|
1098
|
+
|
|
1114
1099
|
case 'is_before_business_days': {
|
|
1115
1100
|
if (isNaN(numVal)) {
|
|
1116
1101
|
throw new BadRequestException('Value must be a number');
|
|
1117
1102
|
}
|
|
1118
1103
|
|
|
1119
|
-
const targetDate =
|
|
1104
|
+
const targetDate = subtractBusinessDays(numVal);
|
|
1120
1105
|
|
|
1121
1106
|
return {
|
|
1122
|
-
query: `${dateColumn}
|
|
1107
|
+
query: `${dateColumn} <= :${key} AND EXTRACT(DOW FROM ${dateColumn}) NOT IN (0, 6)`,
|
|
1123
1108
|
params: { [key]: targetDate },
|
|
1124
1109
|
};
|
|
1125
1110
|
}
|
|
1126
1111
|
|
|
1127
1112
|
case 'is_after_business_days': {
|
|
1128
1113
|
if (isNaN(numVal)) {
|
|
1129
|
-
throw new BadRequestException(
|
|
1114
|
+
throw new BadRequestException(
|
|
1115
|
+
'Value must be a number for is_after_business_days',
|
|
1116
|
+
);
|
|
1130
1117
|
}
|
|
1131
1118
|
|
|
1132
|
-
const
|
|
1119
|
+
const businessAfter = (() => {
|
|
1120
|
+
let d = new Date();
|
|
1121
|
+
let count = 0;
|
|
1122
|
+
|
|
1123
|
+
while (count < numVal) {
|
|
1124
|
+
d.setDate(d.getDate() + 1);
|
|
1125
|
+
const day = d.getDay(); // 0=Sun, 6=Sat
|
|
1126
|
+
if (day !== 0 && day !== 6) count++;
|
|
1127
|
+
}
|
|
1128
|
+
|
|
1129
|
+
// DB shift -1 day
|
|
1130
|
+
d.setDate(d.getDate() - 1);
|
|
1131
|
+
|
|
1132
|
+
return d.toISOString().split('T')[0];
|
|
1133
|
+
})();
|
|
1133
1134
|
|
|
1134
1135
|
return {
|
|
1135
1136
|
query: `${dateColumn} > :${key}`,
|
|
1136
|
-
params: { [key]:
|
|
1137
|
+
params: { [key]: businessAfter },
|
|
1137
1138
|
};
|
|
1138
1139
|
}
|
|
1139
1140
|
|
|
1140
|
-
//
|
|
1141
|
-
// if (isNaN(numVal)) {
|
|
1142
|
-
// throw new BadRequestException('Value must be a number');
|
|
1143
|
-
// }
|
|
1144
|
-
|
|
1145
|
-
// const targetDate = subtractBusinessDays(numVal);
|
|
1146
|
-
|
|
1147
|
-
// return {
|
|
1148
|
-
// query: `${dateColumn} < :${key} AND EXTRACT(DOW FROM ${dateColumn}) NOT IN (0, 6)`,
|
|
1149
|
-
// params: { [key]: targetDate },
|
|
1150
|
-
// };
|
|
1151
|
-
// }
|
|
1152
|
-
|
|
1153
|
-
// case 'is_after_business_days': {
|
|
1154
|
-
// if (isNaN(numVal)) {
|
|
1155
|
-
// throw new BadRequestException(
|
|
1156
|
-
// 'Value must be a number for is_after_business_days',
|
|
1157
|
-
// );
|
|
1158
|
-
// }
|
|
1159
|
-
|
|
1160
|
-
// const businessAfter = (() => {
|
|
1161
|
-
// let d = new Date();
|
|
1162
|
-
// let count = 0;
|
|
1163
|
-
|
|
1164
|
-
// while (count < numVal) {
|
|
1165
|
-
// d.setDate(d.getDate() + 1);
|
|
1166
|
-
// const day = d.getDay(); // 0=Sun, 6=Sat
|
|
1167
|
-
// if (day !== 0 && day !== 6) count++;
|
|
1168
|
-
// }
|
|
1169
|
-
|
|
1170
|
-
// return d.toISOString().split('T')[0];
|
|
1171
|
-
// })();
|
|
1172
|
-
|
|
1173
|
-
// return {
|
|
1174
|
-
// query: `${dateColumn} > :${key}`,
|
|
1175
|
-
// params: { [key]: businessAfter },
|
|
1176
|
-
// };
|
|
1177
|
-
// }
|
|
1178
|
-
|
|
1141
|
+
// ============================================
|
|
1179
1142
|
// IN LAST DAY (range: today to N days before)
|
|
1143
|
+
// ============================================
|
|
1180
1144
|
case 'in_last_day': {
|
|
1181
1145
|
if (isNaN(numVal)) {
|
|
1182
1146
|
throw new BadRequestException(
|
|
@@ -1204,7 +1168,9 @@ export class FilterService {
|
|
|
1204
1168
|
};
|
|
1205
1169
|
}
|
|
1206
1170
|
|
|
1171
|
+
// ============================================
|
|
1207
1172
|
// IN NEXT DAY (range: today to N days after)
|
|
1173
|
+
// ============================================
|
|
1208
1174
|
case 'in_next_day': {
|
|
1209
1175
|
if (isNaN(numVal)) {
|
|
1210
1176
|
throw new BadRequestException(
|
|
@@ -20,8 +20,7 @@ export class ResolverService {
|
|
|
20
20
|
private readonly reflectionHelper: ReflectionHelper,
|
|
21
21
|
private readonly entityMasterRepo: EntityMasterRepository,
|
|
22
22
|
private readonly entityManger: EntityManager,
|
|
23
|
-
) {
|
|
24
|
-
}
|
|
23
|
+
) {}
|
|
25
24
|
|
|
26
25
|
private async getMediaDataService() {
|
|
27
26
|
if (!this.mediaDataService) {
|
|
@@ -78,18 +77,32 @@ export class ResolverService {
|
|
|
78
77
|
}
|
|
79
78
|
resolvedEntityData[field] = resolvedValues;
|
|
80
79
|
} else {
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
80
|
+
// if we r resolving a ListMaster then we get the name of the item from ListMasterItems table directly
|
|
81
|
+
if (attr.data_source_type === 'master') {
|
|
82
|
+
const listMasterItemsRepo =
|
|
83
|
+
this.reflectionHelper.getRepoService('ListMasterItems');
|
|
84
|
+
const item = await listMasterItemsRepo.findOne({
|
|
85
|
+
where: {
|
|
86
|
+
id: Number(codeValue),
|
|
87
|
+
},
|
|
88
|
+
select: ['name'],
|
|
89
|
+
});
|
|
90
|
+
resolvedEntityData[field] = item?.name ?? codeValue;
|
|
91
|
+
} else {
|
|
92
|
+
// ENTITY handling here
|
|
93
|
+
const options = await this.listMasterService.getDropdownOptions(
|
|
94
|
+
type,
|
|
95
|
+
params,
|
|
96
|
+
undefined,
|
|
97
|
+
loggedInUser,
|
|
98
|
+
);
|
|
99
|
+
const item = options.find(
|
|
100
|
+
(opt) => opt.value == codeValue || opt.code == codeValue,
|
|
101
|
+
);
|
|
102
|
+
resolvedEntityData[field] = Array.isArray(item)
|
|
103
|
+
? (item?.[attr.data_source_attribute] ?? codeValue)
|
|
104
|
+
: (item?.label ?? codeValue);
|
|
105
|
+
}
|
|
93
106
|
}
|
|
94
107
|
}
|
|
95
108
|
|
|
@@ -140,12 +153,20 @@ export class ResolverService {
|
|
|
140
153
|
}
|
|
141
154
|
|
|
142
155
|
// fetch attribute meta only for the given attributeKey
|
|
143
|
-
const attr =
|
|
156
|
+
const attr =
|
|
157
|
+
await this.attributeMasterRepo.findByMappedEntityTypeAndAttributeKeyAndOrganizationId(
|
|
158
|
+
entityType,
|
|
159
|
+
attrKey,
|
|
160
|
+
loggedInUser.enterprise_id,
|
|
161
|
+
);
|
|
144
162
|
if (!attr) return rawValue;
|
|
145
163
|
|
|
146
164
|
// -------- ENTITY data_source_type --------
|
|
147
165
|
if (attr.data_source_type === 'entity') {
|
|
148
|
-
const entityDef = await this.entityMasterRepo.getEntityByMappedEntityType(
|
|
166
|
+
const entityDef = await this.entityMasterRepo.getEntityByMappedEntityType(
|
|
167
|
+
attr.datasource_list,
|
|
168
|
+
loggedInUser.enterprise_id,
|
|
169
|
+
);
|
|
149
170
|
|
|
150
171
|
if (!entityDef) return rawValue;
|
|
151
172
|
|
|
@@ -161,13 +182,8 @@ export class ResolverService {
|
|
|
161
182
|
WHERE code = $1`
|
|
162
183
|
: `SELECT *
|
|
163
184
|
FROM ${tableName}
|
|
164
|
-
WHERE id = $1
|
|
165
|
-
;
|
|
166
|
-
|
|
167
|
-
const params =
|
|
168
|
-
tableName === 'sso_organization'
|
|
169
|
-
? [value]
|
|
170
|
-
: [value];
|
|
185
|
+
WHERE id = $1`;
|
|
186
|
+
const params = tableName === 'sso_organization' ? [value] : [value];
|
|
171
187
|
|
|
172
188
|
const [item] = await this.entityManger.query(query, params);
|
|
173
189
|
resolvedValues.push(item?.[attr.data_source_attribute] ?? value);
|
|
@@ -176,9 +192,7 @@ export class ResolverService {
|
|
|
176
192
|
} else {
|
|
177
193
|
const query = `SELECT *
|
|
178
194
|
FROM ${tableName}
|
|
179
|
-
WHERE id = $1
|
|
180
|
-
;
|
|
181
|
-
|
|
195
|
+
WHERE id = $1`;
|
|
182
196
|
const params = [rawValue];
|
|
183
197
|
|
|
184
198
|
const [item] = await this.entityManger.query(query, params);
|
|
@@ -194,7 +208,7 @@ export class ResolverService {
|
|
|
194
208
|
for (const code of rawValue) {
|
|
195
209
|
let item = repo.findOne({
|
|
196
210
|
where: {
|
|
197
|
-
id: code
|
|
211
|
+
id: code,
|
|
198
212
|
},
|
|
199
213
|
});
|
|
200
214
|
resolvedValues.push(item?.[attr.data_source_attribute] ?? code);
|
|
@@ -204,7 +218,7 @@ export class ResolverService {
|
|
|
204
218
|
if (typeof rawValue !== 'number') return rawValue;
|
|
205
219
|
let item = await repo.findOne({
|
|
206
220
|
where: {
|
|
207
|
-
id: Number(rawValue)
|
|
221
|
+
id: Number(rawValue),
|
|
208
222
|
},
|
|
209
223
|
});
|
|
210
224
|
return item?.[attr.data_source_attribute] ?? rawValue;
|
|
@@ -229,13 +243,21 @@ export class ResolverService {
|
|
|
229
243
|
}
|
|
230
244
|
|
|
231
245
|
// fetch attribute meta
|
|
232
|
-
const attr =
|
|
246
|
+
const attr =
|
|
247
|
+
await this.attributeMasterRepo.findByMappedEntityTypeAndAttributeKeyAndOrganizationId(
|
|
248
|
+
entityType,
|
|
249
|
+
attrKey,
|
|
250
|
+
loggedInUser.enterprise_id,
|
|
251
|
+
);
|
|
233
252
|
|
|
234
253
|
if (!attr) return displayValue;
|
|
235
254
|
|
|
236
255
|
// -------- ENTITY data_source_type --------
|
|
237
256
|
if (attr.data_source_type === 'entity') {
|
|
238
|
-
const entityDef = await this.entityMasterRepo.getEntityByMappedEntityType(
|
|
257
|
+
const entityDef = await this.entityMasterRepo.getEntityByMappedEntityType(
|
|
258
|
+
attr.datasource_list,
|
|
259
|
+
loggedInUser.enterprise_id,
|
|
260
|
+
);
|
|
239
261
|
|
|
240
262
|
if (!entityDef) return displayValue;
|
|
241
263
|
|
|
@@ -262,7 +284,8 @@ export class ResolverService {
|
|
|
262
284
|
|
|
263
285
|
// -------- MASTER data_source_type --------
|
|
264
286
|
else if (attr.data_source_type === 'master') {
|
|
265
|
-
const listMasterItemsRepo =
|
|
287
|
+
const listMasterItemsRepo =
|
|
288
|
+
this.reflectionHelper.getRepoService('ListMasterItems');
|
|
266
289
|
|
|
267
290
|
const item = await listMasterItemsRepo.findOne({
|
|
268
291
|
where: {
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<module type="WEB_MODULE" version="4">
|
|
3
|
-
<component name="NewModuleRootManager">
|
|
4
|
-
<content url="file://$MODULE_DIR$">
|
|
5
|
-
<excludeFolder url="file://$MODULE_DIR$/.tmp" />
|
|
6
|
-
<excludeFolder url="file://$MODULE_DIR$/temp" />
|
|
7
|
-
<excludeFolder url="file://$MODULE_DIR$/tmp" />
|
|
8
|
-
</content>
|
|
9
|
-
<orderEntry type="inheritedJdk" />
|
|
10
|
-
<orderEntry type="sourceFolder" forTests="false" />
|
|
11
|
-
</component>
|
|
12
|
-
</module>
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
<component name="ProjectCodeStyleConfiguration">
|
|
2
|
-
<code_scheme name="Project" version="173">
|
|
3
|
-
<HTMLCodeStyleSettings>
|
|
4
|
-
<option name="HTML_SPACE_INSIDE_EMPTY_TAG" value="true" />
|
|
5
|
-
</HTMLCodeStyleSettings>
|
|
6
|
-
<JSCodeStyleSettings version="0">
|
|
7
|
-
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
8
|
-
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
9
|
-
<option name="USE_DOUBLE_QUOTES" value="false" />
|
|
10
|
-
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
11
|
-
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
|
12
|
-
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
13
|
-
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
14
|
-
</JSCodeStyleSettings>
|
|
15
|
-
<TypeScriptCodeStyleSettings version="0">
|
|
16
|
-
<option name="FORCE_SEMICOLON_STYLE" value="true" />
|
|
17
|
-
<option name="SPACE_BEFORE_FUNCTION_LEFT_PARENTH" value="false" />
|
|
18
|
-
<option name="USE_DOUBLE_QUOTES" value="false" />
|
|
19
|
-
<option name="FORCE_QUOTE_STYlE" value="true" />
|
|
20
|
-
<option name="ENFORCE_TRAILING_COMMA" value="WhenMultiline" />
|
|
21
|
-
<option name="SPACES_WITHIN_OBJECT_LITERAL_BRACES" value="true" />
|
|
22
|
-
<option name="SPACES_WITHIN_IMPORTS" value="true" />
|
|
23
|
-
</TypeScriptCodeStyleSettings>
|
|
24
|
-
<VueCodeStyleSettings>
|
|
25
|
-
<option name="INTERPOLATION_NEW_LINE_AFTER_START_DELIMITER" value="false" />
|
|
26
|
-
<option name="INTERPOLATION_NEW_LINE_BEFORE_END_DELIMITER" value="false" />
|
|
27
|
-
</VueCodeStyleSettings>
|
|
28
|
-
<codeStyleSettings language="HTML">
|
|
29
|
-
<option name="SOFT_MARGINS" value="80" />
|
|
30
|
-
<indentOptions>
|
|
31
|
-
<option name="INDENT_SIZE" value="2" />
|
|
32
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
33
|
-
<option name="TAB_SIZE" value="2" />
|
|
34
|
-
</indentOptions>
|
|
35
|
-
</codeStyleSettings>
|
|
36
|
-
<codeStyleSettings language="JavaScript">
|
|
37
|
-
<option name="SOFT_MARGINS" value="80" />
|
|
38
|
-
<indentOptions>
|
|
39
|
-
<option name="INDENT_SIZE" value="2" />
|
|
40
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
41
|
-
<option name="TAB_SIZE" value="2" />
|
|
42
|
-
</indentOptions>
|
|
43
|
-
</codeStyleSettings>
|
|
44
|
-
<codeStyleSettings language="TypeScript">
|
|
45
|
-
<option name="SOFT_MARGINS" value="80" />
|
|
46
|
-
<indentOptions>
|
|
47
|
-
<option name="INDENT_SIZE" value="2" />
|
|
48
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
49
|
-
<option name="TAB_SIZE" value="2" />
|
|
50
|
-
</indentOptions>
|
|
51
|
-
</codeStyleSettings>
|
|
52
|
-
<codeStyleSettings language="Vue">
|
|
53
|
-
<option name="SOFT_MARGINS" value="80" />
|
|
54
|
-
<indentOptions>
|
|
55
|
-
<option name="CONTINUATION_INDENT_SIZE" value="2" />
|
|
56
|
-
</indentOptions>
|
|
57
|
-
</codeStyleSettings>
|
|
58
|
-
</code_scheme>
|
|
59
|
-
</component>
|
package/.idea/modules.xml
DELETED
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
-
<project version="4">
|
|
3
|
-
<component name="ProjectModuleManager">
|
|
4
|
-
<modules>
|
|
5
|
-
<module fileurl="file://$PROJECT_DIR$/.idea/250218_nodejs_core.iml" filepath="$PROJECT_DIR$/.idea/250218_nodejs_core.iml" />
|
|
6
|
-
</modules>
|
|
7
|
-
</component>
|
|
8
|
-
</project>
|