controllers

package
v0.0.0-...-6fd4c63 Latest Latest
Warning

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

Go to latest
Published: Feb 9, 2024 License: MIT Imports: 9 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateOrder

func CreateOrder(c *gin.Context)

CreateOrder Create Order @Summary Create Order @Description Creates a new order. @Tags Order @Accept json @Produce json @Param order body models.Order true "Order object" @Success 201 {object} object "{"message": "Created Successfully", "id": string}" @Failure 500 {object} object "{"message": "Internal Server Error"}" @Router /order [post]

func CreateProduct

func CreateProduct(c *gin.Context)

CreateProduct Create Product @Summary Create Product @Description Creates a new product. @Tags Product @Security ApiKeyAuth @Accept multipart/form-data @Produce json @Param Authorization header string true "Bearer token" @Param name formData string true "Product Name" @Param description formData string false "Product Description" @Param price formData number true "Product Price" @Param color formData []string false "Product Colors" @Param file formData file true "Product Images" @Success 201 {object} object "{"message": "Created Product Successfully", "productId": string, "id": string}" @Failure 400 {object} object "{"message": "Bad Request"}" @Failure 500 {object} object "{"message": "Error during creation of product"}" @Router /product/ [post]

func CreateReview

func CreateReview(c *gin.Context)

CreateReview Create Review @Summary Create Review @Description Creates a new review for a product by ID. @Tags Review @Accept json @Produce json @Param id path string true "Product ID" @Param review body models.Review true "Review object" @Success 200 {object} object "{"message": "Review added successfully", "id": string}" @Failure 400 {object} object "{"message": "Invalid data"}" @Failure 500 {object} object "{"message": "Error during creating review"}" @Router /review/{id} [post]

func CreateShiipingAddress

func CreateShiipingAddress(c *gin.Context)

CreateShiipingAddress Create Shipping Address @Summary Create Shipping Address @Description Creates a new shipping address. @Tags Shipping @Accept json @Produce json @Param shipping body models.Shipping true "Shipping object" @Success 200 {object} object "{"message": "Created Successfully", "_id": string}" @Failure 400 {object} object "{"message": "Bad Request"}" @Failure 500 {object} object "{"message": "Internal Server Error"}" @Router /order/shipping [post]

func DeleteProduct

func DeleteProduct(c *gin.Context)

DeleteProduct Delete Product @Summary Delete Product @Description Deletes a product by ID. @Tags Product @Security ApiKeyAuth @Accept json @Produce json @Param Authorization header string true "Bearer token" @Param id path string true "Product ID" @Success 200 {object} object "{"message": "Product Deleted", "count": integer}" @Failure 500 {object} object "{"message": "Internal Server Error"}" @Router /product/{id} [delete]

func DeleteReview

func DeleteReview(c *gin.Context)

DeleteReview Delete Review @Summary Delete Review @Description Deletes a review by ID. @Tags Review @Accept json @Produce json @Param id path string true "Review ID" @Success 200 {object} object "{"count": integer}" @Failure 400 {object} object "{"message": "Please Provide ID"}" @Failure 500 {object} object "{"message": "Internal Server Error"}" @Router /review/{id} [delete]

func GetAllOrders

func GetAllOrders(c *gin.Context)

GetAllOrders Get All Orders @Summary Get All Orders @Description Retrieves a list of all orders. @Tags Order @Accept json @Produce json @Success 200 {object} object "{"message": "All orders", "orders": []}" @Failure 500 {object} object "{"message": "Internal Server Error"}" @Router /order [get]

func GetAllProduct

func GetAllProduct(c *gin.Context)

GetAllProduct Get All Products @Summary Get All Products @Description Retrieves a list of all products. @Tags Product @Accept json @Produce json @Param lt query string false "Price less than" @Param gt query string false "Price greater than" @Param color query string false "Color filter" @Success 200 {object} object "{"message": "All products", "products": []}" @Failure 500 {object} object "{"message": "Internal Server Error"}" @Router /product/ [get]

func GetAllReviews

func GetAllReviews(c *gin.Context)

GetAllReviews Get All Reviews @Summary Get All Reviews @Description Retrieves a list of all reviews. @Tags Review @Accept json @Produce json @Success 200 {object} object "{"total": integer, "reviews": []}" @Failure 500 {object} object "{"message": "Internal Server Error"}" @Router /review [get]

func GetAllUsers

func GetAllUsers(c *gin.Context)

GetAllUsers Get All User GetAllUsers Get All Users @Summary Get All Users @Description Retrieves a list of all users. @Tags User @Produce json @Success 200 {object} object "{"message": "All user list", "total": integer, "users": []}" @Failure 404 {object} object "{"message": "No users Found"}" @Router /user [get]

func GetOrder

func GetOrder(c *gin.Context)

GetOrder Get Order @Summary Get Order @Description Retrieves an order by ID. @Tags Order @Accept json @Produce json @Param id path string true "Order ID" @Success 200 {object} object "{"message": "Success", "order": object}" @Failure 500 {object} object "{"message": "Internal Server Error"}" @Router /order/{id} [get]

func GetProductById

func GetProductById(c *gin.Context)

GetProductById Get Product By ID @Summary Get Product By ID @Description Retrieves product information by ID. @Tags Product @Accept json @Produce json @Param id path string true "Product ID" @Success 200 {object} object "{"message": "Get product by id", "product": object}" @Failure 404 {object} object "{"message": "No Product Found"}" @Router /product/{id} [get]

func GetProfile

func GetProfile(c *gin.Context)

GetProfile GEt Profile GetProfile Get User Profile @Summary Get User Profile @Description Retrieves the profile information of the authenticated user. @Tags User @Security ApiKeyAuth @Accept json @Produce json @Param Authorization header string true "Bearer token" @Success 200 {object} object "{"user": "User profile information"}" @Failure 401 {object} object "{"message": "Unauthorized"}" @Router /user/profile [get]

func GetRevById

func GetRevById(c *gin.Context)

GetRevById Get Review By ID @Summary Get Review By ID @Description Retrieves a review by ID. @Tags Review @Accept json @Produce json @Param id path string true "Review ID" @Success 200 {object} object "{"message": "Got successfully", "review": object}" @Failure 500 {object} object "{"message": "Internal Server Error"}" @Router /review/{id} [get]

func GetUser

func GetUser(c *gin.Context)

GetUser Get User By Id GetUser By Id @Summary Get User By Id @Description Retrieves user information by ID. @Tags User @Param id path string true "User ID" @Produce json @Success 200 {object} object "{"message": "User information"}" @Failure 404 {object} object "{"message": "No user Found"}" @Router /user/{id} [get]

func LoginUser

func LoginUser(c *gin.Context)

LoginUser Login User LoginUser Login User @Summary Login User @Description Responds with the message and token books as JSON. @Tags User @Param user body models.User true "User object" @Produce json @Success 200 {object} object "{"message": "Login Successfully", "token": string}" @Failure 400 {object} object "{"message": "Inavalid data"} "Bad request" @Failure 401 {object} object "{"message": "No user Found"} "Unauthorized er Error" @Router /user/register [post]

func LogoutUser

func LogoutUser(c *gin.Context)

LogoutUser Logout User @Summary Logout User @Description Logs out the user by removing the token cookie. @Tags User @Produce json @Success 200 {object} object "{"message": "Logout successfully"}" @Router /user/logout [get]

func RegisterUser

func RegisterUser(c *gin.Context)

RegisterUser Register User @Summary Create a new User @Description Responds with the message and token books as JSON. @Tags User @Param user body models.User true "User object" @Produce json @Success 200 {object} object "{"message": "User Created successfully", "token": string}" @Failure 400 {object} object "{"message": "Bad request"} "Bad request" @Failure 500 {object} object "{"message": "Internal Server Error"} "Internal Server Error" @Router /user/register [post]

func UpdateOrde

func UpdateOrde(c *gin.Context)

UpdateOrde Update Order @Summary Update Order @Description Updates the status of an order by ID. @Tags Order @Accept json @Produce json @Param id path string true "Order ID" @Param order body models.Order true "Order object" @Success 200 {object} object "{"message": "Updated successfully", "count": integer}" @Failure 400 {object} object "{"message": "Order Status is empty"}" @Failure 500 {object} object "{"message": "Internal Server Error"}" @Router /order/{id} [put]

func UpdateProduct

func UpdateProduct(c *gin.Context)

UpdateProduct Update Product @Summary Update Product @Description Updates product information by ID. @Tags Product @Security ApiKeyAuth @Accept json @Produce json @Param Authorization header string true "Bearer token" @Param id path string true "Product ID" @Param product body models.Product true "Product object" @Success 200 {object} object "{"message": "Updated Successfully", "count": integer}" @Failure 400 {object} object "{"message": "Bad Request"}" @Failure 500 {object} object "{"message": "Internal Server Error"}" @Router /product/{id} [put]

func UpdateReview

func UpdateReview(c *gin.Context)

UpdateReview Update Review @Summary Update Review @Description Updates a review by ID. @Tags Review @Accept json @Produce json @Param id path string true "Review ID" @Param review body models.Review true "Review object" @Success 200 {object} object "{"updatedCount": integer}" @Failure 400 {object} object "{"message": "Provide the valid data"}" @Failure 500 {object} object "{"message": "Internal Server Error"}" @Router /review/{id} [put]

func UpdateUser

func UpdateUser(c *gin.Context)

UpdateUser UPadte User Profile UpdateUser Update User @Summary Update User @Description Updates user information. @Tags User @Security ApiKeyAuth @Accept json @Produce json @Param Authorization header string true "Bearer token" @Param user body models.User true "User object" @Success 200 {object} object "{"message": "Updated successfully", "count": integer}" @Failure 400 {object} object "{"message": "Invalid info"}" @Failure 500 {object} object "{"message": "Error during updating user"}" @Router /user [put]

Types

This section is empty.

Jump to

Keyboard shortcuts

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