mirror of
https://gitlab.com/mbugroup/lti-api.git
synced 2026-05-20 13:31:56 +00:00
28 lines
1.1 KiB
Go
28 lines
1.1 KiB
Go
package validation
|
|
|
|
type SupplierPrice struct {
|
|
SupplierID uint `json:"supplier_id" validate:"required,gt=0"`
|
|
Price float64 `json:"price" validate:"required,gte=0"`
|
|
}
|
|
|
|
type Create struct {
|
|
Name string `json:"name" validate:"required_strict,min=3,max=50"`
|
|
UomID uint `json:"uom_id" validate:"required,gt=0"`
|
|
Suppliers []SupplierPrice `json:"suppliers,omitempty" validate:"omitempty,dive"`
|
|
Flags []string `json:"flags" validate:"dive,max=50"`
|
|
}
|
|
|
|
type Update struct {
|
|
Name *string `json:"name,omitempty" validate:"omitempty,min=3,max=50"`
|
|
UomID *uint `json:"uom_id,omitempty" validate:"omitempty,gt=0"`
|
|
Suppliers *[]SupplierPrice `json:"suppliers,omitempty" validate:"omitempty,dive"`
|
|
Flags *[]string `json:"flags,omitempty" validate:"omitempty,dive,max=50"`
|
|
}
|
|
|
|
type Query struct {
|
|
Page int `query:"page" validate:"omitempty,number,min=1"`
|
|
Limit int `query:"limit" validate:"omitempty,number,min=1,max=100"`
|
|
Search string `query:"search" validate:"omitempty,max=50"`
|
|
SupplierID uint `query:"supplier_id" validate:"omitempty,gt=0"`
|
|
}
|