rez_core 3.1.162 → 3.1.164

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": "3.1.162",
3
+ "version": "3.1.164",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -1,6 +1,6 @@
1
1
  import { Injectable, Logger } from '@nestjs/common';
2
2
  import { DataSource } from 'typeorm';
3
- import { IntegrationService, GenericMessageDto } from './integration.service';
3
+ import { GenericMessageDto, IntegrationService } from './integration.service';
4
4
  import { GoogleService } from './calendar-event.service';
5
5
  import { IcsMeetingService } from 'src/module/ics/service/ics.service';
6
6
 
@@ -384,6 +384,21 @@ export class WrapperService {
384
384
  `Generating ICS file. Payload: ${JSON.stringify(payload)}`,
385
385
  );
386
386
 
387
+ if (payload.template_code) {
388
+ let templates = await this.datasource.query(
389
+ `SELECT id FROM cr_wf_comm_template
390
+ WHERE code = ?
391
+ AND level_id = ?
392
+ AND level_type = ?
393
+ LIMIT 1`,
394
+ [payload.template_code, levelId, levelType],
395
+ );
396
+
397
+ if (templates && templates.length > 0) {
398
+ payload['templateId'] = templates[0].id;
399
+ }
400
+ }
401
+
387
402
  let activeConfig = await this.integrationService.getSingleActiveConfig(levelId, levelType, appCode, 'EMAIL');
388
403
  const base64String = await this.icsService.generateIcs(payload, activeConfig?.config_json);
389
404
  this.logger.debug(`ICS generated (base64 length: ${base64String?.length})`);
@@ -50,31 +50,49 @@ 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>,
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 {
61
+ inactiveIds,
62
+ loggedInUser: loggedInUserParam,
63
+ ...params
64
+ } = queryParams;
65
+
66
+ const inactiveIdsArray = inactiveIds
67
+ ? inactiveIds.split(',').map((id) => parseInt(id, 10))
68
+ : [];
69
+
70
+ // Default user object (if organization_id or appcode is needed in service)
71
+ let loggedInUser: any = {};
72
+
73
+ if (typeof loggedInUserParam === 'string') {
74
+ try {
75
+ loggedInUser = JSON.parse(loggedInUserParam);
76
+ } catch (e) {
77
+ loggedInUser = {};
78
+ }
79
+ } else if (
80
+ typeof loggedInUserParam === 'object' &&
81
+ loggedInUserParam !== null
59
82
  ) {
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
- );
83
+ loggedInUser = loggedInUserParam;
84
+ } else {
85
+ loggedInUser = {};
75
86
  }
76
-
77
87
 
88
+ return await this.service.getDropdownOptions(
89
+ type,
90
+ params,
91
+ inactiveIdsArray,
92
+ loggedInUser,
93
+ true, // publicCall flag set to true
94
+ );
95
+ }
78
96
 
79
97
  @Get('/getDataSourceList/:source')
80
98
  @UseGuards(JwtAuthGuard)
@@ -68,6 +68,7 @@ export class ListMasterService {
68
68
  params: Record<string, string>,
69
69
  inactiveIdsArray?: number[],
70
70
  loggedInUser?,
71
+ publicCall = false,
71
72
  ) {
72
73
  const config = await this.listMasterRepo.findByType(
73
74
  type,
@@ -76,15 +77,23 @@ export class ListMasterService {
76
77
 
77
78
  if (!config) throw new NotFoundException(`Type ${type} not found`);
78
79
 
79
- if (config.appcode != loggedInUser?.appcode) {
80
+ if (config.appcode != loggedInUser?.appcode && !publicCall) {
80
81
  // Call internal API for appcode mismatch
81
82
  try {
82
- const response = await axios.post(
83
- `${this.configService.get('REDIRECT_BE_URL')}/api/list-master/getDropdownData/${type}`,
84
- {},
83
+ const baseUrl = this.configService.get<string>('REDIRECT_BE_URL');
84
+
85
+ // Prepare the query string
86
+ const queryParams = new URLSearchParams({
87
+ inactiveIds: inactiveIdsArray?.join(',') || '',
88
+ loggedInUser: JSON.stringify(loggedInUser),
89
+ ...params, // Spread other params into the query string
90
+ }).toString();
91
+
92
+ // Make the GET request with query parameters
93
+ const response = await axios.get(
94
+ `${baseUrl}/list-master/getDropdownDataPublic/${type}?${queryParams}`,
85
95
  {
86
96
  headers: {
87
- Authorization: `Bearer ${loggedInUser?.token || ''}`,
88
97
  'Content-Type': 'application/json',
89
98
  },
90
99
  },