Documentation
¶
Index ¶
- Variables
- type AddDishArgument
- type AddDishCommand
- type AddMenuArgument
- type AddMenuCommand
- type AddRestaurantCommand
- type DeleteDishCommand
- type DeleteMenuCommand
- type DishStoragePort
- type MenuStoragePort
- type RestaurantStoragePort
- type UpdateDishArgument
- type UpdateDishCommand
- type UpdateMenuArgument
- type UpdateMenuCommand
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrNotFound = errors.New("object is not found") ErrAlreadyExists = errors.New("object already exists") ErrInvalidData = errors.New("invalid data provided") ErrDishNotFound = fmt.Errorf("dish %w", ErrNotFound) ErrDishAlreadyExists = fmt.Errorf("dish %w", ErrAlreadyExists) ErrMenuNotFound = fmt.Errorf("menu %w", ErrNotFound) ErrMenuAlreadyExists = fmt.Errorf("menu %w", ErrAlreadyExists) ErrRestaurantNotFound = fmt.Errorf("restaurant %w", ErrNotFound) ErrRestaurantAlreadyExists = fmt.Errorf("restaurant %w", ErrAlreadyExists) ErrInternal = errors.New("internal service error") )
Functions ¶
This section is empty.
Types ¶
type AddDishArgument ¶
type AddDishCommand ¶
type AddDishCommand struct {
// contains filtered or unexported fields
}
AddDishCommand - a command that handles the addition of a new dish to the menu
func NewAddDishCommand ¶
func NewAddDishCommand( dishes DishStoragePort, menus MenuStoragePort, restaurant RestaurantStoragePort, logger *slog.Logger, ) *AddDishCommand
func (*AddDishCommand) AddDish ¶
func (cmd *AddDishCommand) AddDish(ctx context.Context, args AddDishArgument) (uuid.UUID, error)
type AddMenuArgument ¶
type AddMenuCommand ¶
type AddMenuCommand struct {
// contains filtered or unexported fields
}
func NewAddMenuCommand ¶
func NewAddMenuCommand( restaurants RestaurantStoragePort, menus MenuStoragePort, logger *slog.Logger, ) *AddMenuCommand
func (*AddMenuCommand) AddMenu ¶
func (cmd *AddMenuCommand) AddMenu(ctx context.Context, args AddMenuArgument) (uuid.UUID, error)
type AddRestaurantCommand ¶
type AddRestaurantCommand struct {
// contains filtered or unexported fields
}
func NewAddRestaurantCommand ¶
func NewAddRestaurantCommand( restaurants RestaurantStoragePort, logger *slog.Logger, ) *AddRestaurantCommand
func (*AddRestaurantCommand) AddRestaurant ¶
type DeleteDishCommand ¶
type DeleteDishCommand struct {
// contains filtered or unexported fields
}
func NewDeleteDishCommand ¶
func NewDeleteDishCommand( dishes DishStoragePort, restaurants RestaurantStoragePort, menus MenuStoragePort, logger *slog.Logger, ) *DeleteDishCommand
func (*DeleteDishCommand) DeleteDish ¶
type DeleteMenuCommand ¶
type DeleteMenuCommand struct {
// contains filtered or unexported fields
}
func NewDeleteMenuCommand ¶
func NewDeleteMenuCommand( restaurants RestaurantStoragePort, menus MenuStoragePort, logger *slog.Logger, ) *DeleteMenuCommand
func (*DeleteMenuCommand) DeleteMenu ¶
type DishStoragePort ¶
type DishStoragePort interface { GetDish(ctx context.Context, id uuid.UUID) (*domain.Dish, error) AddDish(ctx context.Context, dish *domain.Dish) error DeleteDish(ctx context.Context, id uuid.UUID) error UpdateDish(ctx context.Context, dish *domain.Dish) error }
DishStoragePort - is a port to dish storage
type MenuStoragePort ¶
type MenuStoragePort interface { GetMenuByRestaurant(ctx context.Context, restaurant uuid.UUID) ([]*domain.Menu, error) GetMenu(ctx context.Context, id uuid.UUID) (*domain.Menu, error) AddMenu(ctx context.Context, menu *domain.Menu) error DeleteMenu(ctx context.Context, id uuid.UUID) error UpdateMenu(ctx context.Context, menu *domain.Menu) error }
MenuStoragePort - is a port to menu storage
type RestaurantStoragePort ¶
type RestaurantStoragePort interface { RestaurantExists(ctx context.Context, id uuid.UUID) (bool, error) AddRestaurant(ctx context.Context, id uuid.UUID) error }
RestaurantStoragePort - is a port to restaurant storage
type UpdateDishArgument ¶
type UpdateDishCommand ¶
type UpdateDishCommand struct {
// contains filtered or unexported fields
}
func NewUpdateDishCommand ¶
func NewUpdateDishCommand( restaurants RestaurantStoragePort, menu MenuStoragePort, dishes DishStoragePort, logger *slog.Logger, ) *UpdateDishCommand
func (*UpdateDishCommand) UpdateDish ¶
func (cmd *UpdateDishCommand) UpdateDish(ctx context.Context, arg UpdateDishArgument) error
type UpdateMenuArgument ¶
type UpdateMenuCommand ¶
type UpdateMenuCommand struct {
// contains filtered or unexported fields
}
func NewUpdateMenuCommand ¶
func NewUpdateMenuCommand( restaurant RestaurantStoragePort, menu MenuStoragePort, logger *slog.Logger, ) *UpdateMenuCommand
func (*UpdateMenuCommand) UpdateMenu ¶
func (cmd *UpdateMenuCommand) UpdateMenu(ctx context.Context, arg UpdateMenuArgument) error
Click to show internal directories.
Click to hide internal directories.