rez_core 2.2.28 → 2.2.30

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.2.28",
3
+ "version": "2.2.30",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -73,7 +73,8 @@ export class UserService extends EntityServiceImpl {
73
73
  loggedInUser?.organization_id || 0,
74
74
  );
75
75
 
76
- userData.name = (userData.first_name || '') + (userData.last_name || '');
76
+ userData.name =
77
+ (userData.first_name || '') + ' ' + (userData.last_name || '');
77
78
  userData.password = EncryptUtilService.encryptGCM(
78
79
  userData.password || 'Admin@123',
79
80
  this.masterKey,
@@ -21,8 +21,8 @@ export class FormMasterRepository {
21
21
  .createQueryBuilder()
22
22
  .select(['fm.id', 'fm.form_name'])
23
23
  .from('cr_form_master', 'fm')
24
- .where('fm.organization_id = :orgId', { orgId: organization_id })
25
- .andWhere('fm.source_entity_type = :sourceEntityType', {
24
+ // .where('fm.organization_id = :orgId', { orgId: organization_id })
25
+ .where('fm.source_entity_type = :sourceEntityType', {
26
26
  sourceEntityType: source_entity_type,
27
27
  })
28
28
  .getRawMany();
@@ -12,14 +12,14 @@ export class ActionCategoryService extends EntityServiceImpl {
12
12
  async getActionsCat(loggedInUser: UserData, entity_type: string) {
13
13
  const { organization_id } = loggedInUser;
14
14
 
15
+ console.log(entity_type, 'entity_type in action category service');
16
+
15
17
  const result = await this.dataSource.query(
16
18
  `
17
19
  SELECT id, name
18
20
  FROM cr_wf_action_category
19
- WHERE mapped_entity_type = ?
20
- AND organization_id = ?
21
- `,
22
- [entity_type, organization_id],
21
+ WHERE mapped_entity_type = ?`,
22
+ [entity_type],
23
23
  );
24
24
 
25
25
  return result.map((row: any) => ({
@@ -50,9 +50,9 @@ export class ActionCategoryService extends EntityServiceImpl {
50
50
  `
51
51
  SELECT *
52
52
  FROM cr_wf_action_category
53
- WHERE organization_id = ? AND id = ?
53
+ WHERE id = ?
54
54
  `,
55
- [organization_id, action_cat_id],
55
+ [action_cat_id],
56
56
  );
57
57
 
58
58
  return result;
@@ -24,6 +24,7 @@ export class CommTemplateService extends EntityServiceImpl {
24
24
  organization_id: loggedInUser.organization_id,
25
25
  appcode: loggedInUser.appcode,
26
26
  level_id: loggedInUser.level_id,
27
+ mapped_entity_type: 'LEAD',
27
28
  level_type: loggedInUser.level_type,
28
29
  }));
29
30
 
@@ -81,6 +81,30 @@ export class PopulateWorkflowService extends EntityServiceImpl {
81
81
  // }
82
82
 
83
83
  async populateWorkflowData(organization_id: number, loggedInUser: UserData) {
84
+ // template populate
85
+ // Step 1: Fetch default cr_wf_comm_template
86
+ const defaultCommTemplates = await this.dataSource.query(
87
+ `SELECT * FROM cr_wf_comm_template WHERE organization_id = -1 AND level_type = 'ORG' AND level_id = -1`,
88
+ );
89
+
90
+ if (defaultCommTemplates.length > 0) {
91
+ // Step 2: Insert default communication templates for the new organization
92
+ for (const template of defaultCommTemplates) {
93
+ const { id, created_date, modified_date, ...rest } = template;
94
+ await super.createEntity(
95
+ {
96
+ ...rest,
97
+ organization_id,
98
+ level_id: organization_id,
99
+ entity_type: 'TEM',
100
+ created_date: new Date(),
101
+ modified_date: new Date(),
102
+ },
103
+ loggedInUser,
104
+ );
105
+ }
106
+ }
107
+
84
108
  const defaultEntity = await this.dataSource.query(
85
109
  `SELECT * FROM eth_entity WHERE organization_id = -1 AND level_type = 'ORG' AND level_id = -1 AND entity_type = 'ENT'`,
86
110
  );
@@ -135,6 +135,7 @@ export class WorkflowMetaService extends EntityServiceImpl {
135
135
  status: firstStage.status,
136
136
  current_user_id: loggedInUser.id,
137
137
  stage_action_mapping_id: firstStage.id,
138
+ orgnization_id: loggedInUser.organization_id,
138
139
  stage_group_id: stageGroup.id,
139
140
  stage_id: firstStage.id,
140
141
  start_date: new Date(),
@@ -170,6 +171,7 @@ export class WorkflowMetaService extends EntityServiceImpl {
170
171
  status: nextStage.status,
171
172
  current_user_id: loggedInUser.id,
172
173
  stage_action_mapping_id: nextStage.id,
174
+ organization_id: loggedInUser.organization_id,
173
175
  start_date: now,
174
176
  stage_group_id: nextStage?.stage_group_id,
175
177
  stage_id: nextStage.id,