controllers

package
v0.0.0-...-982d919 Latest Latest
Warning

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

Go to latest
Published: Jul 5, 2022 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateUser

func CreateUser() http.HandlerFunc

CreateUser godoc @Description Create a new user @Accept json @Produce json @Param user body models.User true "User Data" @Success 201 {object} responses.UserResponse{status=int,message=string,data=map[string]interface{}} "Successfully create a new user" @Failure 400 {object} responses.UserResponse{status=int,message=string,data=map[string]interface{}} "There is an issue with the request body" @Failure 500 {object} responses.UserResponse{status=int,message=string,data=map[string]interface{}} "Fail to create a new user" @Router /user [post]

func DeleteAllUsers

func DeleteAllUsers() http.HandlerFunc

DeleteAllUsers godoc @Description Delete all users from the database @Produce json @Success 200 {object} responses.UserResponse{status=int,message=string,data=map[string]interface{}} "Successfully delete all users" @Failure 500 {object} responses.UserResponse{status=int,message=string,data=map[string]interface{}} "Fail to delete all users" @Router /users/ [delete]

func DeleteUser

func DeleteUser() http.HandlerFunc

DeleteUser godoc @Description Update a user's information by userID @Produce json @Param userId path string true "User ID" @Success 200 {object} responses.UserResponse{status=int,message=string,data=map[string]interface{}} "Successfully delete a user" @Failure 400 {object} responses.UserResponse{status=int,message=string,data=map[string]interface{}} "user ID is not provided" @Failure 404 {object} responses.UserResponse{status=int,message=string,data=map[string]interface{}} "A user with the specified ID could not be found" @Failure 500 {object} responses.UserResponse{status=int,message=string,data=map[string]interface{}} "Fail to delete a user" @Router /user/{userId}/ [delete]

func GetAllUsers

func GetAllUsers() http.HandlerFunc

GetAllUsers godoc @Description Retrieve all users from the database @Produce json @Success 200 {object} responses.UserResponse{status=int,message=string,data=map[string]interface{}} "Successfully retrieve all users" @Failure 500 {object} responses.UserResponse{status=int,message=string,data=map[string]interface{}} "Fail to retrieve all users" @Router /users/ [get]

func GetUser

func GetUser() http.HandlerFunc

GetUser godoc @Description Get a user by userID @Produce json @Param userId path string true "User ID" @Success 200 {object} responses.UserResponse{status=int,message=string,data=map[string]interface{}} "Successfully get a user by their ID" @Failure 400 {object} responses.UserResponse{status=int,message=string,data=map[string]interface{}} "user ID is not provided" @Failure 404 {object} responses.UserResponse{status=int,message=string,data=map[string]interface{}} "A user with the specified ID could not be found" @Router /user/{userId} [get]

func UpdateUser

func UpdateUser() http.HandlerFunc

UpdateUser godoc @Description Update a user's information by userID @Accept json @Produce json @Param userId path string true "User ID" @Success 200 {object} responses.UserResponse{status=int,message=string,data=map[string]interface{}} "Successfully update a user" @Failure 400 {object} responses.UserResponse{status=int,message=string,data=map[string]interface{}} "user ID is not provided or request body is improperly formatted" @Failure 404 {object} responses.UserResponse{status=int,message=string,data=map[string]interface{}} "A user with the specified ID could not be found" @Failure 500 {object} responses.UserResponse{status=int,message=string,data=map[string]interface{}} "Fail to update a user's information" @Router /user/{userId} [put]

Types

This section is empty.

Jump to

Keyboard shortcuts

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