rez_core 4.0.15 → 4.0.17

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": "4.0.15",
3
+ "version": "4.0.17",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -56,6 +56,7 @@ export interface GenericMessageDto {
56
56
  user_id?: number;
57
57
  entity_type?: string;
58
58
  entity_id?: number;
59
+ organization_id?: number;
59
60
  }
60
61
 
61
62
  export interface IntegrationConfigWithConfig extends IntegrationConfig {
@@ -888,6 +889,7 @@ export class IntegrationService {
888
889
  user_id,
889
890
  entity_id,
890
891
  entity_type,
892
+ organization_id,
891
893
  } = messageDto;
892
894
 
893
895
  let subject = messageDto.subject;
@@ -928,6 +930,14 @@ export class IntegrationService {
928
930
  mediaUrl,
929
931
  };
930
932
 
933
+ const loggedInUser = {
934
+ id: user_id || null,
935
+ organization_id: organization_id || null,
936
+ level_id: levelId,
937
+ level_type: levelType,
938
+ app_code: app_code,
939
+ };
940
+
931
941
  // Handle multiple recipients by sending to each individually
932
942
  if (Array.isArray(to)) {
933
943
  const results: IntegrationResult[] = [];
@@ -956,6 +966,7 @@ export class IntegrationService {
956
966
  parseInt(templateId, 10),
957
967
  entity_type,
958
968
  entity_id,
969
+ loggedInUser,
959
970
  );
960
971
  variables = templateData.variables;
961
972
  externalTemplateId = templateData.externalTemplateId;
@@ -1048,6 +1059,7 @@ export class IntegrationService {
1048
1059
  parseInt(templateId, 10),
1049
1060
  entity_type,
1050
1061
  entity_id,
1062
+ loggedInUser,
1051
1063
  );
1052
1064
  variables = templateData.variables;
1053
1065
  externalTemplateId = templateData.externalTemplateId;
@@ -256,6 +256,7 @@ export class WrapperService {
256
256
  entity_id: entity.entity_id,
257
257
  attachments: entity.attachments,
258
258
  mediaUrl: entity.mediaUrl,
259
+ organization_id: organization_id,
259
260
  } as any;
260
261
 
261
262
  this.logger.debug(
@@ -318,12 +319,24 @@ export class WrapperService {
318
319
  ),
319
320
  ];
320
321
 
321
- let integrationConfig = await this.integrationService.getSingleActiveConfig(payload.level_id, payload.level_type, payload.app_code, 'EMAIL');
322
+ let integrationConfig =
323
+ await this.integrationService.getSingleActiveConfig(
324
+ payload.level_id,
325
+ payload.level_type,
326
+ payload.app_code,
327
+ 'EMAIL',
328
+ );
322
329
 
323
330
  if (integrationConfig) {
324
331
  return {
325
332
  success: true,
326
- data: await this.sendIcsInvite(payload, payload.level_id, payload.level_type, payload.app_code),
333
+ data: await this.sendIcsInvite(
334
+ payload,
335
+ payload.level_id,
336
+ payload.level_type,
337
+ payload.app_code,
338
+ loggedInUser.organization_id,
339
+ ),
327
340
  };
328
341
  }
329
342
 
@@ -340,14 +353,25 @@ export class WrapperService {
340
353
  [],
341
354
  );
342
355
 
343
- integrationConfig = await this.integrationService.getSingleActiveConfig(1, 'ORG', 'DEFAULT', 'EMAIL');
356
+ integrationConfig = await this.integrationService.getSingleActiveConfig(
357
+ 1,
358
+ 'ORG',
359
+ 'DEFAULT',
360
+ 'EMAIL',
361
+ );
344
362
 
345
363
  this.logger.debug(`ORG configs found: ${JSON.stringify(orgConfigs)}`);
346
364
 
347
365
  if (integrationConfig) {
348
366
  return {
349
367
  success: true,
350
- data: await this.sendIcsInvite(payload, 1, 'ORG', 'DEFAULT'),
368
+ data: await this.sendIcsInvite(
369
+ payload,
370
+ 1,
371
+ 'ORG',
372
+ 'DEFAULT',
373
+ loggedInUser.organization_id,
374
+ ),
351
375
  };
352
376
  }
353
377
  } catch (error: any) {
@@ -378,11 +402,10 @@ export class WrapperService {
378
402
  payload: any,
379
403
  levelId: number,
380
404
  levelType: string,
381
- appCode: string
405
+ appCode: string,
406
+ organizationId: number,
382
407
  ) {
383
- this.logger.log(
384
- `Generating ICS file. Payload: ${JSON.stringify(payload)}`,
385
- );
408
+ this.logger.log(`Generating ICS file. Payload: ${JSON.stringify(payload)}`);
386
409
 
387
410
  if (payload.template_code) {
388
411
  let templates = await this.datasource.query(
@@ -398,8 +421,16 @@ export class WrapperService {
398
421
  }
399
422
  }
400
423
 
401
- let activeConfig = await this.integrationService.getSingleActiveConfig(levelId, levelType, appCode, 'EMAIL');
402
- const base64String = await this.icsService.generateIcs(payload, activeConfig?.config_json);
424
+ let activeConfig = await this.integrationService.getSingleActiveConfig(
425
+ levelId,
426
+ levelType,
427
+ appCode,
428
+ 'EMAIL',
429
+ );
430
+ const base64String = await this.icsService.generateIcs(
431
+ payload,
432
+ activeConfig?.config_json,
433
+ );
403
434
  this.logger.debug(`ICS generated (base64 length: ${base64String?.length})`);
404
435
 
405
436
  // Normalize attendees
@@ -418,8 +449,8 @@ export class WrapperService {
418
449
  ? [payload.to]
419
450
  : []),
420
451
  ...attendeeEmails,
421
- ].map(email => email.toLowerCase().trim())
422
- )
452
+ ].map((email) => email.toLowerCase().trim()),
453
+ ),
423
454
  );
424
455
 
425
456
  const payloadSendMail: GenericMessageDto = {
@@ -443,7 +474,8 @@ export class WrapperService {
443
474
  ],
444
475
  templateId: payload.templateId,
445
476
  entity_id: payload.entity_id,
446
- entity_type: payload.entity_type
477
+ entity_type: payload.entity_type,
478
+ organization_id: organizationId,
447
479
  };
448
480
 
449
481
  this.logger.debug(