This commit is contained in:
Dmitriy Bondarenko 2025-03-27 20:01:50 +00:00
parent 2a4d567549
commit 33ecdd8ae3
6 changed files with 50 additions and 36 deletions

View File

@ -0,0 +1,8 @@
package domain
// Cargo представляет перевозимый груз
type Cargo struct {
ID int64 `json:"id"`
Description string `json:"description"`
Weight float64 `json:"weight"`
}

View File

@ -0,0 +1,8 @@
package domain
// Client представляет клиента, оформляющего перевозку
type Client struct {
ID int64 `json:"id"`
Name string `json:"name"`
IsRegular bool `json:"is_regular"`
}

View File

@ -0,0 +1,8 @@
package domain
// Route представляет маршрут перевозки
type Route struct {
ID int64 `json:"id"`
Name string `json:"name"`
Price float64 `json:"price"`
}

View File

@ -1,36 +0,0 @@
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
}

View File

@ -0,0 +1,11 @@
package domain
// Shipment представляет перевозку груза по маршруту
type Shipment struct {
ID int64 `json:"id"`
Route string `json:"route"`
Transport string `json:"transport"`
Cargo string `json:"cargo"`
Client string `json:"client"`
Cost float64 `json:"cost"`
}

View File

@ -0,0 +1,15 @@
package main
// Transport представляет конкретное транспортное средство
type Transport struct {
ID int64 `json:"id"`
Model string `json:"model"`
Capacity int `json:"capacity"`
Type string `json:"type"`
}
// TransportType представляет тип транспорта (автомобильный, морской и т. д.)
type TransportType struct {
ID int64 `json:"id"`
Name string `json:"name"`
}