Files
cmroubao/backend-api/internal/domain/freight.go
T

155 lines
3.9 KiB
Go

package domain
import "time"
const (
FreightSourceShunyunbao = "SHUNYUNBAO"
FreightSyncOrderNumber = "ORDER_NUMBER"
FreightSyncCreatedRange = "CREATED_RANGE"
)
type FreightSyncStatus string
const (
FreightSyncPending FreightSyncStatus = "PENDING"
FreightSyncRunning FreightSyncStatus = "RUNNING"
FreightSyncSucceeded FreightSyncStatus = "SUCCEEDED"
FreightSyncFailed FreightSyncStatus = "FAILED"
)
type FreightSyncRun struct {
ID string
CreatorSubject string
CreatedByUserID string
Mode string
OrderNumber string
CreatedFrom string
CreatedTo string
WatermarkThrough *time.Time
QuerySHA256 string
Status FreightSyncStatus
ErrorCode *string
OrderCount int
ItemCount int
CreatedAt time.Time
StartedAt *time.Time
FinishedAt *time.Time
}
type FreightOrder struct {
ID string
CreatorSubject string
SourceSystem string
ExternalStockID string
SourceCode string
PlatformOrderNo *string
ShopName *string
SourceCreatedAt *time.Time
OrderStatus *string
PurchaseStatus *string
IsCanceled *bool
CanonicalSHA256 string
Revision int
FirstSyncRunID string
LastSyncRunID string
CreatedAt time.Time
UpdatedAt time.Time
ItemCount int
}
type FreightOrderItem struct {
ID string
FreightOrderID string
ExternalItemID string
Title string
ProductSpec string
SKU string
Quantity *int
ProductThumbRef *string
PurchaseStatus *string
CanonicalSHA256 string
Revision int
IsPresent bool
FirstSyncRunID string
LastSyncRunID string
CreatedAt time.Time
UpdatedAt time.Time
}
type FreightOrderDetail struct {
Order FreightOrder
Items []FreightOrderItem
}
type FreightSourceBatch struct {
SchemaVersion int `json:"schema_version"`
Query FreightSourceQuery `json:"query"`
Orders []FreightSourceOrder `json:"orders"`
}
type FreightSourceQuery struct {
Mode string `json:"mode"`
CreatedFrom *string `json:"created_from"`
CreatedTo *string `json:"created_to"`
}
type FreightSyncWatermark struct {
CreatorSubject string
SourceSystem string
LastSuccessfulTo time.Time
LastSuccessfulRunID string
UpdatedAt time.Time
}
type FreightSourceOrder struct {
ExternalStockID string `json:"external_stock_id"`
SourceCode string `json:"source_code"`
PlatformOrderNo *string `json:"platform_order_no"`
ShopName *string `json:"shop_name"`
SourceCreatedAt *string `json:"source_created_at"`
OrderStatus *string `json:"order_status"`
PurchaseStatus *string `json:"purchase_status"`
IsCanceled *bool `json:"is_canceled"`
Items []FreightSourceItem `json:"items"`
}
type FreightSourceItem struct {
ExternalItemID string `json:"external_item_id"`
Title string `json:"title"`
ProductSpec string `json:"product_spec"`
SKU string `json:"sku"`
Quantity *int `json:"quantity"`
ProductThumbRef *string `json:"product_thumb_ref"`
PurchaseStatus *string `json:"purchase_status"`
}
type FreightImportBatch struct {
Orders []FreightImportOrder
}
type FreightImportOrder struct {
ID string
ExternalStockID string
SourceCode string
PlatformOrderNo *string
ShopName *string
SourceCreatedAt *time.Time
OrderStatus *string
PurchaseStatus *string
IsCanceled *bool
CanonicalSHA256 string
Items []FreightImportItem
}
type FreightImportItem struct {
ID string
ExternalItemID string
Title string
ProductSpec string
SKU string
Quantity *int
ProductThumbRef *string
PurchaseStatus *string
CanonicalSHA256 string
}