handler

package
v0.0.0-...-38cb3c5 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 8, 2025 License: AGPL-3.0 Imports: 15 Imported by: 0

Documentation

Overview

Package handler provides the business logic for the carpool service

Index

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

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

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL
⌂ 换网址