rez_core 1.0.26 → 1.0.28
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/.idea/250218_nodejs_core.iml +12 -0
- package/.idea/codeStyles/Project.xml +59 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/dataSources.xml +12 -0
- package/.idea/modules.xml +8 -0
- package/.idea/prettier.xml +6 -0
- package/.idea/vcs.xml +6 -0
- package/dist/app.module.d.ts +0 -0
- package/dist/app.module.js +1 -0
- package/dist/app.module.js.map +1 -0
- package/dist/config/database.config.d.ts +3 -0
- package/dist/config/database.config.js +14 -6
- package/dist/config/database.config.js.map +1 -1
- package/dist/constant/global.constant.d.ts +6 -2
- package/dist/constant/global.constant.js +7 -3
- package/dist/constant/global.constant.js.map +1 -1
- package/dist/core.module.js +5 -2
- package/dist/core.module.js.map +1 -1
- package/dist/main.js +2 -1
- package/dist/main.js.map +1 -1
- package/dist/module/auth/auth.module.js +1 -1
- package/dist/module/auth/auth.module.js.map +1 -1
- package/dist/module/auth/guards/role.guard.js +3 -3
- package/dist/module/auth/strategies/google.strategy.d.ts +3 -1
- package/dist/module/auth/strategies/google.strategy.js +7 -5
- package/dist/module/auth/strategies/google.strategy.js.map +1 -1
- package/dist/module/auth/strategies/jwt.strategy.d.ts +4 -4
- package/dist/module/auth/strategies/jwt.strategy.js +8 -9
- package/dist/module/auth/strategies/jwt.strategy.js.map +1 -1
- package/dist/module/layout/controller/layout.controller.d.ts +11 -0
- package/dist/module/layout/controller/layout.controller.js +61 -0
- package/dist/module/layout/controller/layout.controller.js.map +1 -0
- package/dist/module/layout/dto/header.dto.d.ts +0 -0
- package/dist/module/layout/dto/header.dto.js +1 -0
- package/dist/module/layout/dto/header.dto.js.map +1 -0
- package/dist/module/layout/entity/header-items.entity.d.ts +10 -0
- package/dist/module/layout/entity/header-items.entity.js +52 -0
- package/dist/module/layout/entity/header-items.entity.js.map +1 -0
- package/dist/module/layout/entity/header-section.entity.d.ts +7 -0
- package/dist/module/layout/entity/header-section.entity.js +40 -0
- package/dist/module/layout/entity/header-section.entity.js.map +1 -0
- package/dist/module/layout/layout.module.d.ts +2 -0
- package/dist/module/layout/layout.module.js +30 -0
- package/dist/module/layout/layout.module.js.map +1 -0
- package/dist/module/layout/repository/header-items.repository.d.ts +7 -0
- package/dist/module/layout/repository/header-items.repository.js +36 -0
- package/dist/module/layout/repository/header-items.repository.js.map +1 -0
- package/dist/module/layout/repository/header-section.repository.d.ts +7 -0
- package/dist/module/layout/repository/header-section.repository.js +36 -0
- package/dist/module/layout/repository/header-section.repository.js.map +1 -0
- package/dist/module/layout/service/header-section.service.d.ts +8 -0
- package/dist/module/layout/service/header-section.service.js +37 -0
- package/dist/module/layout/service/header-section.service.js.map +1 -0
- package/dist/module/meta/entity/base-entity.entity.d.ts +1 -2
- package/dist/module/meta/entity/base-entity.entity.js +1 -2
- package/dist/module/meta/entity/base-entity.entity.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/media-data.entity.d.ts +11 -0
- package/dist/module/meta/entity/media-data.entity.js +55 -0
- package/dist/module/meta/entity/media-data.entity.js.map +1 -0
- package/dist/module/meta/entity.module.js +8 -1
- package/dist/module/meta/entity.module.js.map +1 -1
- package/dist/module/meta/repository/media-data.repository.d.ts +9 -0
- package/dist/module/meta/repository/media-data.repository.js +55 -0
- package/dist/module/meta/repository/media-data.repository.js.map +1 -0
- package/dist/module/meta/service/entity-list.service.d.ts +1 -0
- package/dist/module/meta/service/entity-list.service.js +14 -2
- package/dist/module/meta/service/entity-list.service.js.map +1 -1
- package/dist/module/meta/service/entity-service-impl.service.d.ts +1 -1
- package/dist/module/meta/service/entity-service-impl.service.js +21 -4
- package/dist/module/meta/service/entity-service-impl.service.js.map +1 -1
- package/dist/module/meta/service/media-data.service.d.ts +9 -0
- package/dist/module/meta/service/media-data.service.js +36 -0
- package/dist/module/meta/service/media-data.service.js.map +1 -0
- package/dist/module/module/entity/menu.entity.d.ts +1 -2
- package/dist/module/module/entity/menu.entity.js +1 -2
- package/dist/module/module/entity/menu.entity.js.map +1 -1
- package/dist/module/module/entity/module.entity.d.ts +1 -2
- package/dist/module/module/entity/module.entity.js +1 -2
- package/dist/module/module/entity/module.entity.js.map +1 -1
- package/dist/module/notification/controller/otp.controller.d.ts +5 -3
- package/dist/module/notification/controller/otp.controller.js +7 -4
- package/dist/module/notification/controller/otp.controller.js.map +1 -1
- package/dist/module/notification/service/otp.service.d.ts +5 -3
- package/dist/module/notification/service/otp.service.js +7 -4
- package/dist/module/notification/service/otp.service.js.map +1 -1
- package/dist/module/user/service/login.service.d.ts +3 -1
- package/dist/module/user/service/login.service.js +7 -5
- package/dist/module/user/service/login.service.js.map +1 -1
- package/dist/module/user/service/user.service.d.ts +5 -3
- package/dist/module/user/service/user.service.js +10 -6
- package/dist/module/user/service/user.service.js.map +1 -1
- package/dist/resources/dev.properties.yaml +15 -0
- package/dist/resources/properties.module.d.ts +2 -0
- package/dist/resources/properties.module.js +25 -0
- package/dist/resources/properties.module.js.map +1 -0
- package/dist/resources/properties.yaml.d.ts +2 -0
- package/dist/resources/properties.yaml.js +10 -0
- package/dist/resources/properties.yaml.js.map +1 -0
- package/dist/resources/uat.properties.yaml +15 -0
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/nest-cli.json +6 -0
- package/package.json +1 -1
- package/src/app.module.ts +0 -0
- package/src/config/database.config.ts +10 -5
- package/src/constant/global.constant.ts +13 -4
- package/src/core.module.ts +5 -2
- package/src/module/auth/auth.module.ts +3 -2
- package/src/module/auth/guards/jwt.guard.ts +22 -22
- package/src/module/auth/guards/role.guard.ts +68 -68
- package/src/module/auth/services/auth.service.ts +29 -29
- package/src/module/auth/services/jwt.service.ts +11 -11
- package/src/module/auth/strategies/google.strategy.ts +7 -4
- package/src/module/auth/strategies/jwt.strategy.ts +5 -6
- package/src/module/auth/strategies/local.strategy.ts +13 -13
- package/src/module/dev/dev.module.ts +12 -12
- package/src/module/dev/service/dev.service.ts +7 -7
- package/src/module/enterprise/entity/enterprise.entity.ts +37 -37
- package/src/module/enterprise/entity/organization.entity.ts +80 -80
- package/src/module/layout/controller/layout.controller.ts +32 -0
- package/src/module/layout/dto/header.dto.ts +0 -0
- package/src/module/layout/entity/header-items.entity.ts +28 -0
- package/src/module/layout/entity/header-section.entity.ts +19 -0
- package/src/module/layout/layout.module.ts +17 -0
- package/src/module/layout/repository/header-items.repository.ts +18 -0
- package/src/module/layout/repository/header-section.repository.ts +18 -0
- package/src/module/layout/service/header-section.service.ts +26 -0
- package/src/module/master/controller/master.controller.ts +22 -22
- package/src/module/meta/dto/entity-list-data.dto.ts +6 -6
- package/src/module/meta/entity/attribute-master.entity.ts +67 -67
- package/src/module/meta/entity/base-entity.entity.ts +1 -2
- package/src/module/meta/entity/entity-master.entity.ts +3 -0
- package/src/module/meta/entity/media-data.entity.ts +32 -0
- package/src/module/meta/entity/preference.entity.ts +65 -65
- package/src/module/meta/entity.module.ts +8 -1
- package/src/module/meta/repository/attribute-master.repository.ts +28 -28
- package/src/module/meta/repository/media-data.repository.ts +50 -0
- package/src/module/meta/repository/preference.repository.ts +20 -20
- package/src/module/meta/service/entity-list.service.ts +21 -2
- package/src/module/meta/service/entity-service-impl.service.ts +36 -11
- package/src/module/meta/service/media-data.service.ts +44 -0
- package/src/module/module/controller/menu.controller.ts +15 -15
- package/src/module/module/entity/menu.entity.ts +1 -2
- package/src/module/module/entity/module-access.entity.ts +22 -22
- package/src/module/module/entity/module-action.entity.ts +19 -19
- package/src/module/module/entity/module.entity.ts +1 -2
- package/src/module/notification/controller/otp.controller.ts +8 -3
- package/src/module/notification/service/otp.service.ts +6 -3
- package/src/module/user/controller/user.controller.ts +28 -28
- package/src/module/user/dto/update-user.dto.ts +4 -4
- package/src/module/user/entity/user-role-mapping.entity.ts +21 -21
- package/src/module/user/entity/user-session.entity.ts +61 -61
- package/src/module/user/entity/user.entity.ts +35 -35
- package/src/module/user/repository/role.repository.ts +16 -16
- package/src/module/user/repository/userSession.repository.ts +33 -33
- package/src/module/user/service/login.service.ts +7 -5
- package/src/module/user/service/user.service.ts +10 -7
- package/src/resources/dev.properties.yaml +15 -0
- package/src/resources/properties.module.ts +12 -0
- package/src/resources/properties.yaml.ts +11 -0
- package/src/resources/uat.properties.yaml +15 -0
- package/src/utils/service/encryptUtil.service.ts +97 -97
- package/src/utils/service/excelUtil.service.ts +15 -15
- package/src/utils/service/reflection-helper.service.ts +53 -53
- package/.env +0 -10
- package/dist/constant/status.constant.d.ts +0 -4
- package/dist/constant/status.constant.js +0 -9
- package/dist/constant/status.constant.js.map +0 -1
- package/src/constant/status.constant.ts +0 -3
|
@@ -1,65 +1,65 @@
|
|
|
1
|
-
import { BaseEntity } from './base-entity.entity';
|
|
2
|
-
import { Column, Entity } from 'typeorm';
|
|
3
|
-
import { ENTITYTYPE_PREFERENCEMASTER } from '../../../constant/global.constant';
|
|
4
|
-
|
|
5
|
-
@Entity({ name: 'cr_preference_master' })
|
|
6
|
-
export class PreferenceMaster extends BaseEntity {
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
this.entity_type = ENTITYTYPE_PREFERENCEMASTER;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@Column({ name: 'appcode', type: 'varchar', length: 200, nullable: true })
|
|
13
|
-
appCode: string;
|
|
14
|
-
|
|
15
|
-
@Column({
|
|
16
|
-
name: 'display_name',
|
|
17
|
-
type: 'varchar',
|
|
18
|
-
length: 200,
|
|
19
|
-
nullable: true,
|
|
20
|
-
})
|
|
21
|
-
display_name: string;
|
|
22
|
-
|
|
23
|
-
@Column({
|
|
24
|
-
name: 'preference_key',
|
|
25
|
-
type: 'varchar',
|
|
26
|
-
length: 200,
|
|
27
|
-
nullable: true,
|
|
28
|
-
})
|
|
29
|
-
preference_key: string;
|
|
30
|
-
|
|
31
|
-
@Column({
|
|
32
|
-
name: 'preference_value',
|
|
33
|
-
type: 'varchar',
|
|
34
|
-
length: 200,
|
|
35
|
-
nullable: true,
|
|
36
|
-
})
|
|
37
|
-
preference_value: string;
|
|
38
|
-
|
|
39
|
-
@Column({
|
|
40
|
-
name: 'description',
|
|
41
|
-
type: 'varchar',
|
|
42
|
-
length: 2000,
|
|
43
|
-
nullable: true,
|
|
44
|
-
})
|
|
45
|
-
description: string;
|
|
46
|
-
|
|
47
|
-
@Column({ name: 'reflect_on', type: 'varchar', length: 200, nullable: true })
|
|
48
|
-
reflect_on: string;
|
|
49
|
-
|
|
50
|
-
@Column({
|
|
51
|
-
name: 'default_value',
|
|
52
|
-
type: 'varchar',
|
|
53
|
-
length: 200,
|
|
54
|
-
nullable: true,
|
|
55
|
-
})
|
|
56
|
-
default_value: string;
|
|
57
|
-
|
|
58
|
-
@Column({
|
|
59
|
-
name: 'possible_values',
|
|
60
|
-
type: 'varchar',
|
|
61
|
-
length: 200,
|
|
62
|
-
nullable: true,
|
|
63
|
-
})
|
|
64
|
-
possible_values: string;
|
|
65
|
-
}
|
|
1
|
+
import { BaseEntity } from './base-entity.entity';
|
|
2
|
+
import { Column, Entity } from 'typeorm';
|
|
3
|
+
import { ENTITYTYPE_PREFERENCEMASTER } from '../../../constant/global.constant';
|
|
4
|
+
|
|
5
|
+
@Entity({ name: 'cr_preference_master' })
|
|
6
|
+
export class PreferenceMaster extends BaseEntity {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.entity_type = ENTITYTYPE_PREFERENCEMASTER;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@Column({ name: 'appcode', type: 'varchar', length: 200, nullable: true })
|
|
13
|
+
appCode: string;
|
|
14
|
+
|
|
15
|
+
@Column({
|
|
16
|
+
name: 'display_name',
|
|
17
|
+
type: 'varchar',
|
|
18
|
+
length: 200,
|
|
19
|
+
nullable: true,
|
|
20
|
+
})
|
|
21
|
+
display_name: string;
|
|
22
|
+
|
|
23
|
+
@Column({
|
|
24
|
+
name: 'preference_key',
|
|
25
|
+
type: 'varchar',
|
|
26
|
+
length: 200,
|
|
27
|
+
nullable: true,
|
|
28
|
+
})
|
|
29
|
+
preference_key: string;
|
|
30
|
+
|
|
31
|
+
@Column({
|
|
32
|
+
name: 'preference_value',
|
|
33
|
+
type: 'varchar',
|
|
34
|
+
length: 200,
|
|
35
|
+
nullable: true,
|
|
36
|
+
})
|
|
37
|
+
preference_value: string;
|
|
38
|
+
|
|
39
|
+
@Column({
|
|
40
|
+
name: 'description',
|
|
41
|
+
type: 'varchar',
|
|
42
|
+
length: 2000,
|
|
43
|
+
nullable: true,
|
|
44
|
+
})
|
|
45
|
+
description: string;
|
|
46
|
+
|
|
47
|
+
@Column({ name: 'reflect_on', type: 'varchar', length: 200, nullable: true })
|
|
48
|
+
reflect_on: string;
|
|
49
|
+
|
|
50
|
+
@Column({
|
|
51
|
+
name: 'default_value',
|
|
52
|
+
type: 'varchar',
|
|
53
|
+
length: 200,
|
|
54
|
+
nullable: true,
|
|
55
|
+
})
|
|
56
|
+
default_value: string;
|
|
57
|
+
|
|
58
|
+
@Column({
|
|
59
|
+
name: 'possible_values',
|
|
60
|
+
type: 'varchar',
|
|
61
|
+
length: 200,
|
|
62
|
+
nullable: true,
|
|
63
|
+
})
|
|
64
|
+
possible_values: string;
|
|
65
|
+
}
|
|
@@ -19,6 +19,9 @@ import { EntityTableService } from './service/entity-table.service';
|
|
|
19
19
|
import { EntityTableColumnRepository } from './repository/entity-table-column.repository';
|
|
20
20
|
import { EntityTableColumnService } from './service/entity-table-column.service';
|
|
21
21
|
import { EntityListService } from './service/entity-list.service';
|
|
22
|
+
import { MediaData } from './entity/media-data.entity';
|
|
23
|
+
import { MediaDataService } from './service/media-data.service';
|
|
24
|
+
import { MediaDataRepository } from './repository/media-data.repository';
|
|
22
25
|
|
|
23
26
|
@Module({
|
|
24
27
|
imports: [
|
|
@@ -28,6 +31,7 @@ import { EntityListService } from './service/entity-list.service';
|
|
|
28
31
|
PreferenceMaster,
|
|
29
32
|
EntityTable,
|
|
30
33
|
EntityTableColumn,
|
|
34
|
+
MediaData
|
|
31
35
|
]),
|
|
32
36
|
UtilsModule,
|
|
33
37
|
],
|
|
@@ -43,6 +47,8 @@ import { EntityListService } from './service/entity-list.service';
|
|
|
43
47
|
EntityTableColumnRepository,
|
|
44
48
|
EntityTableColumnService,
|
|
45
49
|
EntityListService,
|
|
50
|
+
MediaDataRepository,
|
|
51
|
+
MediaDataService,
|
|
46
52
|
],
|
|
47
53
|
exports: [
|
|
48
54
|
EntityMasterService,
|
|
@@ -50,7 +56,8 @@ import { EntityListService } from './service/entity-list.service';
|
|
|
50
56
|
PreferenceService,
|
|
51
57
|
EntityListService,
|
|
52
58
|
EntityTableService,
|
|
53
|
-
EntityTableColumnService
|
|
59
|
+
EntityTableColumnService,
|
|
60
|
+
MediaDataService,
|
|
54
61
|
],
|
|
55
62
|
controllers: [EntityController, MasterController],
|
|
56
63
|
})
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import { Injectable } from '@nestjs/common';
|
|
2
|
-
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
|
-
import { AttributeMaster } from '../entity/attribute-master.entity';
|
|
4
|
-
import { Repository } from 'typeorm';
|
|
5
|
-
|
|
6
|
-
@Injectable()
|
|
7
|
-
export class AttributeMasterRepository {
|
|
8
|
-
constructor(
|
|
9
|
-
@InjectRepository(AttributeMaster)
|
|
10
|
-
private readonly attributeMasterRepository: Repository<AttributeMaster>,
|
|
11
|
-
) {}
|
|
12
|
-
|
|
13
|
-
async findByMappedEntityIdAndMappedEntityTypeAndAttributeKeyAndOrganizationId(
|
|
14
|
-
mappedEntityId: number,
|
|
15
|
-
mappedEntityType: string,
|
|
16
|
-
attributeKey: string,
|
|
17
|
-
organizationId: number,
|
|
18
|
-
): Promise<AttributeMaster | null> {
|
|
19
|
-
return await this.attributeMasterRepository.findOne({
|
|
20
|
-
where: {
|
|
21
|
-
mapped_entity_id: mappedEntityId,
|
|
22
|
-
mapped_entity_type: mappedEntityType,
|
|
23
|
-
attribute_key: attributeKey,
|
|
24
|
-
organization_id: organizationId,
|
|
25
|
-
},
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
}
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
|
+
import { AttributeMaster } from '../entity/attribute-master.entity';
|
|
4
|
+
import { Repository } from 'typeorm';
|
|
5
|
+
|
|
6
|
+
@Injectable()
|
|
7
|
+
export class AttributeMasterRepository {
|
|
8
|
+
constructor(
|
|
9
|
+
@InjectRepository(AttributeMaster)
|
|
10
|
+
private readonly attributeMasterRepository: Repository<AttributeMaster>,
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
async findByMappedEntityIdAndMappedEntityTypeAndAttributeKeyAndOrganizationId(
|
|
14
|
+
mappedEntityId: number,
|
|
15
|
+
mappedEntityType: string,
|
|
16
|
+
attributeKey: string,
|
|
17
|
+
organizationId: number,
|
|
18
|
+
): Promise<AttributeMaster | null> {
|
|
19
|
+
return await this.attributeMasterRepository.findOne({
|
|
20
|
+
where: {
|
|
21
|
+
mapped_entity_id: mappedEntityId,
|
|
22
|
+
mapped_entity_type: mappedEntityType,
|
|
23
|
+
attribute_key: attributeKey,
|
|
24
|
+
organization_id: organizationId,
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -0,0 +1,50 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
|
+
import { MediaData } from '../entity/media-data.entity';
|
|
4
|
+
import { Repository } from 'typeorm';
|
|
5
|
+
|
|
6
|
+
@Injectable()
|
|
7
|
+
export class MediaDataRepository {
|
|
8
|
+
constructor(
|
|
9
|
+
@InjectRepository(MediaData)
|
|
10
|
+
private readonly mediaRepository: Repository<MediaData>,
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
async findByAttributeKeyAndMappedEntityIdAndMappedEntityType(
|
|
14
|
+
attributeKey: string,
|
|
15
|
+
mappedEntityId: number,
|
|
16
|
+
mappedEntityType: string,
|
|
17
|
+
) {
|
|
18
|
+
return await this.mediaRepository.findOne({
|
|
19
|
+
where: {
|
|
20
|
+
mapped_attribute_key: attributeKey,
|
|
21
|
+
mapped_entity_id: mappedEntityId,
|
|
22
|
+
mapped_entity_type: mappedEntityType,
|
|
23
|
+
},
|
|
24
|
+
});
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async findByMappedEntityIdAndMappedEntityType(
|
|
28
|
+
mappedEntityId: number,
|
|
29
|
+
mappedEntityType: string,
|
|
30
|
+
) {
|
|
31
|
+
return await this.mediaRepository.find({
|
|
32
|
+
where: {
|
|
33
|
+
mapped_entity_id: mappedEntityId,
|
|
34
|
+
mapped_entity_type: mappedEntityType,
|
|
35
|
+
},
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
|
|
39
|
+
async deleteByAttributeKeyAndMappedEntityIdAndMappedEntityType(
|
|
40
|
+
attributeKey: string,
|
|
41
|
+
mappedEntityId: number,
|
|
42
|
+
mappedEntityType: string,
|
|
43
|
+
) {
|
|
44
|
+
return await this.mediaRepository.delete({
|
|
45
|
+
mapped_attribute_key: attributeKey,
|
|
46
|
+
mapped_entity_id: mappedEntityId,
|
|
47
|
+
mapped_entity_type: mappedEntityType,
|
|
48
|
+
});
|
|
49
|
+
}
|
|
50
|
+
}
|
|
@@ -1,20 +1,20 @@
|
|
|
1
|
-
import { Injectable } from '@nestjs/common';
|
|
2
|
-
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
|
-
import { PreferenceMaster } from '../entity/preference.entity';
|
|
4
|
-
import { Repository } from 'typeorm';
|
|
5
|
-
|
|
6
|
-
@Injectable()
|
|
7
|
-
export class PreferenceRepository {
|
|
8
|
-
constructor(
|
|
9
|
-
@InjectRepository(PreferenceMaster)
|
|
10
|
-
private readonly preferenceRepository: Repository<PreferenceMaster>,
|
|
11
|
-
) {}
|
|
12
|
-
|
|
13
|
-
async findByPreferenceKey(
|
|
14
|
-
preferenceKey: string,
|
|
15
|
-
): Promise<PreferenceMaster | null> {
|
|
16
|
-
return await this.preferenceRepository.findOne({
|
|
17
|
-
where: { preference_key: preferenceKey },
|
|
18
|
-
});
|
|
19
|
-
}
|
|
20
|
-
}
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { InjectRepository } from '@nestjs/typeorm';
|
|
3
|
+
import { PreferenceMaster } from '../entity/preference.entity';
|
|
4
|
+
import { Repository } from 'typeorm';
|
|
5
|
+
|
|
6
|
+
@Injectable()
|
|
7
|
+
export class PreferenceRepository {
|
|
8
|
+
constructor(
|
|
9
|
+
@InjectRepository(PreferenceMaster)
|
|
10
|
+
private readonly preferenceRepository: Repository<PreferenceMaster>,
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
async findByPreferenceKey(
|
|
14
|
+
preferenceKey: string,
|
|
15
|
+
): Promise<PreferenceMaster | null> {
|
|
16
|
+
return await this.preferenceRepository.findOne({
|
|
17
|
+
where: { preference_key: preferenceKey },
|
|
18
|
+
});
|
|
19
|
+
}
|
|
20
|
+
}
|
|
@@ -97,10 +97,10 @@ export class EntityListService {
|
|
|
97
97
|
private getQuery(source: string, groupByColumn: string | null) {
|
|
98
98
|
if (groupByColumn) {
|
|
99
99
|
return `SELECT ${groupByColumn} as tab_value, COUNT(1) AS tab_value_count
|
|
100
|
-
|
|
100
|
+
FROM ${source}`;
|
|
101
101
|
} else {
|
|
102
102
|
return `SELECT *
|
|
103
|
-
|
|
103
|
+
FROM ${source}`;
|
|
104
104
|
}
|
|
105
105
|
}
|
|
106
106
|
|
|
@@ -145,4 +145,23 @@ export class EntityListService {
|
|
|
145
145
|
|
|
146
146
|
return { query, argumentList: argsObjectList };
|
|
147
147
|
}
|
|
148
|
+
|
|
149
|
+
public async getMaxSequenceNumber(
|
|
150
|
+
tableName: string,
|
|
151
|
+
parentType: string,
|
|
152
|
+
parentId: number,
|
|
153
|
+
) {
|
|
154
|
+
let query = `SELECT COUNT(1) seq_no
|
|
155
|
+
FROM ${tableName} `;
|
|
156
|
+
const argsObjectList: any[] = [];
|
|
157
|
+
if (parentId) {
|
|
158
|
+
query += `parent_id = ? AND parent_type = ? `;
|
|
159
|
+
argsObjectList.push(parentId);
|
|
160
|
+
argsObjectList.push(parentType);
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
let result = await this.entityManager.query(query, argsObjectList);
|
|
164
|
+
|
|
165
|
+
return result ? result[0].seq_no : 0;
|
|
166
|
+
}
|
|
148
167
|
}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { EntityService } from './entity.service';
|
|
2
|
-
import { Inject, Injectable } from '@nestjs/common';
|
|
2
|
+
import { BadRequestException, Inject, Injectable } from '@nestjs/common';
|
|
3
3
|
import { UserData } from '../../user/entity/user.entity';
|
|
4
4
|
import { EntityMasterService } from './entity-master.service';
|
|
5
5
|
import { ReflectionHelper } from '../../../utils/service/reflection-helper.service';
|
|
@@ -15,6 +15,7 @@ import { ExcelHelper } from '../../../utils/service/excel-helper.service';
|
|
|
15
15
|
import { ExcelsheetData } from '../../../utils/dto/excelsheet-data.dto';
|
|
16
16
|
import { EntityTableService } from './entity-table.service';
|
|
17
17
|
import { EntityTableColumnService } from './entity-table-column.service';
|
|
18
|
+
import { ENTITYTYPE_ENTITYMASTER } from '../../../constant/global.constant';
|
|
18
19
|
|
|
19
20
|
@Injectable()
|
|
20
21
|
export class EntityServiceImpl implements EntityService<BaseEntity> {
|
|
@@ -26,13 +27,14 @@ export class EntityServiceImpl implements EntityService<BaseEntity> {
|
|
|
26
27
|
@Inject() protected readonly entityListService: EntityListService;
|
|
27
28
|
@Inject() protected readonly loggingService: LoggingService;
|
|
28
29
|
|
|
29
|
-
constructor() {}
|
|
30
|
-
|
|
31
30
|
async createEntity(
|
|
32
31
|
entityData: BaseEntity,
|
|
33
32
|
loggedInUser: UserData | null,
|
|
34
33
|
manager?: EntityManager,
|
|
35
34
|
): Promise<BaseEntity> {
|
|
35
|
+
if (!entityData.entity_type) {
|
|
36
|
+
throw new BadRequestException(`EntityType is missing`);
|
|
37
|
+
}
|
|
36
38
|
const entityMaster = await this.entityMasterService.getEntityData(
|
|
37
39
|
entityData.entity_type,
|
|
38
40
|
);
|
|
@@ -46,7 +48,17 @@ export class EntityServiceImpl implements EntityService<BaseEntity> {
|
|
|
46
48
|
`Repository service not found for entityType: ${entityData.entity_type}`,
|
|
47
49
|
);
|
|
48
50
|
}
|
|
49
|
-
|
|
51
|
+
|
|
52
|
+
if (!entityData.code) {
|
|
53
|
+
let maxSeqNo = await this.getMaxSequenceNumber(
|
|
54
|
+
entityData.entity_type,
|
|
55
|
+
entityData.parent_id,
|
|
56
|
+
entityData.parent_type,
|
|
57
|
+
);
|
|
58
|
+
maxSeqNo = Number(maxSeqNo) + 1;
|
|
59
|
+
entityData.code = entityData.entity_type + maxSeqNo;
|
|
60
|
+
}
|
|
61
|
+
|
|
50
62
|
entityData.created_date = new Date();
|
|
51
63
|
if (loggedInUser) {
|
|
52
64
|
entityData.created_by = loggedInUser.id;
|
|
@@ -86,13 +98,6 @@ export class EntityServiceImpl implements EntityService<BaseEntity> {
|
|
|
86
98
|
id: number,
|
|
87
99
|
): Promise<BaseEntity | null> {
|
|
88
100
|
const entityData = await this.entityMasterService.getEntityData(entityType);
|
|
89
|
-
// this.loggingService.log(
|
|
90
|
-
// 'info',
|
|
91
|
-
// EntityServiceImpl.name,
|
|
92
|
-
// 'GetEntity',
|
|
93
|
-
// 'STARTED',
|
|
94
|
-
// [{ entityData }],
|
|
95
|
-
// );
|
|
96
101
|
|
|
97
102
|
const repoService = this.reflectionHelper.getRepoService(
|
|
98
103
|
entityData.entityDataClass,
|
|
@@ -244,4 +249,24 @@ export class EntityServiceImpl implements EntityService<BaseEntity> {
|
|
|
244
249
|
excelData.addSheet(sheet);
|
|
245
250
|
}
|
|
246
251
|
}
|
|
252
|
+
|
|
253
|
+
private async getMaxSequenceNumber(
|
|
254
|
+
entityType: string,
|
|
255
|
+
parentId: number,
|
|
256
|
+
parentType: string,
|
|
257
|
+
): Promise<number> {
|
|
258
|
+
let tableName: string;
|
|
259
|
+
if (ENTITYTYPE_ENTITYMASTER === entityType) {
|
|
260
|
+
tableName = 'cr_entity_master';
|
|
261
|
+
} else {
|
|
262
|
+
let entityMaster =
|
|
263
|
+
await this.entityMasterService.getEntityData(entityType);
|
|
264
|
+
tableName = entityMaster.dbTableName;
|
|
265
|
+
}
|
|
266
|
+
return await this.entityListService.getMaxSequenceNumber(
|
|
267
|
+
tableName,
|
|
268
|
+
parentType,
|
|
269
|
+
parentId,
|
|
270
|
+
);
|
|
271
|
+
}
|
|
247
272
|
}
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { EntityServiceImpl } from './entity-service-impl.service';
|
|
3
|
+
import { MediaDataRepository } from '../repository/media-data.repository';
|
|
4
|
+
|
|
5
|
+
@Injectable()
|
|
6
|
+
export class MediaDataService extends EntityServiceImpl {
|
|
7
|
+
constructor(private readonly mediaRepository: MediaDataRepository) {
|
|
8
|
+
super();
|
|
9
|
+
}
|
|
10
|
+
|
|
11
|
+
async findByAttributeKeyAndMappedEntityIdAndMappedEntityType(
|
|
12
|
+
attributeKey: string,
|
|
13
|
+
mappedEntityId: number,
|
|
14
|
+
mappedEntityType: string,
|
|
15
|
+
) {
|
|
16
|
+
return await this.mediaRepository.findByAttributeKeyAndMappedEntityIdAndMappedEntityType(
|
|
17
|
+
attributeKey,
|
|
18
|
+
mappedEntityId,
|
|
19
|
+
mappedEntityType,
|
|
20
|
+
);
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async findByMappedEntityIdAndMappedEntityType(
|
|
24
|
+
mappedEntityId: number,
|
|
25
|
+
mappedEntityType: string,
|
|
26
|
+
) {
|
|
27
|
+
return await this.mediaRepository.findByMappedEntityIdAndMappedEntityType(
|
|
28
|
+
mappedEntityId,
|
|
29
|
+
mappedEntityType,
|
|
30
|
+
);
|
|
31
|
+
}
|
|
32
|
+
|
|
33
|
+
async deleteByAttributeKeyAndMappedEntityIdAndMappedEntityType(
|
|
34
|
+
attributeKey: string,
|
|
35
|
+
mappedEntityId: number,
|
|
36
|
+
mappedEntityType: string,
|
|
37
|
+
) {
|
|
38
|
+
return await this.mediaRepository.deleteByAttributeKeyAndMappedEntityIdAndMappedEntityType(
|
|
39
|
+
attributeKey,
|
|
40
|
+
mappedEntityId,
|
|
41
|
+
mappedEntityType,
|
|
42
|
+
);
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,15 +1,15 @@
|
|
|
1
|
-
import { Controller, Get, Request, UseGuards } from '@nestjs/common';
|
|
2
|
-
import { MenuService } from '../service/menu.service';
|
|
3
|
-
import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
4
|
-
|
|
5
|
-
@Controller('menu')
|
|
6
|
-
export class MenuController {
|
|
7
|
-
constructor(private readonly menuService: MenuService) {}
|
|
8
|
-
|
|
9
|
-
@UseGuards(JwtAuthGuard)
|
|
10
|
-
@Get()
|
|
11
|
-
async getMenu(@Request() req) {
|
|
12
|
-
const userId = req.user.userId;
|
|
13
|
-
return this.menuService.getUserMenu(userId);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
1
|
+
import { Controller, Get, Request, UseGuards } from '@nestjs/common';
|
|
2
|
+
import { MenuService } from '../service/menu.service';
|
|
3
|
+
import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
4
|
+
|
|
5
|
+
@Controller('menu')
|
|
6
|
+
export class MenuController {
|
|
7
|
+
constructor(private readonly menuService: MenuService) {}
|
|
8
|
+
|
|
9
|
+
@UseGuards(JwtAuthGuard)
|
|
10
|
+
@Get()
|
|
11
|
+
async getMenu(@Request() req) {
|
|
12
|
+
const userId = req.user.userId;
|
|
13
|
+
return this.menuService.getUserMenu(userId);
|
|
14
|
+
}
|
|
15
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
-
import { StatusType } from '../../../constant/status.constant';
|
|
3
2
|
|
|
4
3
|
@Entity({ name: 'cr_menu' })
|
|
5
4
|
export class MenuData {
|
|
@@ -13,7 +12,7 @@ export class MenuData {
|
|
|
13
12
|
module_code: string;
|
|
14
13
|
|
|
15
14
|
@Column({ type: 'varchar', length: 100, nullable: true })
|
|
16
|
-
status:
|
|
15
|
+
status: string;
|
|
17
16
|
|
|
18
17
|
@Column({ type: 'varchar', length: 100, nullable: true })
|
|
19
18
|
wbs_code: string;
|
|
@@ -1,22 +1,22 @@
|
|
|
1
|
-
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
-
|
|
3
|
-
@Entity({ name: 'cr_module_access' })
|
|
4
|
-
export class ModuleAccess {
|
|
5
|
-
@PrimaryGeneratedColumn()
|
|
6
|
-
id: number;
|
|
7
|
-
|
|
8
|
-
@Column({type: 'varchar', length: 100, nullable: true})
|
|
9
|
-
module_code: string;
|
|
10
|
-
|
|
11
|
-
@Column({type: 'varchar', length: 100, nullable: true })
|
|
12
|
-
role_code: string;
|
|
13
|
-
|
|
14
|
-
@Column({type: 'int', nullable: true })
|
|
15
|
-
access_flag: number;
|
|
16
|
-
|
|
17
|
-
@Column({type: 'varchar', length: 100, nullable: true })
|
|
18
|
-
action_type: string;
|
|
19
|
-
|
|
20
|
-
@Column({type: 'varchar', length: 100, nullable: true})
|
|
21
|
-
app_code: string;
|
|
22
|
-
}
|
|
1
|
+
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
+
|
|
3
|
+
@Entity({ name: 'cr_module_access' })
|
|
4
|
+
export class ModuleAccess {
|
|
5
|
+
@PrimaryGeneratedColumn()
|
|
6
|
+
id: number;
|
|
7
|
+
|
|
8
|
+
@Column({type: 'varchar', length: 100, nullable: true})
|
|
9
|
+
module_code: string;
|
|
10
|
+
|
|
11
|
+
@Column({type: 'varchar', length: 100, nullable: true })
|
|
12
|
+
role_code: string;
|
|
13
|
+
|
|
14
|
+
@Column({type: 'int', nullable: true })
|
|
15
|
+
access_flag: number;
|
|
16
|
+
|
|
17
|
+
@Column({type: 'varchar', length: 100, nullable: true })
|
|
18
|
+
action_type: string;
|
|
19
|
+
|
|
20
|
+
@Column({type: 'varchar', length: 100, nullable: true})
|
|
21
|
+
app_code: string;
|
|
22
|
+
}
|
|
@@ -1,19 +1,19 @@
|
|
|
1
|
-
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
-
|
|
3
|
-
@Entity({ name: 'module_action' })
|
|
4
|
-
export class ModuleAction {
|
|
5
|
-
@PrimaryGeneratedColumn()
|
|
6
|
-
id: number;
|
|
7
|
-
|
|
8
|
-
@Column({type: 'int', nullable: true})
|
|
9
|
-
module_id: number;
|
|
10
|
-
|
|
11
|
-
@Column({type: 'varchar', length: 100, nullable: true })
|
|
12
|
-
module_code: string;
|
|
13
|
-
|
|
14
|
-
@Column({type: 'varchar', length: 100, nullable: true })
|
|
15
|
-
action_name:string
|
|
16
|
-
|
|
17
|
-
@Column({type: 'varchar', length: 50, nullable: true })
|
|
18
|
-
action_type: string;
|
|
19
|
-
}
|
|
1
|
+
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
+
|
|
3
|
+
@Entity({ name: 'module_action' })
|
|
4
|
+
export class ModuleAction {
|
|
5
|
+
@PrimaryGeneratedColumn()
|
|
6
|
+
id: number;
|
|
7
|
+
|
|
8
|
+
@Column({type: 'int', nullable: true})
|
|
9
|
+
module_id: number;
|
|
10
|
+
|
|
11
|
+
@Column({type: 'varchar', length: 100, nullable: true })
|
|
12
|
+
module_code: string;
|
|
13
|
+
|
|
14
|
+
@Column({type: 'varchar', length: 100, nullable: true })
|
|
15
|
+
action_name:string
|
|
16
|
+
|
|
17
|
+
@Column({type: 'varchar', length: 50, nullable: true })
|
|
18
|
+
action_type: string;
|
|
19
|
+
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
-
import { StatusType } from '../../../constant/status.constant';
|
|
3
2
|
|
|
4
3
|
@Entity({ name: 'cr_module' })
|
|
5
4
|
export class ModuleData {
|
|
@@ -16,7 +15,7 @@ export class ModuleData {
|
|
|
16
15
|
wbs_code: string;
|
|
17
16
|
|
|
18
17
|
@Column({ type: 'varchar', length: 100, nullable: true })
|
|
19
|
-
status:
|
|
18
|
+
status: string;
|
|
20
19
|
|
|
21
20
|
@Column({ type: 'varchar', length: 100, nullable: true })
|
|
22
21
|
module_level: string;
|
|
@@ -1,12 +1,17 @@
|
|
|
1
1
|
import { BadRequestException, Body, Controller, HttpCode, HttpStatus, Post, Query } from '@nestjs/common';
|
|
2
2
|
import { OtpService } from '../service/otp.service';
|
|
3
|
+
import { ConfigService } from '@nestjs/config';
|
|
3
4
|
|
|
4
5
|
@Controller('otp')
|
|
5
6
|
export class OtpController{
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
7
|
+
|
|
8
|
+
constructor(private readonly otpService: OtpService,
|
|
9
|
+
private configService: ConfigService,
|
|
10
|
+
) {
|
|
9
11
|
}
|
|
12
|
+
|
|
13
|
+
otpExpiry = this.configService.get('OTP_EXPIRY')|| '2';
|
|
14
|
+
otpLength = this.configService.get('OTP_LENGTH')|| '6';
|
|
10
15
|
|
|
11
16
|
@Post('generate')
|
|
12
17
|
@HttpCode(HttpStatus.OK)
|