rez_core 1.0.26 → 1.0.27

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 (136) hide show
  1. package/.idea/250218_nodejs_core.iml +12 -0
  2. package/.idea/codeStyles/Project.xml +59 -0
  3. package/.idea/codeStyles/codeStyleConfig.xml +5 -0
  4. package/.idea/dataSources.xml +12 -0
  5. package/.idea/modules.xml +8 -0
  6. package/.idea/prettier.xml +6 -0
  7. package/.idea/vcs.xml +6 -0
  8. package/dist/app.module.d.ts +0 -0
  9. package/dist/app.module.js +1 -0
  10. package/dist/app.module.js.map +1 -0
  11. package/dist/config/database.config.d.ts +3 -0
  12. package/dist/config/database.config.js +14 -6
  13. package/dist/config/database.config.js.map +1 -1
  14. package/dist/constant/global.constant.d.ts +6 -2
  15. package/dist/constant/global.constant.js +7 -3
  16. package/dist/constant/global.constant.js.map +1 -1
  17. package/dist/main.js +2 -1
  18. package/dist/main.js.map +1 -1
  19. package/dist/module/auth/auth.module.js +1 -1
  20. package/dist/module/auth/auth.module.js.map +1 -1
  21. package/dist/module/auth/guards/role.guard.js +3 -3
  22. package/dist/module/auth/strategies/google.strategy.d.ts +3 -1
  23. package/dist/module/auth/strategies/google.strategy.js +7 -5
  24. package/dist/module/auth/strategies/google.strategy.js.map +1 -1
  25. package/dist/module/auth/strategies/jwt.strategy.d.ts +4 -4
  26. package/dist/module/auth/strategies/jwt.strategy.js +8 -9
  27. package/dist/module/auth/strategies/jwt.strategy.js.map +1 -1
  28. package/dist/module/meta/entity/base-entity.entity.d.ts +1 -2
  29. package/dist/module/meta/entity/base-entity.entity.js +1 -2
  30. package/dist/module/meta/entity/base-entity.entity.js.map +1 -1
  31. package/dist/module/meta/entity/entity-master.entity.d.ts +1 -0
  32. package/dist/module/meta/entity/entity-master.entity.js +4 -0
  33. package/dist/module/meta/entity/entity-master.entity.js.map +1 -1
  34. package/dist/module/meta/entity/media-data.entity.d.ts +11 -0
  35. package/dist/module/meta/entity/media-data.entity.js +55 -0
  36. package/dist/module/meta/entity/media-data.entity.js.map +1 -0
  37. package/dist/module/meta/entity.module.js +8 -1
  38. package/dist/module/meta/entity.module.js.map +1 -1
  39. package/dist/module/meta/repository/media-data.repository.d.ts +9 -0
  40. package/dist/module/meta/repository/media-data.repository.js +55 -0
  41. package/dist/module/meta/repository/media-data.repository.js.map +1 -0
  42. package/dist/module/meta/service/entity-list.service.d.ts +1 -0
  43. package/dist/module/meta/service/entity-list.service.js +14 -2
  44. package/dist/module/meta/service/entity-list.service.js.map +1 -1
  45. package/dist/module/meta/service/entity-service-impl.service.d.ts +1 -1
  46. package/dist/module/meta/service/entity-service-impl.service.js +21 -4
  47. package/dist/module/meta/service/entity-service-impl.service.js.map +1 -1
  48. package/dist/module/meta/service/media-data.service.d.ts +9 -0
  49. package/dist/module/meta/service/media-data.service.js +36 -0
  50. package/dist/module/meta/service/media-data.service.js.map +1 -0
  51. package/dist/module/module/entity/menu.entity.d.ts +1 -2
  52. package/dist/module/module/entity/menu.entity.js +1 -2
  53. package/dist/module/module/entity/menu.entity.js.map +1 -1
  54. package/dist/module/module/entity/module.entity.d.ts +1 -2
  55. package/dist/module/module/entity/module.entity.js +1 -2
  56. package/dist/module/module/entity/module.entity.js.map +1 -1
  57. package/dist/module/notification/controller/otp.controller.d.ts +5 -3
  58. package/dist/module/notification/controller/otp.controller.js +7 -4
  59. package/dist/module/notification/controller/otp.controller.js.map +1 -1
  60. package/dist/module/notification/service/otp.service.d.ts +5 -3
  61. package/dist/module/notification/service/otp.service.js +7 -4
  62. package/dist/module/notification/service/otp.service.js.map +1 -1
  63. package/dist/module/user/service/login.service.d.ts +3 -1
  64. package/dist/module/user/service/login.service.js +7 -5
  65. package/dist/module/user/service/login.service.js.map +1 -1
  66. package/dist/module/user/service/user.service.d.ts +5 -3
  67. package/dist/module/user/service/user.service.js +10 -6
  68. package/dist/module/user/service/user.service.js.map +1 -1
  69. package/dist/resources/dev.properties.yaml +15 -0
  70. package/dist/resources/properties.module.d.ts +2 -0
  71. package/dist/resources/properties.module.js +25 -0
  72. package/dist/resources/properties.module.js.map +1 -0
  73. package/dist/resources/properties.yaml.d.ts +2 -0
  74. package/dist/resources/properties.yaml.js +10 -0
  75. package/dist/resources/properties.yaml.js.map +1 -0
  76. package/dist/resources/uat.properties.yaml +15 -0
  77. package/dist/tsconfig.build.tsbuildinfo +1 -1
  78. package/nest-cli.json +6 -0
  79. package/package.json +1 -1
  80. package/src/app.module.ts +0 -0
  81. package/src/config/database.config.ts +10 -5
  82. package/src/constant/global.constant.ts +13 -4
  83. package/src/module/auth/auth.module.ts +3 -2
  84. package/src/module/auth/guards/jwt.guard.ts +22 -22
  85. package/src/module/auth/guards/role.guard.ts +68 -68
  86. package/src/module/auth/services/auth.service.ts +29 -29
  87. package/src/module/auth/services/jwt.service.ts +11 -11
  88. package/src/module/auth/strategies/google.strategy.ts +7 -4
  89. package/src/module/auth/strategies/jwt.strategy.ts +5 -6
  90. package/src/module/auth/strategies/local.strategy.ts +13 -13
  91. package/src/module/dev/dev.module.ts +12 -12
  92. package/src/module/dev/service/dev.service.ts +7 -7
  93. package/src/module/enterprise/entity/enterprise.entity.ts +37 -37
  94. package/src/module/enterprise/entity/organization.entity.ts +80 -80
  95. package/src/module/master/controller/master.controller.ts +22 -22
  96. package/src/module/meta/dto/entity-list-data.dto.ts +6 -6
  97. package/src/module/meta/entity/attribute-master.entity.ts +67 -67
  98. package/src/module/meta/entity/base-entity.entity.ts +1 -2
  99. package/src/module/meta/entity/entity-master.entity.ts +3 -0
  100. package/src/module/meta/entity/media-data.entity.ts +32 -0
  101. package/src/module/meta/entity/preference.entity.ts +65 -65
  102. package/src/module/meta/entity.module.ts +8 -1
  103. package/src/module/meta/repository/attribute-master.repository.ts +28 -28
  104. package/src/module/meta/repository/media-data.repository.ts +50 -0
  105. package/src/module/meta/repository/preference.repository.ts +20 -20
  106. package/src/module/meta/service/entity-list.service.ts +21 -2
  107. package/src/module/meta/service/entity-service-impl.service.ts +36 -11
  108. package/src/module/meta/service/media-data.service.ts +44 -0
  109. package/src/module/module/controller/menu.controller.ts +15 -15
  110. package/src/module/module/entity/menu.entity.ts +1 -2
  111. package/src/module/module/entity/module-access.entity.ts +22 -22
  112. package/src/module/module/entity/module-action.entity.ts +19 -19
  113. package/src/module/module/entity/module.entity.ts +1 -2
  114. package/src/module/notification/controller/otp.controller.ts +8 -3
  115. package/src/module/notification/service/otp.service.ts +6 -3
  116. package/src/module/user/controller/user.controller.ts +28 -28
  117. package/src/module/user/dto/update-user.dto.ts +4 -4
  118. package/src/module/user/entity/user-role-mapping.entity.ts +21 -21
  119. package/src/module/user/entity/user-session.entity.ts +61 -61
  120. package/src/module/user/entity/user.entity.ts +35 -35
  121. package/src/module/user/repository/role.repository.ts +16 -16
  122. package/src/module/user/repository/userSession.repository.ts +33 -33
  123. package/src/module/user/service/login.service.ts +7 -5
  124. package/src/module/user/service/user.service.ts +10 -7
  125. package/src/resources/dev.properties.yaml +15 -0
  126. package/src/resources/properties.module.ts +12 -0
  127. package/src/resources/properties.yaml.ts +11 -0
  128. package/src/resources/uat.properties.yaml +15 -0
  129. package/src/utils/service/encryptUtil.service.ts +97 -97
  130. package/src/utils/service/excelUtil.service.ts +15 -15
  131. package/src/utils/service/reflection-helper.service.ts +53 -53
  132. package/.env +0 -10
  133. package/dist/constant/status.constant.d.ts +0 -4
  134. package/dist/constant/status.constant.js +0 -9
  135. package/dist/constant/status.constant.js.map +0 -1
  136. package/src/constant/status.constant.ts +0 -3
package/nest-cli.json CHANGED
@@ -3,6 +3,12 @@
3
3
  "collection": "@nestjs/schematics",
4
4
  "sourceRoot": "src",
5
5
  "compilerOptions": {
6
+ "assets": [
7
+ {
8
+ "include": "../src/resources/*.yaml",
9
+ "outDir": "./dist/"
10
+ }
11
+ ],
6
12
  "deleteOutDir": true
7
13
  }
8
14
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "1.0.26",
3
+ "version": "1.0.27",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
File without changes
@@ -1,17 +1,22 @@
1
1
  import { Injectable } from '@nestjs/common';
2
+ import { ConfigService } from '@nestjs/config';
2
3
  import { TypeOrmModuleOptions, TypeOrmOptionsFactory } from '@nestjs/typeorm';
3
4
 
4
5
  @Injectable()
5
6
  export class MySqlConfiguration implements TypeOrmOptionsFactory {
6
7
 
8
+ constructor(
9
+ private configService: ConfigService,
10
+ ){}
11
+
7
12
  createTypeOrmOptions(): TypeOrmModuleOptions {
8
13
  return {
9
14
  type: 'mysql',
10
- host: process.env.DB_HOST || '13.234.25.234',
11
- port: parseInt(process.env.DB_PORT || '3306', 10),
12
- username: process.env.DB_USER || 'root',
13
- password: process.env.DB_PASS || 'Rezolut@123',
14
- database: process.env.DB_NAME || 'core',
15
+ host: this.configService.get('DB_HOST')|| '13.234.25.234',
16
+ port: parseInt(this.configService.get('DB_PORT') || '3306', 10),
17
+ username: this.configService.get('DB_USER') || 'root',
18
+ password: this.configService.get('DB_PASS') || 'Rezolut@123',
19
+ database: this.configService.get('DB_NAME') || 'core',
15
20
  entities: [__dirname + '/../module/**/*.entity.{ts,js}'],
16
21
  synchronize: true,
17
22
  autoLoadEntities: true,
@@ -4,7 +4,16 @@ export const ENTITYTYPE_ENTITYMASTER = 'EMS';
4
4
  export const ENTITYTYPE_ROLE = 'ROL';
5
5
  export const ENTITYTYPE_ENTITYTABLE = 'ETB';
6
6
  export const ENTITYTYPE_ENTITYTABLECOLUMN = 'ETC';
7
- export const ENTITYTYPE_PREFERENCEMASTER = 'PRM'
8
- export const masterKey: string = process.env.master_key || '';
9
- export const masterIv: string = process.env.master_iv || '';
10
- export const secretKey: string = process.env.secret_key || '';
7
+ export const ENTITYTYPE_PREFERENCEMASTER = 'PRM';
8
+ export const ENTITYTYPE_VIEWMASTER = 'VMS';
9
+ export const ENTITYTYPE_MEDIA = 'MDA';
10
+
11
+ export const STORAGETYPE_SINGLEJSON = 'singlejson';
12
+ export const STORAGETYPE_COLUMN = 'column';
13
+
14
+ // SECRET KEY
15
+ export const secretKey: string = process.env.secret_key || '';
16
+
17
+ // STATUS
18
+ export const STATUS_ACTIVE = 'ACTIVE';
19
+ export const STATUS_INACTIVE = 'INACTIVE';
@@ -5,6 +5,7 @@ import { TypeOrmModule } from '@nestjs/typeorm';
5
5
  import { JwtStrategy } from './strategies/jwt.strategy';
6
6
  import { JwtAuthService } from './services/jwt.service';
7
7
  import { JwtAuthGuard } from './guards/jwt.guard';
8
+ import { secretKey } from '../../constant/global.constant';
8
9
  import { PassportModule } from '@nestjs/passport';
9
10
  import { UserSession } from '../user/entity/user-session.entity';
10
11
  import { GoogleStrategy } from './strategies/google.strategy';
@@ -15,10 +16,10 @@ import { RolesGuard } from './guards/role.guard';
15
16
  ConfigModule, // ✅ Ensure ConfigModule is imported
16
17
  PassportModule.register({ defaultStrategy: 'jwt' }),
17
18
  JwtModule.registerAsync({
18
- imports: [ConfigModule], // ✅ Ensure ConfigModule is available
19
+ imports: [ConfigModule],
19
20
  inject: [ConfigService],
20
21
  useFactory: async (configService: ConfigService) => ({
21
- secret: configService.get<string>('secret_key', 'defaultSecret'), // ✅ Use ConfigService
22
+ secret: configService.get('SECRET_KEY'),
22
23
  signOptions: { expiresIn: '1800s' },
23
24
  }),
24
25
  }),
@@ -1,22 +1,22 @@
1
- import { ExecutionContext, Injectable } from '@nestjs/common';
2
- import { AuthGuard } from '@nestjs/passport';
3
- import { Reflector } from '@nestjs/core';
4
- import { Observable } from 'rxjs';
5
-
6
- @Injectable()
7
- export class JwtAuthGuard extends AuthGuard('jwt') {
8
- constructor(private reflector: Reflector) {
9
- super();
10
- }
11
-
12
- canActivate(
13
- context: ExecutionContext,
14
- ): Promise<boolean> | boolean | Observable<boolean> {
15
- const isPublic = this.reflector.getAllAndOverride('isPublic', [
16
- context.getHandler(),
17
- context.getClass(),
18
- ]);
19
- if (isPublic) return true;
20
- return super.canActivate(context);
21
- }
22
- }
1
+ import { ExecutionContext, Injectable } from '@nestjs/common';
2
+ import { AuthGuard } from '@nestjs/passport';
3
+ import { Reflector } from '@nestjs/core';
4
+ import { Observable } from 'rxjs';
5
+
6
+ @Injectable()
7
+ export class JwtAuthGuard extends AuthGuard('jwt') {
8
+ constructor(private reflector: Reflector) {
9
+ super();
10
+ }
11
+
12
+ canActivate(
13
+ context: ExecutionContext,
14
+ ): Promise<boolean> | boolean | Observable<boolean> {
15
+ const isPublic = this.reflector.getAllAndOverride('isPublic', [
16
+ context.getHandler(),
17
+ context.getClass(),
18
+ ]);
19
+ if (isPublic) return true;
20
+ return super.canActivate(context);
21
+ }
22
+ }
@@ -1,68 +1,68 @@
1
- import {
2
- CanActivate,
3
- ExecutionContext,
4
- ForbiddenException,
5
- Injectable,
6
- UnauthorizedException,
7
- } from '@nestjs/common';
8
- import { Reflector } from '@nestjs/core';
9
- import { UserData } from '../../user/entity/user.entity';
10
- import { InjectEntityManager } from '@nestjs/typeorm';
11
- import { EntityManager } from 'typeorm';
12
-
13
- @Injectable()
14
- export class RolesGuard implements CanActivate {
15
- constructor(
16
- private reflector: Reflector,
17
- @InjectEntityManager() private entityManager: EntityManager,
18
- ) {}
19
-
20
- async canActivate(context: ExecutionContext) {
21
- const request = context
22
- .switchToHttp()
23
- .getRequest<Request & { user: any }>();
24
- const object = request.user;
25
-
26
- const users: UserData = await this.entityManager.query(
27
- `SELECT * FROM cr_user WHERE id = ${object.userId} LIMIT 1`,
28
- );
29
-
30
- const user = users[0];
31
- if (!user || !user['role_id']) {
32
- throw new UnauthorizedException('User not authorized');
33
- }
34
-
35
- const requiredModule = this.reflector.get<string>(
36
- 'moduleCode',
37
- context.getHandler(),
38
- );
39
- const requiredActions = this.reflector.get<string>(
40
- 'actions',
41
- context.getHandler(),
42
- );
43
-
44
- const roleAccess = await this.entityManager.query(
45
- `SELECT *
46
- FROM cr_module_access
47
- WHERE role_id = ${user['role_id']}
48
- AND module_code = '${requiredModule}'`,
49
- );
50
-
51
- if (!roleAccess || roleAccess.length === 0) {
52
- throw new ForbiddenException(
53
- 'Access denied: No permissions found for this module',
54
- );
55
- }
56
-
57
- const hasAccess = roleAccess.some(
58
- (access) =>
59
- requiredActions.includes(access.action_type) &&
60
- access.access_flag === 1,
61
- );
62
-
63
- if (!hasAccess) {
64
- throw new ForbiddenException('Access denied: Insufficient permissions.');
65
- }
66
- return true;
67
- }
68
- }
1
+ import {
2
+ CanActivate,
3
+ ExecutionContext,
4
+ ForbiddenException,
5
+ Injectable,
6
+ UnauthorizedException,
7
+ } from '@nestjs/common';
8
+ import { Reflector } from '@nestjs/core';
9
+ import { UserData } from '../../user/entity/user.entity';
10
+ import { InjectEntityManager } from '@nestjs/typeorm';
11
+ import { EntityManager } from 'typeorm';
12
+
13
+ @Injectable()
14
+ export class RolesGuard implements CanActivate {
15
+ constructor(
16
+ private reflector: Reflector,
17
+ @InjectEntityManager() private entityManager: EntityManager,
18
+ ) {}
19
+
20
+ async canActivate(context: ExecutionContext) {
21
+ const request = context
22
+ .switchToHttp()
23
+ .getRequest<Request & { user: any }>();
24
+ const object = request.user;
25
+
26
+ const users: UserData = await this.entityManager.query(
27
+ `SELECT * FROM cr_user WHERE id = ${object.userId} LIMIT 1`,
28
+ );
29
+
30
+ const user = users[0];
31
+ if (!user || !user['role_id']) {
32
+ throw new UnauthorizedException('User not authorized');
33
+ }
34
+
35
+ const requiredModule = this.reflector.get<string>(
36
+ 'moduleCode',
37
+ context.getHandler(),
38
+ );
39
+ const requiredActions = this.reflector.get<string>(
40
+ 'actions',
41
+ context.getHandler(),
42
+ );
43
+
44
+ const roleAccess = await this.entityManager.query(
45
+ `SELECT *
46
+ FROM cr_module_access
47
+ WHERE role_id = ${user['role_id']}
48
+ AND module_code = '${requiredModule}'`,
49
+ );
50
+
51
+ if (!roleAccess || roleAccess.length === 0) {
52
+ throw new ForbiddenException(
53
+ 'Access denied: No permissions found for this module',
54
+ );
55
+ }
56
+
57
+ const hasAccess = roleAccess.some(
58
+ (access) =>
59
+ requiredActions.includes(access.action_type) &&
60
+ access.access_flag === 1,
61
+ );
62
+
63
+ if (!hasAccess) {
64
+ throw new ForbiddenException('Access denied: Insufficient permissions.');
65
+ }
66
+ return true;
67
+ }
68
+ }
@@ -1,29 +1,29 @@
1
- import { BadRequestException, Injectable } from '@nestjs/common';
2
- import { UserService } from '../../user/service/user.service';
3
- import { JwtService } from '@nestjs/jwt';
4
- import { UserData } from '../../user/entity/user.entity';
5
-
6
- @Injectable()
7
- export class AuthService {
8
- constructor(
9
- private userService: UserService,
10
- private jwtService: JwtService,
11
- ) {}
12
-
13
- async validateUser(email: string, password: string): Promise<UserData> {
14
- const user = await this.userService.findByEmailId(email);
15
- if (!user) {
16
- throw new BadRequestException('User not found');
17
- }
18
- const isMatch: boolean = password === user.password;
19
- if (!isMatch) {
20
- throw new BadRequestException('Password does not match');
21
- }
22
- return user;
23
- }
24
-
25
- async login(user: UserData) {
26
- const payload = { email: user.email_id, id: user.id };
27
- return { access_token: this.jwtService.sign(payload) };
28
- }
29
- }
1
+ import { BadRequestException, Injectable } from '@nestjs/common';
2
+ import { UserService } from '../../user/service/user.service';
3
+ import { JwtService } from '@nestjs/jwt';
4
+ import { UserData } from '../../user/entity/user.entity';
5
+
6
+ @Injectable()
7
+ export class AuthService {
8
+ constructor(
9
+ private userService: UserService,
10
+ private jwtService: JwtService,
11
+ ) {}
12
+
13
+ async validateUser(email: string, password: string): Promise<UserData> {
14
+ const user = await this.userService.findByEmailId(email);
15
+ if (!user) {
16
+ throw new BadRequestException('User not found');
17
+ }
18
+ const isMatch: boolean = password === user.password;
19
+ if (!isMatch) {
20
+ throw new BadRequestException('Password does not match');
21
+ }
22
+ return user;
23
+ }
24
+
25
+ async login(user: UserData) {
26
+ const payload = { email: user.email_id, id: user.id };
27
+ return { access_token: this.jwtService.sign(payload) };
28
+ }
29
+ }
@@ -1,11 +1,11 @@
1
- import { Injectable } from '@nestjs/common';
2
- import { JwtService } from '@nestjs/jwt';
3
-
4
- @Injectable()
5
- export class JwtAuthService {
6
- constructor(private readonly jwtService: JwtService) {}
7
-
8
- generateJwt(payload: any): string {
9
- return this.jwtService.sign(payload);
10
- }
11
- }
1
+ import { Injectable } from '@nestjs/common';
2
+ import { JwtService } from '@nestjs/jwt';
3
+
4
+ @Injectable()
5
+ export class JwtAuthService {
6
+ constructor(private readonly jwtService: JwtService) {}
7
+
8
+ generateJwt(payload: any): string {
9
+ return this.jwtService.sign(payload);
10
+ }
11
+ }
@@ -1,14 +1,17 @@
1
1
  import { Injectable } from '@nestjs/common';
2
+ import { ConfigService } from '@nestjs/config';
2
3
  import { PassportStrategy } from '@nestjs/passport';
3
4
  import { Strategy, VerifyCallback } from 'passport-google-oauth20';
4
5
 
5
6
  @Injectable()
6
7
  export class GoogleStrategy extends PassportStrategy(Strategy, 'google') {
7
- constructor() {
8
+ constructor(
9
+ private configService: ConfigService,
10
+ ) {
8
11
  super({
9
- clientID: process.env.clientID,
10
- clientSecret: process.env.clientSecret,
11
- callbackURL: process.env.callbackURL,
12
+ clientID: configService.get('CLIENT_ID'),
13
+ clientSecret: configService.get('CLIENT_SECRET'),
14
+ callbackURL:configService.get('CALLBACK_URL'),
12
15
  scope: ['email', 'profile'],
13
16
  });
14
17
  }
@@ -1,25 +1,24 @@
1
1
  import { ExtractJwt, Strategy } from 'passport-jwt';
2
2
  import { PassportStrategy } from '@nestjs/passport';
3
3
  import { Injectable, UnauthorizedException } from '@nestjs/common';
4
+ import { secretKey } from '../../../constant/global.constant';
4
5
  import { InjectRepository } from '@nestjs/typeorm';
5
- import { ConfigService } from '@nestjs/config'; // ✅ Import ConfigService
6
- import { UserSession } from '../../../module/user/entity/user-session.entity';
6
+ import { UserSession } from 'src/module/user/entity/user-session.entity';
7
7
  import { Repository } from 'typeorm';
8
+ import { ConfigService } from '@nestjs/config';
8
9
 
9
10
  @Injectable()
10
11
  export class JwtStrategy extends PassportStrategy(Strategy) {
11
12
  constructor(
12
- private readonly configService: ConfigService, // ✅ Inject ConfigService
13
13
  @InjectRepository(UserSession)
14
14
  private userSessionRepository: Repository<UserSession>,
15
+ private configService: ConfigService,
15
16
  ) {
16
17
  super({
17
18
  jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
18
19
  ignoreExpiration: false,
19
- secretOrKey: configService.get<string>('secret_key'), // ✅ Use ConfigService
20
+ secretOrKey:configService.get('SECRET_KEY'),
20
21
  });
21
-
22
- console.log('Loaded JWT Secret:', configService.get<string>('secret_key')); // Debugging
23
22
  }
24
23
 
25
24
  async validate(payload) {
@@ -1,13 +1,13 @@
1
- import { PassportStrategy } from '@nestjs/passport';
2
- import { AuthService } from '../services/auth.service';
3
- import { Injectable } from '@nestjs/common';
4
- import { Strategy } from 'passport-jwt';
5
-
6
- @Injectable()
7
- export class LocalStrategy extends PassportStrategy(Strategy) {
8
- constructor(private authService: AuthService) {
9
- super({
10
- usernameField: 'email',
11
- });
12
- }
13
- }
1
+ import { PassportStrategy } from '@nestjs/passport';
2
+ import { AuthService } from '../services/auth.service';
3
+ import { Injectable } from '@nestjs/common';
4
+ import { Strategy } from 'passport-jwt';
5
+
6
+ @Injectable()
7
+ export class LocalStrategy extends PassportStrategy(Strategy) {
8
+ constructor(private authService: AuthService) {
9
+ super({
10
+ usernameField: 'email',
11
+ });
12
+ }
13
+ }
@@ -1,12 +1,12 @@
1
- import { Module } from '@nestjs/common';
2
- import { EntityModule } from '../meta/entity.module';
3
- import { UserModule } from '../user/user.module';
4
- import { ModuleModule } from '../module/module.module';
5
- import { DevService } from './service/dev.service';
6
-
7
- @Module({
8
- imports: [EntityModule, UserModule, ModuleModule],
9
- controllers: [],
10
- providers: [DevService],
11
- })
12
- export class DevModule {}
1
+ import { Module } from '@nestjs/common';
2
+ import { EntityModule } from '../meta/entity.module';
3
+ import { UserModule } from '../user/user.module';
4
+ import { ModuleModule } from '../module/module.module';
5
+ import { DevService } from './service/dev.service';
6
+
7
+ @Module({
8
+ imports: [EntityModule, UserModule, ModuleModule],
9
+ controllers: [],
10
+ providers: [DevService],
11
+ })
12
+ export class DevModule {}
@@ -1,7 +1,7 @@
1
- import { Injectable } from '@nestjs/common';
2
- import { UserService } from '../../user/service/user.service';
3
-
4
- @Injectable()
5
- export class DevService {
6
- constructor(private readonly userService: UserService) {}
7
- }
1
+ import { Injectable } from '@nestjs/common';
2
+ import { UserService } from '../../user/service/user.service';
3
+
4
+ @Injectable()
5
+ export class DevService {
6
+ constructor(private readonly userService: UserService) {}
7
+ }
@@ -1,37 +1,37 @@
1
- import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
2
-
3
- @Entity({ name: 'cr_enterprise' })
4
- export class EnterpriseData {
5
- @PrimaryGeneratedColumn({ name: 'id', type: 'bigint' })
6
- id: number;
7
-
8
- @Column({ name: 'entity_type', type: 'varchar', nullable: true, length: 50 })
9
- entityType: string;
10
-
11
- @Column({ name: 'code', type: 'varchar', nullable: true, length: 50 })
12
- code: string;
13
-
14
- @Column({ name: 'name', type: 'varchar', nullable: true, length: 50 })
15
- name: string;
16
-
17
- @Column({ name: 'status', type: 'varchar', nullable: true, length: 50 })
18
- status: string;
19
-
20
- @Column({ name: 'created_by', type: 'int', nullable: true })
21
- createdBy: number;
22
-
23
- @Column({ name: 'modified_by', type: 'int', nullable: true })
24
- modifiedBy: number;
25
-
26
- @Column({ name: 'created_date', type: 'datetime', nullable: true })
27
- createdDate: Date;
28
-
29
- @Column({ name: 'modified_date', type: 'datetime', nullable: true })
30
- modifiedDate: Date;
31
-
32
- @Column({ name: 'app_code', type: 'varchar', nullable: true, length: 50 })
33
- appCode: string;
34
-
35
- @Column({ name: 'app_url_name', type: 'varchar', nullable: true, length: 50 })
36
- appUrlName: string;
37
- }
1
+ import { Column, Entity, PrimaryGeneratedColumn } from 'typeorm';
2
+
3
+ @Entity({ name: 'cr_enterprise' })
4
+ export class EnterpriseData {
5
+ @PrimaryGeneratedColumn({ name: 'id', type: 'bigint' })
6
+ id: number;
7
+
8
+ @Column({ name: 'entity_type', type: 'varchar', nullable: true, length: 50 })
9
+ entityType: string;
10
+
11
+ @Column({ name: 'code', type: 'varchar', nullable: true, length: 50 })
12
+ code: string;
13
+
14
+ @Column({ name: 'name', type: 'varchar', nullable: true, length: 50 })
15
+ name: string;
16
+
17
+ @Column({ name: 'status', type: 'varchar', nullable: true, length: 50 })
18
+ status: string;
19
+
20
+ @Column({ name: 'created_by', type: 'int', nullable: true })
21
+ createdBy: number;
22
+
23
+ @Column({ name: 'modified_by', type: 'int', nullable: true })
24
+ modifiedBy: number;
25
+
26
+ @Column({ name: 'created_date', type: 'datetime', nullable: true })
27
+ createdDate: Date;
28
+
29
+ @Column({ name: 'modified_date', type: 'datetime', nullable: true })
30
+ modifiedDate: Date;
31
+
32
+ @Column({ name: 'app_code', type: 'varchar', nullable: true, length: 50 })
33
+ appCode: string;
34
+
35
+ @Column({ name: 'app_url_name', type: 'varchar', nullable: true, length: 50 })
36
+ appUrlName: string;
37
+ }