Documentation
¶
Index ¶
- func CreatePayment(c *fiber.Ctx) error
- func CreateProduct(c *fiber.Ctx) error
- func CreateUser(c *fiber.Ctx) error
- func DeletePayment(c *fiber.Ctx) error
- func DeleteProduct(c *fiber.Ctx) error
- func DeleteUser(c *fiber.Ctx) error
- func GetAllPaymentsByProductId(c *fiber.Ctx) error
- func GetPayment(c *fiber.Ctx) error
- func GetPaymentByProductId(c *fiber.Ctx) error
- func GetPayments(c *fiber.Ctx) error
- func GetProduct(c *fiber.Ctx) error
- func GetProductId(id int, product *models.Product) error
- func GetProducts(c *fiber.Ctx) error
- func GetStream(c *fiber.Ctx) error
- func GetUser(c *fiber.Ctx) error
- func GetUserId(id int, user *models.User) error
- func GetUsers(c *fiber.Ctx) error
- func Login(c *fiber.Ctx) error
- func UpdatePayment(c *fiber.Ctx) error
- func UpdateProduct(c *fiber.Ctx) error
- func UpdateUser(c *fiber.Ctx) error
- type Payment
- type Product
- type Stream
- type User
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreatePayment ¶
func CreatePayment(c *fiber.Ctx) error
Create a new payment godoc @Summary Create a new payment @Description Create a new payment @Tags payments @Accept json @Produce json @Param payment body Payment true "Payment" @Success 200 {object} Payment @Failure 400 {string} string "Something went wrong" @Router /api/payments [post]
func CreateProduct ¶
func CreateProduct(c *fiber.Ctx) error
Create product godoc @Summary Create product @Description Create product @Tags products @Accept json @Produce json @Param product body Product true "Product" @Success 200 {object} Product @Failure 400 {string} string "Product name is required" @Failure 400 {string} string "Product name already taken" @Router /api/products [post]
func CreateUser ¶
func CreateUser(c *fiber.Ctx) error
Create user godoc @Summary Create user @Description Create user @Tags users @Accept json @Produce json @Param user body User true "User" @Success 201 {object} User @Failure 400 {string} string "Invalid request" @Failure 500 {string} string "Error encrypting password" @Router /api/users [post]
func DeletePayment ¶
func DeletePayment(c *fiber.Ctx) error
Delete the payment with the given id godoc @Summary Delete the payment with the given id @Description Delete the payment with the given id @Tags payments @Accept json @Produce json @Param id path int true "Payment ID" @Success 200 {object} Payment @Failure 400 {string} string "Payment not found" @Router /api/payments/{id} [delete]
func DeleteProduct ¶
func DeleteProduct(c *fiber.Ctx) error
Delete product godoc @Summary Delete product @Description Delete product @Tags products @Accept json @Produce json @Param id path int true "Product ID" @Success 200 {string} string "Product deleted" @Failure 400 {string} string "Please ensure that :id is an integer" @Failure 400 {string} string "Product not found" @Router /api/products/{id} [delete]
func DeleteUser ¶
func DeleteUser(c *fiber.Ctx) error
Delete user godoc @Summary Delete user @Description Delete user @Tags users @Accept json @Produce json @Param id path int true "User ID" @Success 200 {string} string "User deleted" @Failure 400 {string} string "Invalid request" @Failure 404 {string} string "User not found" @Router /api/users/{id} [delete]
func GetAllPaymentsByProductId ¶
func GetAllPaymentsByProductId(c *fiber.Ctx) error
func GetPayment ¶
func GetPayment(c *fiber.Ctx) error
Get payment by id godoc @Summary Get payment by id @Description Get payment by id @Tags payments @Accept json @Produce json @Param id path int true "Payment ID" @Success 200 {object} Payment @Failure 400 {string} string "Payment not found" @Router /api/payments/{id} [get]
func GetPaymentByProductId ¶
func GetPaymentByProductId(c *fiber.Ctx) error
func GetPayments ¶
func GetPayments(c *fiber.Ctx) error
Get all payments godoc @Summary Get all payments @Description Get all payments @Tags payments @Accept json @Produce json @Success 200 {object} []Payment @Failure 400 {string} string "Payment not found" @Router /api/payments [get]
func GetProduct ¶
func GetProduct(c *fiber.Ctx) error
Get product by id godoc @Summary Get product by id @Description Get product by id @Tags products @Accept json @Produce json @Param id path int true "Product ID" @Success 200 {object} Product @Failure 400 {string} string "Please ensure that :id is an integer" @Failure 400 {string} string "Product not found" @Router /api/products/{id} [get]
func GetProducts ¶
func GetProducts(c *fiber.Ctx) error
Get all products godoc @Summary Get all products @Description Get all products @Tags products @Accept json @Produce json @Success 200 {object} []Product @Failure 400 {string} string "Product not found" @Router /api/products [get]
func GetUser ¶
func GetUser(c *fiber.Ctx) error
Get user godoc @Summary Get user @Description Get user @Tags users @Accept json @Produce json @Param id path int true "User ID" @Success 200 {object} User @Failure 404 {string} string "User not found" @Router /api/users/{id} [get]
func GetUsers ¶
func GetUsers(c *fiber.Ctx) error
Get users godoc @Summary Get users @Description Get users @Tags users @Accept json @Produce json @Success 200 {object} User @Failure 404 {string} string "User not found" @Router /api/users [get]
func UpdatePayment ¶
func UpdatePayment(c *fiber.Ctx) error
Update the payment with the given id godoc @Summary Update the payment with the given id @Description Update the payment with the given id @Tags payments @Accept json @Produce json @Param id path int true "Payment ID" @Param payment body Payment true "Payment" @Success 200 {object} Payment @Failure 400 {string} string "Payment not found" @Router /api/payments/{id} [put]
func UpdateProduct ¶
func UpdateProduct(c *fiber.Ctx) error
Update product godoc @Summary Update product @Description Update product @Tags products @Accept json @Produce json @Param id path int true "Product ID" @Param product body Product true "Product" @Success 200 {object} Product @Failure 400 {string} string "Please ensure that :id is an integer" @Failure 400 {string} string "Product not found" @Failure 400 {string} string "Product name already taken" @Router /api/products/{id} [put]
func UpdateUser ¶
func UpdateUser(c *fiber.Ctx) error
Update user godoc @Summary Update user @Description Update user @Tags users @Accept json @Produce json @Param id path int true "User ID" @Param user body User true "User" @Success 200 {object} User @Failure 400 {string} string "Invalid request" @Failure 404 {string} string "User not found" @Failure 500 {string} string "Error encrypting password" @Router /api/users/{id} [put]
Types ¶
type Payment ¶
type Payment struct { ID uint `json:"id"` ProductId uint `json:"product_id"` Amount uint `json:"amount"` }