rez_core 2.2.157 → 2.2.159
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/auth/strategies/google.strategy.js +6 -1
- package/dist/module/auth/strategies/google.strategy.js.map +1 -1
- package/dist/module/auth/strategies/jwt.strategy.js +1 -1
- package/dist/module/auth/strategies/jwt.strategy.js.map +1 -1
- package/dist/module/communication/communication.module.js +13 -2
- package/dist/module/communication/communication.module.js.map +1 -1
- package/dist/module/communication/controller/communication.controller.js.map +1 -1
- package/dist/module/communication/dto/create-config.dto.js +11 -1
- package/dist/module/communication/dto/create-config.dto.js.map +1 -1
- package/dist/module/communication/entity/communication-config.entity.js.map +1 -1
- package/dist/module/communication/entity/communication-hub.entity.js +11 -1
- package/dist/module/communication/entity/communication-hub.entity.js.map +1 -1
- package/dist/module/communication/examples/usage.example.js +9 -9
- package/dist/module/communication/examples/usage.example.js.map +1 -1
- package/dist/module/communication/factories/communication.factory.js +4 -4
- package/dist/module/communication/factories/communication.factory.js.map +1 -1
- package/dist/module/communication/factories/email.factory.js +1 -1
- package/dist/module/communication/factories/email.factory.js.map +1 -1
- package/dist/module/communication/factories/sms.factory.js +1 -1
- package/dist/module/communication/factories/sms.factory.js.map +1 -1
- package/dist/module/communication/factories/telephone.factory.js +2 -4
- package/dist/module/communication/factories/telephone.factory.js.map +1 -1
- package/dist/module/communication/factories/whatsapp.factory.js +2 -4
- package/dist/module/communication/factories/whatsapp.factory.js.map +1 -1
- package/dist/module/communication/service/communication-queue.service.d.ts +40 -0
- package/dist/module/communication/service/communication-queue.service.js +147 -0
- package/dist/module/communication/service/communication-queue.service.js.map +1 -0
- package/dist/module/communication/service/communication.service.d.ts +34 -2
- package/dist/module/communication/service/communication.service.js +117 -24
- package/dist/module/communication/service/communication.service.js.map +1 -1
- package/dist/module/communication/service/oauth.service.js +25 -20
- package/dist/module/communication/service/oauth.service.js.map +1 -1
- package/dist/module/communication/strategies/email/gmail-api.strategy.js +16 -7
- package/dist/module/communication/strategies/email/gmail-api.strategy.js.map +1 -1
- package/dist/module/communication/strategies/gmail-smtp.strategy.js +2 -3
- package/dist/module/communication/strategies/gmail-smtp.strategy.js.map +1 -1
- package/dist/module/communication/strategies/gmail.strategy.js.map +1 -1
- package/dist/module/communication/strategies/knowlarity.strategy.js +20 -14
- package/dist/module/communication/strategies/knowlarity.strategy.js.map +1 -1
- package/dist/module/communication/strategies/outlook-smtp.strategy.js +2 -3
- package/dist/module/communication/strategies/outlook-smtp.strategy.js.map +1 -1
- package/dist/module/communication/strategies/outlook.strategy.js +1 -1
- package/dist/module/communication/strategies/outlook.strategy.js.map +1 -1
- package/dist/module/communication/strategies/sms.strategy.js +1 -3
- package/dist/module/communication/strategies/sms.strategy.js.map +1 -1
- package/dist/module/communication/strategies/whatsapp.strategy.js +1 -2
- package/dist/module/communication/strategies/whatsapp.strategy.js.map +1 -1
- package/dist/module/dashboard/dashboard.module.js +1 -1
- package/dist/module/dashboard/repository/dashboard.repository.js.map +1 -1
- package/dist/module/dashboard/service/dashboard.service.js +3 -3
- package/dist/module/dashboard/service/dashboard.service.js.map +1 -1
- package/dist/module/enterprise/repository/organization.repository.js.map +1 -1
- package/dist/module/filter/entity/saved-filter-master.entity.d.ts +1 -1
- package/dist/module/filter/service/filter.service.js +3 -3
- package/dist/module/filter/service/filter.service.js.map +1 -1
- package/dist/module/filter/service/saved-filter.service.js.map +1 -1
- package/dist/module/layout/controller/layout.controller.js +1 -1
- package/dist/module/layout/controller/layout.controller.js.map +1 -1
- package/dist/module/layout/repository/header-section.repository.js.map +1 -1
- package/dist/module/layout/service/header-section.service.js +2 -2
- package/dist/module/layout/service/header-section.service.js.map +1 -1
- package/dist/module/layout_preference/repository/layout_preference.repository.js +1 -1
- package/dist/module/layout_preference/service/layout_preference.service.js +1 -1
- package/dist/module/layout_preference/service/layout_preference.service.js.map +1 -1
- package/dist/module/listmaster/controller/list-master.controller.js +1 -1
- package/dist/module/listmaster/controller/list-master.controller.js.map +1 -1
- package/dist/module/listmaster/repository/list-master.repository.js.map +1 -1
- package/dist/module/listmaster/service/list-master.service.js +2 -2
- package/dist/module/listmaster/service/list-master.service.js.map +1 -1
- package/dist/module/master/controller/master.controller.js +2 -2
- package/dist/module/master/controller/master.controller.js.map +1 -1
- package/dist/module/master/service/master.service.js +1 -1
- package/dist/module/master/service/master.service.js.map +1 -1
- package/dist/module/meta/controller/attribute-master.controller.js +3 -3
- package/dist/module/meta/controller/attribute-master.controller.js.map +1 -1
- package/dist/module/meta/controller/entity-dynamic.controller.js +1 -1
- package/dist/module/meta/controller/entity-dynamic.controller.js.map +1 -1
- package/dist/module/meta/controller/entity.controller.js +2 -2
- package/dist/module/meta/controller/entity.controller.js.map +1 -1
- package/dist/module/meta/controller/media.controller.js +1 -1
- package/dist/module/meta/controller/media.controller.js.map +1 -1
- package/dist/module/meta/controller/meta.controller.js +1 -1
- package/dist/module/meta/controller/meta.controller.js.map +1 -1
- package/dist/module/meta/dto/entity-table.dto.js.map +1 -1
- package/dist/module/meta/entity/entity-master.entity.d.ts +1 -0
- package/dist/module/meta/entity/entity-master.entity.js +4 -0
- package/dist/module/meta/entity/entity-master.entity.js.map +1 -1
- package/dist/module/meta/entity/entity-table.entity.js.map +1 -1
- package/dist/module/meta/service/entity-dynamic.service.js +1 -1
- package/dist/module/meta/service/entity-dynamic.service.js.map +1 -1
- package/dist/module/meta/service/entity-list.service.js +11 -11
- package/dist/module/meta/service/entity-list.service.js.map +1 -1
- package/dist/module/meta/service/entity-service-impl.service.js +2 -2
- package/dist/module/meta/service/entity-service-impl.service.js.map +1 -1
- package/dist/module/meta/service/entity-table-column.service.js +3 -3
- package/dist/module/meta/service/entity-table-column.service.js.map +1 -1
- package/dist/module/meta/service/entity-table.service.js +2 -2
- package/dist/module/meta/service/entity-table.service.js.map +1 -1
- package/dist/module/meta/service/media-data.service.js +3 -3
- package/dist/module/meta/service/media-data.service.js.map +1 -1
- package/dist/module/meta/service/update-form-json.service.d.ts +3 -3
- package/dist/module/meta/service/update-form-json.service.js +1 -1
- package/dist/module/meta/service/update-form-json.service.js.map +1 -1
- package/dist/module/module/controller/menu.controller.js.map +1 -1
- package/dist/module/module/controller/module-access.controller.js +1 -1
- package/dist/module/module/controller/module-access.controller.js.map +1 -1
- package/dist/module/module/entity/module-access.entity.js.map +1 -1
- package/dist/module/module/entity/module.entity.js.map +1 -1
- package/dist/module/module/service/module-access.service.d.ts +1 -1
- package/dist/module/module/service/module-access.service.js +1 -1
- package/dist/module/module/service/module-access.service.js.map +1 -1
- package/dist/module/notification/controller/otp.controller.js +3 -3
- package/dist/module/notification/controller/otp.controller.js.map +1 -1
- package/dist/module/notification/service/email.service.js +2 -2
- package/dist/module/notification/service/email.service.js.map +1 -1
- package/dist/module/notification/service/otp.service.js +1 -1
- package/dist/module/notification/service/otp.service.js.map +1 -1
- package/dist/module/user/controller/login.controller.js +4 -2
- package/dist/module/user/controller/login.controller.js.map +1 -1
- package/dist/module/user/service/login.service.js +6 -18
- package/dist/module/user/service/login.service.js.map +1 -1
- package/dist/module/user/service/role.service.js +1 -1
- package/dist/module/user/service/role.service.js.map +1 -1
- package/dist/module/user/service/user.service.js +5 -5
- package/dist/module/user/service/user.service.js.map +1 -1
- package/dist/module/workflow/controller/workflow-meta.controller.js +1 -1
- package/dist/module/workflow/controller/workflow-meta.controller.js.map +1 -1
- package/dist/module/workflow/service/action.service.js +3 -3
- package/dist/module/workflow/service/action.service.js.map +1 -1
- package/dist/module/workflow/service/stage-group.service.js +1 -1
- package/dist/module/workflow/service/stage-group.service.js.map +1 -1
- package/dist/module/workflow/service/workflow-meta.service.js +5 -5
- package/dist/module/workflow/service/workflow-meta.service.js.map +1 -1
- package/dist/resources/properties.module.js +2 -2
- package/dist/resources/properties.module.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/utils/service/base64util.service.js.map +1 -1
- package/dist/utils/service/clockIDGenUtil.service.js.map +1 -1
- package/dist/utils/service/dateUtil.service.js +1 -1
- package/dist/utils/service/dateUtil.service.js.map +1 -1
- package/dist/utils/service/encryptUtil.service.js +4 -4
- package/dist/utils/service/encryptUtil.service.js.map +1 -1
- package/dist/utils/service/excel-helper.service.js +4 -1
- package/dist/utils/service/excel-helper.service.js.map +1 -1
- package/dist/utils/service/json-util.service.js.map +1 -1
- package/dist/utils/service/loggingUtil.service.js +3 -3
- package/dist/utils/service/loggingUtil.service.js.map +1 -1
- package/package.json +1 -1
- package/src/decorators/roles.decorator.ts +1 -1
- package/src/module/auth/strategies/google.strategy.ts +6 -1
- package/src/module/auth/strategies/jwt.strategy.ts +1 -1
- package/src/module/communication/communication.module.ts +13 -2
- package/src/module/communication/controller/communication.controller.ts +21 -18
- package/src/module/communication/dto/create-config.dto.ts +32 -13
- package/src/module/communication/entity/communication-config.entity.ts +15 -9
- package/src/module/communication/entity/communication-hub.entity.ts +29 -3
- package/src/module/communication/examples/usage.example.ts +18 -17
- package/src/module/communication/factories/communication.factory.ts +36 -18
- package/src/module/communication/factories/email.factory.ts +8 -5
- package/src/module/communication/factories/sms.factory.ts +8 -5
- package/src/module/communication/factories/telephone.factory.ts +9 -8
- package/src/module/communication/factories/whatsapp.factory.ts +9 -8
- package/src/module/communication/service/communication-queue.service.ts +214 -0
- package/src/module/communication/service/communication.service.ts +340 -101
- package/src/module/communication/service/oauth.service.ts +67 -46
- package/src/module/communication/strategies/email/gmail-api.strategy.ts +44 -24
- package/src/module/communication/strategies/gmail-smtp.strategy.ts +15 -11
- package/src/module/communication/strategies/gmail.strategy.ts +15 -7
- package/src/module/communication/strategies/knowlarity.strategy.ts +67 -33
- package/src/module/communication/strategies/outlook-smtp.strategy.ts +15 -11
- package/src/module/communication/strategies/outlook.strategy.ts +12 -5
- package/src/module/communication/strategies/sms.strategy.ts +13 -10
- package/src/module/communication/strategies/whatsapp.strategy.ts +13 -9
- package/src/module/dashboard/dashboard.module.ts +1 -1
- package/src/module/dashboard/repository/dashboard.repository.ts +4 -2
- package/src/module/dashboard/service/dashboard.service.ts +16 -12
- package/src/module/enterprise/repository/organization.repository.ts +3 -1
- package/src/module/enterprise/service/enterprise.service.ts +2 -2
- package/src/module/filter/entity/saved-filter-master.entity.ts +3 -3
- package/src/module/filter/service/filter.service.ts +3 -3
- package/src/module/filter/service/saved-filter.service.ts +1 -1
- package/src/module/layout/controller/layout.controller.ts +1 -1
- package/src/module/layout/repository/header-section.repository.ts +2 -2
- package/src/module/layout/service/header-section.service.ts +2 -3
- package/src/module/layout_preference/repository/layout_preference.repository.ts +2 -2
- package/src/module/layout_preference/service/layout_preference.service.ts +1 -1
- package/src/module/listmaster/controller/list-master.controller.ts +1 -1
- package/src/module/listmaster/repository/list-master.repository.ts +2 -2
- package/src/module/listmaster/service/list-master.service.ts +2 -2
- package/src/module/master/controller/master.controller.ts +2 -2
- package/src/module/master/service/master.service.ts +1 -1
- package/src/module/meta/controller/attribute-master.controller.ts +3 -3
- package/src/module/meta/controller/entity-dynamic.controller.ts +1 -1
- package/src/module/meta/controller/entity.controller.ts +2 -2
- package/src/module/meta/controller/media.controller.ts +1 -1
- package/src/module/meta/controller/meta.controller.ts +1 -1
- package/src/module/meta/dto/entity-tab.dto.ts +4 -4
- package/src/module/meta/dto/entity-table.dto.ts +5 -6
- package/src/module/meta/entity/entity-master.entity.ts +3 -0
- package/src/module/meta/entity/entity-table.entity.ts +1 -2
- package/src/module/meta/service/entity-dynamic.service.ts +1 -1
- package/src/module/meta/service/entity-list.service.ts +18 -14
- package/src/module/meta/service/entity-service-impl.service.ts +2 -2
- package/src/module/meta/service/entity-table-column.service.ts +3 -3
- package/src/module/meta/service/entity-table.service.ts +2 -2
- package/src/module/meta/service/entity.service.ts +1 -1
- package/src/module/meta/service/media-data.service.ts +3 -3
- package/src/module/meta/service/update-form-json.service.ts +17 -26
- package/src/module/module/controller/menu.controller.ts +0 -1
- package/src/module/module/controller/module-access.controller.ts +2 -3
- package/src/module/module/entity/menu.entity.ts +1 -1
- package/src/module/module/entity/module-access.entity.ts +6 -6
- package/src/module/module/entity/module-action.entity.ts +2 -2
- package/src/module/module/entity/module.entity.ts +0 -1
- package/src/module/module/service/module-access.service.ts +7 -8
- package/src/module/notification/controller/otp.controller.ts +10 -4
- package/src/module/notification/repository/otp.repository.ts +1 -1
- package/src/module/notification/service/email.service.ts +2 -2
- package/src/module/notification/service/otp.service.ts +8 -3
- package/src/module/third-party-module/third-party.module.ts +1 -1
- package/src/module/user/controller/login.controller.ts +27 -12
- package/src/module/user/service/login.service.ts +28 -39
- package/src/module/user/service/role.service.ts +1 -1
- package/src/module/user/service/user.service.ts +5 -5
- package/src/module/workflow/controller/workflow-meta.controller.ts +1 -1
- package/src/module/workflow/service/action.service.ts +3 -3
- package/src/module/workflow/service/stage-group.service.ts +1 -1
- package/src/module/workflow/service/workflow-meta.service.ts +5 -5
- package/src/resources/properties.module.ts +10 -10
- package/src/utils/dto/excel-data.dto.ts +2 -2
- package/src/utils/dto/excelsheet-data.dto.ts +3 -3
- package/src/utils/service/base64util.service.ts +16 -17
- package/src/utils/service/clockIDGenUtil.service.ts +15 -13
- package/src/utils/service/dateUtil.service.ts +6 -6
- package/src/utils/service/encryptUtil.service.ts +4 -4
- package/src/utils/service/excel-helper.service.ts +4 -1
- package/src/utils/service/file-util.service.ts +2 -2
- package/src/utils/service/json-util.service.ts +19 -19
- package/src/utils/service/loggingUtil.service.ts +4 -4
|
@@ -82,14 +82,14 @@ export class EntityTableService {
|
|
|
82
82
|
loggedInUser: any,
|
|
83
83
|
) {
|
|
84
84
|
console.log(entityType, listType, displayType, loggedInUser);
|
|
85
|
-
|
|
85
|
+
const entityTable = await this.findByEntityTypeAndListTypeAndDisplayType(
|
|
86
86
|
entityType,
|
|
87
87
|
listType,
|
|
88
88
|
displayType,
|
|
89
89
|
loggedInUser?.organization_id,
|
|
90
90
|
);
|
|
91
91
|
console.log(entityTable, 'entityTable');
|
|
92
|
-
|
|
92
|
+
const entityTableDto = entityTable as EntityTableDto;
|
|
93
93
|
if (entityTable) {
|
|
94
94
|
entityTableDto.column_list =
|
|
95
95
|
await this.entityTableColumnRepository.findByParentIdAndParentType(
|
|
@@ -53,7 +53,7 @@ export class MediaDataService extends EntityServiceImpl {
|
|
|
53
53
|
ContentType: this.getContentType(ext),
|
|
54
54
|
});
|
|
55
55
|
|
|
56
|
-
|
|
56
|
+
const mediaData = new MediaData();
|
|
57
57
|
mediaData.file_name = fileName;
|
|
58
58
|
mediaData.mapped_attribute_key = mappedAttributeKey;
|
|
59
59
|
mediaData.status = STATUS_PENDING;
|
|
@@ -65,7 +65,7 @@ export class MediaDataService extends EntityServiceImpl {
|
|
|
65
65
|
}
|
|
66
66
|
mediaData.media_url = s3Key;
|
|
67
67
|
|
|
68
|
-
|
|
68
|
+
const savedEntity = await super.createEntity(mediaData, loggedInUser);
|
|
69
69
|
|
|
70
70
|
if (savedEntity) {
|
|
71
71
|
return { id: savedEntity.id, path: s3Key, uploadUrl };
|
|
@@ -125,7 +125,7 @@ export class MediaDataService extends EntityServiceImpl {
|
|
|
125
125
|
id,
|
|
126
126
|
loggedInUser,
|
|
127
127
|
);
|
|
128
|
-
|
|
128
|
+
const mediaData = entityData as MediaData;
|
|
129
129
|
const signedUrl = await this.s3.getSignedUrlPromise('getObject', {
|
|
130
130
|
Bucket: this.bucketName,
|
|
131
131
|
Key: mediaData.media_url,
|
|
@@ -1,31 +1,22 @@
|
|
|
1
|
-
import { Injectable } from
|
|
2
|
-
import { InjectRepository } from
|
|
3
|
-
import { ViewMaster } from
|
|
4
|
-
import { Repository } from
|
|
5
|
-
import { ClockIDGenService } from
|
|
6
|
-
|
|
7
|
-
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
|
+
import { ViewMaster } from '../entity/view-master.entity';
|
|
4
|
+
import { Repository } from 'typeorm';
|
|
5
|
+
import { ClockIDGenService } from 'src/utils/service/clockIDGenUtil.service';
|
|
8
6
|
|
|
9
7
|
@Injectable()
|
|
10
|
-
export class UpdateFormJsonService {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
) {}
|
|
17
|
-
|
|
18
|
-
async updateFormJson(body:any): Promise<ViewMaster> {
|
|
19
|
-
|
|
20
|
-
const entityType = this.clockIDGenService.idGenerator();
|
|
21
|
-
|
|
22
|
-
const newViewMasterRecord = ({})
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return this.viewMasterRepository.save(newViewMasterRecord)
|
|
26
|
-
}
|
|
27
|
-
|
|
8
|
+
export class UpdateFormJsonService {
|
|
9
|
+
constructor(
|
|
10
|
+
@InjectRepository(ViewMaster)
|
|
11
|
+
private readonly viewMasterRepository: Repository<ViewMaster>,
|
|
12
|
+
private readonly clockIDGenService: ClockIDGenService,
|
|
13
|
+
) {}
|
|
28
14
|
|
|
15
|
+
async updateFormJson(body: any): Promise<ViewMaster> {
|
|
16
|
+
const entityType = this.clockIDGenService.idGenerator();
|
|
29
17
|
|
|
18
|
+
const newViewMasterRecord = {};
|
|
30
19
|
|
|
31
|
-
|
|
20
|
+
return this.viewMasterRepository.save(newViewMasterRecord);
|
|
21
|
+
}
|
|
22
|
+
}
|
|
@@ -23,12 +23,11 @@ export class ModuleAccessController {
|
|
|
23
23
|
private readonly menuService: MenuService,
|
|
24
24
|
) {}
|
|
25
25
|
|
|
26
|
-
|
|
27
26
|
@Get('roles')
|
|
28
27
|
async getRoles(
|
|
29
28
|
@Query('appcode') appcode: string,
|
|
30
29
|
@Query('include') include: string, // ✅ declare it as boolean
|
|
31
|
-
@Request() req
|
|
30
|
+
@Request() req,
|
|
32
31
|
) {
|
|
33
32
|
const { level_type, level_id, organization_id } = req.user.userData;
|
|
34
33
|
|
|
@@ -37,7 +36,7 @@ export class ModuleAccessController {
|
|
|
37
36
|
level_type,
|
|
38
37
|
level_id,
|
|
39
38
|
organization_id,
|
|
40
|
-
include: include ===
|
|
39
|
+
include: include === 'true', // ensure it's either true or false
|
|
41
40
|
});
|
|
42
41
|
}
|
|
43
42
|
|
|
@@ -5,21 +5,21 @@ export class ModuleAccess {
|
|
|
5
5
|
@PrimaryGeneratedColumn()
|
|
6
6
|
id: number;
|
|
7
7
|
|
|
8
|
-
@Column({type: 'varchar', length: 100, nullable: true})
|
|
8
|
+
@Column({ type: 'varchar', length: 100, nullable: true })
|
|
9
9
|
module_code: string;
|
|
10
10
|
|
|
11
|
-
@Column({type: 'varchar', length: 100, nullable: true })
|
|
11
|
+
@Column({ type: 'varchar', length: 100, nullable: true })
|
|
12
12
|
role_code: string;
|
|
13
13
|
|
|
14
|
-
@Column({type: 'int', nullable: true })
|
|
14
|
+
@Column({ type: 'int', nullable: true })
|
|
15
15
|
access_flag: number;
|
|
16
16
|
|
|
17
|
-
@Column({type: 'varchar', length: 100, nullable: true })
|
|
17
|
+
@Column({ type: 'varchar', length: 100, nullable: true })
|
|
18
18
|
action_type: string;
|
|
19
19
|
|
|
20
|
-
@Column({type: 'varchar', length: 100, nullable: true })
|
|
20
|
+
@Column({ type: 'varchar', length: 100, nullable: true })
|
|
21
21
|
level_type: string;
|
|
22
22
|
|
|
23
|
-
@Column({type: 'varchar', length: 100, nullable: true})
|
|
23
|
+
@Column({ type: 'varchar', length: 100, nullable: true })
|
|
24
24
|
appcode: string;
|
|
25
25
|
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { Column, Entity, PrimaryGeneratedColumn, Unique } from 'typeorm';
|
|
2
2
|
|
|
3
|
-
@Entity({ name: 'cr_module_action' })
|
|
4
|
-
@Unique(['module_code', 'action_type'])
|
|
3
|
+
@Entity({ name: 'cr_module_action' }) // <- new table name
|
|
4
|
+
@Unique(['module_code', 'action_type']) // enforce uniqueness per module + action
|
|
5
5
|
export class ModuleAction {
|
|
6
6
|
@PrimaryGeneratedColumn()
|
|
7
7
|
id: number;
|
|
@@ -33,7 +33,7 @@ export class ModuleAccessService {
|
|
|
33
33
|
level_type,
|
|
34
34
|
level_id,
|
|
35
35
|
organization_id,
|
|
36
|
-
include
|
|
36
|
+
include,
|
|
37
37
|
}: {
|
|
38
38
|
appcode: string;
|
|
39
39
|
level_type?: string;
|
|
@@ -46,36 +46,35 @@ export class ModuleAccessService {
|
|
|
46
46
|
.select('*')
|
|
47
47
|
.from('cr_role', 'role')
|
|
48
48
|
.where('role.appcode = :appcode', { appcode });
|
|
49
|
-
|
|
49
|
+
|
|
50
50
|
// Only add this condition if `include` is false (exclude factory roles)
|
|
51
51
|
if (!include) {
|
|
52
52
|
query.andWhere('(role.is_factory IS NULL OR role.is_factory != 1)');
|
|
53
53
|
}
|
|
54
|
-
|
|
54
|
+
|
|
55
55
|
if (level_type) {
|
|
56
56
|
query.andWhere('role.level_type = :level_type', { level_type });
|
|
57
57
|
}
|
|
58
|
-
|
|
58
|
+
|
|
59
59
|
if (organization_id) {
|
|
60
60
|
query.andWhere('role.organization_id = :organization_id', {
|
|
61
61
|
organization_id,
|
|
62
62
|
});
|
|
63
63
|
}
|
|
64
|
-
|
|
64
|
+
|
|
65
65
|
if (level_id !== undefined) {
|
|
66
66
|
query.andWhere('role.level_id = :level_id', {
|
|
67
67
|
level_id: String(level_id),
|
|
68
68
|
});
|
|
69
69
|
}
|
|
70
|
-
|
|
70
|
+
|
|
71
71
|
const roles = await query.getRawMany();
|
|
72
|
-
|
|
72
|
+
|
|
73
73
|
return roles.map((role) => ({
|
|
74
74
|
label: role.name,
|
|
75
75
|
value: role.id,
|
|
76
76
|
}));
|
|
77
77
|
}
|
|
78
|
-
|
|
79
78
|
|
|
80
79
|
async getAccessListing(
|
|
81
80
|
roleIds: number[],
|
|
@@ -26,13 +26,13 @@ export class OtpController {
|
|
|
26
26
|
@Post('generate')
|
|
27
27
|
@HttpCode(HttpStatus.OK)
|
|
28
28
|
async generateOtp(@Body() request: any) {
|
|
29
|
-
|
|
30
|
-
|
|
29
|
+
const identifier = request.identifier;
|
|
30
|
+
const service = request.service;
|
|
31
31
|
|
|
32
32
|
if (!identifier || !service) {
|
|
33
33
|
throw new BadRequestException('Missing identifier or service!');
|
|
34
34
|
}
|
|
35
|
-
|
|
35
|
+
const otp = await this.otpService.generate(
|
|
36
36
|
identifier,
|
|
37
37
|
service,
|
|
38
38
|
parseInt(this.otpExpiry),
|
|
@@ -44,7 +44,13 @@ export class OtpController {
|
|
|
44
44
|
@Post('verify')
|
|
45
45
|
@HttpCode(HttpStatus.OK)
|
|
46
46
|
async verifyOtp(
|
|
47
|
-
@Body()
|
|
47
|
+
@Body()
|
|
48
|
+
body: {
|
|
49
|
+
otp: string;
|
|
50
|
+
otp_id: string;
|
|
51
|
+
identifier: string;
|
|
52
|
+
subdomain: string;
|
|
53
|
+
},
|
|
48
54
|
) {
|
|
49
55
|
return await this.otpService.verifyOtp(body);
|
|
50
56
|
}
|
|
@@ -27,7 +27,7 @@ export class EmailService {
|
|
|
27
27
|
const compiled = Handlebars.compile(template.rich_text || '');
|
|
28
28
|
const htmlContent = compiled(context);
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
const attachments: any[] = [];
|
|
31
31
|
|
|
32
32
|
if (icsPayload) {
|
|
33
33
|
const icsBase64 = await this.icsService.generateIcs(icsPayload);
|
|
@@ -96,7 +96,7 @@ export class EmailService {
|
|
|
96
96
|
}
|
|
97
97
|
const htmlContent = compiled(context);
|
|
98
98
|
|
|
99
|
-
|
|
99
|
+
const attachments: any[] = [];
|
|
100
100
|
|
|
101
101
|
if (icsPayload) {
|
|
102
102
|
const icsBase64 = await this.icsService.generateIcs(icsPayload);
|
|
@@ -27,7 +27,7 @@ export class OtpService {
|
|
|
27
27
|
expiresIn: number = 5,
|
|
28
28
|
otpLength: number = 6,
|
|
29
29
|
) {
|
|
30
|
-
|
|
30
|
+
const otp = new Otp();
|
|
31
31
|
otp.created_date = new Date();
|
|
32
32
|
otp.otp_id = this.idGen.idGenerator();
|
|
33
33
|
otp.identifier = identifier;
|
|
@@ -53,8 +53,13 @@ export class OtpService {
|
|
|
53
53
|
return await this.otpRepository.save(otp);
|
|
54
54
|
}
|
|
55
55
|
|
|
56
|
-
async verifyOtp(body: {
|
|
57
|
-
|
|
56
|
+
async verifyOtp(body: {
|
|
57
|
+
otp: string;
|
|
58
|
+
otp_id: string;
|
|
59
|
+
identifier: string;
|
|
60
|
+
subdomain: string;
|
|
61
|
+
}) {
|
|
62
|
+
const { otp, otp_id, identifier, subdomain } = body;
|
|
58
63
|
const verifyOTPResponse = { isValid: false };
|
|
59
64
|
|
|
60
65
|
// Find OTP entity by ID
|
|
@@ -28,8 +28,13 @@ export class LoginController {
|
|
|
28
28
|
|
|
29
29
|
@Post('login')
|
|
30
30
|
async login(@Body() body, @Res() res: Response) {
|
|
31
|
-
const { email_id, password, appcode, organization_id
|
|
32
|
-
const result = await this.loginService.login(
|
|
31
|
+
const { email_id, password, appcode, organization_id, subdomain } = body;
|
|
32
|
+
const result = await this.loginService.login(
|
|
33
|
+
email_id,
|
|
34
|
+
password,
|
|
35
|
+
false,
|
|
36
|
+
subdomain,
|
|
37
|
+
);
|
|
33
38
|
return res.status(HttpStatus.OK).json(result);
|
|
34
39
|
}
|
|
35
40
|
@Post('form-login')
|
|
@@ -60,23 +65,33 @@ export class LoginController {
|
|
|
60
65
|
@Get('google/callback')
|
|
61
66
|
@UseGuards(GoogleAuthGuard)
|
|
62
67
|
async googleAuthRedirect(@Req() req: any, @Res() res: Response) {
|
|
63
|
-
const {
|
|
68
|
+
const {
|
|
69
|
+
email,
|
|
70
|
+
name,
|
|
71
|
+
accessToken: googleAccessToken,
|
|
72
|
+
refreshToken: googleRefreshToken,
|
|
73
|
+
} = req.user;
|
|
64
74
|
const { state } = req.query;
|
|
65
75
|
|
|
66
76
|
// Check if this is a Gmail configuration request
|
|
67
|
-
if (
|
|
77
|
+
if (
|
|
78
|
+
state &&
|
|
79
|
+
typeof state === 'string' &&
|
|
80
|
+
state.startsWith('gmail_config:')
|
|
81
|
+
) {
|
|
68
82
|
try {
|
|
69
83
|
// Extract the actual state from the prefixed state
|
|
70
84
|
const actualState = state.replace('gmail_config:', '');
|
|
71
|
-
|
|
85
|
+
|
|
72
86
|
// Forward to communication service for Gmail config handling using already exchanged tokens
|
|
73
|
-
const result =
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
87
|
+
const result =
|
|
88
|
+
await this.communicationService.handleGmailTokensCallback(
|
|
89
|
+
email,
|
|
90
|
+
googleAccessToken,
|
|
91
|
+
googleRefreshToken,
|
|
92
|
+
actualState,
|
|
93
|
+
);
|
|
94
|
+
|
|
80
95
|
return res.status(200).json({
|
|
81
96
|
success: true,
|
|
82
97
|
message: 'Gmail configuration saved successfully',
|
|
@@ -43,53 +43,43 @@ export class LoginService {
|
|
|
43
43
|
subdomain?: string,
|
|
44
44
|
) {
|
|
45
45
|
let organization;
|
|
46
|
-
|
|
46
|
+
|
|
47
47
|
// 🔹 Step 1: If subdomain is provided, resolve the organization
|
|
48
48
|
if (subdomain) {
|
|
49
49
|
organization =
|
|
50
|
-
await this.organizationRepository.findOrganizationBySubdomain(
|
|
51
|
-
|
|
50
|
+
await this.organizationRepository.findOrganizationBySubdomain(
|
|
51
|
+
subdomain,
|
|
52
|
+
);
|
|
53
|
+
|
|
52
54
|
if (!organization) {
|
|
53
|
-
|
|
54
|
-
success: false,
|
|
55
|
-
message: 'Invalid subdomain provided.',
|
|
56
|
-
type: 'subdomain',
|
|
57
|
-
};
|
|
55
|
+
throw new BadRequestException('Organization not found.');
|
|
58
56
|
}
|
|
59
57
|
}
|
|
60
|
-
|
|
58
|
+
|
|
61
59
|
// 🔹 Step 2: Find the user by email + organization check
|
|
62
60
|
const user = await this.userService.findByEmailId(email);
|
|
63
|
-
|
|
61
|
+
|
|
64
62
|
if (!user || (organization && user.organization_id !== organization.id)) {
|
|
65
|
-
|
|
66
|
-
success: false,
|
|
67
|
-
message: 'Your Email ID is not registered with this organization.',
|
|
68
|
-
type: 'email',
|
|
69
|
-
};
|
|
63
|
+
throw new BadRequestException('User not found in organization.');
|
|
70
64
|
}
|
|
71
|
-
|
|
65
|
+
|
|
72
66
|
// 🔹 Step 3: Verify org status
|
|
73
67
|
const userOrgData = await this.organizationRepository.findOrganizationById(
|
|
74
68
|
user.organization_id,
|
|
75
69
|
);
|
|
76
|
-
|
|
70
|
+
|
|
77
71
|
const resolveStatus = await this.listMasterService.getResolvedListCode(
|
|
78
72
|
STATUS_ACTIVE,
|
|
79
73
|
user?.organization_id || 0,
|
|
80
74
|
);
|
|
81
|
-
|
|
75
|
+
|
|
82
76
|
if (
|
|
83
77
|
user.status != resolveStatus.id ||
|
|
84
78
|
userOrgData?.status != resolveStatus.id
|
|
85
79
|
) {
|
|
86
|
-
|
|
87
|
-
success: false,
|
|
88
|
-
message: 'Your account is inactive.',
|
|
89
|
-
type: 'email',
|
|
90
|
-
};
|
|
80
|
+
throw new BadRequestException('User is inactive.');
|
|
91
81
|
}
|
|
92
|
-
|
|
82
|
+
|
|
93
83
|
// 🔹 Step 4: Verify password if not OTP
|
|
94
84
|
if (!is_otp) {
|
|
95
85
|
const encryptedPassword = EncryptUtilService.encryptGCM(
|
|
@@ -97,7 +87,7 @@ export class LoginService {
|
|
|
97
87
|
this.masterKey,
|
|
98
88
|
this.masterIv,
|
|
99
89
|
);
|
|
100
|
-
|
|
90
|
+
|
|
101
91
|
if (encryptedPassword !== user.password) {
|
|
102
92
|
return {
|
|
103
93
|
success: false,
|
|
@@ -106,54 +96,54 @@ export class LoginService {
|
|
|
106
96
|
};
|
|
107
97
|
}
|
|
108
98
|
}
|
|
109
|
-
|
|
99
|
+
|
|
110
100
|
// 🔹 Step 5: App access check
|
|
111
|
-
|
|
112
|
-
|
|
101
|
+
const appcode = user.last_app_access;
|
|
102
|
+
|
|
113
103
|
if (!user.last_app_access) {
|
|
114
104
|
await this.userService.setDefaultLastAccess(user.id, appcode);
|
|
115
105
|
}
|
|
116
|
-
|
|
106
|
+
|
|
117
107
|
const roleMappings = await this.userRoleMappingRepository.find({
|
|
118
108
|
where: { user_id: user.id, appcode },
|
|
119
109
|
});
|
|
120
|
-
|
|
110
|
+
|
|
121
111
|
if (!roleMappings.length) {
|
|
122
112
|
throw new BadRequestException(
|
|
123
113
|
'User does not have any access mapped for this app.',
|
|
124
114
|
);
|
|
125
115
|
}
|
|
126
|
-
|
|
116
|
+
|
|
127
117
|
// 🔹 Step 6: Resolve default access
|
|
128
118
|
const defaultAccess = await this.getDefaultAccess(user, roleMappings);
|
|
129
|
-
|
|
119
|
+
|
|
130
120
|
await this.userService.setLastLevelTypeAndId(
|
|
131
121
|
user.id,
|
|
132
122
|
defaultAccess.level_type,
|
|
133
123
|
defaultAccess.level_id,
|
|
134
124
|
defaultAccess.appcode,
|
|
135
125
|
);
|
|
136
|
-
|
|
126
|
+
|
|
137
127
|
const token = await this.userSessionService.createSession(
|
|
138
128
|
user,
|
|
139
129
|
defaultAccess.appcode,
|
|
140
130
|
defaultAccess,
|
|
141
131
|
);
|
|
142
|
-
|
|
132
|
+
|
|
143
133
|
// 🔹 Step 7: Update first login + invitation status
|
|
144
134
|
const resolvedInvitationStatus =
|
|
145
135
|
await this.listMasterService.getResolvedListCode(
|
|
146
136
|
INVITATION_STATUS_ACCEPTED,
|
|
147
137
|
user?.organization_id || 0,
|
|
148
138
|
);
|
|
149
|
-
|
|
139
|
+
|
|
150
140
|
if (user.is_firstlogin === 1) {
|
|
151
141
|
user.invitation_status = resolvedInvitationStatus.id;
|
|
152
142
|
user.is_firstlogin = 0;
|
|
153
143
|
const { password, ...userWithoutPassword } = user;
|
|
154
144
|
await this.userService.updateEntity(userWithoutPassword, user);
|
|
155
145
|
}
|
|
156
|
-
|
|
146
|
+
|
|
157
147
|
// 🔹 Step 8: Return response
|
|
158
148
|
return {
|
|
159
149
|
success: true,
|
|
@@ -163,7 +153,6 @@ export class LoginService {
|
|
|
163
153
|
level_id: defaultAccess.level_id,
|
|
164
154
|
};
|
|
165
155
|
}
|
|
166
|
-
|
|
167
156
|
|
|
168
157
|
async formLogin(body: any): Promise<any> {
|
|
169
158
|
if (body) {
|
|
@@ -257,7 +246,7 @@ export class LoginService {
|
|
|
257
246
|
}
|
|
258
247
|
|
|
259
248
|
async loginWithGoogle(email: string, name) {
|
|
260
|
-
|
|
249
|
+
const user = await this.userService.findByEmailId(email);
|
|
261
250
|
|
|
262
251
|
if (!user) {
|
|
263
252
|
return new BadRequestException('User not found');
|
|
@@ -284,7 +273,7 @@ export class LoginService {
|
|
|
284
273
|
}
|
|
285
274
|
|
|
286
275
|
async logout(sessionKey: string) {
|
|
287
|
-
|
|
276
|
+
const userSession =
|
|
288
277
|
await this.userSessionService.findBySessionKey(sessionKey);
|
|
289
278
|
if (userSession) {
|
|
290
279
|
userSession.is_session_loggedout = 1;
|
|
@@ -28,7 +28,7 @@ export class RoleService extends EntityServiceImpl {
|
|
|
28
28
|
entityData: BaseEntity,
|
|
29
29
|
loggedInUser: UserData,
|
|
30
30
|
): Promise<ServiceResult<BaseEntity>> {
|
|
31
|
-
|
|
31
|
+
const role = entityData as Role;
|
|
32
32
|
|
|
33
33
|
// if level_type and level_id are not provided, use loggedInUser's values
|
|
34
34
|
role.level_type = entityData.level_type || loggedInUser.level_type;
|
|
@@ -49,7 +49,7 @@ export class UserService extends EntityServiceImpl {
|
|
|
49
49
|
loggedInUser: UserData | null,
|
|
50
50
|
manager?: EntityManager,
|
|
51
51
|
): Promise<ServiceResult<BaseEntity>> {
|
|
52
|
-
|
|
52
|
+
const userData = entityData as CreateUserDto;
|
|
53
53
|
|
|
54
54
|
let existingUser = await this.userRepository.findByEmailId(
|
|
55
55
|
userData.email_id,
|
|
@@ -139,12 +139,12 @@ export class UserService extends EntityServiceImpl {
|
|
|
139
139
|
): Promise<BaseEntity | null> {
|
|
140
140
|
const user = await this.userRepository.findById(id);
|
|
141
141
|
if (user) {
|
|
142
|
-
|
|
142
|
+
const userRoleMappings: UserRoleMapping[] | null =
|
|
143
143
|
await this.userRoleMappingService.findByUserId(id);
|
|
144
144
|
if (userRoleMappings) {
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
for (
|
|
145
|
+
const userDto = user as unknown as CreateUserDto;
|
|
146
|
+
const roles: any[] = [];
|
|
147
|
+
for (const i in userRoleMappings) {
|
|
148
148
|
const userRoleMapping = userRoleMappings[i];
|
|
149
149
|
const roleId = userRoleMapping.role_id;
|
|
150
150
|
const role = await super.getEntityData(
|
|
@@ -25,7 +25,7 @@ export class WorkflowMetaController {
|
|
|
25
25
|
@Query('entityId') mapped_entity_id: number,
|
|
26
26
|
@Req() req: Request & { user: any },
|
|
27
27
|
): Promise<StageMovementData | null> {
|
|
28
|
-
|
|
28
|
+
const loggedInUser = req.user.userData;
|
|
29
29
|
|
|
30
30
|
return this.workflowMetaService.getCurrentStage(
|
|
31
31
|
mapped_entity_type,
|
|
@@ -133,7 +133,7 @@ export class ActionService extends EntityServiceImpl {
|
|
|
133
133
|
};
|
|
134
134
|
|
|
135
135
|
// Pass only actionData (without template) to super.updateEntity
|
|
136
|
-
|
|
136
|
+
const action = await super.updateEntity({ ...actionData }, loggedInUser);
|
|
137
137
|
|
|
138
138
|
if (!action) {
|
|
139
139
|
throw new Error('Action not found or could not be updated');
|
|
@@ -145,14 +145,14 @@ export class ActionService extends EntityServiceImpl {
|
|
|
145
145
|
);
|
|
146
146
|
|
|
147
147
|
// stage mapping
|
|
148
|
-
|
|
148
|
+
const stageActionMapping = {
|
|
149
149
|
action_id: action.id,
|
|
150
150
|
stage_id: stage_id,
|
|
151
151
|
entity_type: 'WFSA',
|
|
152
152
|
id: stageMapID.length > 0 ? stageMapID[0].id : null,
|
|
153
153
|
} as any;
|
|
154
154
|
|
|
155
|
-
|
|
155
|
+
const stageActionMappingData = await super.updateEntity(
|
|
156
156
|
stageActionMapping,
|
|
157
157
|
loggedInUser,
|
|
158
158
|
);
|
|
@@ -216,7 +216,7 @@ export class StageGroupService extends EntityServiceImpl {
|
|
|
216
216
|
|
|
217
217
|
if (user.length === 0) return null;
|
|
218
218
|
|
|
219
|
-
|
|
219
|
+
const profileImageId = user[0].profile_image;
|
|
220
220
|
let profile: any = null;
|
|
221
221
|
|
|
222
222
|
if (profileImageId) {
|