handlers

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Jul 1, 2025 License: MIT Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type DBHandler

type DBHandler struct {
	*sql.DB
	// contains filtered or unexported fields
}

func NewDBHandler

func NewDBHandler(db *sql.DB, redisClient *redis.Client) *DBHandler

NewDBHandler => create a new instance from DBHandler and return it

func (*DBHandler) DeleteLabel

func (db *DBHandler) DeleteLabel(w http.ResponseWriter, r *http.Request)

DeleteLabel => delete the label by id and return json response @Summary Delete Label @Description delete label by id @Produce json @Param id path integer true "The id of the label" @Success 200 {object} map[string]string @Failure 422 {object} map[string]string @Failure 404 {object} map[string]string @Router /labels/{id} [delete]

func (*DBHandler) DeleteTask

func (db *DBHandler) DeleteTask(w http.ResponseWriter, r *http.Request)

DeleteTask => Delete task by id @Summary Delete task @Description Delete task by id @Produce json @Param id query string true "The ID of the task" @Success 200 {object} map[string]string @Router /tasks/{id} [delete]

func (*DBHandler) ForgotPasswordAuth

func (db *DBHandler) ForgotPasswordAuth(w http.ResponseWriter, r *http.Request)

ForgotPasswordAuth => Send email or sms to user for forgot password @Summary Forgot password @Description Send email or sms to user for forgot password @Produce json @Param username body string true "The email or phone of the user" @Success 200 {object} map[string]string @Failure 400 {object} map[string]string @Router /forgot-password [post]

func (*DBHandler) ForgotPasswordVerifyAuth

func (db *DBHandler) ForgotPasswordVerifyAuth(w http.ResponseWriter, r *http.Request)

ForgotPasswordVerifyAuth => Verify the user with otp @Summary Forgot Password Verify @Description Verify the user with otp @Produce json @Param username body string true "The email or phone of the user" @Success 200 {object} map[string]string @Failure 400 {object} map[string]string @Router /forgot-password-verify [post]

func (*DBHandler) GetLatestLabels

func (db *DBHandler) GetLatestLabels(w http.ResponseWriter, r *http.Request)

GetLatestLabels => Get the latest labels and return json response @Summary Get Labels @Description Get the latest labels @Produce json @Success 200 {object} []models.Label @Router /labels [get]

func (*DBHandler) GetLatestTasks

func (db *DBHandler) GetLatestTasks(w http.ResponseWriter, r *http.Request)

GetLatestTasks => Get the latest tasks and return json response @Summary Get Tasks @Description Get the latest tasks @Produce json @Success 200 {object} []models.Task @Router /tasks [get]

func (*DBHandler) GetLatestUsers

func (db *DBHandler) GetLatestUsers(w http.ResponseWriter, r *http.Request)

GetLatestUsers => get the latest users and return json response @Summary Get Users @Description Get the latest users @Produce json @Success 200 {object} []models.User @Router /users [get]

func (*DBHandler) LoginAuth

func (db *DBHandler) LoginAuth(w http.ResponseWriter, r *http.Request)

LoginAuth => Check user credentials and create jwt token @Summary Login user @Description Check user credentials and login @Produce json @Param username body string true "The email or phone of the user" @Param password body string true "The password of the user" @Success 200 {object} map[string]string @Failure 400 {object} map[string]string @Router /login [post]

func (*DBHandler) MarkTaskAsCompleted

func (db *DBHandler) MarkTaskAsCompleted(w http.ResponseWriter, r *http.Request)

MarkTaskAsCompleted => Mark task as completed @Summary Mark Task as Completed @Description mark task as completed @Produce json @Param id query string true "The ID of the task" @Success 200 {object} map[string]string @Router /tasks/{id}/mark-as-completed [patch]

func (*DBHandler) RegisterAuth

func (db *DBHandler) RegisterAuth(w http.ResponseWriter, r *http.Request)

RegisterAuth => Register user and create token @Summary Register user @Description Create new user with token @Produce json @Param name body string true "The name of the user" @Param username body string true "The email or phone of the user" @Param password body string true "The password of the user" @Success 200 {object} map[string]string @Failure 400 {object} map[string]string @Failure 422 {object} map[string]string @Router /register [post]

func (*DBHandler) ResetPasswordAuth

func (db *DBHandler) ResetPasswordAuth(w http.ResponseWriter, r *http.Request)

ResetPasswordAuth => Reset user password @Summary Reset Password @Description Reset user password @Produce json @Param username body string true "The email or phone of the user" @Param new_password body string true "The new password" @Param re_new_password body string true "The retry new password" @Success 200 {object} map[string]string @Failure 302 {object} map[string]string @Failure 400 {object} map[string]string @Failure 500 {object} map[string]string @Router /reset-password [post]

func (*DBHandler) StoreLabel

func (db *DBHandler) StoreLabel(w http.ResponseWriter, r *http.Request)

StoreLabel => store new label and return json response @Summary Store Label @Description store new label @Produce json @Param title body string true "The title of the label" @Param color body string true "The color of the label" @Success 200 {object} map[string]string @Failure 400 {object} map[string]string @Router /labels [post]

func (*DBHandler) StoreTask

func (db *DBHandler) StoreTask(w http.ResponseWriter, r *http.Request)

StoreTask => Store new task and return json response @Summary Store Task @Description store new task @Produce json @Param title body string true "The title of the task" @Param description body string true "The description of the task" @Param status body string true "The status of the task" @Param label_id body string true "The label ID of the task" @Success 200 {object} map[string]string @Failure 400 {object} map[string]string @Router /tasks [post]

Jump to

Keyboard shortcuts

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