handlers

package
v1.0.2 Latest Latest
Warning

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

Go to latest
Published: Dec 25, 2023 License: MIT Imports: 19 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AuthMiddleware

func AuthMiddleware(db *gorm.DB) gin.HandlerFunc

func CreateTodo

func CreateTodo(c *gin.Context)

Create godoc @Summary Create a TODO in a specific TODO list @Schemes @Description Returns an newly created TODO in a specific TODO list @Tags TODO @Accept json @Produce json @Param listID path string true "ID of a TODO list" @Param body body models.Todo true "TODO" @Success 200 {object} models.Todo @Failure 401 {object} ErrorSchema @Failure 500 {object} ErrorSchema @Security HttpBearer @Router /list/{listID}/todo/ [post]

func CreateTodoList

func CreateTodoList(c *gin.Context)

Create godoc @Summary Create a TODO list @Schemes @Description Returns an newly created TODO list @Tags TODO list @Accept json @Produce json @Param body body models.TodoList true "TODO list" @Success 200 {object} models.TodoList @Failure 401 {object} ErrorSchema @Failure 500 {object} ErrorSchema @Security HttpBearer @Router /list/ [post]

func CreateUser

func CreateUser(c *gin.Context)

Create godoc @Summary Create a user @Schemes @Description Returns an newly created user @Tags registration @Accept json @Produce json @Param body body models.User true "User object" @Success 200 {object} models.User @Failure 401 {object} ErrorSchema @Failure 500 {object} ErrorSchema @Router /user/ [post]

func DefineRoutes

func DefineRoutes(db *gorm.DB, r *gin.Engine)

func DeleteTodo

func DeleteTodo(c *gin.Context)

Create godoc @Summary Delete a TODO from a specific TODO list @Schemes @Description Deletes a TODO from a specific TODO list @Tags TODO @Accept json @Produce json @Param listID path string true "ID of a TODO list" @Param todoID path string true "ID of a TODO" @Success 200 {object} models.Todo @Failure 401 {object} ErrorSchema @Failure 500 {object} ErrorSchema @Security HttpBearer @Router /list/{listID}/todo/{todoID}/ [delete]

func DeleteTodoList

func DeleteTodoList(c *gin.Context)

Create godoc @Summary Delte a TODO list @Schemes @Description Deletes a particular TODO list by its ID @Tags TODO list @Accept json @Produce json @Param listID path string true "ID of a TODO list" @Success 200 {object} models.TodoList @Failure 401 {object} ErrorSchema @Failure 500 {object} ErrorSchema @Security HttpBearer @Router /list/{listID}/ [delete]

func DeleteUser

func DeleteUser(c *gin.Context)

Create godoc @Summary Delete a user @Schemes @Description Deletes a user by its ID @Tags users @Accept json @Produce json @Param userID path string true "ID of a User" @Success 204 {object} models.User @Failure 401 {object} ErrorSchema @Failure 500 {object} ErrorSchema @Security HttpBearer @Router /user/{userID}/ [delete]

func FacebookLogin

func FacebookLogin(c *gin.Context)

func FacebookLoginCallback

func FacebookLoginCallback(c *gin.Context)

func GetTodo

func GetTodo(c *gin.Context)

Create godoc @Summary Get a TODO in a specific TODO list @Schemes @Description Returns a TODO in a specific TODO list @Tags TODO @Accept json @Produce json @Param listID path string true "ID of a TODO list" @Param todoID path string true "ID of a TODO" @Success 200 {object} models.Todo @Failure 401 {object} ErrorSchema @Failure 500 {object} ErrorSchema @Security HttpBearer @Router /list/{listID}/todo/{todoID}/ [get]

func GetTodoList

func GetTodoList(c *gin.Context)

Create godoc @Summary Get a TODO list @Schemes @Description Returns a particular TODO list by its ID @Tags TODO list @Accept json @Produce json @Param listID path string true "ID of a TODO list" @Success 200 {object} models.TodoList @Failure 401 {object} ErrorSchema @Failure 500 {object} ErrorSchema @Security HttpBearer @Router /list/{listID}/ [get]

func GetTodoLists

func GetTodoLists(c *gin.Context)

Create godoc @Summary Get a TODO lists @Schemes @Description Returns TODO lists @Tags TODO list @Accept json @Produce json @Success 200 {object} []models.TodoList @Failure 401 {object} ErrorSchema @Failure 500 {object} ErrorSchema @Security HttpBearer @Router /list/ [get]

func GetTodos

func GetTodos(c *gin.Context)

Create godoc @Summary Get TODOs in a specific TODO list @Schemes @Description Returns a list of TODOs in a specific TODO list @Tags TODO @Accept json @Produce json @Param listID path string true "ID of a TODO list" @Success 200 {object} []models.Todo @Failure 401 {object} ErrorSchema @Failure 500 {object} ErrorSchema @Security HttpBearer @Router /list/{listID}/todo/ [get]

func GetUser

func GetUser(c *gin.Context)

Create godoc @Summary Get a user @Schemes @Description Returns a user by its ID @Tags users @Accept json @Produce json @Param userID path string true "ID of a User" @Success 200 {object} models.User @Failure 401 {object} ErrorSchema @Failure 500 {object} ErrorSchema @Security HttpBearer @Router /user/{userID}/ [get]

func GetUsers

func GetUsers(c *gin.Context)

Create godoc @Summary Get list of users @Schemes @Description Returns a list of users @Tags users @Accept json @Produce json @Success 200 {object} []models.User @Failure 401 {object} ErrorSchema @Failure 500 {object} ErrorSchema @Security HttpBearer @Router /user/ [get]

func Login

func Login(c *gin.Context)

Create godoc @Summary Create auth token @Schemes @Description Returns an newly created authentication token @Tags auth @Accept json @Produce json @Param body body LoginSchema true "User credentials" @Success 200 {object} TokenSchema @Failure 401 {object} ErrorSchema @Failure 500 {object} ErrorSchema @Router /auth/login/ [post]

func OptionsLogin

func OptionsLogin(c *gin.Context)

func OptionsTodo

func OptionsTodo(c *gin.Context)

func OptionsTodoList

func OptionsTodoList(c *gin.Context)

func OptionsUser

func OptionsUser(c *gin.Context)

func TodoGraphql

func TodoGraphql(c *gin.Context)

func TodoListGraphql

func TodoListGraphql(c *gin.Context)

func UpdateTodo

func UpdateTodo(c *gin.Context)

Create godoc @Summary Update a TODO in a specific TODO list @Schemes @Description Updates and returns a TODO in a specific TODO list @Tags TODO @Accept json @Produce json @Param listID path string true "ID of a TODO list" @Param todoID path string true "ID of a TODO" @Param body body models.Todo true "TODO" @Success 200 {object} models.Todo @Failure 401 {object} ErrorSchema @Failure 500 {object} ErrorSchema @Security HttpBearer @Router /list/{listID}/todo/{todoID}/ [put]

func UpdateTodoList

func UpdateTodoList(c *gin.Context)

Create godoc @Summary Update a TODO list @Schemes @Description Updates a particular TODO list by its ID @Tags TODO list @Accept json @Produce json @Param listID path string true "ID of a TODO list" @Param body body models.TodoList true "TODO list" @Success 200 {object} models.TodoList @Failure 401 {object} ErrorSchema @Failure 500 {object} ErrorSchema @Security HttpBearer @Router /list/{listID}/ [put]

func UpdateUser

func UpdateUser(c *gin.Context)

Create godoc @Summary Update a user @Schemes @Description Updates a user by its ID @Tags users @Accept json @Produce json @Param userID path string true "ID of a User" @Param body body models.User true "User object" @Success 200 {object} models.User @Failure 401 {object} ErrorSchema @Failure 500 {object} ErrorSchema @Security HttpBearer @Router /user/{userID}/ [put]

func UserGraphql

func UserGraphql(c *gin.Context)

Types

type ErrorSchema

type ErrorSchema struct {
	Error string `form:"error" json:"error" binding:"required"`
}

type LoginSchema

type LoginSchema struct {
	Email    string `form:"email" json:"email" binding:"required"`
	Password string `form:"Password" json:"Password" binding:"required"`
}

type TokenSchema

type TokenSchema struct {
	Token string `form:"token" json:"token" binding:"required"`
}

Jump to

Keyboard shortcuts

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