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