From e4d7c034e8ea8c135e2e4c9c2bae812bf01c9344 Mon Sep 17 00:00:00 2001 From: Bright Date: Wed, 15 May 2024 11:42:37 +0700 Subject: [PATCH] no message --- src/controllers/SubDistrictController.ts | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/src/controllers/SubDistrictController.ts b/src/controllers/SubDistrictController.ts index 2d93445c..3ea667c8 100644 --- a/src/controllers/SubDistrictController.ts +++ b/src/controllers/SubDistrictController.ts @@ -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, "ชื่อนี้มีอยู่ในระบบแล้ว");