role
This commit is contained in:
parent
8e82201fbd
commit
1736f5043e
7 changed files with 147 additions and 30 deletions
|
|
@ -27,6 +27,8 @@ import { SalaryRankEmployee } from "../entities/SalaryRankEmployee";
|
|||
import { randomUUID } from "crypto";
|
||||
import { Salarys } from "../entities/Salarys";
|
||||
import { SalaryFormulaEmployee } from "../entities/SalaryFormulaEmployee";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import permission from "../interfaces/permission";
|
||||
|
||||
@Route("api/v1/salary/employee")
|
||||
@Tags("SalaryEmployee")
|
||||
|
|
@ -68,8 +70,9 @@ export class SalaryEmployeeController extends Controller {
|
|||
})
|
||||
async create_salary(
|
||||
@Body() requestBody: CreateSalaryEmployee,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionCreate(request, "SYS_WAGE_CHART_EMP");
|
||||
const salarys = Object.assign(new SalaryEmployee(), requestBody);
|
||||
if (!salarys) {
|
||||
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
|
||||
|
|
@ -110,8 +113,9 @@ export class SalaryEmployeeController extends Controller {
|
|||
async update_salary(
|
||||
@Path() id: string,
|
||||
@Body() requestBody: UpdateSalaryEmployee,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionUpdate(request, "SYS_WAGE_CHART_EMP");
|
||||
const chk_Salary = await this.salaryEmployeeRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -161,7 +165,8 @@ export class SalaryEmployeeController extends Controller {
|
|||
* @param {string} id Guid, *Id ผังเงินเดือน
|
||||
*/
|
||||
@Delete("{id}")
|
||||
async delete_salary(@Path() id: string) {
|
||||
async delete_salary(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
await new permission().PermissionDelete(request, "SYS_WAGE_CHART_EMP");
|
||||
const chk_Salary = await this.salaryEmployeeRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -267,8 +272,9 @@ export class SalaryEmployeeController extends Controller {
|
|||
@Post("copy")
|
||||
async copySalary(
|
||||
@Body() body: { id: string },
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionCreate(request, "SYS_WAGE_CHART_EMP");
|
||||
const salary = await this.salaryEmployeeRepository.findOne({
|
||||
relations: ["salaryRankEmployees_"],
|
||||
where: { id: body.id },
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue