diff --git a/src/controllers/EvaluationController.ts b/src/controllers/EvaluationController.ts index 5bd7ca2..09a09bc 100644 --- a/src/controllers/EvaluationController.ts +++ b/src/controllers/EvaluationController.ts @@ -3361,72 +3361,4 @@ export class EvaluationController { } else throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, error); } } - - /** - * API สำหรับลบกรรมการออกจากการประเมิน - * @summary ลบกรรมการในการประเมิน (ADMIN) - * @param {string} id id ของ evaluation_directors_director - */ - @Delete("del-director/{id}") - async removeEvaluationDirector( - @Path() id: string, - @Request() request: RequestWithUser, - ) { - try { - const evaluationDirector = - await this.evaluation_directors_directorRepository.findOneBy({ id }); - - if (!evaluationDirector) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลกรรมการ"); - } - - await this.evaluation_directors_directorRepository.remove(evaluationDirector, { - data: request, - }); - - return new HttpSuccess(); - } catch (error: any) { - if (error instanceof HttpError) { - throw error; - } else throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, error); - } - } - - /** - * API สำหรับลบการประชุมออกจากการประเมิน - * @summary ลบการประชุมในการประเมิน (ADMIN) - * @param {string} evaluationId id ของ evaluation - * @param {string} meetingId id ของ meeting - */ - @Delete("del-meeting/{evaluationId}/{meetingId}") - async removeMeetingFromEvaluation( - @Path() evaluationId: string, - @Path() meetingId: string, - @Request() request: RequestWithUser, - ) { - try { - const evaluation = await this.evaluationRepository.findOne({ - where: { id: evaluationId }, - relations: { meetings: true }, - }); - - if (!evaluation) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประเมิน"); - } - - const meetingExists = evaluation.meetings.some((m) => m.id === meetingId); - if (!meetingExists) { - throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลการประชุมในการประเมินนี้"); - } - - evaluation.meetings = evaluation.meetings.filter((m) => m.id !== meetingId); - await this.evaluationRepository.save(evaluation, { data: request }); - - return new HttpSuccess(); - } catch (error: any) { - if (error instanceof HttpError) { - throw error; - } else throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, error); - } - } }