FEAT[BE] :add marketing type field to delivery and sales order DTOs, enhance validation and service logic for consistent marketing type handling

This commit is contained in:
aguhh18
2026-02-04 14:47:56 +07:00
parent 357b5709f5
commit 1d95976360
4 changed files with 53 additions and 25 deletions
@@ -5,11 +5,11 @@ type Create struct {
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"`
MarketingType string `json:"marketing_type" validate:"required,min=1,max=50"`
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"`
@@ -25,7 +25,6 @@ type Update struct {
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"`
MarketingType string `json:"marketing_type" validate:"omitempty,min=1,max=50"`
MarketingProducts []CreateMarketingProduct `json:"marketing_products" validate:"omitempty,min=1,dive"`
}