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
|
@@ -2,17 +2,20 @@ import { Injectable } from '@nestjs/common';
|
|
|
2
2
|
import { OtpRepository } from '../repository/otp.repository';
|
|
3
3
|
import { Otp } from '../entity/otp.entity';
|
|
4
4
|
import { ClockIDGenService } from '../../../utils/service/clockIDGenUtil.service';
|
|
5
|
+
import { ConfigService } from '@nestjs/config';
|
|
5
6
|
|
|
6
7
|
@Injectable()
|
|
7
8
|
export class OtpService {
|
|
8
|
-
VERIFY_OTP = process.env.VERIFY_OTP || 'true';
|
|
9
|
-
DEFAULT_OTP = process.env.DEFAULT_OTP || '123456';
|
|
10
|
-
|
|
11
9
|
constructor(
|
|
12
10
|
private readonly otpRepository: OtpRepository,
|
|
13
11
|
private readonly idGen: ClockIDGenService,
|
|
12
|
+
private configService: ConfigService,
|
|
14
13
|
) {
|
|
15
14
|
}
|
|
15
|
+
|
|
16
|
+
VERIFY_OTP = this.configService.get('VERIFY_OTP') || 'true';
|
|
17
|
+
DEFAULT_OTP = this.configService.get('DEFAULT_OTP') || '123456';
|
|
18
|
+
|
|
16
19
|
|
|
17
20
|
async generate(identifier: string, service: string, expiresIn: number = 5, otpLength: number = 6) {
|
|
18
21
|
let otp = new Otp();
|
|
@@ -1,28 +1,28 @@
|
|
|
1
|
-
import {
|
|
2
|
-
Body,
|
|
3
|
-
Controller,
|
|
4
|
-
HttpStatus,
|
|
5
|
-
Inject,
|
|
6
|
-
Post,
|
|
7
|
-
Res,
|
|
8
|
-
ValidationPipe,
|
|
9
|
-
} from '@nestjs/common';
|
|
10
|
-
import { UserService } from '../service/user.service';
|
|
11
|
-
import { CreateUserDto } from '../dto/create-user.dto';
|
|
12
|
-
import { Response } from 'express';
|
|
13
|
-
|
|
14
|
-
@Controller('user')
|
|
15
|
-
export class UserController {
|
|
16
|
-
constructor(
|
|
17
|
-
@Inject('UserService') private readonly userService: UserService,
|
|
18
|
-
) {}
|
|
19
|
-
|
|
20
|
-
@Post('signup')
|
|
21
|
-
async signup(
|
|
22
|
-
@Body(new ValidationPipe()) createUserDto: CreateUserDto,
|
|
23
|
-
@Res() res: Response,
|
|
24
|
-
) {
|
|
25
|
-
const result = await this.userService.createEntity(createUserDto, null);
|
|
26
|
-
res.status(HttpStatus.OK).json(result);
|
|
27
|
-
}
|
|
28
|
-
}
|
|
1
|
+
import {
|
|
2
|
+
Body,
|
|
3
|
+
Controller,
|
|
4
|
+
HttpStatus,
|
|
5
|
+
Inject,
|
|
6
|
+
Post,
|
|
7
|
+
Res,
|
|
8
|
+
ValidationPipe,
|
|
9
|
+
} from '@nestjs/common';
|
|
10
|
+
import { UserService } from '../service/user.service';
|
|
11
|
+
import { CreateUserDto } from '../dto/create-user.dto';
|
|
12
|
+
import { Response } from 'express';
|
|
13
|
+
|
|
14
|
+
@Controller('user')
|
|
15
|
+
export class UserController {
|
|
16
|
+
constructor(
|
|
17
|
+
@Inject('UserService') private readonly userService: UserService,
|
|
18
|
+
) {}
|
|
19
|
+
|
|
20
|
+
@Post('signup')
|
|
21
|
+
async signup(
|
|
22
|
+
@Body(new ValidationPipe()) createUserDto: CreateUserDto,
|
|
23
|
+
@Res() res: Response,
|
|
24
|
+
) {
|
|
25
|
+
const result = await this.userService.createEntity(createUserDto, null);
|
|
26
|
+
res.status(HttpStatus.OK).json(result);
|
|
27
|
+
}
|
|
28
|
+
}
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { PartialType } from '@nestjs/mapped-types';
|
|
2
|
-
import { CreateUserDto } from './create-user.dto';
|
|
3
|
-
|
|
4
|
-
export class UpdateUserDto extends PartialType(CreateUserDto) {}
|
|
1
|
+
import { PartialType } from '@nestjs/mapped-types';
|
|
2
|
+
import { CreateUserDto } from './create-user.dto';
|
|
3
|
+
|
|
4
|
+
export class UpdateUserDto extends PartialType(CreateUserDto) {}
|
|
@@ -1,21 +1,21 @@
|
|
|
1
|
-
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
-
|
|
3
|
-
@Entity({ name: 'cr_user_role_mapping' })
|
|
4
|
-
export class UserRoleMapping {
|
|
5
|
-
constructor(user_id: number, role_id: number) {
|
|
6
|
-
this.user_id = user_id;
|
|
7
|
-
this.role_id = role_id;
|
|
8
|
-
}
|
|
9
|
-
|
|
10
|
-
@PrimaryGeneratedColumn()
|
|
11
|
-
id: number;
|
|
12
|
-
|
|
13
|
-
@Column({ type: 'bigint', nullable: true })
|
|
14
|
-
user_id: number;
|
|
15
|
-
|
|
16
|
-
@Column({ type: 'bigint', nullable: true })
|
|
17
|
-
role_id: number;
|
|
18
|
-
|
|
19
|
-
@Column({ type: 'int', nullable: true })
|
|
20
|
-
is_default: number;
|
|
21
|
-
}
|
|
1
|
+
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
+
|
|
3
|
+
@Entity({ name: 'cr_user_role_mapping' })
|
|
4
|
+
export class UserRoleMapping {
|
|
5
|
+
constructor(user_id: number, role_id: number) {
|
|
6
|
+
this.user_id = user_id;
|
|
7
|
+
this.role_id = role_id;
|
|
8
|
+
}
|
|
9
|
+
|
|
10
|
+
@PrimaryGeneratedColumn()
|
|
11
|
+
id: number;
|
|
12
|
+
|
|
13
|
+
@Column({ type: 'bigint', nullable: true })
|
|
14
|
+
user_id: number;
|
|
15
|
+
|
|
16
|
+
@Column({ type: 'bigint', nullable: true })
|
|
17
|
+
role_id: number;
|
|
18
|
+
|
|
19
|
+
@Column({ type: 'int', nullable: true })
|
|
20
|
+
is_default: number;
|
|
21
|
+
}
|
|
@@ -1,61 +1,61 @@
|
|
|
1
|
-
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
-
|
|
3
|
-
@Entity({ name: 'cr_user_session' })
|
|
4
|
-
export class UserSession {
|
|
5
|
-
@PrimaryGeneratedColumn()
|
|
6
|
-
id: number;
|
|
7
|
-
|
|
8
|
-
@Column({
|
|
9
|
-
name: 'is_session_loggedout',
|
|
10
|
-
nullable: true,
|
|
11
|
-
type: 'int',
|
|
12
|
-
})
|
|
13
|
-
is_session_loggedout: number;
|
|
14
|
-
|
|
15
|
-
@Column({
|
|
16
|
-
name: 'login_id',
|
|
17
|
-
nullable: true,
|
|
18
|
-
length: 50,
|
|
19
|
-
})
|
|
20
|
-
login_id: string;
|
|
21
|
-
|
|
22
|
-
@Column({
|
|
23
|
-
name: 'login_time',
|
|
24
|
-
nullable: true,
|
|
25
|
-
})
|
|
26
|
-
login_time: Date;
|
|
27
|
-
|
|
28
|
-
@Column({
|
|
29
|
-
name: 'logout_time',
|
|
30
|
-
nullable: true,
|
|
31
|
-
})
|
|
32
|
-
logout_time: Date;
|
|
33
|
-
|
|
34
|
-
@Column({
|
|
35
|
-
name: 'session_key',
|
|
36
|
-
nullable: true,
|
|
37
|
-
length: 100,
|
|
38
|
-
})
|
|
39
|
-
session_key: string;
|
|
40
|
-
|
|
41
|
-
@Column({
|
|
42
|
-
name: 'user_id',
|
|
43
|
-
nullable: true,
|
|
44
|
-
type: 'bigint',
|
|
45
|
-
})
|
|
46
|
-
user_id: number;
|
|
47
|
-
|
|
48
|
-
@Column({
|
|
49
|
-
name: 'access_token',
|
|
50
|
-
nullable: true,
|
|
51
|
-
type: 'varchar',
|
|
52
|
-
length: 5000,
|
|
53
|
-
})
|
|
54
|
-
access_token: string;
|
|
55
|
-
|
|
56
|
-
@Column({
|
|
57
|
-
name: 'expiry_date',
|
|
58
|
-
nullable: true,
|
|
59
|
-
})
|
|
60
|
-
expiry_date: Date;
|
|
61
|
-
}
|
|
1
|
+
import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
|
|
2
|
+
|
|
3
|
+
@Entity({ name: 'cr_user_session' })
|
|
4
|
+
export class UserSession {
|
|
5
|
+
@PrimaryGeneratedColumn()
|
|
6
|
+
id: number;
|
|
7
|
+
|
|
8
|
+
@Column({
|
|
9
|
+
name: 'is_session_loggedout',
|
|
10
|
+
nullable: true,
|
|
11
|
+
type: 'int',
|
|
12
|
+
})
|
|
13
|
+
is_session_loggedout: number;
|
|
14
|
+
|
|
15
|
+
@Column({
|
|
16
|
+
name: 'login_id',
|
|
17
|
+
nullable: true,
|
|
18
|
+
length: 50,
|
|
19
|
+
})
|
|
20
|
+
login_id: string;
|
|
21
|
+
|
|
22
|
+
@Column({
|
|
23
|
+
name: 'login_time',
|
|
24
|
+
nullable: true,
|
|
25
|
+
})
|
|
26
|
+
login_time: Date;
|
|
27
|
+
|
|
28
|
+
@Column({
|
|
29
|
+
name: 'logout_time',
|
|
30
|
+
nullable: true,
|
|
31
|
+
})
|
|
32
|
+
logout_time: Date;
|
|
33
|
+
|
|
34
|
+
@Column({
|
|
35
|
+
name: 'session_key',
|
|
36
|
+
nullable: true,
|
|
37
|
+
length: 100,
|
|
38
|
+
})
|
|
39
|
+
session_key: string;
|
|
40
|
+
|
|
41
|
+
@Column({
|
|
42
|
+
name: 'user_id',
|
|
43
|
+
nullable: true,
|
|
44
|
+
type: 'bigint',
|
|
45
|
+
})
|
|
46
|
+
user_id: number;
|
|
47
|
+
|
|
48
|
+
@Column({
|
|
49
|
+
name: 'access_token',
|
|
50
|
+
nullable: true,
|
|
51
|
+
type: 'varchar',
|
|
52
|
+
length: 5000,
|
|
53
|
+
})
|
|
54
|
+
access_token: string;
|
|
55
|
+
|
|
56
|
+
@Column({
|
|
57
|
+
name: 'expiry_date',
|
|
58
|
+
nullable: true,
|
|
59
|
+
})
|
|
60
|
+
expiry_date: Date;
|
|
61
|
+
}
|
|
@@ -1,35 +1,35 @@
|
|
|
1
|
-
import { Column, Entity } from 'typeorm';
|
|
2
|
-
import { ENTITYTYPE_USER } from '../../../constant/global.constant';
|
|
3
|
-
import { BaseEntity } from '../../meta/entity/base-entity.entity';
|
|
4
|
-
|
|
5
|
-
@Entity({ name: 'cr_user' })
|
|
6
|
-
export class UserData extends BaseEntity {
|
|
7
|
-
constructor() {
|
|
8
|
-
super();
|
|
9
|
-
this.entity_type = ENTITYTYPE_USER;
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
@Column({ type: 'varchar', length: 50, nullable: true })
|
|
13
|
-
first_name: string;
|
|
14
|
-
|
|
15
|
-
@Column({ type: 'varchar', length: 50, nullable: true })
|
|
16
|
-
last_name: string;
|
|
17
|
-
|
|
18
|
-
@Column({ type: 'varchar', length: 200, nullable: true })
|
|
19
|
-
password: string;
|
|
20
|
-
|
|
21
|
-
@Column({ type: 'varchar', length: 200, nullable: true })
|
|
22
|
-
email_id: string;
|
|
23
|
-
|
|
24
|
-
@Column({ type: 'varchar', length: 50, nullable: true })
|
|
25
|
-
mobile: string;
|
|
26
|
-
|
|
27
|
-
@Column({ type: 'int', nullable: true })
|
|
28
|
-
is_firstlogin: number;
|
|
29
|
-
|
|
30
|
-
@Column({ type: 'int', width: 1, nullable: true })
|
|
31
|
-
is_defaultadmin: number;
|
|
32
|
-
|
|
33
|
-
@Column({ type: 'int', width: 1, nullable: true })
|
|
34
|
-
is_customer: number;
|
|
35
|
-
}
|
|
1
|
+
import { Column, Entity } from 'typeorm';
|
|
2
|
+
import { ENTITYTYPE_USER } from '../../../constant/global.constant';
|
|
3
|
+
import { BaseEntity } from '../../meta/entity/base-entity.entity';
|
|
4
|
+
|
|
5
|
+
@Entity({ name: 'cr_user' })
|
|
6
|
+
export class UserData extends BaseEntity {
|
|
7
|
+
constructor() {
|
|
8
|
+
super();
|
|
9
|
+
this.entity_type = ENTITYTYPE_USER;
|
|
10
|
+
}
|
|
11
|
+
|
|
12
|
+
@Column({ type: 'varchar', length: 50, nullable: true })
|
|
13
|
+
first_name: string;
|
|
14
|
+
|
|
15
|
+
@Column({ type: 'varchar', length: 50, nullable: true })
|
|
16
|
+
last_name: string;
|
|
17
|
+
|
|
18
|
+
@Column({ type: 'varchar', length: 200, nullable: true })
|
|
19
|
+
password: string;
|
|
20
|
+
|
|
21
|
+
@Column({ type: 'varchar', length: 200, nullable: true })
|
|
22
|
+
email_id: string;
|
|
23
|
+
|
|
24
|
+
@Column({ type: 'varchar', length: 50, nullable: true })
|
|
25
|
+
mobile: string;
|
|
26
|
+
|
|
27
|
+
@Column({ type: 'int', nullable: true })
|
|
28
|
+
is_firstlogin: number;
|
|
29
|
+
|
|
30
|
+
@Column({ type: 'int', width: 1, nullable: true })
|
|
31
|
+
is_defaultadmin: number;
|
|
32
|
+
|
|
33
|
+
@Column({ type: 'int', width: 1, nullable: true })
|
|
34
|
+
is_customer: number;
|
|
35
|
+
}
|
|
@@ -1,16 +1,16 @@
|
|
|
1
|
-
import { Injectable } from '@nestjs/common';
|
|
2
|
-
import { Repository } from 'typeorm';
|
|
3
|
-
import { InjectRepository } from '@nestjs/typeorm';
|
|
4
|
-
import { Role } from '../entity/role.entity';
|
|
5
|
-
|
|
6
|
-
@Injectable()
|
|
7
|
-
export class RoleRepository {
|
|
8
|
-
constructor(
|
|
9
|
-
@InjectRepository(Role)
|
|
10
|
-
private readonly roleRepo: Repository<Role>,
|
|
11
|
-
) {}
|
|
12
|
-
|
|
13
|
-
async findByCode(code: string): Promise<Role | null> {
|
|
14
|
-
return this.roleRepo.findOne({ where: { code } });
|
|
15
|
-
}
|
|
16
|
-
}
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { Repository } from 'typeorm';
|
|
3
|
+
import { InjectRepository } from '@nestjs/typeorm';
|
|
4
|
+
import { Role } from '../entity/role.entity';
|
|
5
|
+
|
|
6
|
+
@Injectable()
|
|
7
|
+
export class RoleRepository {
|
|
8
|
+
constructor(
|
|
9
|
+
@InjectRepository(Role)
|
|
10
|
+
private readonly roleRepo: Repository<Role>,
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
async findByCode(code: string): Promise<Role | null> {
|
|
14
|
+
return this.roleRepo.findOne({ where: { code } });
|
|
15
|
+
}
|
|
16
|
+
}
|
|
@@ -1,33 +1,33 @@
|
|
|
1
|
-
import { Repository } from 'typeorm';
|
|
2
|
-
import { UserSession } from '../entity/user-session.entity';
|
|
3
|
-
import { Injectable } from '@nestjs/common';
|
|
4
|
-
import { InjectRepository } from '@nestjs/typeorm';
|
|
5
|
-
|
|
6
|
-
@Injectable()
|
|
7
|
-
export class UserSessionRepository {
|
|
8
|
-
constructor(
|
|
9
|
-
@InjectRepository(UserSession)
|
|
10
|
-
private userSessionRepo: Repository<UserSession>,
|
|
11
|
-
) {}
|
|
12
|
-
|
|
13
|
-
async findBySessionKey(sessionKey: string): Promise<UserSession | null> {
|
|
14
|
-
return this.userSessionRepo.findOne({ where: { session_key: sessionKey } });
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
async findActiveSessionByUserId(userId: number): Promise<UserSession | null> {
|
|
18
|
-
return this.userSessionRepo.findOne({
|
|
19
|
-
where: { user_id: userId, is_session_loggedout: 0 },
|
|
20
|
-
});
|
|
21
|
-
}
|
|
22
|
-
|
|
23
|
-
async saveSession(session: UserSession): Promise<UserSession> {
|
|
24
|
-
return this.userSessionRepo.save(session);
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
async logoutSession(sessionKey: string): Promise<void> {
|
|
28
|
-
await this.userSessionRepo.update(
|
|
29
|
-
{ session_key: sessionKey },
|
|
30
|
-
{ is_session_loggedout: 1, logout_time: new Date() },
|
|
31
|
-
);
|
|
32
|
-
}
|
|
33
|
-
}
|
|
1
|
+
import { Repository } from 'typeorm';
|
|
2
|
+
import { UserSession } from '../entity/user-session.entity';
|
|
3
|
+
import { Injectable } from '@nestjs/common';
|
|
4
|
+
import { InjectRepository } from '@nestjs/typeorm';
|
|
5
|
+
|
|
6
|
+
@Injectable()
|
|
7
|
+
export class UserSessionRepository {
|
|
8
|
+
constructor(
|
|
9
|
+
@InjectRepository(UserSession)
|
|
10
|
+
private userSessionRepo: Repository<UserSession>,
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
async findBySessionKey(sessionKey: string): Promise<UserSession | null> {
|
|
14
|
+
return this.userSessionRepo.findOne({ where: { session_key: sessionKey } });
|
|
15
|
+
}
|
|
16
|
+
|
|
17
|
+
async findActiveSessionByUserId(userId: number): Promise<UserSession | null> {
|
|
18
|
+
return this.userSessionRepo.findOne({
|
|
19
|
+
where: { user_id: userId, is_session_loggedout: 0 },
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
async saveSession(session: UserSession): Promise<UserSession> {
|
|
24
|
+
return this.userSessionRepo.save(session);
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
async logoutSession(sessionKey: string): Promise<void> {
|
|
28
|
+
await this.userSessionRepo.update(
|
|
29
|
+
{ session_key: sessionKey },
|
|
30
|
+
{ is_session_loggedout: 1, logout_time: new Date() },
|
|
31
|
+
);
|
|
32
|
+
}
|
|
33
|
+
}
|
|
@@ -3,6 +3,8 @@ import { EncryptUtilService } from '../../../utils/service/encryptUtil.service';
|
|
|
3
3
|
import { UserData } from '../entity/user.entity';
|
|
4
4
|
import { UserSessionService } from './user-session.service';
|
|
5
5
|
import { UserService } from './user.service';
|
|
6
|
+
import { ConfigService } from '@nestjs/config';
|
|
7
|
+
|
|
6
8
|
|
|
7
9
|
|
|
8
10
|
@Injectable()
|
|
@@ -10,13 +12,13 @@ export class LoginService {
|
|
|
10
12
|
constructor(
|
|
11
13
|
@Inject('UserService') private readonly userService: UserService,
|
|
12
14
|
private userSessionService: UserSessionService,
|
|
15
|
+
private configService: ConfigService
|
|
13
16
|
) {}
|
|
14
|
-
|
|
15
|
-
masterKey: string =
|
|
16
|
-
masterIv: string =
|
|
17
|
-
|
|
17
|
+
|
|
18
|
+
masterKey: string = this.configService.get('MASTER_KEY') || '';
|
|
19
|
+
masterIv: string = this.configService.get('MASTER_IV') || '';
|
|
20
|
+
|
|
18
21
|
async login(email: string, password: string) {
|
|
19
|
-
console.log(process.env.master_key)
|
|
20
22
|
const user = await this.userService.findByEmailId(email);
|
|
21
23
|
if (!user) {
|
|
22
24
|
return {
|
|
@@ -5,27 +5,30 @@ import { BaseEntity } from '../../meta/entity/base-entity.entity';
|
|
|
5
5
|
import { UserRepository } from '../repository/user.repository';
|
|
6
6
|
import { EncryptUtilService } from '../../../utils/service/encryptUtil.service';
|
|
7
7
|
import { ClockIDGenService } from '../../../utils/service/clockIDGenUtil.service';
|
|
8
|
-
import { ENTITYTYPE_ROLE } from '../../../constant/global.constant';
|
|
8
|
+
import { ENTITYTYPE_ROLE, STATUS_ACTIVE } from '../../../constant/global.constant';
|
|
9
9
|
import { CreateUserDto } from '../dto/create-user.dto';
|
|
10
10
|
import { UserRoleMappingService } from './user-role-mapping.service';
|
|
11
11
|
import { UserRoleMapping } from '../entity/user-role-mapping.entity';
|
|
12
12
|
import { plainToInstance } from 'class-transformer';
|
|
13
13
|
import { EntityManager } from 'typeorm';
|
|
14
14
|
import { UpdateUserDto } from '../dto/update-user.dto';
|
|
15
|
+
import { ConfigService } from '@nestjs/config';
|
|
15
16
|
|
|
16
17
|
@Injectable()
|
|
17
18
|
export class UserService extends EntityServiceImpl {
|
|
18
|
-
masterKey = process.env.master_key || '';
|
|
19
|
-
masterIv = process.env.master_iv || '';
|
|
20
|
-
|
|
21
19
|
constructor(
|
|
22
20
|
private userRepository: UserRepository,
|
|
23
21
|
private userRoleMappingService: UserRoleMappingService,
|
|
24
22
|
private readonly clockIDGenService: ClockIDGenService,
|
|
23
|
+
private configService: ConfigService,
|
|
25
24
|
) {
|
|
26
25
|
super();
|
|
27
26
|
}
|
|
28
27
|
|
|
28
|
+
masterKey = this.configService.get('MASTER_KEY') || '';
|
|
29
|
+
masterIv = this.configService.get('MASTER_IV') || '';
|
|
30
|
+
|
|
31
|
+
|
|
29
32
|
async createEntity(
|
|
30
33
|
entityData: BaseEntity,
|
|
31
34
|
loggedInUser: UserData | null,
|
|
@@ -60,11 +63,11 @@ export class UserService extends EntityServiceImpl {
|
|
|
60
63
|
);
|
|
61
64
|
}
|
|
62
65
|
userData.password = password;
|
|
63
|
-
|
|
64
|
-
|
|
66
|
+
userData.status = STATUS_ACTIVE;
|
|
67
|
+
const savedData = await super.createEntity(userData, loggedInUser);
|
|
65
68
|
if (userData.roles) {
|
|
66
69
|
let roles = userData.roles;
|
|
67
|
-
this.userRoleMappingService.deleteByUserId(userData.id);
|
|
70
|
+
await this.userRoleMappingService.deleteByUserId(userData.id);
|
|
68
71
|
for (const role in roles) {
|
|
69
72
|
let userRoleMapping = new UserRoleMapping(
|
|
70
73
|
savedData.id,
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
DB_HOST: "13.234.25.234"
|
|
2
|
+
DB_PORT: "3306"
|
|
3
|
+
DB_USER: "root"
|
|
4
|
+
DB_PASS: "Rezolut@123"
|
|
5
|
+
DB_NAME: "core"
|
|
6
|
+
MASTER_KEY: "0QZ2eRJv5oVILYnyBlC+FbSGVQiWKReh"
|
|
7
|
+
MASTER_IV: "heuUQf5uPVtkotrFAOKUVw=="
|
|
8
|
+
SECRET_KEY: "1hard_to_guess_secret7890a"
|
|
9
|
+
CLIENT_ID: "324529881356-596sc8ksrb9lg01i7sktofqqqf0fv2ug.apps.googleusercontent.com"
|
|
10
|
+
CLIENT_SECRET: "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"
|
|
11
|
+
CALLBACK_URL: "http://localhost:3000/auth/google/callback"
|
|
12
|
+
OTP_EXPIRY: "10"
|
|
13
|
+
OTP_LENGTH: "6"
|
|
14
|
+
VERIFY_OTP: "false"
|
|
15
|
+
DEFAULT_OTP: "123456"
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { Module } from "@nestjs/common";
|
|
2
|
+
import { ConfigModule } from "@nestjs/config";
|
|
3
|
+
import propertiesYaml from "./properties.yaml";
|
|
4
|
+
@Module({
|
|
5
|
+
imports: [
|
|
6
|
+
ConfigModule.forRoot({
|
|
7
|
+
load: [propertiesYaml],
|
|
8
|
+
isGlobal: true
|
|
9
|
+
})
|
|
10
|
+
],
|
|
11
|
+
})
|
|
12
|
+
export default class Properties { }
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import { readFileSync } from 'fs';
|
|
2
|
+
import * as yaml from 'js-yaml';
|
|
3
|
+
import { join } from 'path';
|
|
4
|
+
|
|
5
|
+
const YAML_CONFIG = `/dev.properties.yaml`;
|
|
6
|
+
|
|
7
|
+
export default () => {
|
|
8
|
+
return yaml.load(
|
|
9
|
+
readFileSync(join(__dirname, YAML_CONFIG), 'utf8'),
|
|
10
|
+
) as Record<string, any>
|
|
11
|
+
}
|
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
DB_HOST: "13.234.25.234"
|
|
2
|
+
DB_PORT: "3306"
|
|
3
|
+
DB_USER: "root"
|
|
4
|
+
DB_PASS: "Rezolut@123"
|
|
5
|
+
DB_NAME: "ether_core"
|
|
6
|
+
MASTER_KEY: "0QZ2eRJv5oVILYnyBlC+FbSGVQiWKReh"
|
|
7
|
+
MASTER_IV: "heuUQf5uPVtkotrFAOKUVw=="
|
|
8
|
+
SECRET_KEY: "1hard_to_guess_secret7890a"
|
|
9
|
+
CLIENT_ID: "324529881356-596sc8ksrb9lg01i7sktofqqqf0fv2ug.apps.googleusercontent.com"
|
|
10
|
+
CLIENT_SECRET: "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"
|
|
11
|
+
CALLBACK_URL: "http://localhost:3000/auth/google/callback"
|
|
12
|
+
OTP_EXPIRY: "10"
|
|
13
|
+
OTP_LENGTH: "6"
|
|
14
|
+
VERIFY_OTP: "false"
|
|
15
|
+
DEFAULT_OTP: "123456"
|