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/dist/module/auth/strategies/jwt.strategy.d.ts +3 -1
- package/dist/module/auth/strategies/jwt.strategy.js +10 -2
- package/dist/module/auth/strategies/jwt.strategy.js.map +1 -1
- package/dist/module/user/entity/role.entity.d.ts +1 -0
- package/dist/module/user/entity/role.entity.js +4 -0
- package/dist/module/user/entity/role.entity.js.map +1 -1
- package/dist/module/user/entity/user-role-mapping.entity.d.ts +1 -0
- package/dist/module/user/entity/user-role-mapping.entity.js +4 -0
- package/dist/module/user/entity/user-role-mapping.entity.js.map +1 -1
- package/dist/module/user/entity/user.entity.d.ts +1 -0
- package/dist/module/user/entity/user.entity.js +4 -0
- package/dist/module/user/entity/user.entity.js.map +1 -1
- package/dist/module/user/service/user-session.service.js +2 -0
- package/dist/module/user/service/user-session.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/auth/strategies/jwt.strategy.ts +19 -3
- package/src/module/user/entity/role.entity.ts +3 -0
- package/src/module/user/entity/user-role-mapping.entity.ts +3 -0
- package/src/module/user/entity/user.entity.ts +3 -0
- package/src/module/user/service/user-session.service.ts +2 -0
package/package.json
CHANGED
|
@@ -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 {
|
|
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
|
-
|
|
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
|
}
|
|
@@ -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
|
}
|