role
This commit is contained in:
parent
8e82201fbd
commit
1736f5043e
7 changed files with 147 additions and 30 deletions
|
|
@ -30,6 +30,8 @@ import { EmployeePosLevel } from "../entities/EmployeePosLevel";
|
|||
import { SalaryEmployee } from "../entities/SalaryEmployee";
|
||||
import { SalaryRankEmployee } from "../entities/SalaryRankEmployee";
|
||||
import { SalaryFormulaEmployee } from "../entities/SalaryFormulaEmployee";
|
||||
import { RequestWithUser } from "../middlewares/user";
|
||||
import permission from "../interfaces/permission";
|
||||
|
||||
@Route("api/v1/salary/period-employee")
|
||||
@Tags("SalaryEmployee")
|
||||
|
|
@ -246,7 +248,8 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
* @param {string} id profile Id
|
||||
*/
|
||||
@Delete("profile/{id}")
|
||||
async deleteSalaryProfile(@Path() id: string) {
|
||||
async deleteSalaryProfile(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
await new permission().PermissionDelete(request, "SYS_WAGE");
|
||||
const salaryProfile = await this.salaryProfileRepository.findOne({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: { id: id },
|
||||
|
|
@ -360,7 +363,8 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
* @param {string} amount ฐานเงินเดือน
|
||||
*/
|
||||
@Post("change/amount")
|
||||
async changeAmount(@Body() body: { profileId: string; amount: number }) {
|
||||
async changeAmount(@Body() body: { profileId: string; amount: number }, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionCreate(req, "SYS_WAGE");
|
||||
const salaryProfile = await this.salaryProfileRepository.findOne({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: { id: body.profileId },
|
||||
|
|
@ -809,7 +813,8 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
* @param {string} groupId groupId
|
||||
*/
|
||||
@Post("change/group")
|
||||
async changeGroup(@Body() body: { profileId: string; groupId: string }) {
|
||||
async changeGroup(@Body() body: { profileId: string; groupId: string }, @Request() req: RequestWithUser) {
|
||||
await new permission().PermissionCreate(req, "SYS_WAGE");
|
||||
const salaryProfile = await this.salaryProfileRepository.findOne({
|
||||
// relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: { id: body.profileId },
|
||||
|
|
@ -931,7 +936,9 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
@Post("change/type")
|
||||
async changeType(
|
||||
@Body() body: { profileId: string; type: string; isReserve: boolean; remark?: string | null },
|
||||
@Request() req: RequestWithUser
|
||||
) {
|
||||
await new permission().PermissionCreate(req, "SYS_WAGE");
|
||||
const salaryProfile = await this.salaryProfileRepository.findOne({
|
||||
relations: ["salaryOrg", "salaryOrg.salaryPeriod"],
|
||||
where: { id: body.profileId },
|
||||
|
|
@ -1557,8 +1564,9 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
isAbsent: any;
|
||||
isLeave: any;
|
||||
},
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionUpdate(request, "SYS_WAGE");
|
||||
const salaryProfile = await this.salaryProfileRepository.findOne({
|
||||
where: {
|
||||
id: id,
|
||||
|
|
@ -1587,8 +1595,9 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
@Post("org/profile")
|
||||
async addSalaryProfile(
|
||||
@Body() requestBody: CreateSalaryProfileEmployee,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionCreate(request, "SYS_WAGE");
|
||||
const salaryOrg = await this.salaryOrgRepository.findOne({
|
||||
relations: ["salaryPeriod", "salaryProfiles"],
|
||||
where: {
|
||||
|
|
@ -2095,8 +2104,9 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
@Post()
|
||||
async create_salary_period(
|
||||
@Body() requestBody: CreateSalaryPeriod,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionCreate(request, "SYS_WAGE");
|
||||
const salaryPeriod = Object.assign(new SalaryPeriod(), requestBody);
|
||||
|
||||
const chk_toUpper = ["SPECIAL", "APR", "OCT"];
|
||||
|
|
@ -2173,8 +2183,9 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
async update_salary_period(
|
||||
@Path() id: string,
|
||||
@Body() requestBody: UpdateSalaryPeriod,
|
||||
@Request() request: { user: Record<string, any> },
|
||||
@Request() request: RequestWithUser,
|
||||
) {
|
||||
await new permission().PermissionUpdate(request, "SYS_WAGE");
|
||||
const chk_SalaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -2252,7 +2263,8 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
* @param {string} id Guid, *Id รอบเงินเดือน
|
||||
*/
|
||||
@Delete("{id}")
|
||||
async delete_salary_period(@Path() id: string) {
|
||||
async delete_salary_period(@Path() id: string, @Request() request: RequestWithUser) {
|
||||
await new permission().PermissionDelete(request, "SYS_WAGE");
|
||||
const SalaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: { id: id },
|
||||
});
|
||||
|
|
@ -2472,7 +2484,9 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
body: {
|
||||
titleRecommend: string;
|
||||
},
|
||||
@Request() request: RequestWithUser
|
||||
) {
|
||||
await new permission().PermissionUpdate(request, "SYS_WAGE");
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: { id: periodId },
|
||||
relations: ["salaryOrgEmployees"],
|
||||
|
|
@ -2507,7 +2521,9 @@ export class SalaryPeriodEmployeeController extends Controller {
|
|||
body: {
|
||||
titleRecommend: string;
|
||||
},
|
||||
@Request() request: RequestWithUser
|
||||
) {
|
||||
await new permission().PermissionUpdate(request, "SYS_WAGE");
|
||||
const salaryPeriod = await this.salaryPeriodRepository.findOne({
|
||||
where: { id: periodId },
|
||||
relations: ["salaryOrgEmployees"],
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue