rez_core 2.0.15 → 2.0.17

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/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "rez_core",
3
- "version": "2.0.15",
3
+ "version": "2.0.17",
4
4
  "description": "",
5
5
  "author": "",
6
6
  "private": false,
@@ -4,7 +4,7 @@ import { Injectable, UnauthorizedException } from '@nestjs/common';
4
4
  import { secretKey } from '../../../constant/global.constant';
5
5
  import { InjectRepository } from '@nestjs/typeorm';
6
6
  import { UserSession } from 'src/module/user/entity/user-session.entity';
7
- import { Repository } from 'typeorm';
7
+ import { BaseEntity, Repository } from 'typeorm';
8
8
  import { ConfigService } from '@nestjs/config';
9
9
 
10
10
  @Injectable()
@@ -18,7 +18,14 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
18
18
  }
19
19
 
20
20
  async validate(payload) {
21
- const { userId, sessionToken, appcode, email_id } = payload;
21
+ const {
22
+ userId,
23
+ sessionToken,
24
+ appcode,
25
+ email_id,
26
+ organization_id,
27
+ enterprise_id,
28
+ } = payload;
22
29
 
23
30
  // Check if session exists and is valid
24
31
  // const userSession = await this.userSessionRepository.findOne({
@@ -33,6 +40,15 @@ export class JwtStrategy extends PassportStrategy(Strategy) {
33
40
  // throw new UnauthorizedException('Invalid or expired session');
34
41
  // }
35
42
 
36
- return { userId, sessionToken, appcode, email_id };
43
+ let userData = {
44
+ id: userId,
45
+ sessionToken: sessionToken,
46
+ appcode: appcode,
47
+ email_id: email_id,
48
+ organization_id: organization_id,
49
+ enterprise_id: enterprise_id,
50
+ };
51
+
52
+ return userData;
37
53
  }
38
54
  }
@@ -16,6 +16,9 @@ export class Role extends BaseEntity {
16
16
  @Column({ type: 'varchar', length: 250, nullable: true })
17
17
  description: string;
18
18
 
19
+ @Column({ type: 'int', nullable: true })
20
+ organization_id: number;
21
+
19
22
  @Exclude()
20
23
  copy_from_role_id: number;
21
24
 
@@ -21,6 +21,9 @@ export class UserRoleMapping {
21
21
  @Column({ type: 'bigint', nullable: true })
22
22
  role_id: number;
23
23
 
24
+ @Column({ type: 'int', nullable: true })
25
+ organization_id: number;
26
+
24
27
  @Column({ type: 'int', nullable: true })
25
28
  is_default: number;
26
29
 
@@ -36,6 +36,9 @@ export class UserData extends BaseEntity {
36
36
  @Column({ type: 'int', nullable: true })
37
37
  is_customer: number;
38
38
 
39
+ @Column({ type: 'int', nullable: true })
40
+ organization_id: number;
41
+
39
42
  @Column({ type: 'int', nullable: true })
40
43
  is_factory: number;
41
44
  }
@@ -33,6 +33,8 @@ export class UserSessionService {
33
33
  sessionToken,
34
34
  appcode: appcode,
35
35
  email_id: user.email_id,
36
+ organization_id: user.organization_id,
37
+ enterprise_id: user.enterprise_id,
36
38
  };
37
39
  const accessToken = this.jwtAuthService.generateJwt(payload);
38
40