handlers

package
v0.0.0-...-5b40bf8 Latest Latest
Warning

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

Go to latest
Published: Mar 26, 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 Error

type Error struct {
	Message string `json:"message"`
}

type ProductHandler

type ProductHandler struct {
	ProductDB database.ProductInterface
}

func NewProductHandler

func NewProductHandler(db database.ProductInterface) *ProductHandler

func (*ProductHandler) CreateProduct

func (h *ProductHandler) CreateProduct(w http.ResponseWriter, r *http.Request)

Create Product godoc @Summary Create product @Description Create products @Tags products @Accept json @Produce json @Param request body dto.CreateProductInput true "product request" @Success 201 @Failure 500 {object} Error @Router /products [post] @Security ApiKeyAuth

func (*ProductHandler) DeleteProduct

func (h *ProductHandler) DeleteProduct(w http.ResponseWriter, r *http.Request)

DeleteProduct godoc @Summary Delete a product @Description Delete a product @Tags products @Accept json @Produce json @Param id path string true "product ID" Format(uuid) @Success 200 @Failure 404 @Failure 500 {object} Error @Router /products/{id} [delete] @Security ApiKeyAuth

func (*ProductHandler) GetProduct

func (h *ProductHandler) GetProduct(w http.ResponseWriter, r *http.Request)

GetProduct godoc @Summary Get a product @Description Get a product @Tags products @Accept json @Produce json @Param id path string true "product ID" Format(uuid) @Success 200 {object} entity.Product @Failure 404 @Failure 500 {object} Error @Router /products/{id} [get] @Security ApiKeyAuth

func (*ProductHandler) GetProducts

func (h *ProductHandler) GetProducts(w http.ResponseWriter, r *http.Request)

ListAccounts godoc @Summary List products @Description get all products @Tags products @Accept json @Produce json @Param page query string false "page number" @Param limit query string false "limit" @Success 200 {array} entity.Product @Failure 404 {object} Error @Failure 500 {object} Error @Router /products [get] @Security ApiKeyAuth

func (*ProductHandler) UpdateProduct

func (h *ProductHandler) UpdateProduct(w http.ResponseWriter, r *http.Request)

UpdateProduct godoc @Summary Update a product @Description Update a product @Tags products @Accept json @Produce json @Param id path string true "product ID" Format(uuid) @Param request body dto.CreateProductInput true "product request" @Success 200 @Failure 404 @Failure 500 {object} Error @Router /products/{id} [put] @Security ApiKeyAuth

type UserHandler

type UserHandler struct {
	UserDB database.UserInterface
}

func NewUserHandler

func NewUserHandler(userDB database.UserInterface) *UserHandler

func (*UserHandler) Create

func (h *UserHandler) Create(w http.ResponseWriter, r *http.Request)

Create user godoc @Summary Create user @Description Create user @Tags users @Accept json @Produce json @Param request body dto.CreateUserInput true "user request" @Success 201 @Failure 500 {object} Error @Router /users [post]

func (*UserHandler) GetJWT

func (h *UserHandler) GetJWT(w http.ResponseWriter, r *http.Request)

GetJWT godoc @Summary Get a user JWT @Description Get a user JWT @Tags users @Accept json @Produce json @Param request body dto.GetJWTInput true "user credentials" @Success 200 {object} dto.GetJWTOutput @Failure 404 {object} Error @Failure 500 {object} Error @Router /users/generate_token [post]

Jump to

Keyboard shortcuts

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