Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ItemService ¶
type ItemService interface { GetAllItems(ctx context.Context) ([]*entities.Item, error) GetItem(ctx context.Context, id int64) (*entities.Item, error) CreateItem(ctx context.Context, item *entities.Item) error UpdateItem(ctx context.Context, item *entities.Item) error DeleteItem(ctx context.Context, id int64) error PurchaseItem(ctx context.Context, id int64, userId int64) (*entities.Order, error) }
func InitItemService ¶
func InitItemService(itemRepository repositories.ItemRepository, orderRepository repositories.OrderRepository) ItemService
type OrderService ¶
type OrderService interface { GetOrder(ctx context.Context, id int64) (*entities.Order, error) GetOrders(ctx context.Context) ([]*entities.Order, error) GetOrdersByUser(ctx context.Context, userID int64) ([]*entities.Order, error) GetOrdersByUserAndStatus(ctx context.Context, userID int64, status string) ([]*entities.Order, error) CreateOrder(ctx context.Context, order *entities.Order) (*entities.Order, error) UpdateOrder(ctx context.Context, order *entities.Order) (*entities.Order, error) PayOrder(ctx context.Context, id int64, user *entities.User) (*entities.Order, error) }
func InitOrderService ¶
func InitOrderService(orderRepository repositories.OrderRepository, stripeAPIKey string) OrderService
InitOrderService initialize the order service with necessary dependencies
type StatService ¶
type StatService interface { GetItemsNotOrdered(ctx context.Context) ([]entities.ItemStat, error) GetUsersWhoSpendMore(ctx context.Context) ([]entities.UserStat, error) GetMostOrderedItems(ctx context.Context) ([]entities.ItemStat, error) GetStats(ctx context.Context) ([]entities.Stat, error) GetLeastOrderedItems(ctx context.Context) ([]entities.ItemStat, error) GetTotalNumberOfItems(ctx context.Context) (int, error) GetTotalNumberOfUsers(ctx context.Context) (int, error) GetTotalNumberOfOrders(ctx context.Context) (int, error) }
func InitStatService ¶
func InitStatService(userRepository repositories.UserRepository, orderRepository repositories.OrderRepository, itemRepository repositories.ItemRepository, statRepository repositories.StatRepository) StatService
type UserService ¶
type UserService interface { CreateUser(ctx context.Context, user *entities.User) error GetUserByID(ctx context.Context, id int64) (*entities.User, error) }
func InitUserService ¶
func InitUserService(userRepository repositories.UserRepository, orderRepository repositories.OrderRepository) UserService
Click to show internal directories.
Click to hide internal directories.