handler

package
v1.0.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 20, 2024 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BookHandler

type BookHandler struct {
	// contains filtered or unexported fields
}

func (BookHandler) GetBookById

func (h BookHandler) GetBookById(c *fiber.Ctx) error

GetBookById @Summary Get book. @Description Get book by id. @Tags book @Accept json @Produce json @Param id path int true "Book ID" @Success 200 {object} middleware.ResponseHTTP{data=dto.BookResponse} @Failure 404 {object} middleware.ResponseHTTP{} @Failure 500 {object} middleware.ResponseHTTP{} @Router /book/{id} [get]

func (BookHandler) GetBookList

func (h BookHandler) GetBookList(c *fiber.Ctx) error

GetBookList @Summary Get book list. @Description List all the books. @Tags book @Accept json @Produce json @Success 200 {object} middleware.ResponseHTTP{data=dto.BookListResponse} @Failure 404 {object} middleware.ResponseHTTP{} @Failure 500 {object} middleware.ResponseHTTP{} @Router /book/list [get]

func (BookHandler) Name

func (h BookHandler) Name() string

func (BookHandler) SearchBook

func (h BookHandler) SearchBook(c *fiber.Ctx) error

SearchBook @Summary Search book. @Description Search book by given parameters. @Tags book @Accept json @Produce json @Param search body dto.BookSearchRequest true "Search book" @Success 200 {object} middleware.ResponseHTTP{data=dto.BookListResponse} @Failure 404 {object} middleware.ResponseHTTP{} @Failure 500 {object} middleware.ResponseHTTP{} @Router /book/search [post]

func (BookHandler) SetRoutes

func (h BookHandler) SetRoutes(r fiber.Router) IHandler

type CartHandler

type CartHandler struct {
	// contains filtered or unexported fields
}

func (CartHandler) Add

func (h CartHandler) Add(c *fiber.Ctx) error

Add @Summary Add to cart. @Description Add book to user cart. @Tags cart @Accept json @Produce json @Param search body dto.AddToCartRequest true "Add to cart" @Success 200 {object} middleware.ResponseHTTP{data=dto.CartResponse} @Failure 404 {object} middleware.ResponseHTTP{} @Failure 500 {object} middleware.ResponseHTTP{} @Router /cart [post]

func (CartHandler) GetCartByUserId

func (h CartHandler) GetCartByUserId(c *fiber.Ctx) error

GetCartByUserId @Summary Get user cart. @Description Get user cart. @Tags cart @Accept json @Produce json @Param id path int true "User ID" @Success 200 {object} middleware.ResponseHTTP{data=dto.CartResponse} @Failure 404 {object} middleware.ResponseHTTP{} @Failure 500 {object} middleware.ResponseHTTP{} @Router /cart/{id} [get]

func (CartHandler) GetOrderById

func (h CartHandler) GetOrderById(c *fiber.Ctx) error

GetOrderById @Summary Get order. @Description Get order by id. @Tags cart @Accept json @Produce json @Param id path int true "Order ID" @Success 200 {object} middleware.ResponseHTTP{data=dto.PlaceOrderResponse} @Failure 404 {object} middleware.ResponseHTTP{} @Failure 500 {object} middleware.ResponseHTTP{} @Router /cart/order/{id} [get]

func (CartHandler) GetOrdersByUserId

func (h CartHandler) GetOrdersByUserId(c *fiber.Ctx) error

GetOrdersByUserId @Summary Get user orders. @Description Get orders by user id. @Tags cart @Accept json @Produce json @Param id path int true "User ID" @Success 200 {object} middleware.ResponseHTTP{data=dto.UserOrdersResponse} @Failure 404 {object} middleware.ResponseHTTP{} @Failure 500 {object} middleware.ResponseHTTP{} @Router /cart/order/user/{id} [get]

func (CartHandler) Name

func (h CartHandler) Name() string

func (CartHandler) PlaceOrder

func (h CartHandler) PlaceOrder(c *fiber.Ctx) error

PlaceOrder @Summary Place order. @Description Order all items in the user cart. @Tags cart @Accept json @Produce json @Param id path int true "User ID" @Success 200 {object} middleware.ResponseHTTP{data=dto.PlaceOrderResponse} @Failure 404 {object} middleware.ResponseHTTP{} @Failure 500 {object} middleware.ResponseHTTP{} @Router /cart/place-order/{id} [get]

func (CartHandler) SetRoutes

func (h CartHandler) SetRoutes(r fiber.Router) IHandler

type GeneralHandler

type GeneralHandler struct {
	// contains filtered or unexported fields
}

func (GeneralHandler) GeneralStatus

func (h GeneralHandler) GeneralStatus(c *fiber.Ctx) error

Status @Summary Show the status of server. @Description Get the status of server. @Tags status @Accept json @Produce json @Success 200 {object} middleware.ResponseHTTP{data=general.Status} @Failure 404 {object} middleware.ResponseHTTP{} @Failure 500 {object} middleware.ResponseHTTP{} @Router /general/status [get]

func (GeneralHandler) Name

func (h GeneralHandler) Name() string

func (GeneralHandler) SetRoutes

func (h GeneralHandler) SetRoutes(r fiber.Router) IHandler

type Handler

type Handler struct {
	// contains filtered or unexported fields
}

func New

func New(log *slog.Logger, router fiber.Router) *Handler

type IHandler

type IHandler interface {
	Name() string
	SetRoutes(r fiber.Router) IHandler
}

func NewBook

func NewBook(log *slog.Logger) IHandler

func NewCart

func NewCart(log *slog.Logger) IHandler

func NewGeneral

func NewGeneral(_ *slog.Logger) IHandler

func NewUser

func NewUser(log *slog.Logger) IHandler

type UserHandler

type UserHandler struct {
	// contains filtered or unexported fields
}

func (UserHandler) GetUserById

func (h UserHandler) GetUserById(c *fiber.Ctx) error

GetUserById @Summary Get user. @Description Get user by id. @Tags user @Accept json @Produce json @Param id path int true "User ID" @Success 200 {object} middleware.ResponseHTTP{data=dto.UserResponse} @Failure 404 {object} middleware.ResponseHTTP{} @Failure 500 {object} middleware.ResponseHTTP{} @Router /user/{id} [get]

func (UserHandler) GetUserList

func (h UserHandler) GetUserList(c *fiber.Ctx) error

GetUserList @Summary List users. @Description List all the users. @Tags user @Accept json @Produce json @Success 200 {object} middleware.ResponseHTTP{data=dto.UserListResponse} @Failure 404 {object} middleware.ResponseHTTP{} @Failure 500 {object} middleware.ResponseHTTP{} @Router /user/list [get]

func (UserHandler) Name

func (h UserHandler) Name() string

func (UserHandler) SetRoutes

func (h UserHandler) SetRoutes(r fiber.Router) IHandler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL