rez_core 2.2.259 → 2.2.261
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/.vscode/extensions.json +5 -0
- package/dist/app.module.js.map +1 -1
- package/dist/module/integration/controller/integration.controller.d.ts +3 -0
- package/dist/module/integration/controller/integration.controller.js +15 -0
- package/dist/module/integration/controller/integration.controller.js.map +1 -1
- package/dist/module/integration/entity/integration-ivr-mapper.entity.d.ts +6 -0
- package/dist/module/integration/entity/integration-ivr-mapper.entity.js +33 -0
- package/dist/module/integration/entity/integration-ivr-mapper.entity.js.map +1 -0
- package/dist/module/integration/entity/integration-source.entity.d.ts +1 -0
- package/dist/module/integration/entity/integration-source.entity.js +5 -1
- package/dist/module/integration/entity/integration-source.entity.js.map +1 -1
- package/dist/module/integration/service/integration.service.d.ts +4 -2
- package/dist/module/integration/service/integration.service.js +18 -2
- package/dist/module/integration/service/integration.service.js.map +1 -1
- package/dist/module/meta/service/entity-dynamic.service.d.ts +3 -1
- package/dist/module/meta/service/entity-dynamic.service.js +94 -26
- package/dist/module/meta/service/entity-dynamic.service.js.map +1 -1
- package/dist/module/user/controller/login.controller.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/app.module.ts +0 -1
- package/src/module/integration/controller/integration.controller.ts +21 -0
- package/src/module/integration/entity/integration-ivr-mapper.entity.ts +14 -0
- package/src/module/integration/entity/integration-source.entity.ts +4 -1
- package/src/module/integration/service/integration.service.ts +27 -1
- package/src/module/meta/service/entity-dynamic.service.ts +108 -26
- package/src/module/user/controller/login.controller.ts +6 -8
- package/src/resources/dev.properties.yaml +3 -3
package/package.json
CHANGED
package/src/app.module.ts
CHANGED
|
@@ -19,7 +19,6 @@ import { DashboardModule } from './module/dashboard/dashboard.module';
|
|
|
19
19
|
import { IntegrationModule } from './module/integration/integration.module';
|
|
20
20
|
import { ScheduleModule } from '@nestjs/schedule';
|
|
21
21
|
import { AuthModule } from './module/auth/auth.module';
|
|
22
|
-
import { WorkflowAutomationModule } from './module/workflow-automation/workflow-automation.module';
|
|
23
22
|
|
|
24
23
|
@Module({
|
|
25
24
|
imports: [
|
|
@@ -9,6 +9,8 @@ import {
|
|
|
9
9
|
ParseIntPipe,
|
|
10
10
|
Post,
|
|
11
11
|
Query,
|
|
12
|
+
Req,
|
|
13
|
+
UseGuards,
|
|
12
14
|
} from '@nestjs/common';
|
|
13
15
|
import { IntegrationService } from '../service/integration.service';
|
|
14
16
|
import {
|
|
@@ -21,6 +23,7 @@ import {
|
|
|
21
23
|
UpdateConfigDto,
|
|
22
24
|
UpdateUserIntegrationDto,
|
|
23
25
|
} from '../dto/create-config.dto';
|
|
26
|
+
import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
24
27
|
|
|
25
28
|
export class ScheduledMessageDto extends GenericSendMessageDto {
|
|
26
29
|
scheduleFor: Date;
|
|
@@ -408,4 +411,22 @@ export class IntegrationController {
|
|
|
408
411
|
});
|
|
409
412
|
}
|
|
410
413
|
}
|
|
414
|
+
|
|
415
|
+
@Get('getAll')
|
|
416
|
+
@UseGuards(JwtAuthGuard)
|
|
417
|
+
async getAllIntegration(
|
|
418
|
+
@Req() req: Request & { user: any },
|
|
419
|
+
@Query('integration_type')
|
|
420
|
+
integration_type?: 'EMAIL' | 'SMS' | 'WA' | 'TELEPHONE',
|
|
421
|
+
) {
|
|
422
|
+
const loggedInUser = req.user.userData;
|
|
423
|
+
|
|
424
|
+
const allIntegrationData =
|
|
425
|
+
await this.integrationService.getAllIntegrationData(
|
|
426
|
+
loggedInUser,
|
|
427
|
+
integration_type,
|
|
428
|
+
);
|
|
429
|
+
|
|
430
|
+
return allIntegrationData;
|
|
431
|
+
}
|
|
411
432
|
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { BaseEntity } from 'src/module/meta/entity/base-entity.entity';
|
|
2
|
+
import { Column, Entity } from 'typeorm';
|
|
3
|
+
|
|
4
|
+
@Entity({ name: 'cr_integration_telephone_mapper' })
|
|
5
|
+
export class IntegrationSource extends BaseEntity {
|
|
6
|
+
@Column({ name: 'did', type: 'varchar', length: 100 })
|
|
7
|
+
did: string;
|
|
8
|
+
|
|
9
|
+
@Column({ name: 'campaign_name', type: 'varchar', length: 100 })
|
|
10
|
+
campaign_name: string;
|
|
11
|
+
|
|
12
|
+
@Column({ name: 'mapped_entity_type', type: 'varchar', length: 20 })
|
|
13
|
+
mapped_entity_type: string;
|
|
14
|
+
}
|
|
@@ -3,7 +3,7 @@ import { Column, Entity } from 'typeorm';
|
|
|
3
3
|
|
|
4
4
|
@Entity({ name: 'cr_integration_master' })
|
|
5
5
|
export class IntegrationSource extends BaseEntity {
|
|
6
|
-
@Column({ name: 'logo', type: 'varchar', length:
|
|
6
|
+
@Column({ name: 'logo', type: 'varchar', length: 500 })
|
|
7
7
|
logo: string;
|
|
8
8
|
|
|
9
9
|
@Column({ name: 'base_url', type: 'varchar', length: 100 })
|
|
@@ -11,4 +11,7 @@ export class IntegrationSource extends BaseEntity {
|
|
|
11
11
|
|
|
12
12
|
@Column({ name: 'integration_type', type: 'varchar', length: 20 })
|
|
13
13
|
integration_type: string;
|
|
14
|
+
|
|
15
|
+
@Column({ name: 'description', type: 'varchar', length: 20 })
|
|
16
|
+
description: string;
|
|
14
17
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { forwardRef, Inject, Injectable, Logger } from '@nestjs/common';
|
|
2
2
|
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
|
-
import { Not, Repository } from 'typeorm';
|
|
3
|
+
import { DataSource, Not, Repository } from 'typeorm';
|
|
4
4
|
import { ConfigService } from '@nestjs/config';
|
|
5
5
|
import { google } from 'googleapis';
|
|
6
6
|
import { IntegrationConfig } from '../entity/integration-config.entity';
|
|
@@ -74,6 +74,7 @@ export class IntegrationService {
|
|
|
74
74
|
@InjectRepository(UserIntegration)
|
|
75
75
|
private readonly userIntegrationRepository: Repository<UserIntegration>,
|
|
76
76
|
|
|
77
|
+
private readonly dataSource: DataSource,
|
|
77
78
|
private readonly integrationFactory: IntegrationFactory,
|
|
78
79
|
private readonly gmailApiStrategy: GmailApiStrategy,
|
|
79
80
|
private readonly sendGridApiStrategy: SendGridApiStrategy,
|
|
@@ -169,6 +170,31 @@ export class IntegrationService {
|
|
|
169
170
|
return await queryBuilder.getMany();
|
|
170
171
|
}
|
|
171
172
|
|
|
173
|
+
async getAllIntegrationData(
|
|
174
|
+
loggedInUser,
|
|
175
|
+
integration_type?: string,
|
|
176
|
+
): Promise<any[]> {
|
|
177
|
+
try {
|
|
178
|
+
const allIntegrationData = await this.dataSource.query(
|
|
179
|
+
`SELECT * FROM cr_integration_master`,
|
|
180
|
+
);
|
|
181
|
+
|
|
182
|
+
// if entityType is provided, filter the results
|
|
183
|
+
if (integration_type) {
|
|
184
|
+
return allIntegrationData.filter(
|
|
185
|
+
(data) =>
|
|
186
|
+
data.integration_type.toLowerCase() ===
|
|
187
|
+
integration_type.toLowerCase(),
|
|
188
|
+
);
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return allIntegrationData;
|
|
192
|
+
} catch (error) {
|
|
193
|
+
this.logger.error('Error fetching integration data:', error.message);
|
|
194
|
+
return [];
|
|
195
|
+
}
|
|
196
|
+
}
|
|
197
|
+
|
|
172
198
|
private sortConfigsByPriority(
|
|
173
199
|
configs: IntegrationConfig[],
|
|
174
200
|
_priority: number,
|
|
@@ -6,10 +6,14 @@ import {
|
|
|
6
6
|
} from 'src/constant/global.constant';
|
|
7
7
|
import { DataSource } from 'typeorm';
|
|
8
8
|
import { UserData } from 'src/module/user/entity/user.entity';
|
|
9
|
+
import { MediaDataService } from './media-data.service';
|
|
9
10
|
|
|
10
11
|
@Injectable()
|
|
11
12
|
export class EntityDynamicService {
|
|
12
|
-
constructor(
|
|
13
|
+
constructor(
|
|
14
|
+
private readonly dataSource: DataSource,
|
|
15
|
+
private readonly mediaDataService: MediaDataService,
|
|
16
|
+
) {}
|
|
13
17
|
|
|
14
18
|
// -----------------------------
|
|
15
19
|
async createEntity(
|
|
@@ -60,17 +64,40 @@ export class EntityDynamicService {
|
|
|
60
64
|
}
|
|
61
65
|
|
|
62
66
|
const bypassColumn = [
|
|
63
|
-
{
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
|
|
68
|
-
{
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
{
|
|
67
|
+
{
|
|
68
|
+
attribute_key: 'created_date',
|
|
69
|
+
db_datatype: 'datetime',
|
|
70
|
+
element_type: 'date',
|
|
71
|
+
},
|
|
72
|
+
{
|
|
73
|
+
attribute_key: 'created_by',
|
|
74
|
+
db_datatype: 'int',
|
|
75
|
+
element_type: 'number',
|
|
76
|
+
},
|
|
77
|
+
{
|
|
78
|
+
attribute_key: 'organization_id',
|
|
79
|
+
db_datatype: 'datetime',
|
|
80
|
+
element_type: 'date',
|
|
81
|
+
},
|
|
82
|
+
{
|
|
83
|
+
attribute_key: 'enterprise_id',
|
|
84
|
+
db_datatype: 'int',
|
|
85
|
+
element_type: 'number',
|
|
86
|
+
},
|
|
87
|
+
{ attribute_key: 'level_type', db_datatype: 'int', element_type: 'text' },
|
|
88
|
+
{
|
|
89
|
+
attribute_key: 'level_id',
|
|
90
|
+
db_datatype: 'varchar',
|
|
91
|
+
element_type: 'text',
|
|
92
|
+
},
|
|
93
|
+
{ attribute_key: 'level_id', db_datatype: 'int', element_type: 'number' },
|
|
94
|
+
{ attribute_key: 'status', db_datatype: 'varchar', element_type: 'text' },
|
|
95
|
+
{
|
|
96
|
+
attribute_key: 'entity_type',
|
|
97
|
+
db_datatype: 'varchar',
|
|
98
|
+
element_type: 'text',
|
|
99
|
+
},
|
|
100
|
+
{ attribute_key: 'code', db_datatype: 'varchar', element_type: 'text' },
|
|
74
101
|
];
|
|
75
102
|
|
|
76
103
|
validAttributes.push(...bypassColumn);
|
|
@@ -400,17 +427,49 @@ export class EntityDynamicService {
|
|
|
400
427
|
}
|
|
401
428
|
|
|
402
429
|
const bypassColumn = [
|
|
403
|
-
{
|
|
404
|
-
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
{
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
|
|
412
|
-
|
|
413
|
-
{
|
|
430
|
+
{
|
|
431
|
+
attribute_key: 'created_date',
|
|
432
|
+
db_datatype: 'datetime',
|
|
433
|
+
element_type: 'date',
|
|
434
|
+
},
|
|
435
|
+
{
|
|
436
|
+
attribute_key: 'created_by',
|
|
437
|
+
db_datatype: 'int',
|
|
438
|
+
element_type: 'number',
|
|
439
|
+
},
|
|
440
|
+
{
|
|
441
|
+
attribute_key: 'modified_date',
|
|
442
|
+
db_datatype: 'datetime',
|
|
443
|
+
element_type: 'date',
|
|
444
|
+
},
|
|
445
|
+
{
|
|
446
|
+
attribute_key: 'modified_by',
|
|
447
|
+
db_datatype: 'int',
|
|
448
|
+
element_type: 'number',
|
|
449
|
+
},
|
|
450
|
+
{
|
|
451
|
+
attribute_key: 'organization_id',
|
|
452
|
+
db_datatype: 'int',
|
|
453
|
+
element_type: 'number',
|
|
454
|
+
},
|
|
455
|
+
{
|
|
456
|
+
attribute_key: 'enterprise_id',
|
|
457
|
+
db_datatype: 'int',
|
|
458
|
+
element_type: 'number',
|
|
459
|
+
},
|
|
460
|
+
{
|
|
461
|
+
attribute_key: 'level_type',
|
|
462
|
+
db_datatype: 'varchar',
|
|
463
|
+
element_type: 'text',
|
|
464
|
+
},
|
|
465
|
+
{ attribute_key: 'level_id', db_datatype: 'int', element_type: 'number' },
|
|
466
|
+
{ attribute_key: 'status', db_datatype: 'varchar', element_type: 'text' },
|
|
467
|
+
{
|
|
468
|
+
attribute_key: 'entity_type',
|
|
469
|
+
db_datatype: 'varchar',
|
|
470
|
+
element_type: 'text',
|
|
471
|
+
},
|
|
472
|
+
{ attribute_key: 'code', db_datatype: 'varchar', element_type: 'text' },
|
|
414
473
|
];
|
|
415
474
|
|
|
416
475
|
validAttributes.push(...bypassColumn);
|
|
@@ -464,6 +523,26 @@ export class EntityDynamicService {
|
|
|
464
523
|
row[attr.attribute_key] !== undefined
|
|
465
524
|
) {
|
|
466
525
|
row[attr.attribute_key] = row[attr.attribute_key] == 1 ? true : false;
|
|
526
|
+
} else if (
|
|
527
|
+
attr.element_type == 'upload' &&
|
|
528
|
+
row[attr.attribute_key] !== undefined
|
|
529
|
+
) {
|
|
530
|
+
// fetch media data
|
|
531
|
+
console.log(
|
|
532
|
+
'Fetching media for',
|
|
533
|
+
attr.attribute_key,
|
|
534
|
+
row[attr.attribute_key],
|
|
535
|
+
);
|
|
536
|
+
|
|
537
|
+
row[attr.attribute_key] =
|
|
538
|
+
row[attr.attribute_key] != null
|
|
539
|
+
? await this.mediaDataService.getMediaDownloadUrl(
|
|
540
|
+
Number(row[attr.attribute_key]),
|
|
541
|
+
loggedInUser,
|
|
542
|
+
)
|
|
543
|
+
: null;
|
|
544
|
+
|
|
545
|
+
console.log('Fetched media:', row[attr.attribute_key]);
|
|
467
546
|
}
|
|
468
547
|
}
|
|
469
548
|
|
|
@@ -490,10 +569,12 @@ export class EntityDynamicService {
|
|
|
490
569
|
private async getAttributeCodes(
|
|
491
570
|
entityType: string,
|
|
492
571
|
organizationId: string,
|
|
493
|
-
): Promise<
|
|
572
|
+
): Promise<
|
|
573
|
+
{ attribute_key: string; db_datatype: string; element_type: string }[]
|
|
574
|
+
> {
|
|
494
575
|
const result = await this.dataSource.query(
|
|
495
|
-
`SELECT attribute_key, db_datatype
|
|
496
|
-
FROM cr_attribute_master
|
|
576
|
+
`SELECT attribute_key, db_datatype, element_type
|
|
577
|
+
FROM cr_attribute_master
|
|
497
578
|
WHERE mapped_entity_type = ? AND organization_id = ?`,
|
|
498
579
|
[entityType, organizationId],
|
|
499
580
|
);
|
|
@@ -507,6 +588,7 @@ export class EntityDynamicService {
|
|
|
507
588
|
return result.map((row: any) => ({
|
|
508
589
|
attribute_key: row.attribute_key,
|
|
509
590
|
db_datatype: row.db_datatype,
|
|
591
|
+
element_type: row.element_type,
|
|
510
592
|
}));
|
|
511
593
|
}
|
|
512
594
|
|
|
@@ -16,7 +16,6 @@ import { Request, Response } from 'express';
|
|
|
16
16
|
import { UserSessionService } from '../service/user-session.service';
|
|
17
17
|
import { ConfigService } from '@nestjs/config';
|
|
18
18
|
import { IntegrationService } from '../../integration/service/integration.service';
|
|
19
|
-
import { UAParser } from 'ua-parser-js';
|
|
20
19
|
|
|
21
20
|
@Controller('auth')
|
|
22
21
|
export class LoginController {
|
|
@@ -86,13 +85,12 @@ export class LoginController {
|
|
|
86
85
|
const actualState = state.replace('gmail_config:', '');
|
|
87
86
|
|
|
88
87
|
// Forward to communication service for Gmail config handling using already exchanged tokens
|
|
89
|
-
const result =
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
);
|
|
88
|
+
const result = await this.integrationService.handleGmailTokensCallback(
|
|
89
|
+
email,
|
|
90
|
+
googleAccessToken,
|
|
91
|
+
googleRefreshToken,
|
|
92
|
+
actualState,
|
|
93
|
+
);
|
|
96
94
|
|
|
97
95
|
return res.send(
|
|
98
96
|
`<html><body><script>
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
|
|
2
|
-
PROFILE: 'dev'
|
|
1
|
+
DB_HOST: '13.234.25.234'
|
|
2
|
+
# PROFILE: 'dev'
|
|
3
3
|
DB_HOST: 'localhost'
|
|
4
4
|
DB_PORT: '3306'
|
|
5
5
|
DB_USER: 'root'
|
|
6
|
-
DB_PASS: '
|
|
6
|
+
DB_PASS: 'Rezolut@123'
|
|
7
7
|
DB_NAME: 'package_core'
|
|
8
8
|
MASTER_KEY: '0QZ2eRJv5oVILYnyBlC+FbSGVQiWKReh'
|
|
9
9
|
MASTER_IV: 'heuUQf5uPVtkotrFAOKUVw=='
|