ingredient composition
This commit is contained in:
@@ -6,44 +6,33 @@ import (
|
||||
"github.com/google/uuid"
|
||||
)
|
||||
|
||||
type IngredientComposition struct {
|
||||
ID uuid.UUID `json:"id"`
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
OutletID *uuid.UUID `json:"outlet_id"`
|
||||
ParentIngredientID uuid.UUID `json:"parent_ingredient_id"`
|
||||
ChildIngredientID uuid.UUID `json:"child_ingredient_id"`
|
||||
Quantity float64 `json:"quantity"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
|
||||
// Relations
|
||||
ParentIngredient *Ingredient `json:"parent_ingredient,omitempty"`
|
||||
ChildIngredient *Ingredient `json:"child_ingredient,omitempty"`
|
||||
}
|
||||
|
||||
type CreateIngredientCompositionRequest struct {
|
||||
OutletID *uuid.UUID `json:"outlet_id"`
|
||||
ParentIngredientID uuid.UUID `json:"parent_ingredient_id" validate:"required"`
|
||||
ChildIngredientID uuid.UUID `json:"child_ingredient_id" validate:"required"`
|
||||
Quantity float64 `json:"quantity" validate:"required,gt=0"`
|
||||
}
|
||||
|
||||
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"`
|
||||
OrganizationID uuid.UUID `json:"organization_id"`
|
||||
OutletID *uuid.UUID `json:"outlet_id"`
|
||||
ParentIngredientID uuid.UUID `json:"parent_ingredient_id"`
|
||||
ChildIngredientID uuid.UUID `json:"child_ingredient_id"`
|
||||
Quantity float64 `json:"quantity"`
|
||||
CreatedAt time.Time `json:"created_at"`
|
||||
UpdatedAt time.Time `json:"updated_at"`
|
||||
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"`
|
||||
}
|
||||
|
||||
// Relations
|
||||
ParentIngredient *Ingredient `json:"parent_ingredient,omitempty"`
|
||||
ChildIngredient *Ingredient `json:"child_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"`
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user