rez_core 3.1.203 → 3.1.204
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/workflow/controller/action.controller.d.ts +9 -0
- package/dist/module/workflow/controller/action.controller.js +14 -0
- package/dist/module/workflow/controller/action.controller.js.map +1 -1
- package/dist/module/workflow/repository/action.repository.d.ts +4 -0
- package/dist/module/workflow/repository/action.repository.js +24 -0
- package/dist/module/workflow/repository/action.repository.js.map +1 -1
- package/dist/module/workflow/service/action.service.d.ts +4 -0
- package/dist/module/workflow/service/action.service.js +3 -0
- package/dist/module/workflow/service/action.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/workflow/controller/action.controller.ts +16 -0
- package/src/module/workflow/repository/action.repository.ts +40 -0
- package/src/module/workflow/service/action.service.ts +12 -0
package/package.json
CHANGED
|
@@ -55,6 +55,22 @@ export class ActionController {
|
|
|
55
55
|
return result;
|
|
56
56
|
}
|
|
57
57
|
|
|
58
|
+
@Post('/get_dependent_action')
|
|
59
|
+
@HttpCode(HttpStatus.OK)
|
|
60
|
+
async getDependentActions(
|
|
61
|
+
@Req() req: Request & { user: any },
|
|
62
|
+
@Body() body: { stage_id: number; action_id?: number },
|
|
63
|
+
) {
|
|
64
|
+
const loggedInUser = req.user.userData;
|
|
65
|
+
|
|
66
|
+
const result = this.actionService.getDependentActions(
|
|
67
|
+
loggedInUser,
|
|
68
|
+
body.stage_id,
|
|
69
|
+
body.action_id,
|
|
70
|
+
);
|
|
71
|
+
return result;
|
|
72
|
+
}
|
|
73
|
+
|
|
58
74
|
@Post('/getaction')
|
|
59
75
|
@HttpCode(HttpStatus.OK)
|
|
60
76
|
async getAction(
|
|
@@ -167,6 +167,46 @@ export class ActionRepository {
|
|
|
167
167
|
return enrichedResult;
|
|
168
168
|
}
|
|
169
169
|
|
|
170
|
+
async getDependentActions(
|
|
171
|
+
loggedInUser: UserData,
|
|
172
|
+
stage_id: number,
|
|
173
|
+
action_id?: number,
|
|
174
|
+
) {
|
|
175
|
+
// Step 1: Get all action_ids for the provided stage_id
|
|
176
|
+
const stageActions = await this.dataSource.query(
|
|
177
|
+
`
|
|
178
|
+
SELECT action_id
|
|
179
|
+
FROM cr_wf_stage_action_mapping
|
|
180
|
+
WHERE stage_id = ?
|
|
181
|
+
`,
|
|
182
|
+
[stage_id],
|
|
183
|
+
);
|
|
184
|
+
|
|
185
|
+
if (!stageActions?.length) return [];
|
|
186
|
+
|
|
187
|
+
const actionIds = stageActions.map((sa) => sa.action_id);
|
|
188
|
+
|
|
189
|
+
// Step 2: Fetch action details except the provided action_id incase it is provided
|
|
190
|
+
const filteredActionIds = action_id
|
|
191
|
+
? actionIds.filter((id) => id !== action_id)
|
|
192
|
+
: actionIds;
|
|
193
|
+
|
|
194
|
+
const actionResults = await this.dataSource
|
|
195
|
+
.createQueryBuilder()
|
|
196
|
+
.select(['a.id AS action_id', 'a.name AS action_name'])
|
|
197
|
+
.from('cr_wf_action', 'a')
|
|
198
|
+
.andWhere('a.id IN(:...actionIds)', { actionIds: filteredActionIds })
|
|
199
|
+
.getRawMany();
|
|
200
|
+
|
|
201
|
+
// Step 3: Format result
|
|
202
|
+
const enrichedResult = actionResults.map((row) => ({
|
|
203
|
+
value: row.action_id,
|
|
204
|
+
label: row.action_name,
|
|
205
|
+
}));
|
|
206
|
+
|
|
207
|
+
return enrichedResult;
|
|
208
|
+
}
|
|
209
|
+
|
|
170
210
|
async getAction(
|
|
171
211
|
organization_id: number,
|
|
172
212
|
stage_id: number,
|
|
@@ -246,6 +246,18 @@ export class ActionService extends EntityServiceImpl {
|
|
|
246
246
|
return this.actionRepository.getActions(loggedInUser, stage_id);
|
|
247
247
|
}
|
|
248
248
|
|
|
249
|
+
async getDependentActions(
|
|
250
|
+
loggedInUser: UserData,
|
|
251
|
+
stage_id: number,
|
|
252
|
+
action_id: number | undefined,
|
|
253
|
+
) {
|
|
254
|
+
return this.actionRepository.getDependentActions(
|
|
255
|
+
loggedInUser,
|
|
256
|
+
stage_id,
|
|
257
|
+
action_id,
|
|
258
|
+
);
|
|
259
|
+
}
|
|
260
|
+
|
|
249
261
|
async getAction(
|
|
250
262
|
loggedInUser: UserData,
|
|
251
263
|
stage_id: number,
|