Fix formatting

This commit is contained in:
ryan 2026-06-08 12:30:39 +07:00
parent 69d8c8ce5e
commit 29aeb58fc0
25 changed files with 149 additions and 156 deletions

View File

@ -5,12 +5,12 @@ import (
) )
type CreateAccountRequest struct { type CreateAccountRequest struct {
ChartOfAccountID uuid.UUID `json:"chart_of_account_id" validate:"required"` ChartOfAccountID uuid.UUID `json:"chart_of_account_id" validate:"required"`
Name string `json:"name" validate:"required,min=1,max=255"` Name string `json:"name" validate:"required,min=1,max=255"`
Number string `json:"number" validate:"required,min=1,max=50"` Number string `json:"number" validate:"required,min=1,max=50"`
AccountType string `json:"account_type" validate:"required,oneof=cash wallet bank credit debit asset liability equity revenue expense"` AccountType string `json:"account_type" validate:"required,oneof=cash wallet bank credit debit asset liability equity revenue expense"`
OpeningBalance float64 `json:"opening_balance"` OpeningBalance float64 `json:"opening_balance"`
Description *string `json:"description"` Description *string `json:"description"`
} }
type UpdateAccountRequest struct { type UpdateAccountRequest struct {
@ -24,21 +24,21 @@ type UpdateAccountRequest struct {
} }
type AccountResponse struct { type AccountResponse struct {
ID uuid.UUID `json:"id"` ID uuid.UUID `json:"id"`
OrganizationID uuid.UUID `json:"organization_id"` OrganizationID uuid.UUID `json:"organization_id"`
OutletID *uuid.UUID `json:"outlet_id"` OutletID *uuid.UUID `json:"outlet_id"`
ChartOfAccountID uuid.UUID `json:"chart_of_account_id"` ChartOfAccountID uuid.UUID `json:"chart_of_account_id"`
Name string `json:"name"` Name string `json:"name"`
Number string `json:"number"` Number string `json:"number"`
AccountType string `json:"account_type"` AccountType string `json:"account_type"`
OpeningBalance float64 `json:"opening_balance"` OpeningBalance float64 `json:"opening_balance"`
CurrentBalance float64 `json:"current_balance"` CurrentBalance float64 `json:"current_balance"`
Description *string `json:"description"` Description *string `json:"description"`
IsActive bool `json:"is_active"` IsActive bool `json:"is_active"`
IsSystem bool `json:"is_system"` IsSystem bool `json:"is_system"`
CreatedAt string `json:"created_at"` CreatedAt string `json:"created_at"`
UpdatedAt string `json:"updated_at"` UpdatedAt string `json:"updated_at"`
ChartOfAccount *ChartOfAccountResponse `json:"chart_of_account,omitempty"` ChartOfAccount *ChartOfAccountResponse `json:"chart_of_account,omitempty"`
} }
type ListAccountsRequest struct { type ListAccountsRequest struct {

View File

@ -81,4 +81,3 @@ type IngredientUnitsResponse struct {
BaseUnitName string `json:"base_unit_name"` BaseUnitName string `json:"base_unit_name"`
Units []*UnitResponse `json:"units"` Units []*UnitResponse `json:"units"`
} }

View File

@ -26,9 +26,9 @@ type AdjustInventoryRequest struct {
} }
type RestockInventoryRequest struct { type RestockInventoryRequest struct {
OutletID uuid.UUID `json:"outlet_id" validate:"required"` OutletID uuid.UUID `json:"outlet_id" validate:"required"`
Items []RestockItem `json:"items" validate:"required,min=1,dive"` Items []RestockItem `json:"items" validate:"required,min=1,dive"`
Reason string `json:"reason" validate:"required,min=1,max=255"` Reason string `json:"reason" validate:"required,min=1,max=255"`
} }
type RestockItem struct { type RestockItem struct {
@ -82,10 +82,10 @@ type InventoryAdjustmentResponse struct {
} }
type RestockInventoryResponse struct { type RestockInventoryResponse struct {
OutletID uuid.UUID `json:"outlet_id"` OutletID uuid.UUID `json:"outlet_id"`
Items []RestockItemResult `json:"items"` Items []RestockItemResult `json:"items"`
Reason string `json:"reason"` Reason string `json:"reason"`
RestockedAt time.Time `json:"restocked_at"` RestockedAt time.Time `json:"restocked_at"`
} }
type RestockItemResult struct { type RestockItemResult struct {

View File

@ -34,34 +34,34 @@ type BulkCreateProductRecipeRequest struct {
// Response structures // Response structures
type ProductRecipeResponse struct { type ProductRecipeResponse struct {
ID uuid.UUID `json:"id"` ID uuid.UUID `json:"id"`
OrganizationID uuid.UUID `json:"organization_id"` OrganizationID uuid.UUID `json:"organization_id"`
OutletID *uuid.UUID `json:"outlet_id"` OutletID *uuid.UUID `json:"outlet_id"`
ProductID uuid.UUID `json:"product_id"` ProductID uuid.UUID `json:"product_id"`
VariantID *uuid.UUID `json:"variant_id"` VariantID *uuid.UUID `json:"variant_id"`
IngredientID uuid.UUID `json:"ingredient_id"` IngredientID uuid.UUID `json:"ingredient_id"`
Quantity float64 `json:"quantity"` Quantity float64 `json:"quantity"`
WastePercentage float64 `json:"waste_percentage"` WastePercentage float64 `json:"waste_percentage"`
CreatedAt time.Time `json:"created_at"` CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"` UpdatedAt time.Time `json:"updated_at"`
Product *ProductResponse `json:"product,omitempty"` Product *ProductResponse `json:"product,omitempty"`
ProductVariant *ProductVariantResponse `json:"product_variant,omitempty"` ProductVariant *ProductVariantResponse `json:"product_variant,omitempty"`
Ingredient *ProductRecipeIngredientResponse `json:"ingredient,omitempty"` Ingredient *ProductRecipeIngredientResponse `json:"ingredient,omitempty"`
} }
type ProductRecipeIngredientResponse struct { type ProductRecipeIngredientResponse struct {
ID uuid.UUID `json:"id"` ID uuid.UUID `json:"id"`
OrganizationID uuid.UUID `json:"organization_id"` OrganizationID uuid.UUID `json:"organization_id"`
OutletID *uuid.UUID `json:"outlet_id"` OutletID *uuid.UUID `json:"outlet_id"`
Name string `json:"name"` Name string `json:"name"`
UnitID uuid.UUID `json:"unit_id"` UnitID uuid.UUID `json:"unit_id"`
Cost float64 `json:"cost"` Cost float64 `json:"cost"`
Stock float64 `json:"stock"` Stock float64 `json:"stock"`
IsSemiFinished bool `json:"is_semi_finished"` IsSemiFinished bool `json:"is_semi_finished"`
IsActive bool `json:"is_active"` IsActive bool `json:"is_active"`
Metadata map[string]interface{} `json:"metadata"` Metadata map[string]interface{} `json:"metadata"`
CreatedAt time.Time `json:"created_at"` CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"` UpdatedAt time.Time `json:"updated_at"`
Unit *ProductRecipeUnitResponse `json:"unit,omitempty"` Unit *ProductRecipeUnitResponse `json:"unit,omitempty"`
} }
@ -71,4 +71,4 @@ type ProductRecipeUnitResponse struct {
Symbol string `json:"symbol"` Symbol string `json:"symbol"`
CreatedAt time.Time `json:"created_at"` CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"` UpdatedAt time.Time `json:"updated_at"`
} }

View File

@ -39,4 +39,3 @@ func (iuc *IngredientUnitConverter) BeforeCreate() error {
} }
return nil return nil
} }

View File

@ -26,14 +26,14 @@ type OrderIngredientTransaction struct {
UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"` UpdatedAt time.Time `gorm:"autoUpdateTime" json:"updated_at"`
// Relations // Relations
Organization Organization `gorm:"foreignKey:OrganizationID" json:"organization,omitempty"` Organization Organization `gorm:"foreignKey:OrganizationID" json:"organization,omitempty"`
Outlet *Outlet `gorm:"foreignKey:OutletID" json:"outlet,omitempty"` Outlet *Outlet `gorm:"foreignKey:OutletID" json:"outlet,omitempty"`
Order Order `gorm:"foreignKey:OrderID" json:"order,omitempty"` Order Order `gorm:"foreignKey:OrderID" json:"order,omitempty"`
OrderItem *OrderItem `gorm:"foreignKey:OrderItemID" json:"order_item,omitempty"` OrderItem *OrderItem `gorm:"foreignKey:OrderItemID" json:"order_item,omitempty"`
Product Product `gorm:"foreignKey:ProductID" json:"product,omitempty"` Product Product `gorm:"foreignKey:ProductID" json:"product,omitempty"`
ProductVariant *ProductVariant `gorm:"foreignKey:ProductVariantID" json:"product_variant,omitempty"` ProductVariant *ProductVariant `gorm:"foreignKey:ProductVariantID" json:"product_variant,omitempty"`
Ingredient Ingredient `gorm:"foreignKey:IngredientID" json:"ingredient,omitempty"` Ingredient Ingredient `gorm:"foreignKey:IngredientID" json:"ingredient,omitempty"`
CreatedByUser User `gorm:"foreignKey:CreatedBy" json:"created_by_user,omitempty"` CreatedByUser User `gorm:"foreignKey:CreatedBy" json:"created_by_user,omitempty"`
} }
func (oit *OrderIngredientTransaction) BeforeCreate(tx *gorm.DB) error { func (oit *OrderIngredientTransaction) BeforeCreate(tx *gorm.DB) error {

View File

@ -7,15 +7,15 @@ import (
) )
type ProductIngredient struct { type ProductIngredient struct {
ID uuid.UUID `json:"id" db:"id"` ID uuid.UUID `json:"id" db:"id"`
OrganizationID uuid.UUID `json:"organization_id" db:"organization_id"` OrganizationID uuid.UUID `json:"organization_id" db:"organization_id"`
OutletID *uuid.UUID `json:"outlet_id" db:"outlet_id"` OutletID *uuid.UUID `json:"outlet_id" db:"outlet_id"`
ProductID uuid.UUID `json:"product_id" db:"product_id"` ProductID uuid.UUID `json:"product_id" db:"product_id"`
IngredientID uuid.UUID `json:"ingredient_id" db:"ingredient_id"` IngredientID uuid.UUID `json:"ingredient_id" db:"ingredient_id"`
Quantity float64 `json:"quantity" db:"quantity"` Quantity float64 `json:"quantity" db:"quantity"`
WastePercentage float64 `json:"waste_percentage" db:"waste_percentage"` WastePercentage float64 `json:"waste_percentage" db:"waste_percentage"`
CreatedAt time.Time `json:"created_at" db:"created_at"` CreatedAt time.Time `json:"created_at" db:"created_at"`
UpdatedAt time.Time `json:"updated_at" db:"updated_at"` UpdatedAt time.Time `json:"updated_at" db:"updated_at"`
// Relations // Relations
Product *Product `json:"product,omitempty"` Product *Product `json:"product,omitempty"`

View File

@ -34,4 +34,4 @@ func (pr *ProductRecipe) BeforeCreate(tx *gorm.DB) error {
func (ProductRecipe) TableName() string { func (ProductRecipe) TableName() string {
return "product_recipes" return "product_recipes"
} }

View File

@ -99,7 +99,7 @@ func (h *ChartOfAccountTypeHandler) DeleteChartOfAccountType(c *gin.Context) {
func (h *ChartOfAccountTypeHandler) ListChartOfAccountTypes(c *gin.Context) { func (h *ChartOfAccountTypeHandler) ListChartOfAccountTypes(c *gin.Context) {
// Parse query parameters // Parse query parameters
filters := make(map[string]interface{}) filters := make(map[string]interface{})
if isActive := c.Query("is_active"); isActive != "" { if isActive := c.Query("is_active"); isActive != "" {
if isActiveBool, err := strconv.ParseBool(isActive); err == nil { if isActiveBool, err := strconv.ParseBool(isActive); err == nil {
filters["is_active"] = isActiveBool filters["is_active"] = isActiveBool

View File

@ -275,4 +275,3 @@ func (h *IngredientUnitConverterHandler) GetUnitsByIngredientID(c *gin.Context)
util.HandleResponse(c.Writer, c.Request, unitsResponse, "IngredientUnitConverterHandler::GetUnitsByIngredientID") util.HandleResponse(c.Writer, c.Request, unitsResponse, "IngredientUnitConverterHandler::GetUnitsByIngredientID")
} }

View File

@ -219,4 +219,4 @@ func (h *ProductRecipeHandler) BulkCreate(c *gin.Context) {
} }
c.JSON(http.StatusCreated, contract.BuildSuccessResponse(recipes)) c.JSON(http.StatusCreated, contract.BuildSuccessResponse(recipes))
} }

View File

@ -11,17 +11,17 @@ func MapProductIngredientEntityToModel(entity *entities.ProductIngredient) *mode
} }
return &models.ProductIngredient{ return &models.ProductIngredient{
ID: entity.ID, ID: entity.ID,
OrganizationID: entity.OrganizationID, OrganizationID: entity.OrganizationID,
OutletID: entity.OutletID, OutletID: entity.OutletID,
ProductID: entity.ProductID, ProductID: entity.ProductID,
IngredientID: entity.IngredientID, IngredientID: entity.IngredientID,
Quantity: entity.Quantity, Quantity: entity.Quantity,
WastePercentage: entity.WastePercentage, WastePercentage: entity.WastePercentage,
CreatedAt: entity.CreatedAt, CreatedAt: entity.CreatedAt,
UpdatedAt: entity.UpdatedAt, UpdatedAt: entity.UpdatedAt,
Product: ProductEntityToModel(entity.Product), Product: ProductEntityToModel(entity.Product),
Ingredient: MapIngredientEntityToModel(entity.Ingredient), Ingredient: MapIngredientEntityToModel(entity.Ingredient),
} }
} }
@ -31,17 +31,17 @@ func MapProductIngredientModelToEntity(model *models.ProductIngredient) *entitie
} }
return &entities.ProductIngredient{ return &entities.ProductIngredient{
ID: model.ID, ID: model.ID,
OrganizationID: model.OrganizationID, OrganizationID: model.OrganizationID,
OutletID: model.OutletID, OutletID: model.OutletID,
ProductID: model.ProductID, ProductID: model.ProductID,
IngredientID: model.IngredientID, IngredientID: model.IngredientID,
Quantity: model.Quantity, Quantity: model.Quantity,
WastePercentage: model.WastePercentage, WastePercentage: model.WastePercentage,
CreatedAt: model.CreatedAt, CreatedAt: model.CreatedAt,
UpdatedAt: model.UpdatedAt, UpdatedAt: model.UpdatedAt,
Product: ProductModelToEntity(model.Product), Product: ProductModelToEntity(model.Product),
Ingredient: MapIngredientModelToEntity(model.Ingredient), Ingredient: MapIngredientModelToEntity(model.Ingredient),
} }
} }

View File

@ -25,12 +25,12 @@ type AccountResponse struct {
} }
type CreateAccountRequest struct { type CreateAccountRequest struct {
ChartOfAccountID uuid.UUID `json:"chart_of_account_id" validate:"required"` ChartOfAccountID uuid.UUID `json:"chart_of_account_id" validate:"required"`
Name string `json:"name" validate:"required,min=1,max=255"` Name string `json:"name" validate:"required,min=1,max=255"`
Number string `json:"number" validate:"required,min=1,max=50"` Number string `json:"number" validate:"required,min=1,max=50"`
AccountType string `json:"account_type" validate:"required,oneof=cash wallet bank credit debit asset liability equity revenue expense"` AccountType string `json:"account_type" validate:"required,oneof=cash wallet bank credit debit asset liability equity revenue expense"`
OpeningBalance float64 `json:"opening_balance"` OpeningBalance float64 `json:"opening_balance"`
Description *string `json:"description"` Description *string `json:"description"`
} }
type UpdateAccountRequest struct { type UpdateAccountRequest struct {

View File

@ -23,17 +23,17 @@ type UpdateCustomerRequest struct {
} }
type CustomerResponse struct { type CustomerResponse struct {
ID uuid.UUID `json:"id"` ID uuid.UUID `json:"id"`
OrganizationID uuid.UUID `json:"organization_id"` OrganizationID uuid.UUID `json:"organization_id"`
Name string `json:"name"` Name string `json:"name"`
Email *string `json:"email,omitempty"` Email *string `json:"email,omitempty"`
Phone *string `json:"phone,omitempty"` Phone *string `json:"phone,omitempty"`
Address *string `json:"address,omitempty"` Address *string `json:"address,omitempty"`
IsDefault bool `json:"is_default"` IsDefault bool `json:"is_default"`
IsActive bool `json:"is_active"` IsActive bool `json:"is_active"`
Metadata entities.Metadata `json:"metadata"` Metadata entities.Metadata `json:"metadata"`
CreatedAt time.Time `json:"created_at"` CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"` UpdatedAt time.Time `json:"updated_at"`
} }
// ListCustomersQuery represents query parameters for listing customers // ListCustomersQuery represents query parameters for listing customers

View File

@ -101,4 +101,3 @@ type IngredientUnitsResponse struct {
BaseUnitName string `json:"base_unit_name"` BaseUnitName string `json:"base_unit_name"`
Units []*UnitResponse `json:"units"` Units []*UnitResponse `json:"units"`
} }

View File

@ -52,8 +52,8 @@ type UpdateOrderIngredientTransactionRequest struct {
GrossQty *float64 `json:"gross_qty,omitempty" validate:"omitempty,gt=0"` GrossQty *float64 `json:"gross_qty,omitempty" validate:"omitempty,gt=0"`
NetQty *float64 `json:"net_qty,omitempty" validate:"omitempty,gt=0"` NetQty *float64 `json:"net_qty,omitempty" validate:"omitempty,gt=0"`
WasteQty *float64 `json:"waste_qty,omitempty" validate:"min=0"` WasteQty *float64 `json:"waste_qty,omitempty" validate:"min=0"`
Unit *string `json:"unit,omitempty" validate:"omitempty,max=50"` Unit *string `json:"unit,omitempty" validate:"omitempty,max=50"`
TransactionDate *time.Time `json:"transaction_date,omitempty"` TransactionDate *time.Time `json:"transaction_date,omitempty"`
} }
type OrderIngredientTransactionResponse struct { type OrderIngredientTransactionResponse struct {
@ -98,11 +98,11 @@ type ListOrderIngredientTransactionsRequest struct {
} }
type OrderIngredientTransactionSummary struct { type OrderIngredientTransactionSummary struct {
IngredientID uuid.UUID `json:"ingredient_id"` IngredientID uuid.UUID `json:"ingredient_id"`
IngredientName string `json:"ingredient_name"` IngredientName string `json:"ingredient_name"`
TotalGrossQty float64 `json:"total_gross_qty"` TotalGrossQty float64 `json:"total_gross_qty"`
TotalNetQty float64 `json:"total_net_qty"` TotalNetQty float64 `json:"total_net_qty"`
TotalWasteQty float64 `json:"total_waste_qty"` TotalWasteQty float64 `json:"total_waste_qty"`
WastePercentage float64 `json:"waste_percentage"` WastePercentage float64 `json:"waste_percentage"`
Unit string `json:"unit"` Unit string `json:"unit"`
} }

View File

@ -7,15 +7,15 @@ import (
) )
type ProductIngredient struct { type ProductIngredient struct {
ID uuid.UUID `json:"id"` ID uuid.UUID `json:"id"`
OrganizationID uuid.UUID `json:"organization_id"` OrganizationID uuid.UUID `json:"organization_id"`
OutletID *uuid.UUID `json:"outlet_id"` OutletID *uuid.UUID `json:"outlet_id"`
ProductID uuid.UUID `json:"product_id"` ProductID uuid.UUID `json:"product_id"`
IngredientID uuid.UUID `json:"ingredient_id"` IngredientID uuid.UUID `json:"ingredient_id"`
Quantity float64 `json:"quantity"` Quantity float64 `json:"quantity"`
WastePercentage float64 `json:"waste_percentage"` WastePercentage float64 `json:"waste_percentage"`
CreatedAt time.Time `json:"created_at"` CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"` UpdatedAt time.Time `json:"updated_at"`
// Relations // Relations
Product *Product `json:"product,omitempty"` Product *Product `json:"product,omitempty"`
@ -37,15 +37,15 @@ type UpdateProductIngredientRequest struct {
} }
type ProductIngredientResponse struct { type ProductIngredientResponse struct {
ID uuid.UUID `json:"id"` ID uuid.UUID `json:"id"`
OrganizationID uuid.UUID `json:"organization_id"` OrganizationID uuid.UUID `json:"organization_id"`
OutletID *uuid.UUID `json:"outlet_id"` OutletID *uuid.UUID `json:"outlet_id"`
ProductID uuid.UUID `json:"product_id"` ProductID uuid.UUID `json:"product_id"`
IngredientID uuid.UUID `json:"ingredient_id"` IngredientID uuid.UUID `json:"ingredient_id"`
Quantity float64 `json:"quantity"` Quantity float64 `json:"quantity"`
WastePercentage float64 `json:"waste_percentage"` WastePercentage float64 `json:"waste_percentage"`
CreatedAt time.Time `json:"created_at"` CreatedAt time.Time `json:"created_at"`
UpdatedAt time.Time `json:"updated_at"` UpdatedAt time.Time `json:"updated_at"`
// Relations // Relations
Product *Product `json:"product,omitempty"` Product *Product `json:"product,omitempty"`

View File

@ -56,4 +56,4 @@ type ProductRecipeResponse struct {
Product *Product `json:"product,omitempty"` Product *Product `json:"product,omitempty"`
ProductVariant *ProductVariant `json:"product_variant,omitempty"` ProductVariant *ProductVariant `json:"product_variant,omitempty"`
Ingredient *Ingredient `json:"ingredient,omitempty"` Ingredient *Ingredient `json:"ingredient,omitempty"`
} }

View File

@ -60,12 +60,12 @@ func (s *AccountServiceImpl) ListAccounts(ctx context.Context, req *contract.Lis
if err != nil { if err != nil {
return nil, 0, err return nil, 0, err
} }
contractResp := make([]contract.AccountResponse, len(modelResp)) contractResp := make([]contract.AccountResponse, len(modelResp))
for i, resp := range modelResp { for i, resp := range modelResp {
contractResp[i] = *mappers.ModelToContractAccountResponse(&resp) contractResp[i] = *mappers.ModelToContractAccountResponse(&resp)
} }
return contractResp, total, nil return contractResp, total, nil
} }
@ -74,12 +74,12 @@ func (s *AccountServiceImpl) GetAccountsByOrganization(ctx context.Context, orga
if err != nil { if err != nil {
return nil, err return nil, err
} }
contractResp := make([]contract.AccountResponse, len(modelResp)) contractResp := make([]contract.AccountResponse, len(modelResp))
for i, resp := range modelResp { for i, resp := range modelResp {
contractResp[i] = *mappers.ModelToContractAccountResponse(&resp) contractResp[i] = *mappers.ModelToContractAccountResponse(&resp)
} }
return contractResp, nil return contractResp, nil
} }
@ -88,12 +88,12 @@ func (s *AccountServiceImpl) GetAccountsByChartOfAccount(ctx context.Context, ch
if err != nil { if err != nil {
return nil, err return nil, err
} }
contractResp := make([]contract.AccountResponse, len(modelResp)) contractResp := make([]contract.AccountResponse, len(modelResp))
for i, resp := range modelResp { for i, resp := range modelResp {
contractResp[i] = *mappers.ModelToContractAccountResponse(&resp) contractResp[i] = *mappers.ModelToContractAccountResponse(&resp)
} }
return contractResp, nil return contractResp, nil
} }

View File

@ -59,11 +59,11 @@ func (s *ChartOfAccountTypeServiceImpl) ListChartOfAccountTypes(ctx context.Cont
if err != nil { if err != nil {
return nil, 0, err return nil, 0, err
} }
contractResp := make([]contract.ChartOfAccountTypeResponse, len(modelResp)) contractResp := make([]contract.ChartOfAccountTypeResponse, len(modelResp))
for i, resp := range modelResp { for i, resp := range modelResp {
contractResp[i] = *mappers.ModelToContractChartOfAccountTypeResponse(&resp) contractResp[i] = *mappers.ModelToContractChartOfAccountTypeResponse(&resp)
} }
return contractResp, total, nil return contractResp, total, nil
} }

View File

@ -160,4 +160,3 @@ func (s *IngredientUnitConverterServiceImpl) GetUnitsByIngredientID(ctx context.
contractResponse := transformer.IngredientUnitsModelResponseToResponse(unitsResponse) contractResponse := transformer.IngredientUnitsModelResponseToResponse(unitsResponse)
return contract.BuildSuccessResponse(contractResponse) return contract.BuildSuccessResponse(contractResponse)
} }

View File

@ -111,4 +111,4 @@ func (s *ProductRecipeServiceImpl) BulkCreate(ctx context.Context, organizationI
} }
return s.processor.BulkCreate(ctx, req.Recipes, organizationID) return s.processor.BulkCreate(ctx, req.Recipes, organizationID)
} }

View File

@ -175,4 +175,3 @@ func IngredientUnitsModelResponseToResponse(model *models.IngredientUnitsRespons
return response return response
} }

View File

@ -20,11 +20,11 @@ func CalculateWasteQuantities(productIngredients []*entities.ProductIngredient,
for _, pi := range productIngredients { for _, pi := range productIngredients {
// Calculate net quantity (actual quantity needed for the product) // Calculate net quantity (actual quantity needed for the product)
netQty := pi.Quantity * quantity netQty := pi.Quantity * quantity
// Calculate gross quantity (including waste) // Calculate gross quantity (including waste)
wasteMultiplier := 1 + (pi.WastePercentage / 100) wasteMultiplier := 1 + (pi.WastePercentage / 100)
grossQty := netQty * wasteMultiplier grossQty := netQty * wasteMultiplier
// Calculate waste quantity // Calculate waste quantity
wasteQty := grossQty - netQty wasteQty := grossQty - netQty

View File

@ -119,4 +119,3 @@ func (v *IngredientUnitConverterValidatorImpl) ValidateConvertUnitRequest(req *c
return nil, "" return nil, ""
} }