39 lines
1.4 KiB
Go
39 lines
1.4 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)
|
|
}
|