Documentation ¶
Index ¶
- type Admin
- type AdminService
- type Category
- type CategoryService
- func (s *CategoryService) Create(clientId int, clientType string, category *domain.Category) (int, error)
- func (s *CategoryService) DeleteCategory(clientId int, clientType string, restaurantId int, categoryId int) error
- func (s *CategoryService) GetAll(clientId int, clientType string, restaurantId int) ([]*domain.Category, error)
- func (s *CategoryService) GetAllItems(clientId int, clientType string, restaurantId int, categoryId int) ([]*domain.MenuItem, error)
- func (s *CategoryService) GetById(clientId int, clientType string, restaurantId int, categoryId int) (*domain.Category, error)
- func (s *CategoryService) UpdateCategory(clientId int, clientType string, restaurantId int, categoryId int, ...) error
- type Courier
- type CourierService
- func (s *CourierService) GetById(clientId int, clientType string, courierId int) (*domain.Courier, error)
- func (s *CourierService) SignIn(phone, password string) (*Tokens, error)
- func (s *CourierService) SignUp(courier *domain.Courier, clientType string) (int, error)
- func (s *CourierService) Update(clientId int, clientType string, courierId int, input *domain.Courier) error
- type Deps
- type MenuItem
- type MenuItemService
- func (s *MenuItemService) Create(clientId int, clientType string, menuItem *domain.MenuItem, categoryId int) (int, error)
- func (s *MenuItemService) Delete(clientId int, clientType string, restaurantId int, menuItemId int) error
- func (s *MenuItemService) GetById(clientId int, clientType string, menuItemId int, restaurantId int) (*domain.MenuItem, error)
- func (s *MenuItemService) UpdateImage(clientId int, clientType string, restaurantId int, menuItemId int, ...) (*domain.MenuItem, error)
- func (s *MenuItemService) UpdateMenuItem(clientId int, clientType string, restaurantId int, menuItemId int, ...) error
- type Order
- type OrderService
- func (s *OrderService) Create(clientId int, clientType string, order *domain.Order) (int, error)
- func (s *OrderService) CreateItem(clientId int, clientType string, orderItem *domain.OrderItem) (int, error)
- func (s *OrderService) Delete(clientId int, clientType string, orderId int) error
- func (s *OrderService) DeleteItem(clientId int, clientType string, orderId int, orderItemId int) error
- func (s *OrderService) GetActiveCourierOrder(clientId int, clientType string, courierId int) (*domain.Order, error)
- func (s *OrderService) GetActiveRestaurantOrders(clientId int, clientType string, restaurantId int) ([]*domain.Order, error)
- func (s *OrderService) GetAllItems(clientId int, clientType string, orderId int) ([]*domain.OrderItem, error)
- func (s *OrderService) GetById(clientId int, clientType string, orderId int) (*domain.Order, error)
- func (s *OrderService) GetItemById(clientId int, clientType string, orderId, orderItemId int) (*domain.OrderItem, error)
- func (s *OrderService) Update(clientId int, clientType string, orderId int, input *domain.Order) error
- func (s *OrderService) UpdateItem(clientId int, clientType string, orderId, orderItemId, menuItemsCount int) error
- type Restaurant
- type RestaurantService
- func (s *RestaurantService) GetAll(clientId int, clientType string) ([]*domain.Restaurant, error)
- func (s *RestaurantService) GetById(clientId int, clientType string, restaurantId int) (*domain.Restaurant, error)
- func (s *RestaurantService) GetMenu(clientId int, clientType string, restaurantId int) ([]*domain.MenuItem, error)
- func (s *RestaurantService) SignIn(phone, password string) (*Tokens, error)
- func (s *RestaurantService) SignUp(restaurant *domain.Restaurant, clientType string) (int, error)
- func (s *RestaurantService) Update(clientId int, clientType string, restaurantId int, input *domain.Restaurant) error
- func (s *RestaurantService) UpdateImage(clientId int, clientType string, restaurantId int, image string) (*domain.Restaurant, error)
- type Service
- type Tokens
- type User
- type UserService
- func (s UserService) GetAllOrders(clientId int, clientType string, userId int, activeOrdersFlag bool) ([]*domain.Order, error)
- func (s *UserService) GetById(clientId int, clientType string, userId int) (*domain.User, error)
- func (s *UserService) SignIn(phone, password string) (*Tokens, error)
- func (s *UserService) SignUp(user *domain.User) (int, error)
- func (s *UserService) Update(clientId int, clientType string, userId int, input *domain.User) error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type AdminService ¶
type AdminService struct {
// contains filtered or unexported fields
}
func NewAdminService ¶
func NewAdminService(repo repository.Admin, tokenManager auth.TokenManager, accessTokenTTL time.Duration) *AdminService
type Category ¶
type Category interface { GetAll(clientId int, clientType string, restaurantId int) ([]*domain.Category, error) Create(clientId int, clientType string, category *domain.Category) (int, error) GetById(clientId int, clientType string, restaurantId int, categoryId int) (*domain.Category, error) GetAllItems(clientId int, clientType string, restaurantId int, categoryId int) ([]*domain.MenuItem, error) DeleteCategory(clientId int, clientType string, restaurantId int, categoryId int) error UpdateCategory(clientId int, clientType string, restaurantId int, categoryId int, input *domain.Category) error }
type CategoryService ¶
type CategoryService struct {
// contains filtered or unexported fields
}
func NewCategoryService ¶
func NewCategoryService(repo repository.Category) *CategoryService
func (*CategoryService) DeleteCategory ¶
func (*CategoryService) GetAllItems ¶
func (*CategoryService) UpdateCategory ¶
type Courier ¶
type Courier interface { SignIn(phone, password string) (*Tokens, error) SignUp(courier *domain.Courier, clientType string) (int, error) GetById(clientId int, clientType string, courierId int) (*domain.Courier, error) Update(clientId int, clientType string, courierId int, input *domain.Courier) error }
type CourierService ¶
type CourierService struct {
// contains filtered or unexported fields
}
func NewCourierService ¶
func NewCourierService(repo repository.Courier, orderRepo repository.Order, tokenManager auth.TokenManager, accessTokenTTL time.Duration) *CourierService
func (*CourierService) SignIn ¶
func (s *CourierService) SignIn(phone, password string) (*Tokens, error)
type Deps ¶
type Deps struct { Repos *repository.Repository TokenManager auth.TokenManager AccessTokenTTL time.Duration }
type MenuItem ¶
type MenuItem interface { GetById(clientId int, clientType string, menuItemId int, restaurantId int) (*domain.MenuItem, error) UpdateMenuItem(clientId int, clientType string, restaurantId int, menuItemId int, categoryId int, input *domain.MenuItem) error Create(clientId int, clientType string, menuItem *domain.MenuItem, categoryId int) (int, error) UpdateImage(clientId int, clientType string, restaurantId int, menuItemId int, image string) (*domain.MenuItem, error) Delete(clientId int, clientType string, restaurantId int, menuItemId int) error }
type MenuItemService ¶
type MenuItemService struct {
// contains filtered or unexported fields
}
func NewMenuItemService ¶
func NewMenuItemService(repo repository.MenuItem, categoryRepo repository.Category) *MenuItemService
func (*MenuItemService) UpdateImage ¶
type Order ¶
type Order interface { Create(clientId int, clientType string, order *domain.Order) (int, error) GetById(clientId int, clientType string, orderId int) (*domain.Order, error) Delete(clientId int, clientType string, orderId int) error Update(clientId int, clientType string, orderId int, status *domain.Order) error GetActiveRestaurantOrders(clientId int, clientType string, restaurantId int) ([]*domain.Order, error) CreateItem(clientId int, clientType string, orderItem *domain.OrderItem) (int, error) GetAllItems(clientId int, clientType string, orderId int) ([]*domain.OrderItem, error) GetItemById(clientId int, clientType string, orderId, orderItemId int) (*domain.OrderItem, error) UpdateItem(clientId int, clientType string, orderId, orderItemId, menuItemsCount int) error DeleteItem(clientId int, clientType string, orderId int, orderItemId int) error GetActiveCourierOrder(clientId int, clientType string, courierId int) (*domain.Order, error) }
type OrderService ¶
type OrderService struct {
// contains filtered or unexported fields
}
func NewOrderService ¶
func NewOrderService(repo repository.Order) *OrderService
func (*OrderService) CreateItem ¶
func (*OrderService) Delete ¶
func (s *OrderService) Delete(clientId int, clientType string, orderId int) error
func (*OrderService) DeleteItem ¶
func (*OrderService) GetActiveCourierOrder ¶
func (*OrderService) GetActiveRestaurantOrders ¶
func (*OrderService) GetAllItems ¶
func (*OrderService) GetItemById ¶
func (*OrderService) Update ¶
func (s *OrderService) Update(clientId int, clientType string, orderId int, input *domain.Order) error
TODO: обновление общей стоимости заказа лучше сделать в методах добавления, обновления, удаления позиции заказа
func (*OrderService) UpdateItem ¶
func (s *OrderService) UpdateItem(clientId int, clientType string, orderId, orderItemId, menuItemsCount int) error
type Restaurant ¶
type Restaurant interface { GetAll(clientId int, clientType string) ([]*domain.Restaurant, error) GetById(clientId int, clientType string, restaurantId int) (*domain.Restaurant, error) SignIn(phone, password string) (*Tokens, error) GetMenu(clientId int, clientType string, restaurantId int) ([]*domain.MenuItem, error) SignUp(restaurant *domain.Restaurant, clientType string) (int, error) UpdateImage(clientId int, clientType string, restaurantId int, image string) (*domain.Restaurant, error) Update(clientId int, clientType string, restaurantId int, input *domain.Restaurant) error }
type RestaurantService ¶
type RestaurantService struct {
// contains filtered or unexported fields
}
func NewRestaurantService ¶
func NewRestaurantService(repo repository.Restaurant, tokenManager auth.TokenManager, accessTokenTTL time.Duration) *RestaurantService
func (*RestaurantService) GetAll ¶
func (s *RestaurantService) GetAll(clientId int, clientType string) ([]*domain.Restaurant, error)
func (*RestaurantService) GetById ¶
func (s *RestaurantService) GetById(clientId int, clientType string, restaurantId int) (*domain.Restaurant, error)
func (*RestaurantService) SignIn ¶
func (s *RestaurantService) SignIn(phone, password string) (*Tokens, error)
func (*RestaurantService) SignUp ¶
func (s *RestaurantService) SignUp(restaurant *domain.Restaurant, clientType string) (int, error)
func (*RestaurantService) Update ¶
func (s *RestaurantService) Update(clientId int, clientType string, restaurantId int, input *domain.Restaurant) error
func (*RestaurantService) UpdateImage ¶
func (s *RestaurantService) UpdateImage(clientId int, clientType string, restaurantId int, image string) (*domain.Restaurant, error)
type Service ¶
func NewService ¶
type User ¶
type User interface { SignIn(phone, password string) (*Tokens, error) SignUp(user *domain.User) (int, error) GetAllOrders(clientId int, clientType string, userId int, activeOrdersFlag bool) ([]*domain.Order, error) Update(clientId int, clientType string, userId int, input *domain.User) error GetById(clientId int, clientType string, userId int) (*domain.User, error) }
type UserService ¶
type UserService struct {
// contains filtered or unexported fields
}
func NewUserService ¶
func NewUserService(repo repository.User, tokenManager auth.TokenManager, accessTokenTTL time.Duration) *UserService
func (UserService) GetAllOrders ¶
Click to show internal directories.
Click to hide internal directories.