Skip to content

Commit

Permalink
fix: pet delete image before pet
Browse files Browse the repository at this point in the history
  • Loading branch information
bookpanda committed Feb 20, 2024
1 parent 7164624 commit 23292bb
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions src/app/service/pet/pet.service.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
})
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 23292bb

Please sign in to comment.