102 lines
4.0 KiB
Go
102 lines
4.0 KiB
Go
package schemas
|
|
|
|
type CreateCategoryRequest struct {
|
|
Name string `json:"name" binding:"required"`
|
|
Description string `json:"description"`
|
|
ParentID *uint `json:"parent_id"`
|
|
PurchaseGroupID *uint `json:"purchase_group_id"`
|
|
MinAmount *float64 `json:"min_amount"`
|
|
MaxAmount *float64 `json:"max_amount"`
|
|
MinQuantity *int `json:"min_quantity"`
|
|
MaxQuantity *int `json:"max_quantity"`
|
|
MinWeight *float64 `json:"min_weight"`
|
|
MaxWeight *float64 `json:"max_weight"`
|
|
SortOrder int `json:"sort_order"`
|
|
}
|
|
|
|
type UpdateCategoryRequest struct {
|
|
Name *string `json:"name"`
|
|
Description *string `json:"description"`
|
|
ParentID *uint `json:"parent_id"`
|
|
PurchaseGroupID *uint `json:"purchase_group_id"`
|
|
MinAmount *float64 `json:"min_amount"`
|
|
MaxAmount *float64 `json:"max_amount"`
|
|
MinQuantity *int `json:"min_quantity"`
|
|
MaxQuantity *int `json:"max_quantity"`
|
|
MinWeight *float64 `json:"min_weight"`
|
|
MaxWeight *float64 `json:"max_weight"`
|
|
SortOrder *int `json:"sort_order"`
|
|
}
|
|
|
|
type CreatePurchaseGroupRequest struct {
|
|
Name string `json:"name" binding:"required"`
|
|
Description string `json:"description"`
|
|
SortOrder int `json:"sort_order"`
|
|
}
|
|
|
|
type UpdatePurchaseGroupRequest struct {
|
|
Name *string `json:"name"`
|
|
Description *string `json:"description"`
|
|
SortOrder *int `json:"sort_order"`
|
|
}
|
|
|
|
type CreateProductRequest struct {
|
|
Name string `json:"name" binding:"required"`
|
|
Description string `json:"description"`
|
|
Price float64 `json:"price" binding:"gte=0"`
|
|
Weight float64 `json:"weight"`
|
|
MinPurchase int `json:"min_purchase"`
|
|
MaxPurchase *int `json:"max_purchase"`
|
|
MinWeight *float64 `json:"min_weight"`
|
|
MaxWeight *float64 `json:"max_weight"`
|
|
MinAmount *float64 `json:"min_amount"`
|
|
MaxAmount *float64 `json:"max_amount"`
|
|
RequireCredit bool `json:"require_credit"`
|
|
CreditCost int `json:"credit_cost"`
|
|
CreditReward int `json:"credit_reward"`
|
|
Images string `json:"images"`
|
|
BrandID *uint `json:"brand_id"`
|
|
CategoryIDs []uint `json:"category_ids"`
|
|
CustomFields []CustomFieldRequest `json:"custom_fields"`
|
|
}
|
|
|
|
type UpdateProductRequest struct {
|
|
Name *string `json:"name"`
|
|
Description *string `json:"description"`
|
|
Price *float64 `json:"price"`
|
|
Weight *float64 `json:"weight"`
|
|
MinPurchase *int `json:"min_purchase"`
|
|
MaxPurchase *int `json:"max_purchase"`
|
|
MinWeight *float64 `json:"min_weight"`
|
|
MaxWeight *float64 `json:"max_weight"`
|
|
MinAmount *float64 `json:"min_amount"`
|
|
MaxAmount *float64 `json:"max_amount"`
|
|
RequireCredit *bool `json:"require_credit"`
|
|
CreditCost *int `json:"credit_cost"`
|
|
CreditReward *int `json:"credit_reward"`
|
|
Images *string `json:"images"`
|
|
IsActive *bool `json:"is_active"`
|
|
BrandID *uint `json:"brand_id"`
|
|
CategoryIDs []uint `json:"category_ids"`
|
|
CustomFields []CustomFieldRequest `json:"custom_fields"`
|
|
}
|
|
|
|
type CustomFieldRequest struct {
|
|
FieldName string `json:"field_name" binding:"required"`
|
|
FieldValue string `json:"field_value"`
|
|
}
|
|
|
|
type PaginationRequest struct {
|
|
Page int `form:"page,default=1"`
|
|
PageSize int `form:"page_size,default=20"`
|
|
}
|
|
|
|
type ProductListRequest struct {
|
|
PaginationRequest
|
|
CategoryID *uint `form:"category_id"`
|
|
BrandID *uint `form:"brand_id"`
|
|
Keyword string `form:"keyword"`
|
|
MinPrice *float64 `form:"min_price"`
|
|
MaxPrice *float64 `form:"max_price"`
|
|
}
|