From 712a0952dde66c1c480db4b376aa83e52f8cdc02 Mon Sep 17 00:00:00 2001 From: Methapon2001 <61303214+Methapon2001@users.noreply.github.com> Date: Tue, 2 Apr 2024 13:56:40 +0700 Subject: [PATCH] feat: delete branch contact endpoint --- src/controllers/branch/contact-controller.ts | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/controllers/branch/contact-controller.ts b/src/controllers/branch/contact-controller.ts index 479dc5b..ecd4917 100644 --- a/src/controllers/branch/contact-controller.ts +++ b/src/controllers/branch/contact-controller.ts @@ -55,4 +55,10 @@ export class BranchContactController extends Controller { ), }); } + + @Delete("{contactId}") + async deleteBranchContact(@Path() branchId: string, @Path() contactId: string) { + const result = await prisma.branchContact.deleteMany({ where: { id: contactId, branchId } }); + if (result.count <= 0) throw new HttpError(HttpStatus.NOT_FOUND, "Branch cannot be found."); + } }