diff --git a/src/controllers/branch/contact-controller.ts b/src/controllers/branch/contact-controller.ts index 9598bb8..dde1d4f 100644 --- a/src/controllers/branch/contact-controller.ts +++ b/src/controllers/branch/contact-controller.ts @@ -161,5 +161,8 @@ export class BranchContactController extends Controller { if (result.count <= 0) { throw new HttpError(HttpStatus.NOT_FOUND, "Branch cannot be found.", "data_not_found"); } + await minio.removeObject(MINIO_BUCKET, imageLocation(contactId), { + forceDelete: true, + }); } } diff --git a/src/controllers/user/user-controller.ts b/src/controllers/user/user-controller.ts index 8674ca1..19cfc3f 100644 --- a/src/controllers/user/user-controller.ts +++ b/src/controllers/user/user-controller.ts @@ -325,6 +325,10 @@ export class UserController extends Controller { throw new HttpError(HttpStatus.FORBIDDEN, "User is in used.", "data_in_used"); } + await minio.removeObject(MINIO_BUCKET, imageLocation(userId), { + forceDelete: true, + }); + return await prisma.user.delete({ include: { province: true,