Documentation
¶
Overview ¶
Package handler provides the business logic for the carpool service
Index ¶
- type CarpoolServiceHandler
- func (h *CarpoolServiceHandler) Book(booking ocss.Booking, motivation *string) (*internal.Booking, error)
- func (h *CarpoolServiceHandler) CreateRegularRoutes(routes []*geojson.FeatureCollection) error
- func (h *CarpoolServiceHandler) DeleteRegularRoutes(ids []string) (err error)
- func (h *CarpoolServiceHandler) GetBooking(id string) (*internal.Booking, error)
- func (h *CarpoolServiceHandler) GetBookings(mindate *time.Time, maxdate *time.Time) ([]internal.Booking, error)
- func (h *CarpoolServiceHandler) GetDriverJourneys(departureFeature *geojson.Feature, arrivalFeature *geojson.Feature, ...) ([]internal.PlannedRouteSchedule, error)
- func (h *CarpoolServiceHandler) GetPassengerJourneys(departure orb.Point, arrival orb.Point, departureRadius *float64, ...) ([]internal.PlannedRouteSchedule, error)
- func (h *CarpoolServiceHandler) GetPlannedTrip(id string) (*internal.PlannedRouteSchedule, error)
- func (h *CarpoolServiceHandler) GetUserBookings(user_id string, mindate *time.Time, maxdate *time.Time) ([]internal.Booking, error)
- func (h *CarpoolServiceHandler) GetUserPlanning(userid string, minDepartureDate time.Time, maxDepartureDate time.Time) (planned_schedules map[string][]internal.PlannedRouteSchedule, ...)
- func (h *CarpoolServiceHandler) GetUserRegularRoutes(userid string) ([]*geojson.FeatureCollection, error)
- func (h *CarpoolServiceHandler) UpdateBookingStatus(id string, status ocss.BookingStatus) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CarpoolServiceHandler ¶
type CarpoolServiceHandler struct {
Config *viper.Viper
Storage storage.Storage
Tiles *tiles.TilesHandler
Routing routing.RoutingService
InternalOperatorID string
}
func NewCarpoolServiceHandler ¶
func NewCarpoolServiceHandler(cfg *viper.Viper, storage storage.Storage, tilesHandler *tiles.TilesHandler, routing routing.RoutingService) (*CarpoolServiceHandler, error)
NewCarpoolServiceHandler initiates the carpool service handler, implementing the COOPGO Carpool Service business logic
func (*CarpoolServiceHandler) Book ¶
func (h *CarpoolServiceHandler) Book(booking ocss.Booking, motivation *string) (*internal.Booking, error)
Book handles the booking flow
func (*CarpoolServiceHandler) CreateRegularRoutes ¶
func (h *CarpoolServiceHandler) CreateRegularRoutes(routes []*geojson.FeatureCollection) error
CreateRegularRoutes creates and stores a regular route
func (*CarpoolServiceHandler) DeleteRegularRoutes ¶
func (h *CarpoolServiceHandler) DeleteRegularRoutes(ids []string) (err error)
func (*CarpoolServiceHandler) GetBooking ¶
func (h *CarpoolServiceHandler) GetBooking(id string) (*internal.Booking, error)
GetBooking returns the booking with the given ID
func (*CarpoolServiceHandler) GetBookings ¶
func (h *CarpoolServiceHandler) GetBookings(mindate *time.Time, maxdate *time.Time) ([]internal.Booking, error)
GetBookings retrieves all the bookings between 2 dates
func (*CarpoolServiceHandler) GetDriverJourneys ¶
func (h *CarpoolServiceHandler) GetDriverJourneys(departureFeature *geojson.Feature, arrivalFeature *geojson.Feature, departureRadius *float64, arrivalRadius *float64, minDate time.Time, maxDate time.Time, count *int64) ([]internal.PlannedRouteSchedule, error)
GetDriverJourneys searches for matching punctual planned driver journeys.
func (*CarpoolServiceHandler) GetPassengerJourneys ¶
func (h *CarpoolServiceHandler) GetPassengerJourneys(departure orb.Point, arrival orb.Point, departureRadius *float64, arrivalRadius *float64, minDate time.Time, maxDate time.Time, count *int64) ([]internal.PlannedRouteSchedule, error)
GetPassengerJourneys searches for matching punctual planned passenger journeys.
func (*CarpoolServiceHandler) GetPlannedTrip ¶
func (h *CarpoolServiceHandler) GetPlannedTrip(id string) (*internal.PlannedRouteSchedule, error)
GetPlannedTrip returns a planned trip, given an ID. This should be called after getting the user planning from regular routes
func (*CarpoolServiceHandler) GetUserBookings ¶
func (h *CarpoolServiceHandler) GetUserBookings(user_id string, mindate *time.Time, maxdate *time.Time) ([]internal.Booking, error)
GetUserBookings retrieves all the bookings for a specified user id
func (*CarpoolServiceHandler) GetUserPlanning ¶
func (h *CarpoolServiceHandler) GetUserPlanning(userid string, minDepartureDate time.Time, maxDepartureDate time.Time) (planned_schedules map[string][]internal.PlannedRouteSchedule, missing_planning bool, err error)
GetUserPlanning returns the planned routes for a user between 2 dates. It transforms regular routes to multiple indivual planned route schedules
func (*CarpoolServiceHandler) GetUserRegularRoutes ¶
func (h *CarpoolServiceHandler) GetUserRegularRoutes(userid string) ([]*geojson.FeatureCollection, error)
func (*CarpoolServiceHandler) UpdateBookingStatus ¶
func (h *CarpoolServiceHandler) UpdateBookingStatus(id string, status ocss.BookingStatus) error
UpdateBookingStatus sets a new status for a given booking id