39 lines
1.3 KiB
Go
39 lines
1.3 KiB
Go
package models
|
|
|
|
import (
|
|
"time"
|
|
|
|
"github.com/google/uuid"
|
|
)
|
|
|
|
type UpdateIngredientCompositionRequest struct {
|
|
OutletID *uuid.UUID `json:"outlet_id"`
|
|
Quantity float64 `json:"quantity" validate:"required,gt=0"`
|
|
}
|
|
|
|
type IngredientCompositionResponse struct {
|
|
ID uuid.UUID `json:"id"`
|
|
OutletID *uuid.UUID `json:"outlet_id"`
|
|
ChildIngredientID uuid.UUID `json:"child_ingredient_id"`
|
|
Quantity float64 `json:"quantity"`
|
|
CreatedAt time.Time `json:"created_at"`
|
|
UpdatedAt time.Time `json:"updated_at"`
|
|
ChildIngredient *IngredientResponse `json:"child_ingredient,omitempty"`
|
|
ParentIngredient *IngredientResponse `json:"parent_ingredient,omitempty"`
|
|
}
|
|
|
|
type CompositionItem struct {
|
|
ChildIngredientID uuid.UUID `json:"child_ingredient_id" validate:"required"`
|
|
Quantity float64 `json:"quantity" validate:"required,gt=0"`
|
|
OutletID *uuid.UUID `json:"outlet_id"`
|
|
}
|
|
|
|
type AddIngredientCompositionsRequest struct {
|
|
Compositions []CompositionItem `json:"compositions" validate:"required,min=1,dive"`
|
|
}
|
|
|
|
type AddIngredientCompositionsResponse struct {
|
|
ParentIngredient *IngredientResponse `json:"parent_ingredient"`
|
|
Compositions []*IngredientCompositionResponse `json:"compositions"`
|
|
}
|