handlers

package
v0.0.0-...-46acaf8 Latest Latest
Warning

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

Go to latest
Published: Jun 21, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HandleAllTodos

func HandleAllTodos(c *fiber.Ctx) error

@Summary Get all todos. @Description fetch every todo available. @Tags todos @Accept */* @Produce json @Success 200 {object} []models.Todo @Router /todos [get]

func HandleCreateTodo

func HandleCreateTodo(c *fiber.Ctx) error

@Summary Create a todo. @Description create a single todo. @Tags todos @Accept json @Param todo body CreateTodoDTO true "Todo to create" @Produce json @Success 200 {object} CreateTodoResDTO @Router /todos [post]

func HandleDeleteTodo

func HandleDeleteTodo(c *fiber.Ctx) error

@Summary Delete a single todo. @Description delete a single todo by id. @Tags todos @Param id path string true "Todo ID" @Produce json @Success 200 {object} DeleteTodoResDTO @Router /todos/:id [delete]

func HandleGetOneTodo

func HandleGetOneTodo(c *fiber.Ctx) error

@Summary Get a single todo. @Description fetch a single todo. @Tags todos @Param id path string true "Todo ID" @Produce json @Success 200 {object} models.Todo @Router /todos/:id [get]

func HandleHealthCheck

func HandleHealthCheck(c *fiber.Ctx) error

@Summary Show the status of server. @Description get the status of server. @Tags health @Accept */* @Produce plain @Success 200 "OK" @Router /health [get]

func HandleUpdateTodo

func HandleUpdateTodo(c *fiber.Ctx) error

@Summary Update a todo. @Description update a single todo. @Tags todos @Accept json @Param todo body UpdateTodoDTO true "Todo update data" @Param id path string true "Todo ID" @Produce json @Success 200 {object} UpdateTodoResDTO @Router /todos/:id [put]

Types

type CreateTodoDTO

type CreateTodoDTO struct {
	Title       string `json:"title" bson:"title"`
	Completed   bool   `json:"completed" bson:"completed"`
	Description string `json:"description" bson:"description"`
	Date        string `json:"date" bson:"date"`
}

type CreateTodoResDTO

type CreateTodoResDTO struct {
	InsertedId primitive.ObjectID `json:"inserted_id" bson:"_id"`
}

type DeleteTodoResDTO

type DeleteTodoResDTO struct {
	DeletedCount int64 `json:"deleted_count" bson:"deleted_count"`
}

type UpdateTodoDTO

type UpdateTodoDTO struct {
	Title       string `json:"title" bson:"title"`
	Completed   bool   `json:"completed" bson:"completed"`
	Description string `json:"description" bson:"description"`
	Date        string `json:"date" bson:"date"`
}

type UpdateTodoResDTO

type UpdateTodoResDTO struct {
	UpdatedCount int64 `json:"updated_count" bson:"updated_count"`
}

Jump to

Keyboard shortcuts

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