Skip to content

Commit

Permalink
temporary loggig
Browse files Browse the repository at this point in the history
  • Loading branch information
mevain committed Nov 25, 2024
1 parent d4b5f9b commit 3c325dd
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 3 deletions.
5 changes: 4 additions & 1 deletion internal/pkg/trips/delivery/grpc/grpc.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ import (
"context"
"encoding/base64"
"fmt"
"log"
"log/slog"
"os"
"path/filepath"
Expand Down Expand Up @@ -131,9 +132,11 @@ func (h *GrpcTripsHandler) AddPlaceToTrip(ctx context.Context, in *tripsGen.AddP

func (h *GrpcTripsHandler) AddPhotosToTrip(ctx context.Context, in *tripsGen.AddPhotosToTripRequest) (*tripsGen.AddPhotosToTripResponse, error) {
var savedPhotoPaths []string

log.Println("grpc in photos: ", in.Photos)
for _, base64Photo := range in.Photos {
log.Println("grcp base64 photo: ", base64Photo)
photoBytes, err := base64.StdEncoding.DecodeString(base64Photo)
log.Println("grcp photo bytes: ", photoBytes)
if err != nil {
h.logger.Error("Failed to decode base64 photo", slog.Any("error", err))
return nil, fmt.Errorf("invalid base64 data: %w", err)
Expand Down
2 changes: 0 additions & 2 deletions internal/pkg/trips/delivery/http/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,6 @@ func (h *TripHandler) AddPlaceToTripHandler(w http.ResponseWriter, r *http.Reque
func (h *TripHandler) AddPhotosToTripHandler(w http.ResponseWriter, r *http.Request) {
vars := mux.Vars(r)
tripIDStr := vars["id"]

logCtx := log.LogRequestStart(r.Context(), r.Method, r.RequestURI)
h.logger.DebugContext(logCtx, "Handling request for adding photos to a trip", slog.String("tripID", tripIDStr))

Expand Down Expand Up @@ -525,7 +524,6 @@ func (h *TripHandler) AddPhotosToTripHandler(w http.ResponseWriter, r *http.Requ
httpresponse.SendJSONResponse(w, response, http.StatusBadRequest, h.logger)
return
}

resp, err := h.client.AddPhotosToTrip(r.Context(), &tripsGen.AddPhotosToTripRequest{
TripId: uint32(tripID),
Photos: photosRequest.Photos,
Expand Down

0 comments on commit 3c325dd

Please sign in to comment.