feat: delete branch contact endpoint

This commit is contained in:
Methapon2001 2024-04-02 13:56:40 +07:00
parent 5aded1d215
commit 712a0952dd

View file

@ -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.");
}
}