handler

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

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

Go to latest
Published: Apr 15, 2023 License: MIT Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AdminMiddleware

func AdminMiddleware(next http.Handler) http.Handler

func AuthMiddleware

func AuthMiddleware(j *auth.JWTer) func(next http.Handler) http.Handler

func RespondJSON

func RespondJSON(ctx context.Context, w http.ResponseWriter, body any, status int)

Types

type AddTask

type AddTask struct {
	Service   AddTaskService
	Validator *validator.Validate
}

func (*AddTask) ServeHTTP

func (at *AddTask) ServeHTTP(w http.ResponseWriter, r *http.Request)

type AddTaskService

type AddTaskService interface {
	AddTask(ctx context.Context, title string) (*entity.Task, error)
}

type DeleteTask

type DeleteTask struct {
	Service DeleteTaskService
}

func (*DeleteTask) ServeHTTP

func (dt *DeleteTask) ServeHTTP(w http.ResponseWriter, r *http.Request)

type DeleteTaskService

type DeleteTaskService interface {
	DeleteTask(ctx context.Context, id entity.TaskID) error
}

type ErrResponse

type ErrResponse struct {
	Message string   `json:"message"`
	Details []string `json:"details,omitempty"`
}

type ListTask

type ListTask struct {
	Service ListTasksService
}

func (*ListTask) ServeHTTP

func (lt *ListTask) ServeHTTP(w http.ResponseWriter, r *http.Request)

type ListTasksService

type ListTasksService interface {
	ListTasks(ctx context.Context) (entity.Tasks, error)
}

type Login

type Login struct {
	Service   LoginService
	Validator *validator.Validate
}

func (*Login) ServeHTTP

func (l *Login) ServeHTTP(w http.ResponseWriter, r *http.Request)

type LoginService

type LoginService interface {
	Login(ctx context.Context, name, pw string) (string, error)
}

type RegisterUser

type RegisterUser struct {
	Service   RegisterUserService
	Validator *validator.Validate
}

func (*RegisterUser) ServeHTTP

func (ru *RegisterUser) ServeHTTP(w http.ResponseWriter, r *http.Request)

type RegisterUserService

type RegisterUserService interface {
	RegisterUser(ctx context.Context, name, password, role string) (*entity.User, error)
}

type UpdateTask

type UpdateTask struct {
	Service   UpdateTaskService
	Validator *validator.Validate
}

func (*UpdateTask) ServeHTTP

func (ut *UpdateTask) ServeHTTP(w http.ResponseWriter, r *http.Request)

type UpdateTaskService

type UpdateTaskService interface {
	UpdateTask(ctx context.Context, id int64, title, status string) (*entity.Task, error)
}

Jump to

Keyboard shortcuts

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