apskel-pos-backend/internal/service/ingredient_service.go

39 lines
1.4 KiB
Go
Raw Normal View History

2025-08-03 23:55:51 +07:00
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)
}