37 lines
633 B
Go
37 lines
633 B
Go
package domain
|
|
|
|
import (
|
|
"time"
|
|
)
|
|
|
|
// Aggregate Root
|
|
type Route struct {
|
|
ID int
|
|
Name string
|
|
StartPoint string
|
|
EndPoint string
|
|
Price float64
|
|
Transports []TransportAssignment
|
|
CreatedAt time.Time
|
|
UpdatedAt time.Time
|
|
}
|
|
|
|
type TransportAssignment struct {
|
|
ID int
|
|
DepartureTime time.Time
|
|
ArrivalTime time.Time
|
|
}
|
|
|
|
type RouteTransport struct {
|
|
ID int
|
|
TransportID int
|
|
}
|
|
|
|
// Repository Interface
|
|
type RouteRepository interface {
|
|
FindByID(id int) (*Route, error)
|
|
FindAll() ([]*Route, error)
|
|
Save(route *Route) error
|
|
AddTransport(routeID int, assignment TransportAssignment) error
|
|
}
|