rez_core 2.0.26 → 2.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.
- package/dist/module/enterprise/controller/organization.controller.js +1 -3
- package/dist/module/enterprise/controller/organization.controller.js.map +1 -1
- package/dist/module/layout/controller/layout.controller.js +1 -3
- package/dist/module/layout/controller/layout.controller.js.map +1 -1
- package/dist/module/master/controller/master.controller.js +1 -3
- package/dist/module/master/controller/master.controller.js.map +1 -1
- package/dist/module/meta/controller/entity.controller.js +3 -5
- package/dist/module/meta/controller/entity.controller.js.map +1 -1
- package/dist/module/meta/controller/meta.controller.js +2 -2
- package/dist/module/meta/controller/meta.controller.js.map +1 -1
- package/dist/module/meta/service/entity.service.d.ts +1 -1
- package/dist/module/module/controller/menu.controller.js +2 -2
- package/dist/module/module/controller/menu.controller.js.map +1 -1
- package/dist/module/module/controller/module-access.controller.js +7 -7
- package/dist/module/module/controller/module-access.controller.js.map +1 -1
- package/dist/module/user/controller/login.controller.js +2 -2
- package/dist/module/user/controller/login.controller.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/module/enterprise/controller/organization.controller.ts +5 -5
- package/src/module/layout/controller/layout.controller.ts +5 -5
- package/src/module/master/controller/master.controller.ts +2 -2
- package/src/module/meta/controller/entity.controller.ts +7 -7
- package/src/module/meta/controller/meta.controller.ts +25 -10
- package/src/module/meta/service/entity.service.ts +5 -2
- package/src/module/module/controller/menu.controller.ts +3 -3
- package/src/module/module/controller/module-access.controller.ts +7 -7
- package/src/module/user/controller/login.controller.ts +2 -2
package/package.json
CHANGED
|
@@ -5,18 +5,18 @@ import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
|
5
5
|
import { UserService } from 'src/module/user/service/user.service';
|
|
6
6
|
import { ENTITYTYPE_USER } from '../../../constant/global.constant';
|
|
7
7
|
|
|
8
|
-
|
|
9
8
|
@Controller('organization')
|
|
10
9
|
export class OrganizationController {
|
|
11
|
-
constructor(
|
|
12
|
-
|
|
10
|
+
constructor(
|
|
11
|
+
private readonly orgService: OrganizationService,
|
|
12
|
+
@Inject('UserService') private readonly userService: UserService,
|
|
13
13
|
) {}
|
|
14
14
|
|
|
15
15
|
@UseGuards(JwtAuthGuard)
|
|
16
16
|
@Get('dropdown')
|
|
17
17
|
async getOrganizationDropdown(@Req() req: Request & { user: any }) {
|
|
18
|
-
const
|
|
19
|
-
const userData = await this.userService.getEntityData(ENTITYTYPE_USER, userId);
|
|
18
|
+
const userData = req.user.userData;
|
|
19
|
+
// const userData = await this.userService.getEntityData(ENTITYTYPE_USER, userId);
|
|
20
20
|
// const enterpriseId = req.user['enterpriseId']; // or adapt based on your user structure
|
|
21
21
|
return this.orgService.findById(userData?.organization_id);
|
|
22
22
|
}
|
|
@@ -23,11 +23,11 @@ export class LayoutController {
|
|
|
23
23
|
|
|
24
24
|
@Get('header')
|
|
25
25
|
async getHeader(@Req() req: Request & { user: any }, @Res() res: Response) {
|
|
26
|
-
const
|
|
27
|
-
const userData = await this.userService.getEntityData(
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
);
|
|
26
|
+
const userData = req.user.userData;
|
|
27
|
+
// const userData = await this.userService.getEntityData(
|
|
28
|
+
// ENTITYTYPE_USER,
|
|
29
|
+
// userId,
|
|
30
|
+
// );
|
|
31
31
|
if (userData) {
|
|
32
32
|
let response = await this.headerSectionService.findByOrganizationId(
|
|
33
33
|
userData.organization_id,
|
|
@@ -53,8 +53,8 @@ export class MasterController {
|
|
|
53
53
|
@Req() req: Request & { user: any },
|
|
54
54
|
@Body('duplicateHandling') duplicateHandling: 'skip_duplicates' | 'overwrite_items',
|
|
55
55
|
) {
|
|
56
|
-
let
|
|
57
|
-
let loggedInUser = await this.entityService.getEntityData(ENTITYTYPE_USER, requestedUser.userId);
|
|
56
|
+
let loggedInUser = req.user.userData;
|
|
57
|
+
// let loggedInUser = await this.entityService.getEntityData(ENTITYTYPE_USER, requestedUser.userId);
|
|
58
58
|
|
|
59
59
|
if (!file) {
|
|
60
60
|
throw new BadRequestException('File is required');
|
|
@@ -67,7 +67,7 @@ export class EntityController {
|
|
|
67
67
|
@Res() res: Response,
|
|
68
68
|
@Req() req: Request & { user: any },
|
|
69
69
|
) {
|
|
70
|
-
let requestedUser = req.user;
|
|
70
|
+
let requestedUser = req.user.userData;
|
|
71
71
|
let appcode = requestedUser.appcode;
|
|
72
72
|
// let loggedInUser = await this.entityService.getEntityData(
|
|
73
73
|
// ENTITYTYPE_USER,
|
|
@@ -109,11 +109,11 @@ export class EntityController {
|
|
|
109
109
|
@Res() response: Response,
|
|
110
110
|
@Req() req: Request & { user: any },
|
|
111
111
|
) {
|
|
112
|
-
let
|
|
113
|
-
let loggedInUser = await this.entityService.getEntityData(
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
);
|
|
112
|
+
let loggedInUser = req.user.userData;
|
|
113
|
+
// let loggedInUser = await this.entityService.getEntityData(
|
|
114
|
+
// ENTITYTYPE_USER,
|
|
115
|
+
// requestedUser.userId,
|
|
116
|
+
// );
|
|
117
117
|
if (!entityType) {
|
|
118
118
|
throw new BadRequestException(
|
|
119
119
|
'Query parameter "entity_type" is required',
|
|
@@ -156,7 +156,7 @@ export class EntityController {
|
|
|
156
156
|
@Query('tab_column') tabColumn?: string,
|
|
157
157
|
@Query('tab_value') tabValue?: string,
|
|
158
158
|
) {
|
|
159
|
-
const appcode = req.user.appcode;
|
|
159
|
+
const appcode = req.user.userData.appcode;
|
|
160
160
|
|
|
161
161
|
return res
|
|
162
162
|
.status(HttpStatus.OK)
|
|
@@ -1,4 +1,12 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import {
|
|
2
|
+
Controller,
|
|
3
|
+
HttpStatus,
|
|
4
|
+
Post,
|
|
5
|
+
Query,
|
|
6
|
+
Req,
|
|
7
|
+
Res,
|
|
8
|
+
UseGuards,
|
|
9
|
+
} from '@nestjs/common';
|
|
2
10
|
import { EntityTableService } from '../service/entity-table.service';
|
|
3
11
|
import { Response } from 'express';
|
|
4
12
|
import { JwtAuthGuard } from '../../auth/guards/jwt.guard';
|
|
@@ -9,17 +17,24 @@ export class MetaController {
|
|
|
9
17
|
constructor(private readonly entityTableService: EntityTableService) {}
|
|
10
18
|
|
|
11
19
|
@Post('get-table-data')
|
|
12
|
-
async getTableMetaData(
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
20
|
+
async getTableMetaData(
|
|
21
|
+
@Query('entity_type') entityType: string,
|
|
22
|
+
@Query('list_type') listType: string,
|
|
23
|
+
@Res() response: Response,
|
|
24
|
+
@Req() req: Request & { user: any },
|
|
25
|
+
) {
|
|
26
|
+
const userId = req.user.userData?.id;
|
|
27
|
+
console.log(userId);
|
|
28
|
+
let entityTableDto =
|
|
29
|
+
await this.entityTableService.getTableMetaDataForListing(
|
|
30
|
+
entityType,
|
|
31
|
+
listType,
|
|
32
|
+
userId,
|
|
33
|
+
);
|
|
19
34
|
return response.status(HttpStatus.OK).json({
|
|
20
35
|
success: true,
|
|
21
36
|
data: entityTableDto,
|
|
22
|
-
message: 'Data fetch successfully!'
|
|
23
|
-
})
|
|
37
|
+
message: 'Data fetch successfully!',
|
|
38
|
+
});
|
|
24
39
|
}
|
|
25
40
|
}
|
|
@@ -8,7 +8,6 @@ export interface EntityService<T extends BaseEntity> {
|
|
|
8
8
|
entityData: T,
|
|
9
9
|
loggedInUser: UserData,
|
|
10
10
|
manager?: EntityManager,
|
|
11
|
-
appcode?: string,
|
|
12
11
|
): Promise<BaseEntity>;
|
|
13
12
|
|
|
14
13
|
getEntityData(
|
|
@@ -18,7 +17,11 @@ export interface EntityService<T extends BaseEntity> {
|
|
|
18
17
|
|
|
19
18
|
getEntityList(entityType: string): Promise<BaseEntity[]>;
|
|
20
19
|
|
|
21
|
-
updateEntity(
|
|
20
|
+
updateEntity(
|
|
21
|
+
entityData: T,
|
|
22
|
+
loggedInUserData: UserData,
|
|
23
|
+
app_code?: string,
|
|
24
|
+
): Promise<BaseEntity>;
|
|
22
25
|
|
|
23
26
|
deleteEntity(
|
|
24
27
|
entityType: string,
|
|
@@ -9,8 +9,8 @@ export class MenuController {
|
|
|
9
9
|
@UseGuards(JwtAuthGuard)
|
|
10
10
|
@Get()
|
|
11
11
|
async getMenu(@Request() req) {
|
|
12
|
-
const userId = req.user.
|
|
13
|
-
const appcode = req.user.appcode;
|
|
14
|
-
return this.menuService.getUserMenu(userId,appcode);
|
|
12
|
+
const userId = req.user.userData?.id;
|
|
13
|
+
const appcode = req.user.userData?.appcode;
|
|
14
|
+
return this.menuService.getUserMenu(userId, appcode);
|
|
15
15
|
}
|
|
16
16
|
}
|
|
@@ -28,13 +28,13 @@ export class ModuleAccessController {
|
|
|
28
28
|
|
|
29
29
|
@Get('roles')
|
|
30
30
|
async getRoles(@Request() req) {
|
|
31
|
-
const appcode = req.user.appcode;
|
|
31
|
+
const appcode = req.user.userData.appcode;
|
|
32
32
|
return this.moduleAccessService.getRoles({ appcode });
|
|
33
33
|
}
|
|
34
34
|
|
|
35
35
|
@Get('modules')
|
|
36
36
|
async getModules(@Request() req) {
|
|
37
|
-
const appcode = req.user.appcode;
|
|
37
|
+
const appcode = req.user.userData.appcode;
|
|
38
38
|
|
|
39
39
|
return this.moduleAccessService.getModules({
|
|
40
40
|
appcode,
|
|
@@ -44,20 +44,20 @@ export class ModuleAccessController {
|
|
|
44
44
|
@Get('access-listing')
|
|
45
45
|
async getAccessListing(@Query('roles') roleIds: string, @Request() req) {
|
|
46
46
|
const roleIdArray = roleIds.split(',').map(Number);
|
|
47
|
-
const appcode = req.user.appcode;
|
|
47
|
+
const appcode = req.user.userData.appcode;
|
|
48
48
|
return this.moduleAccessService.getAccessListing(roleIdArray, appcode);
|
|
49
49
|
}
|
|
50
50
|
|
|
51
51
|
@Get('menu-listing')
|
|
52
52
|
async getMenuListing(@Query('mainmod') mainModIds: string, @Request() req) {
|
|
53
53
|
const mainModArray = mainModIds.split(',').map(String);
|
|
54
|
-
const appcode = req.user.appcode;
|
|
54
|
+
const appcode = req.user.userData.appcode;
|
|
55
55
|
return this.moduleAccessService.getMenuListing(mainModArray, appcode);
|
|
56
56
|
}
|
|
57
57
|
|
|
58
58
|
@Post('update')
|
|
59
59
|
async updateModuleAccess(@Body() moduleAccessData: any[], @Request() req) {
|
|
60
|
-
const appcode = req.user.appcode;
|
|
60
|
+
const appcode = req.user.userData.appcode;
|
|
61
61
|
return this.moduleAccessService.updateModuleAccess(
|
|
62
62
|
moduleAccessData,
|
|
63
63
|
appcode,
|
|
@@ -71,8 +71,8 @@ export class ModuleAccessController {
|
|
|
71
71
|
@Query('module_code') moduleCode: string,
|
|
72
72
|
@Request() req,
|
|
73
73
|
) {
|
|
74
|
-
const userId = req.user.
|
|
75
|
-
const appcode = req.user.appcode;
|
|
74
|
+
const userId = req.user.userData?.id;
|
|
75
|
+
const appcode = req.user.userData?.appcode;
|
|
76
76
|
const roles = await this.menuRepository.getUserRoles(userId, appcode); // returns ['1', '4']
|
|
77
77
|
|
|
78
78
|
if (!roles || roles.length === 0) {
|
|
@@ -19,7 +19,7 @@ export class LoginController {
|
|
|
19
19
|
|
|
20
20
|
@Post('login')
|
|
21
21
|
async login(@Body() body, @Res() res: Response) {
|
|
22
|
-
const { email_id, password, appcode
|
|
22
|
+
const { email_id, password, appcode } = body;
|
|
23
23
|
const result = await this.loginService.login(email_id, password, appcode);
|
|
24
24
|
return res.status(HttpStatus.OK).json(result);
|
|
25
25
|
}
|
|
@@ -46,7 +46,7 @@ export class LoginController {
|
|
|
46
46
|
@Get('google/callback')
|
|
47
47
|
@UseGuards(GoogleAuthGuard)
|
|
48
48
|
async googleAuthRedirect(@Req() req) {
|
|
49
|
-
let { email, name } = req.user; // Extracted from Google Strategy
|
|
49
|
+
let { email, name } = req.user.userData; // Extracted from Google Strategy
|
|
50
50
|
|
|
51
51
|
// Call LoginService to validate user, create session, and return JWT
|
|
52
52
|
return this.loginService.loginWithGoogle(email, name);
|