handlers

package
v0.0.0-...-4f6929d Latest Latest
Warning

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

Go to latest
Published: Sep 4, 2023 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CreateFacts

func CreateFacts(c *fiber.Ctx) error

@Description Create a fact @Summary create a fact @Tags Facts @Accept json @Produce json @Param question body string true "Question" @Param answer body string true "Answer" @Success 200 {object} dto.FactsDTO @Failure 404 {object} string @Router /api/v1/facts [post]

func CreateUser

func CreateUser(c *fiber.Ctx) error

@Description Create a new user @Summary create a new user @Tags Users @Accept json @Produce json @Param user body dto.UserLoginBodyDTO true "User" @Success 201 {object} dto.UserDTO @Failure 400 {object} string @Router /auth/v1/register [post]

func DeleteFact

func DeleteFact(c *fiber.Ctx) error

@Description Delete a fact @Summary delete a fact @Tags Facts @Accept json @Produce json @Param id path int true "Fact ID" @Success 200 {object} dto.FactsDTO @Failure 404 {object} string @Router /api/v1/facts/{id} [delete]

func DeleteUser

func DeleteUser(c *fiber.Ctx) error

@Description Delete a user with given id @Summary delete a user @Tags Users @Accept json @Produce json @Param id path int true "User ID" @Success 200 {object} dto.UserDTO @Failure 400 {object} string @Router /auth/v1/users/{id} [delete]

func GetMe

func GetMe(c *fiber.Ctx) error

@Description Get current user @Summary get current user @Tags Users @Accept json @Produce json @Success 200 {object} dto.UserDTO @Failure 400 {object} string @Router /auth/v1/users/me [get]

func GetSingleFact

func GetSingleFact(c *fiber.Ctx) error

@Description Get a single fact @Summary get a single fact @Tags Facts @Accept json @Produce json @Param id path int true "Fact ID" @Success 200 {object} dto.FactsDTO @Failure 404 {object} string @Router /api/v1/facts/{id} [get]

func GetUser

func GetUser(c *fiber.Ctx) error

@Description Get a user with given id @Summary get a user @Tags Users @Accept json @Produce json @Param id path int true "User ID" @Success 200 {object} dto.UserDTO @Failure 400 {object} string @Router /auth/v1/users/{id} [get]

func ListFacts

func ListFacts(c *fiber.Ctx) error

@Description List all facts @Summary get all facts @Tags Facts @Accept json @Produce json @Success 200 {object} []dto.FactsDTO @Failure 404 {object} string @Router /api/v1/facts [get]

func LoginUser

func LoginUser(c *fiber.Ctx) error

@Description Login a user, returns access token, refresh token as cookies, user data and access token as json @Summary login a user @Tags Users @Accept json @Produce json @Param user body dto.UserLoginBodyDTO true "User" @Success 202 {object} dto.UserDTO @Failure 400 {object} string @Router /auth/v1/login [post]

func LogoutUser

func LogoutUser(c *fiber.Ctx) error

@Description Logout a user, deletes refresh token from redis and access token from cookie @Summary logout a user @Tags Users @Accept json @Produce json @Success 200 {object} string @Failure 400 {object} string @Router /auth/v1/logout [get]

func RefreshAccessToken

func RefreshAccessToken(c *fiber.Ctx) error

@Description Refresh access token @Summary refresh access token @Tags Users @Accept json @Produce json @Success 202 {object} dto.UserDTO @Failure 400 {object} string @Router /auth/v1/refresh [get]

func UpdateUser

func UpdateUser(c *fiber.Ctx) error

@Description Update a user with given id @Summary update a user @Tags Users @Accept json @Produce json @Param id path int true "User ID" @Param user body dto.UserUpdateBodyDTO true "User" @Success 200 {object} dto.UserDTO @Failure 400 {object} string @Router /auth/v1/users/{id} [put]

Types

This section is empty.

Jump to

Keyboard shortcuts

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