no message

This commit is contained in:
Kittapath 2024-06-24 10:52:40 +07:00
parent 5a634b4dd3
commit b11be3364f
7 changed files with 201 additions and 125 deletions

View file

@ -3353,4 +3353,32 @@ export class OrganizationController extends Controller {
return new HttpSuccess(formattedData);
}
/**
* API
*
* @summary (ADMIN)
*
* @param {string} id
*/
@Get("approver/{id}")
async getUserRootOrg(@Path() id: string, @Request() request: { user: Record<string, any> }) {
const root = await this.orgRootRepository.findOne({
where: { id: id },
});
if (!root) throw new HttpError(HttpStatusCode.NOT_FOUND, "not found. Root");
const posMaster = await this.posMasterRepository.find({
where: { orgRootId: root.id, orgChild1Id: IsNull() },
relations: ["current_holder"],
});
if (!posMaster) throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลตำแหน่ง");
const maps = posMaster.map((posMaster) => ({
Id: posMaster.current_holder.id,
Name: `${posMaster.current_holder.prefix}${posMaster.current_holder.firstName} ${posMaster.current_holder.lastName}`,
PositionName: posMaster.current_holder.position,
}));
return new HttpSuccess(maps);
}
}