daShangDao_psiServer/models/response/car.go
2026-06-15 13:47:39 +08:00

38 lines
1.0 KiB
Go

package response
import "psi/models"
type CarShopInfo struct {
ShopID string `json:"id"`
ShopName string `json:"shop_name"`
ShopType int8 `json:"shop_type"`
ShopTypeText string `json:"shop_type_text"`
}
type CarResponse struct {
ID int64 `json:"id"`
WarehouseID int64 `json:"warehouse_id"`
PushType int8 `json:"push_type"`
Code int64 `json:"code"`
Name string `json:"name"`
Capacity int64 `json:"capacity"`
Appearance int64 `json:"appearance"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
Shops []CarShopInfo `json:"shops"`
}
func ConvertCarToResponse(car models.Car) CarResponse {
return CarResponse{
ID: car.ID,
WarehouseID: car.WarehouseID,
PushType: car.PushType,
Code: car.Code,
Name: car.Name,
Capacity: car.Capacity,
Appearance: car.Appearance,
CreatedAt: car.CreatedAt,
UpdatedAt: car.UpdatedAt,
Shops: []CarShopInfo{},
}
}