From 23292bbfbcbdb069afe828370c4af33e27bbd4ba Mon Sep 17 00:00:00 2001 From: Idhibhat Pankam Date: Tue, 20 Feb 2024 17:00:32 +0700 Subject: [PATCH] fix: pet delete image before pet --- src/app/service/pet/pet.service.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/app/service/pet/pet.service.go b/src/app/service/pet/pet.service.go index 68eccab..f15d67a 100644 --- a/src/app/service/pet/pet.service.go +++ b/src/app/service/pet/pet.service.go @@ -222,6 +222,11 @@ func (s *Service) Delete(id string) (result *dto.DeleteResponse, err *dto.Respon ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second) defer cancel() + _, errSvc := s.imageService.DeleteByPetId(id) + if errSvc != nil { + return nil, errSvc + } + res, errRes := s.petClient.Delete(ctx, &petproto.DeletePetRequest{ Id: id, }) @@ -254,11 +259,6 @@ func (s *Service) Delete(id string) (result *dto.DeleteResponse, err *dto.Respon } } - _, errSvc := s.imageService.DeleteByPetId(id) - if errSvc != nil { - return nil, errSvc - } - return &dto.DeleteResponse{ Success: res.Success, }, nil