rez_core 1.0.17 → 1.0.18

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.
Files changed (48) hide show
  1. package/.env +3 -1
  2. package/.idea/250218_nodejs_core.iml +12 -0
  3. package/.idea/codeStyles/Project.xml +59 -0
  4. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  5. package/.idea/dataSources.xml +12 -0
  6. package/.idea/modules.xml +8 -0
  7. package/.idea/prettier.xml +6 -0
  8. package/.idea/vcs.xml +6 -0
  9. package/dist/module/auth/guards/role.guard.js +3 -3
  10. package/dist/module/notification/service/otp.service.d.ts +2 -0
  11. package/dist/module/notification/service/otp.service.js +3 -1
  12. package/dist/module/notification/service/otp.service.js.map +1 -1
  13. package/dist/module/user/service/user.service.js.map +1 -1
  14. package/dist/tsconfig.build.tsbuildinfo +1 -1
  15. package/package.json +1 -1
  16. package/src/module/auth/guards/jwt.guard.ts +22 -22
  17. package/src/module/auth/guards/role.guard.ts +68 -68
  18. package/src/module/auth/services/auth.service.ts +29 -29
  19. package/src/module/auth/services/jwt.service.ts +11 -11
  20. package/src/module/auth/strategies/google.strategy.ts +29 -29
  21. package/src/module/auth/strategies/local.strategy.ts +13 -13
  22. package/src/module/dev/dev.module.ts +12 -12
  23. package/src/module/dev/service/dev.service.ts +7 -7
  24. package/src/module/enterprise/entity/enterprise.entity.ts +37 -37
  25. package/src/module/enterprise/entity/organization.entity.ts +80 -80
  26. package/src/module/master/controller/master.controller.ts +22 -22
  27. package/src/module/meta/dto/entity-list-data.dto.ts +6 -6
  28. package/src/module/meta/entity/attribute-master.entity.ts +67 -67
  29. package/src/module/meta/entity/entity-master.entity.ts +61 -61
  30. package/src/module/meta/entity/preference.entity.ts +65 -65
  31. package/src/module/meta/repository/attribute-master.repository.ts +28 -28
  32. package/src/module/meta/repository/preference.repository.ts +20 -20
  33. package/src/module/meta/service/entity-master.service.ts +26 -26
  34. package/src/module/module/controller/menu.controller.ts +15 -15
  35. package/src/module/module/entity/module-access.entity.ts +22 -22
  36. package/src/module/module/entity/module-action.entity.ts +19 -19
  37. package/src/module/notification/service/otp.service.ts +4 -1
  38. package/src/module/user/controller/user.controller.ts +28 -28
  39. package/src/module/user/dto/update-user.dto.ts +4 -4
  40. package/src/module/user/entity/user-role-mapping.entity.ts +21 -21
  41. package/src/module/user/entity/user-session.entity.ts +61 -61
  42. package/src/module/user/entity/user.entity.ts +35 -35
  43. package/src/module/user/repository/role.repository.ts +16 -16
  44. package/src/module/user/repository/userSession.repository.ts +33 -33
  45. package/src/module/user/service/user.service.ts +1 -4
  46. package/src/utils/service/encryptUtil.service.ts +97 -97
  47. package/src/utils/service/excelUtil.service.ts +15 -15
  48. package/src/utils/service/reflection-helper.service.ts +53 -53
@@ -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
+ }
@@ -5,6 +5,9 @@ import { ClockIDGenService } from '../../../utils/service/clockIDGenUtil.service
5
5
 
6
6
  @Injectable()
7
7
  export class OtpService {
8
+ VERIFY_OTP = process.env.VERIFY_OTP || 'true';
9
+ DEFAULT_OTP = process.env.DEFAULT_OTP || '123456';
10
+
8
11
  constructor(
9
12
  private readonly otpRepository: OtpRepository,
10
13
  private readonly idGen: ClockIDGenService,
@@ -16,7 +19,7 @@ export class OtpService {
16
19
  otp.created_date = new Date();
17
20
  otp.otp_id = this.idGen.idGenerator();
18
21
  otp.identifier = identifier;
19
- otp.otp = this.generateOtp(otpLength);
22
+ otp.otp = 'true' === this.VERIFY_OTP ? this.generateOtp(otpLength) : this.DEFAULT_OTP;
20
23
  otp.service = service;
21
24
  otp.verified = 0;
22
25
  otp.expiration_date = new Date(Date.now() + expiresIn * 60 * 1000);
@@ -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
+ }
@@ -1,8 +1,5 @@
1
1
  import { BadRequestException, Injectable } from '@nestjs/common';
2
2
  import { EntityServiceImpl } from '../../meta/service/entity-service-impl.service';
3
- import { EntityMasterService } from '../../meta/service/entity-master.service';
4
- import { ReflectionHelper } from '../../../utils/service/reflection-helper.service';
5
- import { LoggingService } from '../../../utils/service/loggingUtil.service';
6
3
  import { UserData } from '../entity/user.entity';
7
4
  import { BaseEntity } from '../../meta/entity/base-entity.entity';
8
5
  import { UserRepository } from '../repository/user.repository';
@@ -13,7 +10,6 @@ import { CreateUserDto } from '../dto/create-user.dto';
13
10
  import { UserRoleMappingService } from './user-role-mapping.service';
14
11
  import { UserRoleMapping } from '../entity/user-role-mapping.entity';
15
12
  import { plainToInstance } from 'class-transformer';
16
- import { EntityListService } from '../../meta/service/entity-list.service';
17
13
  import { EntityManager } from 'typeorm';
18
14
  import { UpdateUserDto } from '../dto/update-user.dto';
19
15
 
@@ -21,6 +17,7 @@ import { UpdateUserDto } from '../dto/update-user.dto';
21
17
  export class UserService extends EntityServiceImpl {
22
18
  masterKey = process.env.master_key || '';
23
19
  masterIv = process.env.master_iv || '';
20
+
24
21
  constructor(
25
22
  private userRepository: UserRepository,
26
23
  private userRoleMappingService: UserRoleMappingService,