diff --git a/src/controllers/PositionController.ts b/src/controllers/PositionController.ts index 8f97fcce..14807e02 100644 --- a/src/controllers/PositionController.ts +++ b/src/controllers/PositionController.ts @@ -36,7 +36,7 @@ import { Position } from "../entities/Position"; import { Profile } from "../entities/Profile"; @Route("api/v1/org/pos") @Tags("Position") -// @Security("bearerAuth") +@Security("bearerAuth") @Response( HttpStatusCode.INTERNAL_SERVER_ERROR, "เกิดข้อผิดพลาด ไม่สามารถแสดงรายการได้ กรุณาลองใหม่ในภายหลัง", @@ -992,7 +992,13 @@ export class PositionController extends Controller { .leftJoinAndSelect("posMaster.current_holder", "current_holder") .leftJoinAndSelect("posMaster.next_holder", "next_holder") .where(conditions) - .orWhere(searchShortName) + .orWhere( + new Brackets((qb) => { + qb.where(searchShortName) + .andWhere(checkChildConditions) + .andWhere(typeCondition) + }), + ) .orWhere( new Brackets((qb) => { qb.where( @@ -1004,7 +1010,7 @@ export class PositionController extends Controller { }, ) .andWhere(checkChildConditions) - .andWhere(typeCondition); + .andWhere(typeCondition) }), ) .orderBy("posMaster.posMasterOrder", "ASC")