entity ย้ายสับเปลี่ยนตำแหน่ง
This commit is contained in:
parent
8e73b3317d
commit
c1be9bc235
4 changed files with 292 additions and 1 deletions
50
src/controllers/ChangePositionController.ts
Normal file
50
src/controllers/ChangePositionController.ts
Normal 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);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -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) {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue