สิทธิ์เมนู เงินเดือน setup(1-3)

This commit is contained in:
AdisakKanthawilang 2024-09-04 17:42:31 +07:00
parent 927d9563f6
commit 654d1e2470
5 changed files with 21 additions and 7 deletions

View file

@ -247,7 +247,8 @@ export class SalaryController extends Controller {
endDate: "datetime", //วันที่สิ้นสุดบังคับใช้
detail: "string", //คำอธิบาย
})
async GetSalaryById(@Path() id: string) {
async GetSalaryById(@Path() id: string, @Request() req: RequestWithUser) {
await new permission().PermissionGet(req, "SYS_SALARY_CHART_OFFICER");
const salary = await this.salaryRepository.findOne({
relations: ["posType_", "posLevel_"],
where: { id: id },
@ -280,10 +281,12 @@ export class SalaryController extends Controller {
*/
@Get()
async listSalary(
@Request() req: RequestWithUser,
@Query("page") page: number = 1,
@Query("pageSize") pageSize: number = 10,
@Query("keyword") keyword?: string,
) {
await new permission().PermissionList(req, "SYS_SALARY_CHART_OFFICER");
const [salary, total] = await AppDataSource.getRepository(Salarys)
.createQueryBuilder("salary")
.leftJoinAndSelect("salary.posType_", "posType_")
@ -327,10 +330,7 @@ export class SalaryController extends Controller {
*
*/
@Post("copy")
async copySalary(
@Body() body: { id: string },
@Request() request: RequestWithUser,
) {
async copySalary(@Body() body: { id: string }, @Request() request: RequestWithUser) {
await new permission().PermissionCreate(request, "SYS_SALARY_CHART_OFFICER");
const salary = await this.salaryRepository.findOne({
relations: ["posLevel_", "posType_", "salaryRanks_"],

View file

@ -213,7 +213,8 @@ export class SalaryEmployeeController extends Controller {
endDate: "datetime", //วันที่สิ้นสุดบังคับใช้
detail: "string", //คำอธิบาย
})
async GetSalaryById(@Path() id: string) {
async GetSalaryById(@Path() id: string, @Request() request: RequestWithUser) {
await new permission().PermissionGet(request, "SYS_WAGE_CHART_EMP");
const salary = await this.salaryEmployeeRepository.findOne({
where: { id: id },
select: ["name", "group", "isActive", "date", "startDate", "endDate", "details"],
@ -231,10 +232,12 @@ export class SalaryEmployeeController extends Controller {
*/
@Get()
async listSalary(
@Request() request: RequestWithUser,
@Query("page") page: number = 1,
@Query("pageSize") pageSize: number = 10,
@Query("keyword") keyword?: string,
) {
await new permission().PermissionList(request, "SYS_WAGE_CHART_EMP");
const [salaryEmployee, total] = await AppDataSource.getRepository(SalaryEmployee)
.createQueryBuilder("salaryEmployee")
.andWhere(

View file

@ -1546,7 +1546,8 @@ export class SalaryPeriodController extends Controller {
* @param {string} id Guid, *Id
*/
@Get("close/{id}")
async closeSalaryPeriod_ById(@Path() id: string) {
async closeSalaryPeriod_ById(@Path() id: string, @Request() request: RequestWithUser) {
await new permission().PermissionUpdate(request, "SYS_SALARY_ROUND");
const salaryPeriod = await this.salaryPeriodRepository.findOne({
where: { id: id },
});
@ -1915,11 +1916,13 @@ export class SalaryPeriodController extends Controller {
*/
@Get()
async GetListsSalaryPeriod(
@Request() request: RequestWithUser,
@Query("page") page: number = 1,
@Query("pageSize") pageSize: number = 10,
@Query("keyword") keyword?: string,
@Query("year") year: number = 2024,
) {
await new permission().PermissionList(request, "SYS_SALARY_ROUND");
const [salaryPeriod, total] = await AppDataSource.getRepository(SalaryPeriod)
.createQueryBuilder("salaryPeriod")
.andWhere(year != 0 ? "salaryPeriod.year LIKE :year" : "1=1", { year: `${year}` })

View file

@ -21,6 +21,8 @@ import HttpStatusCode from "../interfaces/http-status";
import HttpError from "../interfaces/http-error";
import { CreateSalaryRank, SalaryRanks, UpdateSalaryRank } from "../entities/SalaryRanks";
import { Salarys } from "../entities/Salarys";
import { RequestWithUser } from "../middlewares/user";
import permission from "../interfaces/permission";
@Route("api/v1/salary/rate")
@Tags("SalaryRank")
@Security("bearerAuth")
@ -118,10 +120,12 @@ export class SalaryRanksController extends Controller {
@Get("{id}")
async listSalaryRanks(
@Path() id: string,
@Request() req: RequestWithUser,
@Query("page") page: number = 1,
@Query("pageSize") pageSize: number = 10,
@Query("keyword") keyword?: string,
) {
await new permission().PermissionGet(req, "SYS_SALARY_CHART_OFFICER");
const [salaryRank, total] = await AppDataSource.getRepository(SalaryRanks)
.createQueryBuilder("salaryRank")
.andWhere(

View file

@ -25,6 +25,8 @@ import {
UpdateSalaryRankEmployee,
} from "../entities/SalaryRankEmployee";
import { SalaryEmployee } from "../entities/SalaryEmployee";
import permission from "../interfaces/permission";
import { RequestWithUser } from "../middlewares/user";
@Route("api/v1/salary/rate/employee")
@Tags("SalaryRankEmployee")
@Security("bearerAuth")
@ -138,11 +140,13 @@ export class SalaryRankEmployeeController extends Controller {
*/
@Get("{id}")
async listSalaryRankEmployees(
@Request() request: RequestWithUser,
@Path() id: string,
@Query("page") page: number = 1,
@Query("pageSize") pageSize: number = 10,
@Query("keyword") keyword?: string,
) {
await new permission().PermissionGet(request, "SYS_WAGE_CHART_EMP");
const [salaryRankEmployee, total] = await AppDataSource.getRepository(SalaryRankEmployee)
.createQueryBuilder("salaryRankEmployee")
.andWhere(