fix throw

This commit is contained in:
AdisakKanthawilang 2024-08-02 10:45:11 +07:00
parent b2fd959162
commit 2c26007f2d

View file

@ -101,7 +101,7 @@ export async function removeProfileInOrganize(profileId: string, type:string) {
.getOne();
if (!currentRevision) {
throw new Error("ไม่พบข้อมูลโครงสร้างอัตรากำลังที่เผยแพร่อยู่");
return;
}
if (type === "OFFICER") {
const findProfileInposMaster = await AppDataSource.getRepository(PosMaster)
@ -118,7 +118,7 @@ export async function removeProfileInOrganize(profileId: string, type:string) {
.execute();
if (!findProfileInposMaster) {
throw new Error("ไม่พบข้อมูลบุคคลนี้ภายในโครงสร้างอัตรากำลัง");
return;
}
const findPosition = await AppDataSource.getRepository(Position)
.createQueryBuilder("position")
@ -126,7 +126,7 @@ export async function removeProfileInOrganize(profileId: string, type:string) {
.getMany();
if (!findPosition) {
throw new Error("ไม่พบข้อมูลตำแหน่งของบุคคลนี้ภายในโครงสร้างอัตรากำลัง");
return;
}
await AppDataSource.getRepository(Position)
.createQueryBuilder()
@ -151,7 +151,7 @@ export async function removeProfileInOrganize(profileId: string, type:string) {
.execute();
if (!findProfileInEmpPosMaster) {
throw new Error("ไม่พบข้อมูลบุคคลนี้ภายในโครงสร้างอัตรากำลัง");
return;
}
const findEmpPosition = await AppDataSource.getRepository(EmployeePosition)
.createQueryBuilder("employeePosition")
@ -161,7 +161,7 @@ export async function removeProfileInOrganize(profileId: string, type:string) {
.getMany();
if (!findEmpPosition) {
throw new Error("ไม่พบข้อมูลตำแหน่งของบุคคลนี้ภายในโครงสร้างอัตรากำลัง");
return;
}
await AppDataSource.getRepository(EmployeePosition)