Refactor[BE]: : delete sales orders and delivery order folder and refactor to just one root marketing folder

This commit is contained in:
aguhh18
2025-12-09 19:24:17 +07:00
parent 511e5501bb
commit d7c543bc9d
20 changed files with 97 additions and 192 deletions
@@ -0,0 +1,33 @@
package validation
type DeliveryProduct struct {
MarketingProductId uint `json:"marketing_product_id" validate:"required,gt=0"`
Qty float64 `json:"qty" validate:"omitempty,gte=0"`
UnitPrice float64 `json:"unit_price" validate:"omitempty,gte=0"`
AvgWeight float64 `json:"avg_weight" validate:"omitempty,gte=0"`
TotalWeight float64 `json:"total_weight" validate:"omitempty,gte=0"`
TotalPrice float64 `json:"total_price" validate:"omitempty,gte=0"`
DeliveryDate string `json:"delivery_date" validate:"omitempty,datetime=2006-01-02"`
VehicleNumber string `json:"vehicle_number" validate:"omitempty,max=50"`
}
type DeliveryOrderCreate struct {
MarketingId uint `json:"marketing_id" validate:"required,gt=0"`
DeliveryProducts []DeliveryProduct `json:"delivery_products" validate:"required,min=1,dive"`
}
type DeliveryOrderUpdate struct {
DeliveryProducts []DeliveryProduct `json:"delivery_products" validate:"omitempty,min=1,dive"`
}
type DeliveryOrderQuery struct {
Page int `query:"page" validate:"omitempty,number,min=1,gt=0"`
Limit int `query:"limit" validate:"omitempty,number,min=1,max=100,gt=0"`
MarketingId uint `query:"marketing_id" validate:"omitempty,gt=0"`
}
type DeliveryOrderApprove 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"`
}
@@ -0,0 +1,33 @@
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 {
VehicleNumber string `json:"vehicle_number" validate:"required,min=1,max=50"`
ProductWarehouseId uint `json:"product_warehouse_id" validate:"required,gt=0"`
UnitPrice float64 `json:"unit_price" validate:"required,gt=0"`
TotalWeight float64 `json:"total_weight" validate:"required,gt=0"`
Qty float64 `json:"qty" validate:"required,gt=0"`
AvgWeight float64 `json:"avg_weight" validate:"required,gt=0"`
TotalPrice float64 `json:"total_price" validate:"required,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"`
}