controller

package
v0.0.0-...-c7d2356 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2023 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateCategory

func CreateCategory(context *gin.Context)

CreateCategory godoc @Summary Creates a new category @Tags Categories @Accept json @Produce json @Param Authorization header string true "Bearer Token" @Param model.Category body model.CategoryCreate true "Category object to be created" @Success 201 {object} model.User "Category created successfully" @Failure 400 {object} helper.ErrorResponse "Bad Request" @Failure 401 {object} helper.ErrorResponse "Unauthorized" @Failure 422 {object} helper.ErrorResponse "Unprocessable Entity" @Failure 500 {object} helper.ErrorResponse "Server Error" @Security Bearer @Router /categories [post]

func CreateProduct

func CreateProduct(context *gin.Context)

CreateProduct godoc @Summary Creates a new product @Tags Products @Accept json @Produce json @Param Authorization header string true "Bearer Token" @Param model.Product body model.ProductCreate true "Product object to be created" @Success 201 {object} model.User "Product created successfully" @Failure 400 {object} helper.ErrorResponse "Bad Request" @Failure 401 {object} helper.ErrorResponse "Unauthorized" @Failure 422 {object} helper.ErrorResponse "Unprocessable Entity" @Failure 500 {object} helper.ErrorResponse "Server Error" @Security Bearer @Router /products [post]

func CreateTransaction

func CreateTransaction(context *gin.Context)

CreateTransaction godoc @Summary Creates a new transaction @Tags Transaction @Accept json @Produce json @Param Authorization header string true "Bearer Token" @Param model.TransactionHistory body model.TransactionCreate true "Transaction object to be created" @Success 201 {object} model.TransactionCreateResponse "Transaction created successfully" @Failure 400 {object} helper.ErrorResponse "Bad Request" @Failure 401 {object} helper.ErrorResponse "Unauthorized" @Failure 422 {object} helper.ErrorResponse "Unprocessable Entity" @Failure 500 {object} helper.ErrorResponse "Server Error" @Security Bearer @Router /transactions [post]

func DeleteCategory

func DeleteCategory(context *gin.Context)

DeleteCategory godoc @Summary Delete a Category. @Tags Categories @Accept json @Produce json @Param Authorization header string true "Bearer Token" @Param categoryId path int true "Category ID" @Success 200 {object} model.Category "Category deleted successfully" @Failure 400 {object} helper.ErrorResponse "Bad Request" @Failure 401 {object} helper.ErrorResponse "Unauthorized" @Failure 422 {object} helper.ErrorResponse "Unprocessable Entity" @Failure 500 {object} helper.ErrorResponse "Server Error" @Security Bearer @Router /categories/{categoryId} [delete]

func DeleteProduct

func DeleteProduct(context *gin.Context)

DeleteProduct godoc @Summary Delete a Product. @Tags Products @Accept json @Produce json @Param Authorization header string true "Bearer Token" @Param productId path int true "Product ID" @Success 200 {object} model.Product "Product deleted successfully" @Failure 400 {object} helper.ErrorResponse "Bad Request" @Failure 401 {object} helper.ErrorResponse "Unauthorized" @Failure 422 {object} helper.ErrorResponse "Unprocessable Entity" @Failure 500 {object} helper.ErrorResponse "Server Error" @Security Bearer @Router /products/{productId} [delete]

func GetAllCategories

func GetAllCategories(context *gin.Context)

GetAllCategories godoc @Summary Get All Categories. @Tags Categories @Accept json @Produce json @Param Authorization header string true "Bearer Token" @Success 200 {array} model.Category "Categories fetched successfully" @Failure 400 {object} helper.ErrorResponse "Bad Request" @Failure 401 {object} helper.ErrorResponse "Unauthorized" @Failure 422 {object} helper.ErrorResponse "Unprocessable Entity" @Failure 500 {object} helper.ErrorResponse "Server Error" @Security Bearer @Router /categories [get]

func GetAllProducts

func GetAllProducts(context *gin.Context)

GetAllProducts godoc @Summary Get All Products. @Tags Products @Accept json @Produce json @Param Authorization header string true "Bearer Token" @Success 200 {array} model.Product "Products fetched successfully" @Failure 400 {object} helper.ErrorResponse "Bad Request" @Failure 401 {object} helper.ErrorResponse "Unauthorized" @Failure 422 {object} helper.ErrorResponse "Unprocessable Entity" @Failure 500 {object} helper.ErrorResponse "Server Error" @Security Bearer @Router /products [get]

func GetAllTransaction

func GetAllTransaction(context *gin.Context)

GetAllTransactions godoc @Summary Get All Transactions. @Tags Transaction @Accept json @Produce json @Param Authorization header string true "Bearer Token" @Success 200 {array} model.TransactionHistory "Transactions fetched successfully" @Failure 400 {object} helper.ErrorResponse "Bad Request" @Failure 401 {object} helper.ErrorResponse "Unauthorized" @Failure 422 {object} helper.ErrorResponse "Unprocessable Entity" @Failure 500 {object} helper.ErrorResponse "Server Error" @Security Bearer @Router /transactions/user-transactions [get]

func GetTransactionsByUserID

func GetTransactionsByUserID(context *gin.Context)

GetUserTransactions godoc @Summary Get User Transactions. @Tags Transaction @Accept json @Produce json @Param Authorization header string true "Bearer Token" @Success 200 {array} model.GetTransactionUserResponse "Transactions fetched successfully" @Failure 400 {object} helper.ErrorResponse "Bad Request" @Failure 401 {object} helper.ErrorResponse "Unauthorized" @Failure 422 {object} helper.ErrorResponse "Unprocessable Entity" @Failure 500 {object} helper.ErrorResponse "Server Error" @Security Bearer @Router /transactions/my-transactions [get]

func Login

func Login(context *gin.Context)

UserLogin godoc @Summary Authenticate a user @Description Endpoint to register a new user @Tags User @Accept json @Produce json @Param model.LoginCredential body model.LoginCredential true "authenticate user" @Success 200 {string} string "OK" @Failure 400 {object} helper.ErrorResponse "Bad Request" @Failure 404 {object} helper.ErrorResponse "Not Found" @Failure 422 {object} helper.ErrorResponse "Invalid Request" @Failure 500 {object} helper.ErrorResponse "Server Error" @Router /users/login [post]

func Register

func Register(context *gin.Context)

UserRegister godoc @Summary Register a new user @Description Endpoint to register a new user @Tags User @Accept json @Produce json @Param model.UserRegister body model.UserRegister true "create user" @Success 201 {object} model.UserRegisterResponse @Failure 400 {object} helper.ErrorResponse "Bad Request" @Failure 404 {object} helper.ErrorResponse "Not Found" @Failure 422 {object} helper.ErrorResponse "Invalid Request" @Failure 500 {object} helper.ErrorResponse "Server Error" @Router /users/register [post]

func UpdateBalance

func UpdateBalance(context *gin.Context)

UserTopup godoc @Summary Topup user balance @Description Endpoint to top-up user balance @Tags User @Accept json @Produce json @Param Authorization header string true "Bearer Token" @Param model.User body model.BalanceUpdate true "Amount to top-up" @Success 200 {string} string "OK" @Failure 400 {object} helper.ErrorResponse "Bad Request" @Failure 401 {object} helper.ErrorResponse "Unauthorized" @Failure 404 {object} helper.ErrorResponse "Not Found" @Failure 422 {object} helper.ErrorResponse "Invalid Request" @Failure 500 {object} helper.ErrorResponse "Server Error" @Security Bearer @Router /users/topup [patch]

func UpdateCategory

func UpdateCategory(context *gin.Context)

UpdateCategory godoc @Summary Update a Category. @Tags Categories @Accept json @Produce json @Param Authorization header string true "Bearer Token" @Param categoryId path int true "Category ID" @Param model.Category body model.CategoryUpdate true "Category object to be updated" @Success 200 {object} model.User "Category updated successfully" @Failure 400 {object} helper.ErrorResponse "Bad Request" @Failure 401 {object} helper.ErrorResponse "Unauthorized" @Failure 422 {object} helper.ErrorResponse "Unprocessable Entity" @Failure 500 {object} helper.ErrorResponse "Server Error" @Security Bearer @Router /categories/{categoryId} [put]

func UpdateProduct

func UpdateProduct(context *gin.Context)

UpdateProduct godoc @Summary Update a Product. @Tags Products @Accept json @Produce json @Param Authorization header string true "Bearer Token" @Param productId path int true "Product ID" @Param model.Product body model.ProductUpdate true "Product object to be updated" @Success 200 {object} model.User "Product updated successfully" @Failure 400 {object} helper.ErrorResponse "Bad Request" @Failure 401 {object} helper.ErrorResponse "Unauthorized" @Failure 422 {object} helper.ErrorResponse "Unprocessable Entity" @Failure 500 {object} helper.ErrorResponse "Server Error" @Security Bearer @Router /products/{productId} [put]

Types

This section is empty.

Jump to

Keyboard shortcuts

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