diff --git a/src/interfaces/utils.ts b/src/interfaces/utils.ts index 3961271b..2ed25337 100644 --- a/src/interfaces/utils.ts +++ b/src/interfaces/utils.ts @@ -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)