feat: add product trace APIs
This commit is contained in:
@@ -50,6 +50,26 @@ type Serial struct {
|
||||
Company *Company `gorm:"foreignKey:CompanyName;references:CompanyName" json:"company,omitempty"`
|
||||
}
|
||||
|
||||
// ProductTrace 产品溯源模型
|
||||
type ProductTrace struct {
|
||||
ID uint `gorm:"primaryKey" json:"id"`
|
||||
CompanyName string `gorm:"index;size:255" json:"companyName"`
|
||||
CompanyAddress string `gorm:"size:500" json:"companyAddress"`
|
||||
CompanyPhone string `gorm:"size:32" json:"companyPhone"`
|
||||
DeviceInfo string `gorm:"type:text" json:"deviceInfo"`
|
||||
WarrantyPeriod string `gorm:"size:100" json:"warrantyPeriod"`
|
||||
ManufactureDate time.Time `json:"manufactureDate"`
|
||||
SerialNumber string `gorm:"uniqueIndex;size:255" json:"serialNumber"`
|
||||
OfficialWebsite string `gorm:"size:500" json:"officialWebsite,omitempty"`
|
||||
WechatQRCode string `gorm:"type:text" json:"wechatQrCode,omitempty"`
|
||||
IsActive bool `gorm:"default:true" json:"isActive"`
|
||||
CreatedBy *uint `json:"createdBy"`
|
||||
CreatedAt time.Time `json:"createdAt"`
|
||||
UpdatedAt time.Time `json:"updatedAt"`
|
||||
DeletedAt gorm.DeletedAt `gorm:"index" json:"-"`
|
||||
Creator *User `gorm:"foreignKey:CreatedBy" json:"creator,omitempty"`
|
||||
}
|
||||
|
||||
// UserDTO 数据传输对象
|
||||
type UserDTO struct {
|
||||
ID uint `json:"id"`
|
||||
@@ -131,6 +151,32 @@ type UpdateSerialDTO struct {
|
||||
IsActive *bool `json:"isActive,omitempty"`
|
||||
}
|
||||
|
||||
// CreateProductTraceDTO 创建产品溯源请求数据
|
||||
type CreateProductTraceDTO struct {
|
||||
CompanyName string `json:"companyName" validate:"required"`
|
||||
CompanyAddress string `json:"companyAddress" validate:"required"`
|
||||
CompanyPhone string `json:"companyPhone" validate:"required"`
|
||||
DeviceInfo string `json:"deviceInfo" validate:"required"`
|
||||
WarrantyPeriod string `json:"warrantyPeriod" validate:"required"`
|
||||
ManufactureDate time.Time `json:"manufactureDate" validate:"required"`
|
||||
SerialNumber string `json:"serialNumber" validate:"required"`
|
||||
OfficialWebsite string `json:"officialWebsite,omitempty" validate:"omitempty,url"`
|
||||
WechatQRCode string `json:"wechatQrCode,omitempty"`
|
||||
}
|
||||
|
||||
// UpdateProductTraceDTO 更新产品溯源请求数据
|
||||
type UpdateProductTraceDTO struct {
|
||||
CompanyName string `json:"companyName,omitempty"`
|
||||
CompanyAddress string `json:"companyAddress,omitempty"`
|
||||
CompanyPhone string `json:"companyPhone,omitempty"`
|
||||
DeviceInfo string `json:"deviceInfo,omitempty"`
|
||||
WarrantyPeriod string `json:"warrantyPeriod,omitempty"`
|
||||
ManufactureDate *time.Time `json:"manufactureDate,omitempty"`
|
||||
OfficialWebsite string `json:"officialWebsite,omitempty" validate:"omitempty,url"`
|
||||
WechatQRCode string `json:"wechatQrCode,omitempty"`
|
||||
IsActive *bool `json:"isActive,omitempty"`
|
||||
}
|
||||
|
||||
// QRCodeDTO 二维码生成请求数据
|
||||
type QRCodeDTO struct {
|
||||
BaseUrl string `json:"baseUrl,omitempty"`
|
||||
|
||||
Reference in New Issue
Block a user