no message

This commit is contained in:
Bright 2024-05-15 11:42:37 +07:00
parent 34d988b8a4
commit e4d7c034e8

View file

@ -93,7 +93,10 @@ export class SubDistrictController extends Controller {
}
const checkName = await this.subDistrictRepository.findOne({
where: { name: requestBody.name },
where: {
name: requestBody.name,
districtId: requestBody.districtId
},
});
if (checkName) {
@ -135,7 +138,11 @@ export class SubDistrictController extends Controller {
}
const checkName = await this.subDistrictRepository.findOne({
where: { id: Not(id), name: requestBody.name },
where: {
id: Not(id),
name: requestBody.name,
districtId: requestBody.districtId
},
});
if (checkName) {
throw new HttpError(HttpStatusCode.NOT_FOUND, "ชื่อนี้มีอยู่ในระบบแล้ว");