rez_core 1.0.62 → 1.0.64
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/.idea/250218_nodejs_core.iml +12 -0
- package/.idea/codeStyles/Project.xml +59 -0
- package/.idea/codeStyles/codeStyleConfig.xml +5 -0
- package/.idea/dataSources.xml +12 -0
- package/.idea/modules.xml +8 -0
- package/.idea/prettier.xml +6 -0
- package/.idea/vcs.xml +6 -0
- package/dist/constant/global.constant.d.ts +3 -0
- package/dist/constant/global.constant.js +4 -1
- package/dist/constant/global.constant.js.map +1 -1
- package/dist/module/auth/guards/role.guard.js +3 -3
- package/dist/module/listmaster/controller/list-master.controller.d.ts +1 -1
- package/dist/module/listmaster/controller/list-master.controller.js +3 -4
- package/dist/module/listmaster/controller/list-master.controller.js.map +1 -1
- package/dist/module/listmaster/service/list-master.service.d.ts +4 -2
- package/dist/module/listmaster/service/list-master.service.js +16 -14
- package/dist/module/listmaster/service/list-master.service.js.map +1 -1
- package/dist/module/meta/controller/meta.controller.d.ts +7 -0
- package/dist/module/meta/controller/meta.controller.js +47 -0
- package/dist/module/meta/controller/meta.controller.js.map +1 -0
- package/dist/module/meta/dto/entity-table.dto.d.ts +5 -0
- package/dist/module/meta/dto/entity-table.dto.js +8 -0
- package/dist/module/meta/dto/entity-table.dto.js.map +1 -0
- package/dist/module/meta/entity.module.js +2 -1
- package/dist/module/meta/entity.module.js.map +1 -1
- package/dist/module/meta/repository/entity-table-column.repository.js +1 -0
- package/dist/module/meta/repository/entity-table-column.repository.js.map +1 -1
- package/dist/module/meta/service/entity-table.service.d.ts +6 -1
- package/dist/module/meta/service/entity-table.service.js +18 -2
- package/dist/module/meta/service/entity-table.service.js.map +1 -1
- package/dist/module/user/entity/role.entity.d.ts +1 -0
- package/dist/module/user/entity/role.entity.js +5 -0
- package/dist/module/user/entity/role.entity.js.map +1 -1
- package/dist/module/user/repository/role.repository.d.ts +2 -35
- package/dist/module/user/repository/role.repository.js +2 -95
- package/dist/module/user/repository/role.repository.js.map +1 -1
- package/dist/module/user/service/role.service.d.ts +5 -32
- package/dist/module/user/service/role.service.js +71 -24
- package/dist/module/user/service/role.service.js.map +1 -1
- package/dist/module/user/user.module.js +8 -3
- package/dist/module/user/user.module.js.map +1 -1
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/package.json +1 -1
- package/src/app.controller.ts +12 -12
- package/src/app.service.ts +8 -8
- package/src/constant/global.constant.ts +5 -0
- package/src/module/auth/guards/jwt.guard.ts +22 -22
- package/src/module/auth/guards/role.guard.ts +68 -68
- package/src/module/auth/services/jwt.service.ts +11 -11
- package/src/module/auth/strategies/local.strategy.ts +13 -13
- package/src/module/dev/dev.module.ts +12 -12
- package/src/module/dev/service/dev.service.ts +7 -7
- package/src/module/enterprise/entity/organization.entity.ts +80 -80
- package/src/module/listmaster/controller/list-master.controller.ts +2 -2
- package/src/module/listmaster/service/list-master.service.ts +18 -15
- package/src/module/meta/controller/meta.controller.ts +22 -0
- package/src/module/meta/dto/entity-list-data.dto.ts +6 -6
- package/src/module/meta/dto/entity-table.dto.ts +6 -0
- package/src/module/meta/entity/preference.entity.ts +65 -65
- package/src/module/meta/entity.module.ts +2 -1
- package/src/module/meta/repository/entity-table-column.repository.ts +1 -0
- package/src/module/meta/repository/preference.repository.ts +20 -20
- package/src/module/meta/service/entity-table.service.ts +43 -3
- package/src/module/module/controller/menu.controller.ts +15 -15
- package/src/module/module/entity/module-access.entity.ts +22 -22
- package/src/module/user/controller/user.controller.ts +28 -28
- package/src/module/user/dto/update-user.dto.ts +4 -4
- package/src/module/user/entity/role.entity.ts +4 -0
- package/src/module/user/entity/user-session.entity.ts +61 -61
- package/src/module/user/repository/role.repository.ts +2 -142
- package/src/module/user/repository/userSession.repository.ts +33 -33
- package/src/module/user/service/role.service.ts +92 -42
- package/src/module/user/user.module.ts +8 -3
- package/src/utils/service/encryptUtil.service.ts +97 -97
- package/src/utils/service/excelUtil.service.ts +15 -15
- package/src/utils/service/reflection-helper.service.ts +53 -53
- package/dist/module/user/controller/role.controller.d.ts +0 -41
- package/dist/module/user/controller/role.controller.js +0 -63
- package/dist/module/user/controller/role.controller.js.map +0 -1
- package/src/module/user/controller/role.controller.ts +0 -55
|
@@ -1,53 +1,53 @@
|
|
|
1
|
-
import { Injectable } from '@nestjs/common';
|
|
2
|
-
import { ModuleRef } from '@nestjs/core';
|
|
3
|
-
import { DataSource, Repository } from 'typeorm';
|
|
4
|
-
import { getRepositoryToken } from '@nestjs/typeorm';
|
|
5
|
-
|
|
6
|
-
@Injectable()
|
|
7
|
-
export class ReflectionHelper {
|
|
8
|
-
constructor(
|
|
9
|
-
private moduleRef: ModuleRef,
|
|
10
|
-
private dataSource: DataSource,
|
|
11
|
-
) {}
|
|
12
|
-
|
|
13
|
-
getRepoService(entityName: string): Repository<any> | null {
|
|
14
|
-
const entityMetadata: any = this.dataSource.entityMetadatas.find(
|
|
15
|
-
(meta) =>
|
|
16
|
-
meta.name === entityName ||
|
|
17
|
-
(meta.target && (meta.target as any).name === entityName),
|
|
18
|
-
);
|
|
19
|
-
|
|
20
|
-
if (!entityMetadata) {
|
|
21
|
-
console.error(`Entity "${entityName}" not found in TypeORM metadata`);
|
|
22
|
-
return null;
|
|
23
|
-
}
|
|
24
|
-
|
|
25
|
-
try {
|
|
26
|
-
return this.moduleRef.get<Repository<any>>(
|
|
27
|
-
getRepositoryToken(entityMetadata.target),
|
|
28
|
-
{ strict: false },
|
|
29
|
-
);
|
|
30
|
-
} catch (error) {
|
|
31
|
-
console.error(`Repository for "${entityName}" not found:`, error.message);
|
|
32
|
-
return null;
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
async getBean<T>(beanName: string): Promise<T | null> {
|
|
37
|
-
try {
|
|
38
|
-
const provider = this.moduleRef.get<T>(beanName as any, {
|
|
39
|
-
strict: false,
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
if (!provider) {
|
|
43
|
-
console.error(`Bean "${beanName}" not found in moduleRef.`);
|
|
44
|
-
return null;
|
|
45
|
-
}
|
|
46
|
-
|
|
47
|
-
return provider;
|
|
48
|
-
} catch (error) {
|
|
49
|
-
console.error(`Bean "${beanName}" not found:`, error.message);
|
|
50
|
-
return null;
|
|
51
|
-
}
|
|
52
|
-
}
|
|
53
|
-
}
|
|
1
|
+
import { Injectable } from '@nestjs/common';
|
|
2
|
+
import { ModuleRef } from '@nestjs/core';
|
|
3
|
+
import { DataSource, Repository } from 'typeorm';
|
|
4
|
+
import { getRepositoryToken } from '@nestjs/typeorm';
|
|
5
|
+
|
|
6
|
+
@Injectable()
|
|
7
|
+
export class ReflectionHelper {
|
|
8
|
+
constructor(
|
|
9
|
+
private moduleRef: ModuleRef,
|
|
10
|
+
private dataSource: DataSource,
|
|
11
|
+
) {}
|
|
12
|
+
|
|
13
|
+
getRepoService(entityName: string): Repository<any> | null {
|
|
14
|
+
const entityMetadata: any = this.dataSource.entityMetadatas.find(
|
|
15
|
+
(meta) =>
|
|
16
|
+
meta.name === entityName ||
|
|
17
|
+
(meta.target && (meta.target as any).name === entityName),
|
|
18
|
+
);
|
|
19
|
+
|
|
20
|
+
if (!entityMetadata) {
|
|
21
|
+
console.error(`Entity "${entityName}" not found in TypeORM metadata`);
|
|
22
|
+
return null;
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
try {
|
|
26
|
+
return this.moduleRef.get<Repository<any>>(
|
|
27
|
+
getRepositoryToken(entityMetadata.target),
|
|
28
|
+
{ strict: false },
|
|
29
|
+
);
|
|
30
|
+
} catch (error) {
|
|
31
|
+
console.error(`Repository for "${entityName}" not found:`, error.message);
|
|
32
|
+
return null;
|
|
33
|
+
}
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async getBean<T>(beanName: string): Promise<T | null> {
|
|
37
|
+
try {
|
|
38
|
+
const provider = this.moduleRef.get<T>(beanName as any, {
|
|
39
|
+
strict: false,
|
|
40
|
+
});
|
|
41
|
+
|
|
42
|
+
if (!provider) {
|
|
43
|
+
console.error(`Bean "${beanName}" not found in moduleRef.`);
|
|
44
|
+
return null;
|
|
45
|
+
}
|
|
46
|
+
|
|
47
|
+
return provider;
|
|
48
|
+
} catch (error) {
|
|
49
|
+
console.error(`Bean "${beanName}" not found:`, error.message);
|
|
50
|
+
return null;
|
|
51
|
+
}
|
|
52
|
+
}
|
|
53
|
+
}
|
|
@@ -1,41 +0,0 @@
|
|
|
1
|
-
import { UserService } from '../service/user.service';
|
|
2
|
-
import { RoleService } from '../service/role.service';
|
|
3
|
-
export declare class RoleController {
|
|
4
|
-
private readonly userService;
|
|
5
|
-
private readonly roleService;
|
|
6
|
-
constructor(userService: UserService, roleService: RoleService);
|
|
7
|
-
createRole(body: {
|
|
8
|
-
name: string;
|
|
9
|
-
description?: string;
|
|
10
|
-
status?: 'ACTIVE' | 'INACTIVE';
|
|
11
|
-
copyFromRoleId?: number;
|
|
12
|
-
}, request: Request & {
|
|
13
|
-
user: any;
|
|
14
|
-
}): Promise<{
|
|
15
|
-
success: boolean;
|
|
16
|
-
msg: string;
|
|
17
|
-
role: {
|
|
18
|
-
id: number;
|
|
19
|
-
name: string;
|
|
20
|
-
status: string;
|
|
21
|
-
code: string;
|
|
22
|
-
};
|
|
23
|
-
}>;
|
|
24
|
-
updateRole(id: number, body: {
|
|
25
|
-
name?: string;
|
|
26
|
-
description?: string;
|
|
27
|
-
status?: 'ACTIVE' | 'INACTIVE';
|
|
28
|
-
copyFromRoleId?: number;
|
|
29
|
-
}, req: Request & {
|
|
30
|
-
user: any;
|
|
31
|
-
}): Promise<{
|
|
32
|
-
success: boolean;
|
|
33
|
-
msg: string;
|
|
34
|
-
role: {
|
|
35
|
-
id: number;
|
|
36
|
-
name: string;
|
|
37
|
-
status: string;
|
|
38
|
-
code: string;
|
|
39
|
-
};
|
|
40
|
-
}>;
|
|
41
|
-
}
|
|
@@ -1,63 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __decorate = (this && this.__decorate) || function (decorators, target, key, desc) {
|
|
3
|
-
var c = arguments.length, r = c < 3 ? target : desc === null ? desc = Object.getOwnPropertyDescriptor(target, key) : desc, d;
|
|
4
|
-
if (typeof Reflect === "object" && typeof Reflect.decorate === "function") r = Reflect.decorate(decorators, target, key, desc);
|
|
5
|
-
else for (var i = decorators.length - 1; i >= 0; i--) if (d = decorators[i]) r = (c < 3 ? d(r) : c > 3 ? d(target, key, r) : d(target, key)) || r;
|
|
6
|
-
return c > 3 && r && Object.defineProperty(target, key, r), r;
|
|
7
|
-
};
|
|
8
|
-
var __metadata = (this && this.__metadata) || function (k, v) {
|
|
9
|
-
if (typeof Reflect === "object" && typeof Reflect.metadata === "function") return Reflect.metadata(k, v);
|
|
10
|
-
};
|
|
11
|
-
var __param = (this && this.__param) || function (paramIndex, decorator) {
|
|
12
|
-
return function (target, key) { decorator(target, key, paramIndex); }
|
|
13
|
-
};
|
|
14
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
15
|
-
exports.RoleController = void 0;
|
|
16
|
-
const common_1 = require("@nestjs/common");
|
|
17
|
-
const user_service_1 = require("../service/user.service");
|
|
18
|
-
const global_constant_1 = require("../../../constant/global.constant");
|
|
19
|
-
const role_service_1 = require("../service/role.service");
|
|
20
|
-
const jwt_guard_1 = require("../../auth/guards/jwt.guard");
|
|
21
|
-
let RoleController = class RoleController {
|
|
22
|
-
constructor(userService, roleService) {
|
|
23
|
-
this.userService = userService;
|
|
24
|
-
this.roleService = roleService;
|
|
25
|
-
}
|
|
26
|
-
async createRole(body, request) {
|
|
27
|
-
let requestedUser = request.user;
|
|
28
|
-
let loggedInUser = await this.userService.getEntityData(global_constant_1.ENTITYTYPE_USER, requestedUser.id);
|
|
29
|
-
return this.roleService.createRole(body, loggedInUser);
|
|
30
|
-
}
|
|
31
|
-
async updateRole(id, body, req) {
|
|
32
|
-
let requestedUser = req.user;
|
|
33
|
-
let loggedInUser = await this.userService.getEntityData(global_constant_1.ENTITYTYPE_USER, requestedUser.id);
|
|
34
|
-
return this.roleService.updateRole(id, body, loggedInUser);
|
|
35
|
-
}
|
|
36
|
-
};
|
|
37
|
-
exports.RoleController = RoleController;
|
|
38
|
-
__decorate([
|
|
39
|
-
(0, common_1.Post)('create'),
|
|
40
|
-
__param(0, (0, common_1.Body)()),
|
|
41
|
-
__param(1, (0, common_1.Req)()),
|
|
42
|
-
__metadata("design:type", Function),
|
|
43
|
-
__metadata("design:paramtypes", [Object, Object]),
|
|
44
|
-
__metadata("design:returntype", Promise)
|
|
45
|
-
], RoleController.prototype, "createRole", null);
|
|
46
|
-
__decorate([
|
|
47
|
-
(0, common_1.Post)('update/:id'),
|
|
48
|
-
__param(0, (0, common_1.Param)('id')),
|
|
49
|
-
__param(1, (0, common_1.Body)()),
|
|
50
|
-
__param(2, (0, common_1.Req)()),
|
|
51
|
-
__metadata("design:type", Function),
|
|
52
|
-
__metadata("design:paramtypes", [Number, Object, Object]),
|
|
53
|
-
__metadata("design:returntype", Promise)
|
|
54
|
-
], RoleController.prototype, "updateRole", null);
|
|
55
|
-
exports.RoleController = RoleController = __decorate([
|
|
56
|
-
(0, common_1.Controller)('role'),
|
|
57
|
-
(0, common_1.UseGuards)(jwt_guard_1.JwtAuthGuard),
|
|
58
|
-
__param(0, (0, common_1.Inject)('UserService')),
|
|
59
|
-
__param(1, (0, common_1.Inject)('RoleService')),
|
|
60
|
-
__metadata("design:paramtypes", [user_service_1.UserService,
|
|
61
|
-
role_service_1.RoleService])
|
|
62
|
-
], RoleController);
|
|
63
|
-
//# sourceMappingURL=role.controller.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"role.controller.js","sourceRoot":"","sources":["../../../../src/module/user/controller/role.controller.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA,2CAAuF;AACvF,0DAAsD;AACtD,uEAA+D;AAC/D,0DAAsD;AAItD,2DAAgE;AAGzD,IAAM,cAAc,GAApB,MAAM,cAAc;IACzB,YAC0C,WAAwB,EACxB,WAAw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W;QACX,0BAAW;GAHvD,cAAc,CA4C1B"}
|
|
@@ -1,55 +0,0 @@
|
|
|
1
|
-
import { Body, Controller, Inject, Param, Post, Req, UseGuards } from '@nestjs/common';
|
|
2
|
-
import { UserService } from '../service/user.service';
|
|
3
|
-
import { ENTITYTYPE_USER } from 'src/constant/global.constant';
|
|
4
|
-
import { RoleService } from '../service/role.service';
|
|
5
|
-
import { UserData } from '../entity/user.entity';
|
|
6
|
-
import { request } from 'express';
|
|
7
|
-
import { AuthGuard } from '@nestjs/passport';
|
|
8
|
-
import { JwtAuthGuard } from 'src/module/auth/guards/jwt.guard';
|
|
9
|
-
@Controller('role')
|
|
10
|
-
@UseGuards(JwtAuthGuard)
|
|
11
|
-
export class RoleController {
|
|
12
|
-
constructor(
|
|
13
|
-
@Inject('UserService') private readonly userService: UserService,
|
|
14
|
-
@Inject('RoleService') private readonly roleService: RoleService,
|
|
15
|
-
) {}
|
|
16
|
-
|
|
17
|
-
@Post('create')
|
|
18
|
-
async createRole(
|
|
19
|
-
@Body()
|
|
20
|
-
body: {
|
|
21
|
-
name: string;
|
|
22
|
-
description?: string;
|
|
23
|
-
status?: 'ACTIVE' | 'INACTIVE';
|
|
24
|
-
copyFromRoleId?: number;
|
|
25
|
-
},
|
|
26
|
-
@Req() request: Request & { user: any },
|
|
27
|
-
) {
|
|
28
|
-
let requestedUser = request.user;
|
|
29
|
-
let loggedInUser = await this.userService.getEntityData(
|
|
30
|
-
ENTITYTYPE_USER,
|
|
31
|
-
requestedUser.id,
|
|
32
|
-
);
|
|
33
|
-
return this.roleService.createRole(body, loggedInUser as UserData);
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
@Post('update/:id')
|
|
37
|
-
async updateRole(
|
|
38
|
-
@Param('id') id: number,
|
|
39
|
-
@Body()
|
|
40
|
-
body: {
|
|
41
|
-
name?: string;
|
|
42
|
-
description?: string;
|
|
43
|
-
status?: 'ACTIVE' | 'INACTIVE';
|
|
44
|
-
copyFromRoleId?: number; // <-- ADD THIS
|
|
45
|
-
},
|
|
46
|
-
@Req() req: Request & { user: any },
|
|
47
|
-
) {
|
|
48
|
-
let requestedUser = req.user;
|
|
49
|
-
let loggedInUser = await this.userService.getEntityData(
|
|
50
|
-
ENTITYTYPE_USER,
|
|
51
|
-
requestedUser.id,
|
|
52
|
-
);
|
|
53
|
-
return this.roleService.updateRole(id, body, loggedInUser as UserData);
|
|
54
|
-
}
|
|
55
|
-
}
|