Documentation ¶
Index ¶
- func CreateCategory(context *gin.Context)
- func CreateProduct(context *gin.Context)
- func CreateTransaction(context *gin.Context)
- func DeleteCategory(context *gin.Context)
- func DeleteProduct(context *gin.Context)
- func GetAllCategories(context *gin.Context)
- func GetAllProducts(context *gin.Context)
- func GetAllTransaction(context *gin.Context)
- func GetTransactionsByUserID(context *gin.Context)
- func Login(context *gin.Context)
- func Register(context *gin.Context)
- func UpdateBalance(context *gin.Context)
- func UpdateCategory(context *gin.Context)
- func UpdateProduct(context *gin.Context)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CreateCategory ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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 ¶
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.