rez_core 2.0.11 → 2.0.13
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/core.module.js +2 -6
- package/dist/core.module.js.map +1 -1
- package/dist/module/auth/strategies/jwt.strategy.d.ts +1 -1
- package/dist/module/auth/strategies/jwt.strategy.js +0 -6
- package/dist/module/auth/strategies/jwt.strategy.js.map +1 -1
- package/dist/module/layout/controller/layout.controller.js +2 -2
- package/dist/module/layout/controller/layout.controller.js.map +1 -1
- package/dist/module/layout/layout.module.js +5 -1
- package/dist/module/layout/layout.module.js.map +1 -1
- package/dist/module/user/controller/login.controller.js +1 -1
- package/dist/module/user/controller/login.controller.js.map +1 -1
- package/dist/module/user/service/login.service.d.ts +1 -1
- package/dist/module/user/service/login.service.js +2 -2
- package/dist/module/user/service/login.service.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/core.module.ts +13 -6
- package/src/module/auth/strategies/jwt.strategy.ts +1 -5
- package/src/module/layout/controller/layout.controller.ts +23 -8
- package/src/module/layout/layout.module.ts +5 -1
- package/src/module/user/controller/login.controller.ts +2 -4
- package/src/module/user/service/login.service.ts +2 -7
package/package.json
CHANGED
package/src/core.module.ts
CHANGED
|
@@ -23,10 +23,8 @@ export class CoreModule {
|
|
|
23
23
|
ConfigModule.forRoot({ isGlobal: true }),
|
|
24
24
|
dbModule,
|
|
25
25
|
EntityModule,
|
|
26
|
-
EnterpriseModule,
|
|
27
26
|
UtilsModule,
|
|
28
27
|
NotificationModule,
|
|
29
|
-
LayoutModule,
|
|
30
28
|
ListMasterModule,
|
|
31
29
|
FilterModule,
|
|
32
30
|
];
|
|
@@ -35,17 +33,26 @@ export class CoreModule {
|
|
|
35
33
|
ConfigModule,
|
|
36
34
|
dbModule,
|
|
37
35
|
EntityModule,
|
|
38
|
-
|
|
36
|
+
|
|
39
37
|
UtilsModule,
|
|
40
38
|
NotificationModule,
|
|
41
|
-
LayoutModule,
|
|
42
39
|
ListMasterModule,
|
|
43
40
|
FilterModule,
|
|
44
41
|
];
|
|
45
42
|
|
|
46
43
|
if (isSso) {
|
|
47
|
-
importsArray.push(
|
|
48
|
-
|
|
44
|
+
importsArray.push(
|
|
45
|
+
UserModule,
|
|
46
|
+
ModuleModule,
|
|
47
|
+
LayoutModule,
|
|
48
|
+
EnterpriseModule,
|
|
49
|
+
);
|
|
50
|
+
exportsArray.push(
|
|
51
|
+
UserModule,
|
|
52
|
+
ModuleModule,
|
|
53
|
+
LayoutModule,
|
|
54
|
+
EnterpriseModule,
|
|
55
|
+
);
|
|
49
56
|
}
|
|
50
57
|
|
|
51
58
|
return {
|
|
@@ -9,11 +9,7 @@ import { ConfigService } from '@nestjs/config';
|
|
|
9
9
|
|
|
10
10
|
@Injectable()
|
|
11
11
|
export class JwtStrategy extends PassportStrategy(Strategy) {
|
|
12
|
-
constructor(
|
|
13
|
-
@InjectRepository(UserSession)
|
|
14
|
-
// private userSessionRepository: Repository<UserSession>,
|
|
15
|
-
private configService: ConfigService,
|
|
16
|
-
) {
|
|
12
|
+
constructor(private readonly configService: ConfigService) {
|
|
17
13
|
super({
|
|
18
14
|
jwtFromRequest: ExtractJwt.fromAuthHeaderAsBearerToken(),
|
|
19
15
|
ignoreExpiration: false,
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Controller,
|
|
3
|
+
Get,
|
|
4
|
+
HttpStatus,
|
|
5
|
+
Inject,
|
|
6
|
+
Req,
|
|
7
|
+
Res,
|
|
8
|
+
UseGuards,
|
|
9
|
+
} from '@nestjs/common';
|
|
2
10
|
import { JwtAuthGuard } from '../../auth/guards/jwt.guard';
|
|
3
11
|
import { HeaderSectionService } from '../service/header-section.service';
|
|
4
12
|
import { Request, Response } from 'express';
|
|
@@ -8,25 +16,32 @@ import { ENTITYTYPE_USER } from '../../../constant/global.constant';
|
|
|
8
16
|
@Controller('layout')
|
|
9
17
|
@UseGuards(JwtAuthGuard)
|
|
10
18
|
export class LayoutController {
|
|
11
|
-
constructor(
|
|
12
|
-
|
|
19
|
+
constructor(
|
|
20
|
+
private readonly headerSectionService: HeaderSectionService,
|
|
21
|
+
@Inject('UserService') private readonly userService: UserService,
|
|
22
|
+
) {}
|
|
13
23
|
|
|
14
24
|
@Get('header')
|
|
15
25
|
async getHeader(@Req() req: Request & { user: any }, @Res() res: Response) {
|
|
16
26
|
const userId = req.user.userId;
|
|
17
|
-
const userData = await this.userService.getEntityData(
|
|
27
|
+
const userData = await this.userService.getEntityData(
|
|
28
|
+
ENTITYTYPE_USER,
|
|
29
|
+
userId,
|
|
30
|
+
);
|
|
18
31
|
if (userData) {
|
|
19
|
-
let response = await this.headerSectionService.findByOrganizationId(
|
|
32
|
+
let response = await this.headerSectionService.findByOrganizationId(
|
|
33
|
+
userData.organization_id,
|
|
34
|
+
);
|
|
20
35
|
return res.json({
|
|
21
36
|
success: true,
|
|
22
37
|
data: response,
|
|
23
|
-
message: 'Header fetched successfully'
|
|
38
|
+
message: 'Header fetched successfully',
|
|
24
39
|
});
|
|
25
40
|
} else {
|
|
26
41
|
return res.status(HttpStatus.BAD_REQUEST).json({
|
|
27
42
|
success: false,
|
|
28
|
-
message: 'User data not found'
|
|
29
|
-
})
|
|
43
|
+
message: 'User data not found',
|
|
44
|
+
});
|
|
30
45
|
}
|
|
31
46
|
}
|
|
32
47
|
}
|
|
@@ -11,7 +11,11 @@ import { HeaderSectionService } from './service/header-section.service';
|
|
|
11
11
|
@Module({
|
|
12
12
|
imports: [TypeOrmModule.forFeature([HeaderSection, HeaderItems]), UserModule],
|
|
13
13
|
controllers: [LayoutController],
|
|
14
|
-
providers: [
|
|
14
|
+
providers: [
|
|
15
|
+
HeaderItemsRepository,
|
|
16
|
+
HeaderSectionRepository,
|
|
17
|
+
HeaderSectionService,
|
|
18
|
+
],
|
|
15
19
|
exports: [],
|
|
16
20
|
})
|
|
17
21
|
export class LayoutModule {}
|
|
@@ -18,13 +18,11 @@ export class LoginController {
|
|
|
18
18
|
constructor(private loginService: LoginService) {}
|
|
19
19
|
|
|
20
20
|
@Post('login')
|
|
21
|
-
|
|
22
21
|
async login(@Body() body, @Res() res: Response) {
|
|
23
|
-
const { email_id, password, appcode,organization_id} = body;
|
|
24
|
-
const result = await this.loginService.login(email_id, password, appcode
|
|
22
|
+
const { email_id, password, appcode, organization_id } = body;
|
|
23
|
+
const result = await this.loginService.login(email_id, password, appcode);
|
|
25
24
|
return res.status(HttpStatus.OK).json(result);
|
|
26
25
|
}
|
|
27
|
-
|
|
28
26
|
|
|
29
27
|
@UseGuards(JwtAuthGuard)
|
|
30
28
|
@Post('logout')
|
|
@@ -18,13 +18,8 @@ export class LoginService {
|
|
|
18
18
|
masterKey: string = this.configService.get('MASTER_KEY') || '';
|
|
19
19
|
masterIv: string = this.configService.get('MASTER_IV') || '';
|
|
20
20
|
|
|
21
|
-
async login(
|
|
22
|
-
email
|
|
23
|
-
password: string,
|
|
24
|
-
appcode: string,
|
|
25
|
-
organization_id,
|
|
26
|
-
) {
|
|
27
|
-
const user = await this.userService.findByEmailId(email, organization_id);
|
|
21
|
+
async login(email: string, password: string, appcode: string) {
|
|
22
|
+
const user = await this.userService.findByEmailId(email);
|
|
28
23
|
|
|
29
24
|
if (!user) {
|
|
30
25
|
return {
|