handler

package
v0.0.0-...-3233212 Latest Latest
Warning

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

Go to latest
Published: Apr 21, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrValidationFailed = errors.New("failed validation of request body")

Functions

This section is empty.

Types

type AuthHandler

type AuthHandler struct {
	// contains filtered or unexported fields
}

func NewAuthHandler

func NewAuthHandler(
	userService UserServicer,
	tokenService TokenServicer,
	logger *logger.MyLogger,
	timeout time.Duration,
) (*AuthHandler, error)

func (*AuthHandler) DummyLogin

func (h *AuthHandler) DummyLogin(w http.ResponseWriter, r *http.Request)

func (*AuthHandler) Login

func (h *AuthHandler) Login(w http.ResponseWriter, r *http.Request)

func (*AuthHandler) Register

func (h *AuthHandler) Register(w http.ResponseWriter, r *http.Request)

type PVZHandler

type PVZHandler struct {
	// contains filtered or unexported fields
}

func NewPvzHandler

func NewPvzHandler(
	pvzService PVZServicer,
	receptionService ReceptionServicer,
	productService ProductServicer,
	logger *logger.MyLogger,
	timeout time.Duration,
) (*PVZHandler, error)

func (*PVZHandler) CloseReception

func (h *PVZHandler) CloseReception(w http.ResponseWriter, r *http.Request)

func (*PVZHandler) CreatePvz

func (h *PVZHandler) CreatePvz(w http.ResponseWriter, r *http.Request)

func (*PVZHandler) DeleteLastProduct

func (h *PVZHandler) DeleteLastProduct(w http.ResponseWriter, r *http.Request)

func (*PVZHandler) GetPVZ

func (h *PVZHandler) GetPVZ(w http.ResponseWriter, r *http.Request)

type PVZServicer

type PVZServicer interface {
	CreatePVZ(ctx context.Context, payload dto.PostPvzJSONRequestBody) (*dto.PVZ, error)
	GetPVZWithReceptionsFiltered(ctx context.Context, payload dto.GetPvzParams) []dto.PVZWithReceptions
}

type ProductHandler

type ProductHandler struct {
	// contains filtered or unexported fields
}

func NewProductHandler

func NewProductHandler(
	productService ProductServicer,
	logger *logger.MyLogger,
	timeout time.Duration,
) (*ProductHandler, error)

func (*ProductHandler) CreateProduct

func (h *ProductHandler) CreateProduct(w http.ResponseWriter, r *http.Request)

type ProductServicer

type ProductServicer interface {
	CreateProduct(ctx context.Context, productDto dto.PostProductsJSONBody) (*dto.Product, error)
	DeleteLastProduct(ctx context.Context, pvzID openapi_types.UUID) error
}

type ReceptionHandler

type ReceptionHandler struct {
	// contains filtered or unexported fields
}

func NewReceptionHandler

func NewReceptionHandler(receptionService ReceptionServicer, logger *logger.MyLogger, timeout time.Duration) (*ReceptionHandler, error)

func (*ReceptionHandler) CreateReception

func (h *ReceptionHandler) CreateReception(w http.ResponseWriter, r *http.Request)

type ReceptionServicer

type ReceptionServicer interface {
	CreateReception(ctx context.Context, pvzID openapi_types.UUID) (*dto.Reception, error)
	CloseReception(ctx context.Context, pvzID openapi_types.UUID) (*dto.Reception, error)
}

type TokenServicer

type TokenServicer interface {
	Gen(role string) (dto.Token, error)
}

type UserServicer

type UserServicer interface {
	RegisterUser(ctx context.Context, payload dto.PostRegisterJSONBody) (*dto.User, error)
	LoginUser(ctx context.Context, payload dto.PostLoginJSONBody) (dto.Token, error)
}

Jump to

Keyboard shortcuts

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