Documentation ¶
Overview ¶
Package booking provides the use-case of booking a cargo. 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 ¶
Types ¶
type Cargo ¶
type Cargo struct { ArrivalDeadline time.Time `json:"arrival_deadline"` Destination string `json:"destination"` Legs []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 Leg ¶
type Leg struct { VoyageNumber string `json:"voyage_number"` From string `json:"from"` To string `json:"to"` LoadTime time.Time `json:"load_time"` UnloadTime time.Time `json:"unload_time"` }
Leg 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 location.UNLocode, destination location.UNLocode, arrivalDeadline time.Time) (cargo.TrackingID, error) // LoadCargo returns a read model of a cargo. LoadCargo(trackingID cargo.TrackingID) (*Cargo, error) // RequestPossibleRoutesForCargo requests a list of itineraries describing // possible routes for this cargo. RequestPossibleRoutesForCargo(trackingID cargo.TrackingID) []cargo.Itinerary // AssignCargoToRoute assigns a cargo to the route specified by the // itinerary. AssignCargoToRoute(trackingID cargo.TrackingID, itinerary cargo.Itinerary) error // ChangeDestination changes the destination of a cargo. ChangeDestination(trackingID cargo.TrackingID, unLocode location.UNLocode) 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 ...
func NewService ¶
func NewService(cr cargo.Repository, lr location.Repository, her cargo.HandlingEventRepository, rs routing.Service) Service
NewService creates a booking service with necessary dependencies.
type ServiceMiddleware ¶
ServiceMiddleware ...
func ProxyingMiddleware ¶
func ProxyingMiddleware(proxyURL string, ctx context.Context) ServiceMiddleware
ProxyingMiddleware ...
Click to show internal directories.
Click to hide internal directories.