This commit is contained in:
Bright 2024-02-02 13:31:59 +07:00
parent ed4d07a439
commit f6bf6ef536
2 changed files with 34 additions and 127 deletions

View file

@ -57,128 +57,6 @@ export class PositionController extends Controller {
private child3Repository = AppDataSource.getRepository(OrgChild3);
private child4Repository = AppDataSource.getRepository(OrgChild4);
/**
* API
*
* @summary ORG_026 - (ADMIN) #28
*
*/
@Get("executive")
@Example([
{
id: "00000000-0000-0000-0000-000000000000",
posExecutiveName: "นักบริหาร",
posExecutivePriority: 1,
},
])
async GetPosExecutive() {
try {
const posExecutive = await this.posExecutiveRepository.find({
select: ["id", "posExecutiveName", "posExecutivePriority"],
});
if (!posExecutive) {
return new HttpSuccess([]);
}
return new HttpSuccess(posExecutive);
} catch (error) {
return error;
}
}
// /**
// * API รายการประเภทตำแหน่ง
// *
// * @summary ORG_027 - รายการประเภทตำแหน่ง (ADMIN) #29
// *
// */
// @Get("type")
// @Example([
// {
// id: "00000000-0000-0000-0000-000000000000",
// posTypeName: "นักบริหาร",
// posTypeRank: 1,
// posLevels: [
// {
// id: "00000000-0000-0000-0000-000000000000",
// posLevelName: "นักบริหาร",
// posLevelRank: 1,
// posLevelAuthority: "HEAD",
// },
// ],
// },
// ])
// async GetPosType() {
// try {
// const posType = await this.posTypeRepository.find({
// select: ["id", "posTypeName", "posTypeRank"],
// relations: ["posLevels"],
// });
// if (!posType) {
// return new HttpSuccess([]);
// }
// const mapPosType = posType.map((item) => ({
// id: item.id,
// posTypeName: item.posTypeName,
// posTypeRank: item.posTypeRank,
// posLevels: item.posLevels.map((posLevel) => ({
// id: posLevel.id,
// posLevelName: posLevel.posLevelName,
// posLevelRank: posLevel.posLevelRank,
// posLevelAuthority: posLevel.posLevelAuthority,
// })),
// }));
// return new HttpSuccess(mapPosType);
// } catch (error) {
// return error;
// }
// }
/**
* API
*
* @summary ORG_028 - (ADMIN) #30
*
*/
@Get("level")
@Example([
{
id: "00000000-0000-0000-0000-000000000000",
posLevelName: "นักบริหาร",
posLevelRank: 1,
posLevelAuthority: "HEAD",
posTypes: {
id: "00000000-0000-0000-0000-000000000000",
posTypeName: "นักบริหาร",
posTypeRank: 1,
},
},
])
async GetPosLevel() {
try {
const posLevel = await this.posLevelRepository.find({
select: ["id", "posLevelName", "posLevelRank", "posLevelAuthority", "posTypeId"],
relations: ["posType"],
});
if (!posLevel) {
return new HttpSuccess([]);
}
const mapPosLevel = posLevel.map((item) => ({
id: item.id,
posLevelName: item.posLevelName,
posLevelRank: item.posLevelRank,
posLevelAuthority: item.posLevelAuthority,
posTypes: {
id: item.posType.id,
posTypeName: item.posType.posTypeName,
posTypeRank: item.posType.posTypeRank,
},
}));
return new HttpSuccess(mapPosLevel);
} catch (error) {
return error;
}
}
/**
* API
*