rez_core 3.1.204 → 3.1.206
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/enterprise/repository/school.repository.js +2 -3
- package/dist/module/enterprise/repository/school.repository.js.map +1 -1
- package/dist/module/workflow/controller/action.controller.d.ts +1 -4
- package/dist/module/workflow/entity/action-data.entity.js +1 -1
- package/dist/module/workflow/entity/action-data.entity.js.map +1 -1
- package/dist/module/workflow/repository/action-data.repository.d.ts +4 -1
- package/dist/module/workflow/repository/action-data.repository.js +45 -2
- package/dist/module/workflow/repository/action-data.repository.js.map +1 -1
- package/dist/module/workflow/repository/action.repository.d.ts +1 -4
- package/dist/module/workflow/repository/action.repository.js +6 -2
- package/dist/module/workflow/repository/action.repository.js.map +1 -1
- package/dist/module/workflow/service/action.service.d.ts +1 -4
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/enterprise/repository/school.repository.ts +7 -7
- package/src/module/workflow/entity/action-data.entity.ts +1 -1
- package/src/module/workflow/repository/action-data.repository.ts +72 -1
- package/src/module/workflow/repository/action.repository.ts +8 -2
package/package.json
CHANGED
|
@@ -62,8 +62,8 @@ export class SchoolRepository {
|
|
|
62
62
|
'org.status AS org_status',
|
|
63
63
|
|
|
64
64
|
'brn.id AS brand_id',
|
|
65
|
-
'
|
|
66
|
-
'
|
|
65
|
+
'brn.name AS brand_name',
|
|
66
|
+
'brn.status AS brand_status',
|
|
67
67
|
|
|
68
68
|
'school.id AS school_id',
|
|
69
69
|
'school.name AS school_name',
|
|
@@ -72,11 +72,11 @@ export class SchoolRepository {
|
|
|
72
72
|
])
|
|
73
73
|
.from('sso_organization', 'org')
|
|
74
74
|
.innerJoin('sso_organization', 'brn', "brn.type = 'BRN'")
|
|
75
|
-
.innerJoin(
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
)
|
|
75
|
+
// .innerJoin(
|
|
76
|
+
// 'eth_brand_profile',
|
|
77
|
+
// 'brand_profile',
|
|
78
|
+
// 'brand_profile.parent_id = brn.id AND brand_profile.organization_id = org.id',
|
|
79
|
+
// )
|
|
80
80
|
.innerJoin('sso_school', 'school', 'school.brand_id = brn.id')
|
|
81
81
|
.leftJoin('eth_address', 'address', 'address.parent_id = school.id')
|
|
82
82
|
.where('org.id = :orgId', { orgId: currentORGLevel_id })
|
|
@@ -47,7 +47,7 @@ export class ActionDataEntity extends BaseEntity {
|
|
|
47
47
|
@Column({ nullable: true, default: 0 })
|
|
48
48
|
resubmit_count: number;
|
|
49
49
|
|
|
50
|
-
@Column({
|
|
50
|
+
@Column({ nullable: true })
|
|
51
51
|
dependent_action_id: number;
|
|
52
52
|
|
|
53
53
|
@Column({ type: 'varchar', nullable: true })
|
|
@@ -3,10 +3,11 @@ import { InjectRepository } from '@nestjs/typeorm';
|
|
|
3
3
|
import { ActionDataEntity } from '../entity/action-data.entity';
|
|
4
4
|
import { DataSource, LessThan, Repository } from 'typeorm';
|
|
5
5
|
import { UserData } from 'src/module/user/entity/user.entity';
|
|
6
|
-
import { FormDataEntity } from '../entity/form.entity';
|
|
7
6
|
import { TaskDataEntity } from '../entity/task-data.entity';
|
|
8
7
|
import { EntityServiceImpl } from 'src/module/meta/service/entity-service-impl.service';
|
|
9
8
|
import { FORM_STATUS_TO_BE_SENT } from 'src/constant/global.constant';
|
|
9
|
+
import { ConfigService } from '@nestjs/config';
|
|
10
|
+
import axios from 'axios';
|
|
10
11
|
|
|
11
12
|
@Injectable()
|
|
12
13
|
export class ActionDataRepository extends EntityServiceImpl {
|
|
@@ -18,6 +19,7 @@ export class ActionDataRepository extends EntityServiceImpl {
|
|
|
18
19
|
// private readonly formRepo: Repository<FormDataEntity>,
|
|
19
20
|
@InjectRepository(TaskDataEntity)
|
|
20
21
|
private readonly TaskRepository: Repository<TaskDataEntity>,
|
|
22
|
+
private readonly configService: ConfigService,
|
|
21
23
|
) {
|
|
22
24
|
super();
|
|
23
25
|
}
|
|
@@ -59,12 +61,20 @@ export class ActionDataRepository extends EntityServiceImpl {
|
|
|
59
61
|
// SEND ANY FORM
|
|
60
62
|
// if the action_category_code is 'SDFM', create a entry in crm_lead_form table
|
|
61
63
|
if (act?.action_category_code === 'SDFM') {
|
|
64
|
+
const dynamicFormURL = await this.generateFormURL(
|
|
65
|
+
mapped_entity_type,
|
|
66
|
+
mapped_entity_id,
|
|
67
|
+
act.form_id,
|
|
68
|
+
loggedInUser,
|
|
69
|
+
);
|
|
70
|
+
|
|
62
71
|
const data = {
|
|
63
72
|
entity_type: 'LFRM',
|
|
64
73
|
stage_id: act.stage_id,
|
|
65
74
|
mapped_entity_type,
|
|
66
75
|
mapped_entity_id,
|
|
67
76
|
view_id: act.form_id,
|
|
77
|
+
form_url: dynamicFormURL,
|
|
68
78
|
status: FORM_STATUS_TO_BE_SENT,
|
|
69
79
|
action_id: act.id,
|
|
70
80
|
};
|
|
@@ -239,4 +249,65 @@ export class ActionDataRepository extends EntityServiceImpl {
|
|
|
239
249
|
updated: currentAction,
|
|
240
250
|
};
|
|
241
251
|
}
|
|
252
|
+
|
|
253
|
+
// method to dynamically generate form URL
|
|
254
|
+
async generateFormURL(
|
|
255
|
+
mapped_entity_type: string,
|
|
256
|
+
mapped_entity_id: number,
|
|
257
|
+
view_id: number,
|
|
258
|
+
loggedInUser: any,
|
|
259
|
+
) {
|
|
260
|
+
let organizationData;
|
|
261
|
+
|
|
262
|
+
try {
|
|
263
|
+
const baseUrl = this.configService.get<string>('REDIRECT_BE_URL');
|
|
264
|
+
|
|
265
|
+
// Prepare query params
|
|
266
|
+
const queryParams = new URLSearchParams({
|
|
267
|
+
loggedInUser: JSON.stringify(loggedInUser),
|
|
268
|
+
}).toString();
|
|
269
|
+
|
|
270
|
+
const { level_id } = loggedInUser;
|
|
271
|
+
|
|
272
|
+
const url = `${baseUrl}/entity/public/getById/${level_id}?entity_type=ORG&${queryParams}`;
|
|
273
|
+
|
|
274
|
+
const response = await axios.get(url);
|
|
275
|
+
console.log('Internal Entity API response:', response.data);
|
|
276
|
+
|
|
277
|
+
organizationData = response.data;
|
|
278
|
+
|
|
279
|
+
// The API response is likely a JSON object, not an array
|
|
280
|
+
} catch (error) {
|
|
281
|
+
console.error('Internal Entity API call failed:', error.message);
|
|
282
|
+
}
|
|
283
|
+
|
|
284
|
+
const org_slug = organizationData?.slug;
|
|
285
|
+
|
|
286
|
+
// fetch required var from config or env
|
|
287
|
+
const profile = this.configService.get('PROFILE');
|
|
288
|
+
const baseUrl = this.configService.get('BASE_URL');
|
|
289
|
+
const domainUrl = this.configService.get('DOMAIN_URL');
|
|
290
|
+
|
|
291
|
+
if (!profile || !baseUrl || !domainUrl) {
|
|
292
|
+
throw new BadRequestException(
|
|
293
|
+
`Configuration variable missing for form URL generation`,
|
|
294
|
+
);
|
|
295
|
+
}
|
|
296
|
+
|
|
297
|
+
let finalBaseUrl: string;
|
|
298
|
+
|
|
299
|
+
if (profile === 'DEV' || profile === 'STAGING') {
|
|
300
|
+
finalBaseUrl = baseUrl;
|
|
301
|
+
} else if (profile === 'UAT' || profile === 'PREPROD') {
|
|
302
|
+
// fetch org_slug from DB if needed
|
|
303
|
+
const org_slug = 'orgslug'; // placeholder
|
|
304
|
+
finalBaseUrl = `https://${org_slug}.${domainUrl}`;
|
|
305
|
+
} else {
|
|
306
|
+
finalBaseUrl = baseUrl;
|
|
307
|
+
}
|
|
308
|
+
|
|
309
|
+
const formURL = `${finalBaseUrl}/form/${mapped_entity_type}/${mapped_entity_id}/${view_id}`;
|
|
310
|
+
|
|
311
|
+
return formURL;
|
|
312
|
+
}
|
|
242
313
|
}
|
|
@@ -188,10 +188,16 @@ export class ActionRepository {
|
|
|
188
188
|
|
|
189
189
|
// Step 2: Fetch action details except the provided action_id incase it is provided
|
|
190
190
|
const filteredActionIds = action_id
|
|
191
|
-
? actionIds.filter((id) => id
|
|
191
|
+
? actionIds.filter((id) => id != action_id)
|
|
192
192
|
: actionIds;
|
|
193
193
|
|
|
194
|
-
|
|
194
|
+
let actionResults;
|
|
195
|
+
|
|
196
|
+
if (filteredActionIds.length === 0) {
|
|
197
|
+
return [];
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
actionResults = await this.dataSource
|
|
195
201
|
.createQueryBuilder()
|
|
196
202
|
.select(['a.id AS action_id', 'a.name AS action_name'])
|
|
197
203
|
.from('cr_wf_action', 'a')
|