43 lines
2.0 KiB
Go
43 lines
2.0 KiB
Go
package ocssapi
|
|
|
|
import (
|
|
"context"
|
|
"errors"
|
|
"time"
|
|
|
|
"git.coopgo.io/coopgo-platform/carpool-service/interoperability/ocss"
|
|
"github.com/paulmach/orb"
|
|
)
|
|
|
|
func (s *OCSSApiService) GetDriverJourneys(ctx context.Context, departureLat float64, departureLng float64, arrivalLat float64, arrivalLng float64, departureDate time.Time, timeDelta *time.Duration, departureRadius *float64, arrivalRadius *float64, count *int64) ([]ocss.DriverJourney, error) {
|
|
departure := orb.Point{departureLng, departureLat}
|
|
arrival := orb.Point{arrivalLng, arrivalLat}
|
|
|
|
td := 900 * time.Second
|
|
if timeDelta != nil {
|
|
td = *timeDelta
|
|
}
|
|
|
|
minDate := departureDate.Add(-td * time.Second)
|
|
maxDate := departureDate.Add(td * time.Second)
|
|
|
|
result, err := s.Handler.GetDriverJourneys(departure, arrival, minDate, maxDate)
|
|
if err != nil {
|
|
return nil, err
|
|
}
|
|
|
|
return result, nil
|
|
}
|
|
|
|
func (s *OCSSApiService) GetPassengerJourneys(ctx context.Context, departureLat float64, departureLng float64, arrivalLat float64, arrivalLng float64, departureDate time.Time, timeDelta *time.Duration, departureRadius *float64, arrivalRadius *float64, count *int64) ([]ocss.PassengerJourney, error) {
|
|
return nil, errors.New("method not implmeented - GetPassengerJourneys")
|
|
}
|
|
|
|
func (s *OCSSApiService) GetDriverRegularTrips(ctx context.Context, departureLat float64, departureLng float64, arrivalLat float64, arrivalLng float64, departureTimeOfDay string, departureWeekDays *[]string, timeDelta *time.Duration, departureRadius *float64, arrivalRadius *float64, minDepartureDate *time.Time, maxDepartureDate *time.Time, count *int64) ([]ocss.DriverTrip, error) {
|
|
return []ocss.DriverTrip{}, nil
|
|
}
|
|
|
|
func (s *OCSSApiService) GetPassengerRegularTrips(ctx context.Context, departureLat float64, departureLng float64, arrivalLat float64, arrivalLng float64, departureTimeOfDay string, departureWeekDays *[]string, timeDelta *time.Duration, departureRadius *float64, arrivalRadius *float64, minDepartureDate *time.Time, maxDepartureDate *time.Time, count *int64) ([]ocss.PassengerTrip, error) {
|
|
return []ocss.PassengerTrip{}, nil
|
|
}
|