Compare commits
No commits in common. "dev" and "v1.0.3" have entirely different histories.
1 changed files with 0 additions and 68 deletions
|
|
@ -3361,72 +3361,4 @@ export class EvaluationController {
|
||||||
} else throw new HttpError(HttpStatusCode.INTERNAL_SERVER_ERROR, error);
|
} 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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue