fix and conversions

This commit is contained in:
2023-04-05 20:57:27 +02:00
parent 2f536dfb19
commit d8346a20be
14 changed files with 1212 additions and 958 deletions

View File

@@ -66,3 +66,24 @@ func (s *CarpoolServiceServerImpl) GetUserPlanning(ctx context.Context, req *pro
RoutesByDates: results,
}, nil
}
func (s *CarpoolServiceServerImpl) GetPlannedTrip(ctx context.Context, req *proto.GetPlannedTripRequest) (*proto.GetPlannedTripResponse, error) {
planned_trip, err := s.Handler.GetPlannedTrip(req.Id)
if err != nil {
return nil, status.Errorf(codes.Internal, "could not retrieve planned trip - %s", err.Error())
}
planned_trip.Route.ExtraMembers["departure_date"] = planned_trip.DepartureDate
serialized, err := planned_trip.Route.FeatureCollection().MarshalJSON()
if err != nil {
log.Error().Err(err).Msg("grpc GetPlannedTrip - could not serialize feature collection")
return nil, status.Errorf(codes.Internal, "could not serialize feature collection")
}
return &proto.GetPlannedTripResponse{
PlannedTrip: &proto.CarpoolFeatureCollection{
Serialized: string(serialized),
},
}, nil
}