Return handling
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 40s
Some checks failed
Build and Push Docker Image / build_and_push (push) Failing after 40s
This commit is contained in:
@@ -2,6 +2,7 @@ package server
|
||||
|
||||
import (
|
||||
"context"
|
||||
"time"
|
||||
|
||||
"git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/proto/gen"
|
||||
"git.coopgo.io/coopgo-platform/solidarity-transport/servers/grpc/transformers"
|
||||
@@ -14,8 +15,9 @@ func (s SolidarityTransportServerImpl) BookDriverJourney(ctx context.Context, re
|
||||
passengerId := req.PassengerId
|
||||
driverId := req.DriverId
|
||||
journeyId := req.DriverJourneyId
|
||||
returnWaitingDuration := time.Duration(req.ReturnWaitingDuration)
|
||||
|
||||
booking, err := s.Handler.BookDriverJourney(passengerId, driverId, journeyId)
|
||||
booking, err := s.Handler.BookDriverJourney(passengerId, driverId, journeyId, returnWaitingDuration)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("issue in BookDriverJourney handler")
|
||||
return nil, status.Errorf(codes.Internal, "could not create booking : %v", err)
|
||||
|
||||
@@ -22,7 +22,7 @@ func (s SolidarityTransportServerImpl) GetDriverJourneys(ctx context.Context, re
|
||||
return nil, status.Errorf(codes.Internal, "arrival unmarhsalling error : %v", err)
|
||||
}
|
||||
|
||||
driverJourneys, err := s.Handler.GetDriverJourneys(departure, arrival, departureDate)
|
||||
driverJourneys, err := s.Handler.GetDriverJourneys(departure, arrival, departureDate, req.Noreturn)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("issue in GetDriverJourneys handler")
|
||||
return nil, status.Errorf(codes.Internal, "could not get driver journeys : %v", err)
|
||||
@@ -67,3 +67,14 @@ func (s SolidarityTransportServerImpl) GetDriverJourney(ctx context.Context, req
|
||||
DriverJourney: protojourney,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s SolidarityTransportServerImpl) ToggleSolidarityTransportNoreturn(ctx context.Context, req *gen.ToggleSolidarityTransportNoreturnRequest) (*gen.ToggleSolidarityTransportNoreturnResponse, error) {
|
||||
journeyid := req.JourneyId
|
||||
err := s.Handler.ToggleDriverJourneyNoreturn(journeyid)
|
||||
if err != nil {
|
||||
log.Error().Err(err).Msg("could not update data")
|
||||
return nil, status.Errorf(codes.NotFound, "could not update data : %v", err)
|
||||
}
|
||||
|
||||
return &gen.ToggleSolidarityTransportNoreturnResponse{}, nil
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user