rez_core 3.1.161 → 3.1.162
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/listmaster/controller/list-master.controller.d.ts +2 -4
- package/dist/module/listmaster/controller/list-master.controller.js +16 -0
- package/dist/module/listmaster/controller/list-master.controller.js.map +1 -1
- package/dist/module/listmaster/service/list-master.service.d.ts +4 -5
- package/dist/module/listmaster/service/list-master.service.js +27 -6
- package/dist/module/listmaster/service/list-master.service.js.map +1 -1
- package/dist/module/meta/controller/meta.controller.d.ts +6 -24
- package/dist/module/meta/repository/entity-master.repository.d.ts +6 -24
- package/dist/module/meta/service/entity-master.service.d.ts +6 -24
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/listmaster/controller/list-master.controller.ts +26 -0
- package/src/module/listmaster/service/list-master.service.ts +46 -23
package/package.json
CHANGED
|
@@ -50,6 +50,32 @@ export class ListMasterController {
|
|
|
50
50
|
);
|
|
51
51
|
}
|
|
52
52
|
|
|
53
|
+
// Public/internal endpoint (no JWT required)
|
|
54
|
+
@Get('/getDropdownDataPublic/:type')
|
|
55
|
+
@HttpCode(HttpStatus.OK)
|
|
56
|
+
async getDropdownDataPublic(
|
|
57
|
+
@Param('type') type: string,
|
|
58
|
+
@Query() queryParams: Record<string, string>,
|
|
59
|
+
) {
|
|
60
|
+
const { inactiveIds,loggedInUser, ...params } = queryParams;
|
|
61
|
+
|
|
62
|
+
const inactiveIdsArray = inactiveIds
|
|
63
|
+
? inactiveIds.split(',').map((id) => parseInt(id, 10))
|
|
64
|
+
: [];
|
|
65
|
+
|
|
66
|
+
// Default user object (if organization_id or appcode is needed in service)
|
|
67
|
+
|
|
68
|
+
|
|
69
|
+
return await this.service.getDropdownOptions(
|
|
70
|
+
type,
|
|
71
|
+
params,
|
|
72
|
+
inactiveIdsArray,
|
|
73
|
+
loggedInUser,
|
|
74
|
+
);
|
|
75
|
+
}
|
|
76
|
+
|
|
77
|
+
|
|
78
|
+
|
|
53
79
|
@Get('/getDataSourceList/:source')
|
|
54
80
|
@UseGuards(JwtAuthGuard)
|
|
55
81
|
@HttpCode(HttpStatus.OK)
|
|
@@ -18,7 +18,8 @@ import { STATUS_ACTIVE, STATUS_INACTIVE } from 'src/constant/global.constant';
|
|
|
18
18
|
import { ListMasterExtension } from './list-master-extension.interface';
|
|
19
19
|
import { ListMasterEngine } from './list-master-engine';
|
|
20
20
|
import { Action } from '../../workflow-automation/interface/action.interface';
|
|
21
|
-
|
|
21
|
+
import axios from 'axios';
|
|
22
|
+
import { ConfigService } from '@nestjs/config';
|
|
22
23
|
|
|
23
24
|
@Injectable()
|
|
24
25
|
export class ListMasterService {
|
|
@@ -33,19 +34,18 @@ export class ListMasterService {
|
|
|
33
34
|
private readonly apiRegistryService: ApiRegistryService,
|
|
34
35
|
private readonly httpService: HttpService,
|
|
35
36
|
private readonly listMasterEngine: ListMasterEngine,
|
|
37
|
+
private readonly configService: ConfigService,
|
|
36
38
|
) {}
|
|
37
39
|
|
|
38
40
|
private readonly skipLevelFilterEntities = ['BRN'];
|
|
39
41
|
private readonly actions = new Map<string, Action>();
|
|
40
42
|
|
|
41
|
-
|
|
42
43
|
registerAction(actionName: string, actionInstance: Action) {
|
|
43
44
|
this.actions.set(actionName, actionInstance);
|
|
44
45
|
console.log(
|
|
45
46
|
`⚙️ [WorkflowAutomationEngine] Registered action: ${actionName}`,
|
|
46
47
|
);
|
|
47
48
|
}
|
|
48
|
-
|
|
49
49
|
|
|
50
50
|
async getResolvedListCode(
|
|
51
51
|
code: string,
|
|
@@ -73,29 +73,43 @@ export class ListMasterService {
|
|
|
73
73
|
type,
|
|
74
74
|
loggedInUser?.organization_id,
|
|
75
75
|
);
|
|
76
|
-
|
|
77
|
-
if (!config) throw new NotFoundException(`Type ${type} not found`);
|
|
78
|
-
|
|
79
|
-
if (config.appcode!=loggedInUser?.appcode) {
|
|
80
|
-
|
|
81
|
-
const impl = this.actions.get("LIST_MASTER")
|
|
82
76
|
|
|
77
|
+
if (!config) throw new NotFoundException(`Type ${type} not found`);
|
|
83
78
|
|
|
79
|
+
if (config.appcode != loggedInUser?.appcode) {
|
|
80
|
+
// Call internal API for appcode mismatch
|
|
81
|
+
try {
|
|
82
|
+
const response = await axios.post(
|
|
83
|
+
`${this.configService.get('REDIRECT_BE_URL')}/api/list-master/getDropdownData/${type}`,
|
|
84
|
+
{},
|
|
85
|
+
{
|
|
86
|
+
headers: {
|
|
87
|
+
Authorization: `Bearer ${loggedInUser?.token || ''}`,
|
|
88
|
+
'Content-Type': 'application/json',
|
|
89
|
+
},
|
|
90
|
+
},
|
|
91
|
+
);
|
|
84
92
|
|
|
85
|
-
|
|
86
|
-
|
|
93
|
+
console.log('✅ Internal API response:', response.data);
|
|
94
|
+
return response.data;
|
|
95
|
+
} catch (error) {
|
|
96
|
+
console.error('⚠️ Internal API call failed:', error.message);
|
|
97
|
+
throw new BadRequestException(
|
|
98
|
+
`Failed to fetch dropdown for type ${type} from internal API`,
|
|
99
|
+
);
|
|
87
100
|
}
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
101
|
}
|
|
92
|
-
|
|
93
|
-
|
|
102
|
+
|
|
94
103
|
// Fallback to old logic if no extension exists
|
|
95
104
|
switch (config.source) {
|
|
96
105
|
case 'entity':
|
|
97
|
-
return this.fetchFromEntity(
|
|
98
|
-
|
|
106
|
+
return this.fetchFromEntity(
|
|
107
|
+
type,
|
|
108
|
+
params,
|
|
109
|
+
inactiveIdsArray,
|
|
110
|
+
loggedInUser,
|
|
111
|
+
);
|
|
112
|
+
|
|
99
113
|
case 'master':
|
|
100
114
|
return this.listItemsRepo.findItemsByType(
|
|
101
115
|
type,
|
|
@@ -104,21 +118,30 @@ export class ListMasterService {
|
|
|
104
118
|
loggedInUser?.organization_id,
|
|
105
119
|
params,
|
|
106
120
|
);
|
|
107
|
-
|
|
121
|
+
|
|
108
122
|
case 'operator':
|
|
109
123
|
return this.listItemsRepo.findOperatorsByType(
|
|
110
124
|
type,
|
|
111
125
|
loggedInUser?.organization_id,
|
|
112
126
|
);
|
|
113
|
-
|
|
127
|
+
|
|
114
128
|
case 'custom':
|
|
115
|
-
|
|
116
|
-
|
|
129
|
+
// If you want Axios call here too:
|
|
130
|
+
try {
|
|
131
|
+
const response = await axios.get(
|
|
132
|
+
`https://external-source.com/${config.custom_source_id}`,
|
|
133
|
+
{ params },
|
|
134
|
+
);
|
|
135
|
+
return response.data;
|
|
136
|
+
} catch (error) {
|
|
137
|
+
console.error('⚠️ Custom source fetch failed:', error.message);
|
|
138
|
+
throw new BadRequestException('Failed to fetch custom source');
|
|
139
|
+
}
|
|
140
|
+
|
|
117
141
|
default:
|
|
118
142
|
throw new BadRequestException(`Unknown source: ${config.source}`);
|
|
119
143
|
}
|
|
120
144
|
}
|
|
121
|
-
|
|
122
145
|
|
|
123
146
|
private async fetchFromEntity(
|
|
124
147
|
sourceList: string,
|