ไม่เช็คประเภทคำสั่งซ้ำ

This commit is contained in:
kittapath 2024-09-20 15:02:46 +07:00
parent 395ac1161e
commit 917ca75eb2

View file

@ -143,13 +143,13 @@ export class CommandTypeController extends Controller {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูล");
}
const checkName = await this.commandTypeRepository.findOne({
where: { name: requestBody.name },
});
// const checkName = await this.commandTypeRepository.findOne({
// where: { name: requestBody.name },
// });
if (checkName) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อนี้มีอยู่ในระบบแล้ว");
}
// if (checkName) {
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อนี้มีอยู่ในระบบแล้ว");
// }
const checkNameSys = await this.commandSysRepository.findOne({
where: { id: requestBody.commandSysId },
@ -187,12 +187,12 @@ export class CommandTypeController extends Controller {
if (!_commandType) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ไม่พบข้อมูลประเภทคำสั่งชื่อนี้");
}
const checkName = await this.commandTypeRepository.findOne({
where: { id: Not(id), name: requestBody.name },
});
if (checkName) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อนี้มีอยู่ในระบบแล้ว");
}
// const checkName = await this.commandTypeRepository.findOne({
// where: { id: Not(id), name: requestBody.name },
// });
// if (checkName) {
// throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อนี้มีอยู่ในระบบแล้ว");
// }
const checkNameSys = await this.commandSysRepository.findOne({
where: { id: requestBody.commandSysId },