entity ย้ายสับเปลี่ยนตำแหน่ง

This commit is contained in:
Bright 2024-06-11 16:14:36 +07:00
parent 8e73b3317d
commit c1be9bc235
4 changed files with 292 additions and 1 deletions

View file

@ -0,0 +1,50 @@
import {
Controller,
Get,
Post,
Put,
Delete,
Patch,
Route,
Security,
Tags,
Body,
Path,
Request,
Example,
SuccessResponse,
Response,
Query,
} from "tsoa";
import { AppDataSource } from "../database/data-source";
import HttpSuccess from "../interfaces/http-success";
import HttpStatusCode from "../interfaces/http-status";
import { Equal, ILike, In, IsNull, Like, Not, Brackets, MoreThan } from "typeorm";
import { ChangePosition } from "../entities/ChangePosition";
@Route("api/v1/placement/change-position")
@Tags("Switch")
@Security("bearerAuth")
@Response(
HttpStatusCode.INTERNAL_SERVER_ERROR,
"เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง",
)
@SuccessResponse(HttpStatusCode.OK, "สำเร็จ")
export class ChangePositionController extends Controller {
private ChangePositionRepository = AppDataSource.getRepository(ChangePosition);
/**
* API
*
* @summary API
*
*/
@Get("")
async GetChangePositionLists() {
const data = await this.ChangePositionRepository.find();
return new HttpSuccess(data);
}
}

View file

@ -556,7 +556,11 @@ export class ProfileEmployeeController extends Controller {
const exists =
!!body.citizenId &&
(await this.profileRepo.findOne({
where: { id: Not(id), citizenId: body.citizenId },
where: {
id: Not(id),
citizenId: body.citizenId,
employeeClass: String(body.employeeClass)
},
}));
if (exists) {