ผูกสิท

This commit is contained in:
kittapath 2024-08-22 14:14:35 +07:00
parent 2a536dcc32
commit 204984f63e
4 changed files with 58 additions and 27 deletions

View file

@ -27,6 +27,7 @@ import { EmployeePosType } from "../entities/EmployeePosType";
import { EmployeePosLevel } from "../entities/EmployeePosLevel";
import { RequestWithUser } from "../middlewares/user";
import { addLogSequence, setLogDataDiff } from "../interfaces/utils";
import permission from "../interfaces/permission";
@Route("api/v1/development/history/employee")
@Tags("DevelopmentEmployeeHistory")
@ -44,7 +45,8 @@ export class DevelopmentEmployeeHistoryController extends Controller {
*
*/
@Get("org/{year}")
async GetOrgDevelopemt(@Path() year: number) {
async GetOrgDevelopemt(@Request() request: RequestWithUser, @Path() year: number) {
await new permission().PermissionList(request, "SYS_DEV_HISTORY_EMP");
const type = "EMPLOYEE";
const getOrg = await this.developmentHistoryRepository
.createQueryBuilder("developmentHistory")
@ -76,6 +78,7 @@ export class DevelopmentEmployeeHistoryController extends Controller {
@Body() requestBody: CreateDevelopmentHistory,
@Request() request: RequestWithUser,
) {
await new permission().PermissionCreate(request, "SYS_DEV_HISTORY_EMP");
const type = "EMPLOYEE";
const chk_name = await this.developmentHistoryRepository.find({
where: {
@ -144,6 +147,7 @@ export class DevelopmentEmployeeHistoryController extends Controller {
@Body() requestBody: UpdateDevelopmentHistory,
@Request() request: RequestWithUser,
) {
await new permission().PermissionUpdate(request, "SYS_DEV_HISTORY_EMP");
const type = "EMPLOYEE";
const development = await this.developmentHistoryRepository.findOne({
where: { id: id, type: type },
@ -209,7 +213,8 @@ export class DevelopmentEmployeeHistoryController extends Controller {
* @param {string} id Id
*/
@Delete("{id}")
async DeleteDevelopmentHistory(@Path() id: string,@Request () request: RequestWithUser) {
async DeleteDevelopmentHistory(@Path() id: string, @Request() request: RequestWithUser) {
await new permission().PermissionDelete(request, "SYS_DEV_HISTORY_EMP");
const type = "EMPLOYEE";
const development = await this.developmentHistoryRepository.findOne({
where: { id: id, type: type },
@ -234,6 +239,7 @@ export class DevelopmentEmployeeHistoryController extends Controller {
*/
@Post("filter")
async GetDevelopmentHistoryLists(
@Request() request: RequestWithUser,
@Body()
body: {
page: number;
@ -243,6 +249,7 @@ export class DevelopmentEmployeeHistoryController extends Controller {
root: string | null;
},
) {
await new permission().PermissionList(request, "SYS_DEV_HISTORY_EMP");
const type = "EMPLOYEE";
const [development, total] = await AppDataSource.getRepository(DevelopmentHistory)
.createQueryBuilder("developmentHistory")
@ -352,7 +359,8 @@ export class DevelopmentEmployeeHistoryController extends Controller {
* @param {string} id Id
*/
@Get("{id}")
async GetDevelopemtHistoryById(@Path() id: string) {
async GetDevelopemtHistoryById(@Request() request: RequestWithUser, @Path() id: string) {
await new permission().PermissionGet(request, "SYS_DEV_HISTORY_EMP");
const type = "EMPLOYEE";
const getDevelopment = await this.developmentHistoryRepository.findOne({
relations: ["development", "employeePosLevel", "employeePosType"],