rez_core 2.1.156 → 2.1.157

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "2.1.156",
3
+ "version": "2.1.157",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -196,10 +196,12 @@ export class FilterService {
196
196
  const layoutPreference = await this.dataSource.query(
197
197
  `SELECT layout_json
198
198
  FROM cr_layout_preference
199
- WHERE user_id = ? AND mapped_entity_type = ?`,
200
- [user_id, entity_type],
199
+ WHERE user_id = ? AND mapped_entity_type = ? AND mapped_level_id = ? AND mapped_level_type = ?`,
200
+ [user_id, entity_type, level_id, level_type],
201
201
  );
202
202
 
203
+ console.log('found layoutPreference', layoutPreference);
204
+
203
205
  // Extract layout preference
204
206
  const layout = layoutPreference?.[0]?.layout_json?.quick_tab || {};
205
207
 
@@ -42,7 +42,7 @@ export class ActionController {
42
42
  return result;
43
43
  }
44
44
 
45
- @Post('/getActions')
45
+ @Post('/getactions')
46
46
  @HttpCode(HttpStatus.OK)
47
47
  async getActions(
48
48
  @Req() req: Request & { user: any },
@@ -25,9 +25,10 @@ export class TaskController {
25
25
  @Req() req: Request & { user: any },
26
26
  @Body()
27
27
  body: {
28
- mapped_entity_type: string;
29
- mapped_entity_id: number;
30
28
  stage_id: number;
29
+ mapped_entity_type?: string;
30
+ mapped_entity_id?: number;
31
+ user_id?: number;
31
32
  },
32
33
  ) {
33
34
  const loggedInUser = req.user.userData;
@@ -94,6 +94,11 @@ export class ActionRepository {
94
94
  };
95
95
  });
96
96
 
97
+ enrichedResult.push({
98
+ value: 0,
99
+ label: 'Generic',
100
+ } as any);
101
+
97
102
  return enrichedResult;
98
103
  }
99
104
  }
@@ -11,18 +11,10 @@ export class TaskRepository {
11
11
  private readonly dataSource: DataSource,
12
12
  ) {}
13
13
 
14
- async getAllTaskByUserIdAndStageId(
15
- userId,
16
- stageId,
17
- mapped_entity_type,
18
- mapped_entity_id,
19
- ) {
14
+ async getAllTaskByUserIdAndStageId(condition) {
20
15
  const result = await this.TaskRepository.find({
21
16
  where: {
22
- user_id: userId,
23
- stage_id: stageId,
24
- mapped_entity_type,
25
- mapped_entity_id,
17
+ ...condition,
26
18
  },
27
19
  });
28
20
 
@@ -64,6 +64,7 @@ export class ActionService extends EntityServiceImpl {
64
64
  appcode,
65
65
  );
66
66
 
67
+ // template mapping
67
68
  if (Array.isArray(actionData.template) && actionData.template.length > 0) {
68
69
  const templates = actionData.template;
69
70
 
@@ -102,7 +103,7 @@ export class ActionService extends EntityServiceImpl {
102
103
  };
103
104
 
104
105
  // Pass only actionData (without template) to super.updateEntity
105
- let action = await super.updateEntity(actionData, loggedInUser);
106
+ let action = await super.updateEntity({ ...actionData }, loggedInUser);
106
107
 
107
108
  if (!action) {
108
109
  throw new Error('Action not found or could not be updated');
@@ -126,17 +127,17 @@ export class ActionService extends EntityServiceImpl {
126
127
  loggedInUser,
127
128
  );
128
129
 
130
+ // delete existing template mappings for this action
131
+ await this.dataSource.query(
132
+ `DELETE FROM cr_wf_action_template_mapping WHERE stg_act_mapping_id = ?`,
133
+ [stageActionMappingData.id],
134
+ );
135
+
129
136
  // Handle template mapping (using the extracted template)
130
137
  if (Array.isArray(template) && template.length > 0) {
131
138
  for (let i = 0; i < template.length; i++) {
132
139
  const templateCode = template[i];
133
140
 
134
- // delete existing template mappings for this action
135
- await this.dataSource.query(
136
- `DELETE FROM cr_wf_action_template_mapping WHERE stg_act_mapping_id = ? AND template_code = ?`,
137
- [stageActionMappingData.id, templateCode],
138
- );
139
-
140
141
  // Create Action-Template Mapping
141
142
  const actionTemplateMapping = {
142
143
  stg_act_mapping_id: stageActionMappingData.id,
@@ -291,8 +292,7 @@ export class ActionService extends EntityServiceImpl {
291
292
  const actionResults = await this.dataSource
292
293
  .createQueryBuilder()
293
294
  .select([
294
- 'a.id AS id',
295
- 'a.name AS name',
295
+ 'a.*',
296
296
  'ac.name AS action_category',
297
297
  'ar.name AS action_requirement',
298
298
  ])
@@ -17,12 +17,12 @@ export class TaskService extends EntityServiceImpl {
17
17
  loggedInUser: UserData,
18
18
  data,
19
19
  ): Promise<any> {
20
- const taskData = await this.taskRepository.getAllTaskByUserIdAndStageId(
21
- loggedInUser.id,
22
- data.stage_id,
23
- data.mapped_entity_type,
24
- data.mapped_entity_id,
25
- );
20
+ const taskData = await this.taskRepository.getAllTaskByUserIdAndStageId({
21
+ user_id: data.user_id,
22
+ stage_id: data.stage_id,
23
+ mapped_entity_type: data.mapped_entity_type,
24
+ mapped_entity_id: data.mapped_entity_id,
25
+ });
26
26
 
27
27
  const grouped: { mandatory: any[]; non_mandatory: any[] } = {
28
28
  mandatory: [],