Files
lti-api/internal/modules/marketing/validations/salesorder.validation.go
T

36 lines
2.0 KiB
Go

package validation
type Create struct {
CustomerId uint `json:"customer_id" validate:"required,gt=0"`
SalesPersonId uint `json:"sales_person_id" validate:"required,gt=0"`
Date string `json:"date" validate:"required,datetime=2006-01-02"`
Notes string `json:"notes" validate:"omitempty,max=500"`
MarketingProducts []CreateMarketingProduct `json:"marketing_products" validate:"required,min=1,dive"`
}
type CreateMarketingProduct struct {
MarketingType string `json:"marketing_type" validate:"required,min=1,max=50"`
VehicleNumber string `json:"vehicle_number" validate:"required,min=1,max=50"`
ConvertionUnit *string `json:"convertion_unit" validate:"omitempty,min=1,max=20"`
WeightPerConvertion *float64 `json:"weight_per_convertion" validate:"omitempty,gt=0"`
Week *int `json:"week" validate:"omitempty,gt=0"`
ProductWarehouseId uint `json:"product_warehouse_id" validate:"required,gt=0"`
UnitPrice float64 `json:"unit_price" validate:"required,gt=0"`
Qty float64 `json:"qty" validate:"required,gt=0"`
AvgWeight float64 `json:"avg_weight" validate:"omitempty,gt=0"`
}
type Update struct {
CustomerId uint `json:"customer_id" validate:"omitempty,gt=0"`
SalesPersonId uint `json:"sales_person_id" validate:"omitempty,gt=0"`
Date string `json:"date" validate:"omitempty,datetime=2006-01-02"`
Notes string `json:"notes" validate:"omitempty,max=500"`
MarketingProducts []CreateMarketingProduct `json:"marketing_products" validate:"omitempty,min=1,dive"`
}
type Approve struct {
Action string `json:"action" validate:"required_strict"`
ApprovableIds []uint `json:"approvable_ids" validate:"required_strict,min=1,dive,gt=0"`
Notes *string `json:"notes,omitempty" validate:"omitempty,max=500"`
}