Compare commits

...

2 commits

Author SHA1 Message Date
harid
2714ea8b8a Merge branch 'develop' into dev
All checks were successful
Build & Deploy on Dev / build (push) Successful in 59s
2026-04-03 17:15:50 +07:00
harid
96ea1a2141 api ลบรายชื่อกรรมการ และ รายการการประชุม #2399 2026-04-03 17:15:18 +07:00

View file

@ -3361,4 +3361,72 @@ 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);
}
}
}