rez_core 7.1.2 → 7.1.3
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/layout_preference/controller/layout_preference.controller.d.ts +0 -6
- package/dist/module/layout_preference/controller/layout_preference.controller.js +0 -16
- package/dist/module/layout_preference/controller/layout_preference.controller.js.map +1 -1
- package/dist/module/layout_preference/layout_preference.module.js +1 -1
- package/dist/module/layout_preference/layout_preference.module.js.map +1 -1
- package/dist/module/layout_preference/service/layout_preference.service.d.ts +0 -4
- package/dist/module/layout_preference/service/layout_preference.service.js +0 -67
- package/dist/module/layout_preference/service/layout_preference.service.js.map +1 -1
- package/dist/module/listmaster/controller/list-master.controller.d.ts +22 -7
- package/dist/module/listmaster/controller/list-master.controller.js +25 -11
- package/dist/module/listmaster/controller/list-master.controller.js.map +1 -1
- package/dist/module/listmaster/repository/list-master-items.repository.js +1 -1
- package/dist/module/listmaster/repository/list-master-items.repository.js.map +1 -1
- package/dist/module/listmaster/service/list-master.service.d.ts +10 -5
- package/dist/module/listmaster/service/list-master.service.js +56 -47
- package/dist/module/listmaster/service/list-master.service.js.map +1 -1
- package/dist/module/meta/entity.module.js +2 -0
- package/dist/module/meta/entity.module.js.map +1 -1
- package/dist/module/meta/service/entity-service-impl.service.d.ts +0 -2
- package/dist/module/meta/service/entity-service-impl.service.js +0 -5
- package/dist/module/meta/service/entity-service-impl.service.js.map +1 -1
- package/dist/module/meta/service/entity-table.service.d.ts +3 -8
- package/dist/module/meta/service/entity-table.service.js +54 -52
- package/dist/module/meta/service/entity-table.service.js.map +1 -1
- package/dist/table.config.d.ts +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/layout_preference/controller/layout_preference.controller.ts +17 -17
- package/src/module/layout_preference/layout_preference.module.ts +2 -2
- package/src/module/layout_preference/service/layout_preference.service.ts +101 -101
- package/src/module/listmaster/controller/list-master.controller.ts +35 -17
- package/src/module/listmaster/repository/list-master-items.repository.ts +2 -1
- package/src/module/listmaster/service/list-master.service.ts +84 -92
- package/src/module/meta/entity.module.ts +2 -0
- package/src/module/meta/service/entity-service-impl.service.ts +0 -4
- package/src/module/meta/service/entity-table.service.ts +101 -114
package/package.json
CHANGED
|
@@ -37,24 +37,24 @@ export class LayoutPreferenceController {
|
|
|
37
37
|
);
|
|
38
38
|
}
|
|
39
39
|
|
|
40
|
-
@Get('column')
|
|
41
|
-
@UseGuards(JwtAuthGuard)
|
|
42
|
-
@HttpCode(HttpStatus.OK)
|
|
43
|
-
async getColumnValues(
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
) {
|
|
49
|
-
|
|
40
|
+
// @Get('column')
|
|
41
|
+
// @UseGuards(JwtAuthGuard)
|
|
42
|
+
// @HttpCode(HttpStatus.OK)
|
|
43
|
+
// async getColumnValues(
|
|
44
|
+
// @Query('entity_type') entity_type: string,
|
|
45
|
+
// @Query('column') column: string,
|
|
46
|
+
// @Query('sort_by') sort_by: string,
|
|
47
|
+
// @Req() req: Request & { user: any },
|
|
48
|
+
// ) {
|
|
49
|
+
// const loggedInUser = req.user.userData;
|
|
50
50
|
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
}
|
|
51
|
+
// return this.layoutPreferenceService.getColumnValue(
|
|
52
|
+
// entity_type,
|
|
53
|
+
// column,
|
|
54
|
+
// sort_by,
|
|
55
|
+
// loggedInUser,
|
|
56
|
+
// );
|
|
57
|
+
// }
|
|
58
58
|
|
|
59
59
|
@Post('attributes')
|
|
60
60
|
@UseGuards(JwtAuthGuard)
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { Module } from '@nestjs/common';
|
|
1
|
+
import { forwardRef, Module } from '@nestjs/common';
|
|
2
2
|
import { LayoutPreferenceController } from './controller/layout_preference.controller';
|
|
3
3
|
import { LayoutPreferenceService } from './service/layout_preference.service';
|
|
4
4
|
import { EntityModule } from '../meta/entity.module';
|
|
@@ -9,7 +9,7 @@ import { AttributeMaster } from '../meta/entity/attribute-master.entity';
|
|
|
9
9
|
|
|
10
10
|
@Module({
|
|
11
11
|
imports: [
|
|
12
|
-
EntityModule,
|
|
12
|
+
forwardRef(() => EntityModule),
|
|
13
13
|
TypeOrmModule.forFeature([LayoutPreference, AttributeMaster]),
|
|
14
14
|
],
|
|
15
15
|
controllers: [LayoutPreferenceController],
|
|
@@ -75,107 +75,107 @@ export class LayoutPreferenceService extends EntityServiceImpl {
|
|
|
75
75
|
};
|
|
76
76
|
}
|
|
77
77
|
|
|
78
|
-
async getColumnValue(
|
|
79
|
-
|
|
80
|
-
|
|
81
|
-
|
|
82
|
-
|
|
83
|
-
): Promise<{ label: string; value: string }[]> {
|
|
84
|
-
|
|
85
|
-
|
|
86
|
-
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
110
|
-
|
|
111
|
-
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
117
|
-
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
|
|
137
|
-
|
|
138
|
-
|
|
139
|
-
|
|
140
|
-
|
|
141
|
-
|
|
142
|
-
|
|
143
|
-
|
|
144
|
-
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
158
|
-
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
164
|
-
|
|
165
|
-
|
|
166
|
-
|
|
167
|
-
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
174
|
-
|
|
175
|
-
|
|
176
|
-
|
|
177
|
-
|
|
178
|
-
}
|
|
78
|
+
// async getColumnValue(
|
|
79
|
+
// entity_type: string,
|
|
80
|
+
// column: string,
|
|
81
|
+
// sort_by: string,
|
|
82
|
+
// loggedInUser: UserData,
|
|
83
|
+
// ): Promise<{ label: string; value: string }[]> {
|
|
84
|
+
// try {
|
|
85
|
+
// const getTableMeta =
|
|
86
|
+
// await this.entityTableService.findByEntityTypeAndListTypeAndDisplayType(
|
|
87
|
+
// entity_type,
|
|
88
|
+
// entity_type,
|
|
89
|
+
// 'LIST',
|
|
90
|
+
// loggedInUser?.enterprise_id,
|
|
91
|
+
// );
|
|
92
|
+
|
|
93
|
+
// const tableName = getTableMeta?.data_source;
|
|
94
|
+
|
|
95
|
+
// if (!tableName) {
|
|
96
|
+
// throw new Error('Invalid or missing table name in metadata');
|
|
97
|
+
// }
|
|
98
|
+
|
|
99
|
+
// // Query DB to get distinct column values and counts
|
|
100
|
+
// const rawData: { column_value: string; count: number }[] =
|
|
101
|
+
// await this.dataSource
|
|
102
|
+
// .createQueryBuilder()
|
|
103
|
+
// .select(`${column} AS column_value`)
|
|
104
|
+
// .addSelect(`COUNT(*) AS count`)
|
|
105
|
+
// .from(tableName, tableName)
|
|
106
|
+
// .where(`${column} IS NOT NULL`)
|
|
107
|
+
// .andWhere(`enterprise_id = :enterprise_id`, {
|
|
108
|
+
// enterprise_id: loggedInUser?.enterprise_id,
|
|
109
|
+
// })
|
|
110
|
+
// .andWhere(`level_id = :levelId`, { levelId: loggedInUser?.level_id })
|
|
111
|
+
// .andWhere(`level_type = :levelType`, {
|
|
112
|
+
// levelType: loggedInUser?.level_type,
|
|
113
|
+
// })
|
|
114
|
+
// .groupBy(column)
|
|
115
|
+
// .getRawMany();
|
|
116
|
+
|
|
117
|
+
// if (!rawData.length) {
|
|
118
|
+
// return [];
|
|
119
|
+
// }
|
|
120
|
+
|
|
121
|
+
// // Prepare payload for resolver
|
|
122
|
+
// const payloadBeforeResolved = rawData.map((row) => ({
|
|
123
|
+
// [column]: row?.column_value,
|
|
124
|
+
// }));
|
|
125
|
+
|
|
126
|
+
// // Resolve column values using resolverService
|
|
127
|
+
// const resolvedEntityList = await Promise.all(
|
|
128
|
+
// payloadBeforeResolved.map((row) =>
|
|
129
|
+
// this.resolverService.getResolvedData(loggedInUser, row, entity_type),
|
|
130
|
+
// ),
|
|
131
|
+
// );
|
|
132
|
+
|
|
133
|
+
// // Merge resolved names with counts
|
|
134
|
+
// const resolvedWithCounts = rawData.map((row, index) => {
|
|
135
|
+
// const resolvedValue =
|
|
136
|
+
// resolvedEntityList[index]?.[column] || row.column_value;
|
|
137
|
+
// return {
|
|
138
|
+
// label: resolvedValue, // Human-readable label
|
|
139
|
+
// value: row.column_value, // Original DB value
|
|
140
|
+
// count: Number(row.count),
|
|
141
|
+
// };
|
|
142
|
+
// });
|
|
143
|
+
|
|
144
|
+
// // Sort based on sort_by parameter
|
|
145
|
+
// switch (sort_by) {
|
|
146
|
+
// case 'asc':
|
|
147
|
+
// resolvedWithCounts.sort((a, b) => a.label.localeCompare(b.label));
|
|
148
|
+
// break;
|
|
149
|
+
// case 'dsc':
|
|
150
|
+
// resolvedWithCounts.sort((a, b) => b.label.localeCompare(a.label));
|
|
151
|
+
// break;
|
|
152
|
+
// case 'count_asc':
|
|
153
|
+
// resolvedWithCounts.sort((a, b) => a.count - b.count);
|
|
154
|
+
// break;
|
|
155
|
+
// case 'count_dsc':
|
|
156
|
+
// resolvedWithCounts.sort((a, b) => b.count - a.count);
|
|
157
|
+
// break;
|
|
158
|
+
// default:
|
|
159
|
+
// break;
|
|
160
|
+
// }
|
|
161
|
+
|
|
162
|
+
// // Clean and return only label/value pairs
|
|
163
|
+
// return resolvedWithCounts
|
|
164
|
+
// .filter(
|
|
165
|
+
// (item) =>
|
|
166
|
+
// item.label !== null &&
|
|
167
|
+
// item.label !== undefined &&
|
|
168
|
+
// item.label.toString().trim() !== '',
|
|
169
|
+
// )
|
|
170
|
+
// .map((item) => ({
|
|
171
|
+
// label: item.label,
|
|
172
|
+
// value: item.value,
|
|
173
|
+
// }));
|
|
174
|
+
// } catch (error) {
|
|
175
|
+
// this.logger.error(`getColumnValue ERROR: ${error.message}`, error.stack);
|
|
176
|
+
// return [];
|
|
177
|
+
// }
|
|
178
|
+
// }
|
|
179
179
|
|
|
180
180
|
async getEntityLayoutAttributes(
|
|
181
181
|
entity_type: string,
|
|
@@ -17,6 +17,7 @@ import { ListMasterService } from '../service/list-master.service';
|
|
|
17
17
|
import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
18
18
|
import { ListMasterItemService } from '../service/list-master-item.service';
|
|
19
19
|
import { MessagePattern, Payload } from '@nestjs/microservices';
|
|
20
|
+
import { UserData } from '../../auth/dto/user.dto';
|
|
20
21
|
|
|
21
22
|
@Controller('list-master')
|
|
22
23
|
export class ListMasterController {
|
|
@@ -171,38 +172,55 @@ export class ListMasterController {
|
|
|
171
172
|
@Query('entity_type') entity_type: string,
|
|
172
173
|
@Query('attribute_key') attribute_key: string,
|
|
173
174
|
@Body() body: Record<string, string>,
|
|
175
|
+
@Query() queryParams: Record<string, string>,
|
|
174
176
|
@Request() req,
|
|
175
177
|
) {
|
|
176
|
-
|
|
177
178
|
const loggedInUser = req.user.userData;
|
|
178
|
-
const
|
|
179
|
-
|
|
179
|
+
const {
|
|
180
|
+
inactiveIds,
|
|
181
|
+
} = queryParams;
|
|
182
|
+
|
|
183
|
+
const inactiveIdsArray = inactiveIds
|
|
184
|
+
? inactiveIds.split(',').map((id) => parseInt(id, 10))
|
|
185
|
+
: [];
|
|
180
186
|
|
|
181
187
|
return await this.service.getDropDownData(
|
|
182
188
|
entity_type,
|
|
183
189
|
attribute_key,
|
|
184
190
|
loggedInUser,
|
|
185
|
-
body
|
|
191
|
+
body,
|
|
192
|
+
[],
|
|
193
|
+
inactiveIdsArray,
|
|
186
194
|
);
|
|
187
195
|
}
|
|
188
196
|
|
|
189
|
-
@MessagePattern('
|
|
190
|
-
async
|
|
197
|
+
@MessagePattern('getEntityDropdown')
|
|
198
|
+
async getEntityDropdownMS(
|
|
191
199
|
@Payload()
|
|
192
200
|
data: {
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
loggedInUser:
|
|
196
|
-
|
|
201
|
+
ds_entityType: string,
|
|
202
|
+
params: Record<string, any>,
|
|
203
|
+
loggedInUser: UserData,
|
|
204
|
+
values?: any[],
|
|
205
|
+
inactiveIds?: any[],
|
|
197
206
|
},
|
|
198
207
|
) {
|
|
199
|
-
const {
|
|
208
|
+
const { ds_entityType, params, loggedInUser, values, inactiveIds } = data;
|
|
209
|
+
return await this.service.fetchFromEntity(ds_entityType, params, loggedInUser, values, inactiveIds);
|
|
210
|
+
}
|
|
200
211
|
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
212
|
+
@MessagePattern('getListMasterDropdown')
|
|
213
|
+
async getListMasterDropdownMS(
|
|
214
|
+
@Payload()
|
|
215
|
+
data: {
|
|
216
|
+
type: string,
|
|
217
|
+
params: Record<string, any>,
|
|
218
|
+
loggedInUser: UserData,
|
|
219
|
+
values?: any[],
|
|
220
|
+
inactiveIds?: any[],
|
|
221
|
+
},
|
|
222
|
+
) {
|
|
223
|
+
const { type, params, loggedInUser, values, inactiveIds } = data;
|
|
224
|
+
return await this.service.fetchFromListMaster(type, params, loggedInUser, values, inactiveIds);
|
|
207
225
|
}
|
|
208
226
|
}
|
|
@@ -2,6 +2,7 @@ import { Injectable } from '@nestjs/common';
|
|
|
2
2
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
3
|
import { Repository, In, Raw, Or, And, FindOptionsWhere } from 'typeorm';
|
|
4
4
|
import { ListMasterItems } from '../entity/list-master-items.entity';
|
|
5
|
+
import { ListMasterData } from '../entity/list-master.entity';
|
|
5
6
|
|
|
6
7
|
@Injectable()
|
|
7
8
|
export class ListMasterItemsRepository {
|
|
@@ -43,7 +44,7 @@ export class ListMasterItemsRepository {
|
|
|
43
44
|
});
|
|
44
45
|
|
|
45
46
|
const itemsMapped = itemValues.map((i) => ({
|
|
46
|
-
label: `${i.name}
|
|
47
|
+
label: `${i.name}`,
|
|
47
48
|
value: String(i.code),
|
|
48
49
|
}));
|
|
49
50
|
|
|
@@ -10,6 +10,7 @@ import axios from 'axios';
|
|
|
10
10
|
import { ConfigService } from '@nestjs/config';
|
|
11
11
|
import { AttributeMasterService } from '../../meta/service/attribute-master.service';
|
|
12
12
|
import { IMicroserviceClients } from '../../microservice-client/service/microservice-clients';
|
|
13
|
+
import { firstValueFrom } from 'rxjs';
|
|
13
14
|
|
|
14
15
|
@Injectable()
|
|
15
16
|
export class ListMasterService extends EntityServiceImpl {
|
|
@@ -146,11 +147,12 @@ export class ListMasterService extends EntityServiceImpl {
|
|
|
146
147
|
}
|
|
147
148
|
}
|
|
148
149
|
|
|
149
|
-
|
|
150
|
+
public async fetchFromEntity(
|
|
150
151
|
sourceList: string,
|
|
151
152
|
params: Record<string, any>,
|
|
152
153
|
loggedInUser?: UserData,
|
|
153
154
|
values?: any[],
|
|
155
|
+
inactiveIds?: any[],
|
|
154
156
|
) {
|
|
155
157
|
|
|
156
158
|
let result: { label: string; value: number }[] = [];
|
|
@@ -201,8 +203,8 @@ export class ListMasterService extends EntityServiceImpl {
|
|
|
201
203
|
});
|
|
202
204
|
}
|
|
203
205
|
|
|
204
|
-
// ✅ New: Exclude customers for USR
|
|
205
|
-
if (sourceList === 'USR'
|
|
206
|
+
// ✅ New: Exclude customers for USR
|
|
207
|
+
if (sourceList === 'USR') {
|
|
206
208
|
qb.andWhere(`${tableName}.is_customer is NULL`);
|
|
207
209
|
}
|
|
208
210
|
|
|
@@ -230,6 +232,19 @@ export class ListMasterService extends EntityServiceImpl {
|
|
|
230
232
|
result.push({ label: r.name, value: r.id });
|
|
231
233
|
});
|
|
232
234
|
|
|
235
|
+
if (inactiveIds && inactiveIds.length > 0) {
|
|
236
|
+
const qb = this.entityManager
|
|
237
|
+
.createQueryBuilder()
|
|
238
|
+
.select('*')
|
|
239
|
+
.from(`${this.schema}.${tableName}`, tableName)
|
|
240
|
+
.where('id IN (:...inactiveIds)', { inactiveIds });
|
|
241
|
+
|
|
242
|
+
const inactiveQuery = await qb.getRawMany();
|
|
243
|
+
|
|
244
|
+
inactiveQuery.map((r) => {
|
|
245
|
+
result.push({ label: `${r.name} [INACTIVE]`, value: r.id });
|
|
246
|
+
});
|
|
247
|
+
}
|
|
233
248
|
return result;
|
|
234
249
|
}
|
|
235
250
|
|
|
@@ -300,6 +315,7 @@ export class ListMasterService extends EntityServiceImpl {
|
|
|
300
315
|
loggedInUser: UserData,
|
|
301
316
|
body: Record<string, any>,
|
|
302
317
|
values?: any[],
|
|
318
|
+
inactiveIdsArray?: any[],
|
|
303
319
|
) {
|
|
304
320
|
try {
|
|
305
321
|
// Extract inactiveIds from body
|
|
@@ -333,35 +349,17 @@ export class ListMasterService extends EntityServiceImpl {
|
|
|
333
349
|
);
|
|
334
350
|
}
|
|
335
351
|
|
|
336
|
-
|
|
337
|
-
|
|
338
|
-
|
|
339
|
-
|
|
340
|
-
|
|
341
|
-
|
|
342
|
-
|
|
352
|
+
return this.processDropdown(
|
|
353
|
+
ds_category,
|
|
354
|
+
ds_entitytype,
|
|
355
|
+
ds_appcode,
|
|
356
|
+
ds_filtercode,
|
|
357
|
+
params,
|
|
358
|
+
loggedInUser,
|
|
359
|
+
values,
|
|
360
|
+
inactiveIdsArray,
|
|
361
|
+
);
|
|
343
362
|
|
|
344
|
-
if (isSelfApp) {
|
|
345
|
-
// SELF APP - Process locally
|
|
346
|
-
return this.processLocalDropdown(
|
|
347
|
-
ds_category,
|
|
348
|
-
ds_entitytype,
|
|
349
|
-
ds_filtercode,
|
|
350
|
-
params,
|
|
351
|
-
loggedInUser,
|
|
352
|
-
values,
|
|
353
|
-
);
|
|
354
|
-
} else {
|
|
355
|
-
// CROSS APP - Forward to target microservice
|
|
356
|
-
return this.processCrossAppDropdown(
|
|
357
|
-
ds_appcode,
|
|
358
|
-
entity_type,
|
|
359
|
-
attribute_key,
|
|
360
|
-
loggedInUser,
|
|
361
|
-
body,
|
|
362
|
-
values,
|
|
363
|
-
);
|
|
364
|
-
}
|
|
365
363
|
} catch (error) {
|
|
366
364
|
console.error('❌ Error in getDropDownData:', error.message);
|
|
367
365
|
throw error;
|
|
@@ -371,40 +369,77 @@ export class ListMasterService extends EntityServiceImpl {
|
|
|
371
369
|
/**
|
|
372
370
|
* Process dropdown data locally (SELF APP)
|
|
373
371
|
*/
|
|
374
|
-
private async
|
|
372
|
+
private async processDropdown(
|
|
375
373
|
ds_category: string,
|
|
376
374
|
ds_entitytype: string,
|
|
377
375
|
ds_filtercode: string,
|
|
376
|
+
ds_appcode: string,
|
|
378
377
|
params: Record<string, any>,
|
|
379
378
|
loggedInUser: UserData,
|
|
380
379
|
values?: any[],
|
|
380
|
+
inactives?: any[],
|
|
381
381
|
) {
|
|
382
|
-
|
|
382
|
+
const currentAppCode = this.configService.get<string>('appcode');
|
|
383
|
+
|
|
384
|
+
// Determine if request is SELF or CROSS
|
|
385
|
+
const isSelfApp =
|
|
386
|
+
!ds_appcode ||
|
|
387
|
+
ds_appcode.toUpperCase() === 'SELF' ||
|
|
388
|
+
currentAppCode === ds_appcode;
|
|
389
|
+
|
|
390
|
+
const client = this.factory.getClient(ds_appcode);
|
|
391
|
+
|
|
392
|
+
// Helper: safely call microservice
|
|
393
|
+
const callClient = async (pattern: string, payload: any) => {
|
|
394
|
+
if (!client) return null;
|
|
395
|
+
return firstValueFrom(client.send(pattern, payload));
|
|
396
|
+
};
|
|
397
|
+
|
|
383
398
|
switch (ds_category.toUpperCase()) {
|
|
384
|
-
case '
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
390
|
-
|
|
399
|
+
case 'ENTITY': {
|
|
400
|
+
// Merge params + filter params
|
|
401
|
+
const mergedParams = {
|
|
402
|
+
...params,
|
|
403
|
+
...(ds_filtercode ? this.parseFilterCode(ds_filtercode) : {}),
|
|
404
|
+
};
|
|
405
|
+
|
|
406
|
+
if (isSelfApp) {
|
|
407
|
+
return this.fetchFromEntity(
|
|
408
|
+
ds_entitytype,
|
|
409
|
+
mergedParams,
|
|
410
|
+
loggedInUser,
|
|
411
|
+
values,
|
|
412
|
+
);
|
|
391
413
|
}
|
|
392
|
-
|
|
414
|
+
|
|
415
|
+
return callClient('getEntityDropdown', {
|
|
393
416
|
ds_entitytype,
|
|
394
417
|
mergedParams,
|
|
395
418
|
loggedInUser,
|
|
396
419
|
values,
|
|
397
|
-
);
|
|
420
|
+
});
|
|
421
|
+
}
|
|
398
422
|
|
|
399
|
-
case '
|
|
400
|
-
|
|
401
|
-
|
|
423
|
+
case 'LIST_MASTER': {
|
|
424
|
+
if (isSelfApp) {
|
|
425
|
+
return this.fetchFromListMaster(
|
|
426
|
+
ds_entitytype,
|
|
427
|
+
params,
|
|
428
|
+
loggedInUser,
|
|
429
|
+
values,
|
|
430
|
+
inactives,
|
|
431
|
+
);
|
|
432
|
+
}
|
|
433
|
+
|
|
434
|
+
return callClient('getListMasterDropdown', {
|
|
402
435
|
ds_entitytype,
|
|
403
436
|
ds_filtercode,
|
|
404
437
|
params,
|
|
405
438
|
loggedInUser,
|
|
406
439
|
values,
|
|
407
|
-
|
|
440
|
+
inactives,
|
|
441
|
+
});
|
|
442
|
+
}
|
|
408
443
|
|
|
409
444
|
case 'CAPI':
|
|
410
445
|
case 'CUSTOM_API':
|
|
@@ -443,12 +478,12 @@ export class ListMasterService extends EntityServiceImpl {
|
|
|
443
478
|
/**
|
|
444
479
|
* Fetch dropdown from List Master
|
|
445
480
|
*/
|
|
446
|
-
|
|
481
|
+
public async fetchFromListMaster(
|
|
447
482
|
lmCode: string,
|
|
448
|
-
filterCode: string,
|
|
449
483
|
params: Record<string, any>,
|
|
450
484
|
loggedInUser: UserData,
|
|
451
485
|
values?: any[],
|
|
486
|
+
inactives?: any[],
|
|
452
487
|
) {
|
|
453
488
|
try {
|
|
454
489
|
// Get List Master configuration
|
|
@@ -469,6 +504,7 @@ export class ListMasterService extends EntityServiceImpl {
|
|
|
469
504
|
loggedInUser.enterprise_id,
|
|
470
505
|
params,
|
|
471
506
|
values,
|
|
507
|
+
inactives,
|
|
472
508
|
);
|
|
473
509
|
} catch (error) {
|
|
474
510
|
console.error(`❌ Error fetching from List Master '${lmCode}':`, error.message);
|
|
@@ -644,50 +680,6 @@ export class ListMasterService extends EntityServiceImpl {
|
|
|
644
680
|
}));
|
|
645
681
|
}
|
|
646
682
|
|
|
647
|
-
/**
|
|
648
|
-
* Forward request to cross-app microservice (CROSS APP)
|
|
649
|
-
*/
|
|
650
|
-
private async processCrossAppDropdown(
|
|
651
|
-
targetAppCode: string,
|
|
652
|
-
entity_type: string,
|
|
653
|
-
attribute_key: string,
|
|
654
|
-
loggedInUser: UserData,
|
|
655
|
-
body: Record<string, any>,
|
|
656
|
-
values?: any[],
|
|
657
|
-
) {
|
|
658
|
-
try {
|
|
659
|
-
// Get microservice client for target app
|
|
660
|
-
const client = this.factory.getClient(targetAppCode);
|
|
661
|
-
|
|
662
|
-
if (!client) {
|
|
663
|
-
throw new BadRequestException(
|
|
664
|
-
`Microservice client for app '${targetAppCode}' not available`,
|
|
665
|
-
);
|
|
666
|
-
}
|
|
667
|
-
|
|
668
|
-
// Forward the request to target microservice
|
|
669
|
-
// The target microservice will execute the same process recursively
|
|
670
|
-
const response = await client
|
|
671
|
-
.send('getDropdownData', {
|
|
672
|
-
entity_type,
|
|
673
|
-
attribute_key,
|
|
674
|
-
loggedInUser,
|
|
675
|
-
body,
|
|
676
|
-
})
|
|
677
|
-
.toPromise();
|
|
678
|
-
|
|
679
|
-
return response;
|
|
680
|
-
} catch (error) {
|
|
681
|
-
console.error(
|
|
682
|
-
`❌ Error calling cross-app microservice '${targetAppCode}':`,
|
|
683
|
-
error.message,
|
|
684
|
-
);
|
|
685
|
-
throw new BadRequestException(
|
|
686
|
-
`Failed to fetch dropdown from app '${targetAppCode}': ${error.message}`,
|
|
687
|
-
);
|
|
688
|
-
}
|
|
689
|
-
}
|
|
690
|
-
|
|
691
683
|
// Example custom key handlers
|
|
692
684
|
private async getUserRolesDropdown(
|
|
693
685
|
filterCode: string,
|
|
@@ -57,6 +57,7 @@ import { EntityUpdateRepository } from './repository/entity-attribute-update.rep
|
|
|
57
57
|
import { EntityRelationRepository } from './repository/entity-relation.repository';
|
|
58
58
|
import { EAVModule } from '../eav/eav.module';
|
|
59
59
|
import { PopulateMetaService } from '../master/service/poupulate-meta.service';
|
|
60
|
+
import { LayoutPreferenceModule } from '../layout_preference/layout_preference.module';
|
|
60
61
|
|
|
61
62
|
@Module({
|
|
62
63
|
imports: [
|
|
@@ -73,6 +74,7 @@ import { PopulateMetaService } from '../master/service/poupulate-meta.service';
|
|
|
73
74
|
]),
|
|
74
75
|
forwardRef(() => ListMasterModule),
|
|
75
76
|
forwardRef(() => FilterModule),
|
|
77
|
+
forwardRef(() => LayoutPreferenceModule),
|
|
76
78
|
UtilsModule,
|
|
77
79
|
forwardRef(() => WorkflowAutomationModule),
|
|
78
80
|
EAVModule
|