search position
This commit is contained in:
parent
c7d7732fb6
commit
4b05629c29
1 changed files with 58 additions and 0 deletions
|
|
@ -337,6 +337,64 @@ export class PositionController extends Controller {
|
|||
return new HttpSuccess(posDict.id);
|
||||
}
|
||||
|
||||
/**
|
||||
* API ค้นหารายการตำแหน่ง
|
||||
*
|
||||
* @summary ORG_029 - ค้นหารายการตำแหน่ง (ADMIN) #32
|
||||
*
|
||||
*/
|
||||
@Post("position/search")
|
||||
async findPositionSearch(
|
||||
@Body()
|
||||
requestBody: {
|
||||
posLevel: string;
|
||||
posType: string;
|
||||
},
|
||||
) {
|
||||
let findPosDict = await this.posDictRepository.find({
|
||||
relations: ["posType", "posLevel"],
|
||||
where: {
|
||||
posTypeId: requestBody.posType,
|
||||
posLevelId: requestBody.posLevel,
|
||||
},
|
||||
order: {
|
||||
posDictName: "ASC",
|
||||
createdAt: "DESC",
|
||||
posType: {
|
||||
posTypeRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
},
|
||||
posLevel: {
|
||||
posLevelRank: "ASC",
|
||||
createdAt: "DESC",
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
const mapDataPosDict = await Promise.all(
|
||||
findPosDict.map(async (item: any) => {
|
||||
return {
|
||||
id: item.id,
|
||||
positionName: item.posDictName,
|
||||
positionField: item.posDictField,
|
||||
posTypeId: item.posTypeId,
|
||||
posTypeName: item.posType == null ? null : item.posType.posTypeName,
|
||||
posLevelId: item.posLevelId,
|
||||
posLevelName: item.posLevel == null ? null : item.posLevel.posLevelName,
|
||||
positionExecutiveField: item.posDictExecutiveField,
|
||||
positionArea: item.posDictArea,
|
||||
isSpecial: item.isSpecial,
|
||||
positionIsSelected: false,
|
||||
createdAt: item.createdAt,
|
||||
lastUpdatedAt: item.lastUpdatedAt,
|
||||
lastUpdateFullName: item.lastUpdateFullName,
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
||||
return new HttpSuccess(mapDataPosDict);
|
||||
}
|
||||
|
||||
/**
|
||||
* API แก้ไขตำแหน่ง
|
||||
*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue