handler

package
v0.0.0-...-7253042 Latest Latest
Warning

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

Go to latest
Published: Mar 3, 2024 License: MIT Imports: 8 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 AddTaskHandler

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

func (*AddTaskHandler) ServeHTTP

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

type AddTaskService

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

type ErrResponse

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

type ListTaskHandler

type ListTaskHandler struct {
	Service ListTasksService
}

func (*ListTaskHandler) ServeHTTP

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

type ListTasksService

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

type LoginHandler

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

func (*LoginHandler) ServeHTTP

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

type LoginService

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

type RegisterUserHandler

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

func (*RegisterUserHandler) ServeHTTP

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

type RegisterUserService

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

Jump to

Keyboard shortcuts

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