Documentation ¶
Overview ¶
Package booking provides the use-case of booking a shipping. Used by views facing an administrator.
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidArgument = errors.New("invalid argument")
ErrInvalidArgument is returned when one or more arguments are invalid.
Functions ¶
This section is empty.
Types ¶
type Cargo ¶
type Cargo struct { ArrivalDeadline time.Time `json:"arrival_deadline"` Destination string `json:"destination"` Legs []shipping.Leg `json:"legs,omitempty"` Misrouted bool `json:"misrouted"` Origin string `json:"origin"` Routed bool `json:"routed"` TrackingID string `json:"tracking_id"` }
Cargo is a read model for booking views.
type Service ¶
type Service interface { // BookNewCargo registers a new cargo in the tracking system, not yet // routed. BookNewCargo(origin shipping.UNLocode, destination shipping.UNLocode, deadline time.Time) (shipping.TrackingID, error) // LoadCargo returns a read model of a shipping. LoadCargo(id shipping.TrackingID) (Cargo, error) // RequestPossibleRoutesForCargo requests a list of itineraries describing // possible routes for this shipping. RequestPossibleRoutesForCargo(id shipping.TrackingID) []shipping.Itinerary // AssignCargoToRoute assigns a cargo to the route specified by the // itinerary. AssignCargoToRoute(id shipping.TrackingID, itinerary shipping.Itinerary) (bool, error) // ChangeDestination changes the destination of a shipping. ChangeDestination(id shipping.TrackingID, destination shipping.UNLocode) (bool, error) // Cargos returns a list of all cargos that have been booked. Cargos() []Cargo // Locations returns a list of registered locations. Locations() []Location }
Service is the interface that provides booking methods.
func NewLoggingService ¶
NewLoggingService returns a new instance of a logging Service.
func NewService ¶
func NewService(cargos shipping.CargoRepository, locations shipping.LocationRepository, events shipping.HandlingEventRepository) Service
NewService creates a booking service with necessary dependencies.
Click to show internal directories.
Click to hide internal directories.