add product ingredients

This commit is contained in:
Aditya Siregar
2025-09-12 15:37:19 +07:00
parent efe09c21e4
commit 3a04990ec8
35 changed files with 2572 additions and 357 deletions
@@ -42,3 +42,43 @@ type AccountRepository interface {
UpdateBalance(ctx context.Context, id uuid.UUID, amount float64) error
GetBalance(ctx context.Context, id uuid.UUID) (float64, error)
}
type OrderIngredientTransactionRepository interface {
Create(ctx context.Context, transaction *entities.OrderIngredientTransaction) error
GetByID(ctx context.Context, id, organizationID uuid.UUID) (*entities.OrderIngredientTransaction, error)
Update(ctx context.Context, transaction *entities.OrderIngredientTransaction) error
Delete(ctx context.Context, id, organizationID uuid.UUID) error
List(ctx context.Context, organizationID uuid.UUID, filters map[string]interface{}, page, limit int) ([]*entities.OrderIngredientTransaction, int64, error)
GetByOrderID(ctx context.Context, orderID, organizationID uuid.UUID) ([]*entities.OrderIngredientTransaction, error)
GetByOrderItemID(ctx context.Context, orderItemID, organizationID uuid.UUID) ([]*entities.OrderIngredientTransaction, error)
GetByIngredientID(ctx context.Context, ingredientID, organizationID uuid.UUID) ([]*entities.OrderIngredientTransaction, error)
GetSummary(ctx context.Context, organizationID uuid.UUID, filters map[string]interface{}) ([]*entities.OrderIngredientTransaction, error)
BulkCreate(ctx context.Context, transactions []*entities.OrderIngredientTransaction) error
}
type ProductIngredientRepository interface {
Create(ctx context.Context, productIngredient *entities.ProductIngredient) error
GetByID(ctx context.Context, id, organizationID uuid.UUID) (*entities.ProductIngredient, error)
GetByProductID(ctx context.Context, productID, organizationID uuid.UUID) ([]*entities.ProductIngredient, error)
GetByIngredientID(ctx context.Context, ingredientID, organizationID uuid.UUID) ([]*entities.ProductIngredient, error)
Update(ctx context.Context, productIngredient *entities.ProductIngredient) error
Delete(ctx context.Context, id, organizationID uuid.UUID) error
DeleteByProductID(ctx context.Context, productID, organizationID uuid.UUID) error
}
type IngredientRepository interface {
Create(ctx context.Context, ingredient *entities.Ingredient) error
GetByID(ctx context.Context, id, organizationID uuid.UUID) (*entities.Ingredient, error)
GetAll(ctx context.Context, organizationID uuid.UUID, outletID *uuid.UUID, page, limit int, search string, isSemiFinished *bool) ([]*entities.Ingredient, int, error)
Update(ctx context.Context, ingredient *entities.Ingredient) error
Delete(ctx context.Context, id, organizationID uuid.UUID) error
UpdateStock(ctx context.Context, id uuid.UUID, newStock float64, organizationID uuid.UUID) error
}
type UnitRepository interface {
Create(ctx context.Context, unit *entities.Unit) error
GetByID(ctx context.Context, id, organizationID uuid.UUID) (*entities.Unit, error)
GetAll(ctx context.Context, organizationID uuid.UUID, outletID *uuid.UUID, page, limit int, search string) ([]*entities.Unit, int, error)
Update(ctx context.Context, unit *entities.Unit) error
Delete(ctx context.Context, id, organizationID uuid.UUID) error
}