Skip to content

Commit

Permalink
tmp: log findall
Browse files Browse the repository at this point in the history
  • Loading branch information
bookpanda committed Feb 21, 2024
1 parent 2f233b6 commit 8461a57
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions src/app/service/pet/pet.service.go
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,15 @@ func (s *Service) FindAll(_ context.Context, req *proto.FindAllPetRequest) (res
log.Error().Err(err).Str("service", "event").Str("module", "find all").Msg("Error while querying all events")
return nil, status.Error(codes.Unavailable, "Internal error")
}
log.Info().
Str("service", "pet").
Str("module", "repo.FindAll").Interface("pets", pets).Msg("")

petUtils.FilterPet(&pets, req)
petUtils.PaginatePets(&pets, req.Page, req.PageSize, &metaData)
log.Info().
Str("service", "pet").
Str("module", "filtered pets").Interface("filteredPets", pets).Msg("")

for _, pet := range pets {
images, err := s.imageService.FindByPetId(pet.ID.String())
Expand All @@ -110,6 +116,10 @@ func (s *Service) FindAll(_ context.Context, req *proto.FindAllPetRequest) (res
imagesList[pet.ID.String()] = images
}
petWithImages, err := petUtils.RawToDtoList(&pets, imagesList, req)
log.Info().
Str("service", "pet").
Str("module", "pet with images").Interface("petWithImages", petWithImages).Msg("")

if err != nil {
return nil, status.Error(codes.Internal, fmt.Sprintf("error converting raw to dto list: %v", err))
}
Expand Down

0 comments on commit 8461a57

Please sign in to comment.