apskel-pos-backend/internal/models/ingredient_composition.go

50 lines
1.7 KiB
Go
Raw Normal View History

2025-08-03 23:55:51 +07:00
package models
import (
"time"
"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"`
// Relations
ParentIngredient *Ingredient `json:"parent_ingredient,omitempty"`
ChildIngredient *Ingredient `json:"child_ingredient,omitempty"`
}