handlers

package
v0.0.0-...-9d3d7fb Latest Latest
Warning

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

Go to latest
Published: Aug 28, 2022 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func CORSMiddleware

func CORSMiddleware() gin.HandlerFunc

func NewErrorResponse

func NewErrorResponse(c *gin.Context, statusCode int, message string)

func NewServerErrorResponse

func NewServerErrorResponse(c *gin.Context, statusCode int, message string)

Types

type Handler

type Handler struct {
	PostgresDB    db.PostgresDB
	RedisClient   db.RedisClient
	MinIOClient   db.MinIOClient
	EmailAuthData common.EmailProvider
}

func (*Handler) AddList

func (h *Handler) AddList(c *gin.Context)

@Summary Create list @Tags Working with lists @Accept json @Produce json @Param ListData body models.ApiListData true "List data" @Success 200 {object} models.ApiMessage @Failure 400 {object} models.ApiError @Failure 404 {object} models.ApiError @Failure 500 {object} models.ApiError @Security token @Router /todo/list/add [post]

func (*Handler) AddSubtask

func (h *Handler) AddSubtask(c *gin.Context)

@Summary Create subtask @Tags Working with subtasks @Accept json @Produce json @Param SubtaskData body models.ApiSubtaskData true "Subtask data" @Success 200 {object} models.ApiMessage @Failure 400 {object} models.ApiError @Failure 404 {object} models.ApiError @Failure 500 {object} models.ApiError @Security token @Router /todo/subtask/add [post]

func (*Handler) AddTask

func (h *Handler) AddTask(c *gin.Context)

@Summary Create task @Tags Working with tasks @Accept json @Produce json @Param TaskData body models.ApiTaskData true "Task data" @Success 200 {object} models.ApiMessage @Failure 400 {object} models.ApiError @Failure 404 {object} models.ApiError @Failure 500 {object} models.ApiError @Security token @Router /todo/task/add [post]

func (*Handler) DeleteList

func (h *Handler) DeleteList(c *gin.Context)

@Summary Delete list @Tags Working with lists @Accept json @Produce json @Param list_id query int true "The id of the list to be deleted" @Success 200 {object} models.ApiMessage @Failure 404 {object} models.ApiError @Failure 500 {object} models.ApiError @Security token @Router /todo/list/delete [delete]

func (*Handler) DeleteSubtask

func (h *Handler) DeleteSubtask(c *gin.Context)

@Summary Delete subtask @Tags Working with subtasks @Accept json @Produce json @Param subtask_id query int true "The id of the subtask to be deleted" @Success 200 {object} models.ApiMessage @Failure 404 {object} models.ApiError @Failure 500 {object} models.ApiError @Security token @Router /todo/subtask/delete [delete]

func (*Handler) DeleteTask

func (h *Handler) DeleteTask(c *gin.Context)

@Summary Delete task @Tags Working with tasks @Accept json @Produce json @Param task_id query int true "The id of the task to be deleted" @Success 200 {object} models.ApiMessage @Failure 404 {object} models.ApiError @Failure 500 {object} models.ApiError @Security token @Router /todo/task/delete [delete]

func (*Handler) DeleteUser

func (h *Handler) DeleteUser(c *gin.Context)

@Summary Delete user account @Tags User settings @Accept json @Produce json @Param password query string true "User password" @Success 200 {object} models.ApiMessage @Failure 400 {object} models.ApiError @Failure 404 {object} models.ApiError @Failure 500 {object} models.ApiError @Security token @Router /user/delete/account [delete]

func (*Handler) DeleteUserIcon

func (h *Handler) DeleteUserIcon(c *gin.Context)

@Summary Delete user icon @Tags User settings @Accept json @Produce json @Success 200 {object} models.ApiMessage @Failure 400 {object} models.ApiError @Failure 404 {object} models.ApiError @Failure 500 {object} models.ApiError @Security token @Router /user/delete/icon [delete]

func (*Handler) EditList

func (h *Handler) EditList(c *gin.Context)

@Summary Edit list @Tags Working with lists @Accept json @Produce json @Param ListData body models.ListEditData true "List data" @Success 200 {object} models.ApiMessage @Failure 400 {object} models.ApiError @Failure 404 {object} models.ApiError @Failure 500 {object} models.ApiError @Security token @Router /todo/list/edit [put]

func (*Handler) EditSubtask

func (h *Handler) EditSubtask(c *gin.Context)

@Summary Edit subtask @Tags Working with subtasks @Accept json @Produce json @Param SubtaskData body models.SubtaskEditData true "Subtask data" @Success 200 {object} models.ApiMessage @Failure 400 {object} models.ApiError @Failure 404 {object} models.ApiError @Failure 500 {object} models.ApiError @Security token @Router /todo/subtask/edit [put]

func (*Handler) EditTask

func (h *Handler) EditTask(c *gin.Context)

@Summary Edit task @Tags Working with tasks @Accept json @Produce json @Param TaskData body models.TaskEditData true "Task data" @Success 200 {object} models.ApiMessage @Failure 400 {object} models.ApiError @Failure 404 {object} models.ApiError @Failure 500 {object} models.ApiError @Security token @Router /todo/task/edit [put]

func (*Handler) EditUserName

func (h *Handler) EditUserName(c *gin.Context)

@Summary Change user name @Tags User settings @Accept json @Produce json @Param NewUserName body models.UserName true "User name" @Success 200 {object} models.ApiMessage @Failure 404 {object} models.ApiError @Failure 500 {object} models.ApiError @Security token @Router /user/settings/update/name [patch]

func (*Handler) EditUserUsername

func (h *Handler) EditUserUsername(c *gin.Context)

@Summary Change user username @Tags User settings @Accept json @Produce json @Param NewUsername body models.UserUsername true "Username" @Success 200 {object} models.ApiMessage @Failure 404 {object} models.ApiError @Failure 500 {object} models.ApiError @Security token @Router /user/settings/update/username [patch]

func (*Handler) GetUserData

func (h *Handler) GetUserData(c *gin.Context)

@Summary Get basic user data @Tags Show user data @Accept json @Produce json @Param user_id query int true "User id" @Success 200 {object} models.ShowUserData @Failure 404 {object} models.ApiError @Failure 500 {object} models.ApiError @Router /user/show/data-by-id [get]

func (*Handler) GetUserDataByToken

func (h *Handler) GetUserDataByToken(c *gin.Context)

@Summary Get basic user data @Tags Show user data @Accept json @Produce json @Success 200 {object} models.ShowUserData @Failure 404 {object} models.ApiError @Failure 500 {object} models.ApiError @Security token @Router /user/show/data-by-token [get]

func (*Handler) GetUserIcon

func (h *Handler) GetUserIcon(c *gin.Context)

@Summary Get user icon @Tags Show user data @Accept json @Produce json @Param user_id query int true "User id" @Failure 400 {object} models.ApiError @Failure 404 {object} models.ApiError @Failure 500 {object} models.ApiError @Router /user/show/icon [get]

func (*Handler) InitRoutes

func (h *Handler) InitRoutes() *gin.Engine

func (*Handler) ResetUserEmail

func (h *Handler) ResetUserEmail(c *gin.Context)

@Summary Reset user email @Tags User settings @Accept json @Produce json @Param NewUserEmail body models.UserEmail true "New user email" @Success 200 {object} models.ApiMessage @Failure 400 {object} models.ApiError @Failure 500 {object} models.ApiError @Security token @Router /user/settings/reset/email [post]

func (*Handler) ResetUserPassword

func (h *Handler) ResetUserPassword(c *gin.Context)

@Summary Reset user password @Tags User settings @Accept json @Produce json @Param UserEmail body models.UserEmail true "User data" @Success 200 {object} models.UserTokens @Failure 400 {object} models.ApiError @Failure 500 {object} models.ApiError @Router /user/settings/reset/password [post]

func (*Handler) ShowLists

func (h *Handler) ShowLists(c *gin.Context)

@Summary Shows all lists created by the user @Tags Working with lists @Accept json @Produce json @Success 200 {object} models.ApiShowLists @Failure 404 {object} models.ApiError @Security token @Router /todo/list/show [get]

func (*Handler) ShowSubtasks

func (h *Handler) ShowSubtasks(c *gin.Context)

@Summary Shows all subtasks in the task @Tags Working with subtasks @Accept json @Produce json @Param task_id query int true "Task id with subtasks" @Success 200 {object} models.ApiShowSubtasks @Failure 404 {object} models.ApiError @Failure 500 {object} models.ApiError @Security token @Router /todo/subtask/show [get]

func (*Handler) ShowTasks

func (h *Handler) ShowTasks(c *gin.Context)

@Summary Shows all tasks in the list @Tags Working with tasks @Accept json @Produce json @Param list_id query int true "List id with tasks" @Success 200 {object} models.ApiShowTasks @Failure 404 {object} models.ApiError @Failure 500 {object} models.ApiError @Security token @Router /todo/task/show [get]

func (*Handler) SignIn

func (h *Handler) SignIn(c *gin.Context)

@Summary Sign in to your account @Tags Authorization @Accept json @Produce json @Param LoginData body models.UserLoginData true "User data" @Success 200 {object} models.UserTokens @Failure 400 {object} models.ApiError @Failure 500 {object} models.ApiError @Router /auth/sign-in [post]

func (*Handler) SignUp

func (h *Handler) SignUp(c *gin.Context)

@Summary Register a user @Tags Authorization @Accept json @Produce json @Param UserData body models.UserData true "User data" @Success 200 {object} models.ApiMessage @Failure 400 {object} models.ApiError @Failure 404 {object} models.ApiError @Failure 500 {object} models.ApiError @Router /auth/sign-up [post]

func (*Handler) UpdateUserEmail

func (h *Handler) UpdateUserEmail(c *gin.Context)

@Summary Update user email @Tags User settings @Accept json @Produce json @Param key query string true "Veryfication key" @Success 200 {object} models.ApiMessage @Failure 400 {object} models.ApiError @Failure 500 {object} models.ApiError @Router /user/settings/update/email [patch]

func (*Handler) UpdateUserIcon

func (h *Handler) UpdateUserIcon(c *gin.Context)

@Summary Update user icon @Tags User settings @Accept json @Produce json @Param icon formData file true "User icon" @Success 200 {object} models.ApiMessage @Failure 400 {object} models.ApiError @Failure 500 {object} models.ApiError @Security token @Router /user/settings/update/icon [put]

func (*Handler) UpdateUserPassword

func (h *Handler) UpdateUserPassword(c *gin.Context)

@Summary Update user password @Tags User settings @Accept json @Produce json @Param NewUserPassword body models.UserPassword true "User password" @Param key query string true "Veryfication key" @Success 200 {object} models.UserTokens @Failure 404 {object} models.ApiError @Failure 500 {object} models.ApiError @Router /user/settings/update/password [patch]

func (*Handler) UpdateUserToken

func (h *Handler) UpdateUserToken(c *gin.Context)

@Summary Update user token @Tags User settings @Accept json @Produce json @Param refresh_token header string true "Refresh token" @Success 200 {object} models.UserTokens @Router /user/settings/update/token [put]

func (*Handler) VerifySignUp

func (h *Handler) VerifySignUp(c *gin.Context)

@Summary Confirm the new user's email @Tags Authorization @Accept json @Produce json @Param key query string true "Verification key" @Success 200 {object} models.UserTokens @Failure 400 {object} models.ApiError @Failure 500 {object} models.ApiError @Router /auth/verify [get]

Jump to

Keyboard shortcuts

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