apskel-pos-backend/internal/service/ingredient_service.go
2026-04-27 21:17:12 +07:00

51 lines
2.1 KiB
Go

package service
import (
"apskel-pos-be/internal/models"
"context"
"github.com/google/uuid"
)
type IngredientServiceImpl struct {
ingredientProcessor IngredientProcessor
}
func NewIngredientService(ingredientProcessor IngredientProcessor) *IngredientServiceImpl {
return &IngredientServiceImpl{
ingredientProcessor: ingredientProcessor,
}
}
func (s *IngredientServiceImpl) CreateIngredient(ctx context.Context, req *models.CreateIngredientRequest) (*models.IngredientResponse, error) {
return s.ingredientProcessor.CreateIngredient(ctx, req)
}
func (s *IngredientServiceImpl) UpdateIngredient(ctx context.Context, id uuid.UUID, req *models.UpdateIngredientRequest) (*models.IngredientResponse, error) {
return s.ingredientProcessor.UpdateIngredient(ctx, id, req)
}
func (s *IngredientServiceImpl) DeleteIngredient(ctx context.Context, id uuid.UUID) error {
return s.ingredientProcessor.DeleteIngredient(ctx, id)
}
func (s *IngredientServiceImpl) GetIngredientByID(ctx context.Context, id uuid.UUID) (*models.IngredientResponse, error) {
return s.ingredientProcessor.GetIngredientByID(ctx, id)
}
func (s *IngredientServiceImpl) ListIngredients(ctx context.Context, organizationID uuid.UUID, outletID *uuid.UUID, page, limit int, search string) (*models.PaginatedResponse[models.IngredientResponse], error) {
return s.ingredientProcessor.ListIngredients(ctx, organizationID, outletID, page, limit, search)
}
func (s *IngredientServiceImpl) UpdateComposition(ctx context.Context, id uuid.UUID, req *models.UpdateIngredientCompositionRequest) (*models.IngredientCompositionResponse, error) {
return s.ingredientProcessor.UpdateComposition(ctx, id, req)
}
func (s *IngredientServiceImpl) DeleteComposition(ctx context.Context, id uuid.UUID) (*models.IngredientResponse, error) {
return s.ingredientProcessor.DeleteComposition(ctx, id)
}
func (s *IngredientServiceImpl) AddCompositions(ctx context.Context, parentID uuid.UUID, req *models.AddIngredientCompositionsRequest) (*models.AddIngredientCompositionsResponse, error) {
return s.ingredientProcessor.AddCompositions(ctx, parentID, req)
}