handlers

package
v0.0.0-...-ce453ac Latest Latest
Warning

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

Go to latest
Published: May 25, 2024 License: Apache-2.0 Imports: 24 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ErrorMiddleware

func ErrorMiddleware(handler ErrorHandlerFunc) http.HandlerFunc

func InitRequestID

func InitRequestID(next http.Handler) http.Handler

Types

type AuthRepository

type AuthRepository interface {
	CreateUser(ctx context.Context, model auth.User) (string, error)
	GetUserByLogin(ctx context.Context, login string) (*auth.User, error)
}

type CoreHandler

type CoreHandler struct {
	BaseURL     string
	StorageURL  string
	FeaturesURL string
	// contains filtered or unexported fields
}

func NewCoreHandler

func NewCoreHandler(
	authRepository AuthRepository,
	tokenGenerator TokenGenerator,
	BaseURL string,
	FeaturesURL string,
	StorageURL string,
	transactor postgresql.Transactor,
	validator *validator.Validate,
	logger *zap.Logger,
) *CoreHandler

func (*CoreHandler) Login

func (c *CoreHandler) Login(w http.ResponseWriter, r *http.Request) error

Login godoc

@Summary	Принимает данные пользователя для входа в систему
@ID			login
@Tags		auth
@Param		user_credentials	body		fixtures.LoginRequest	true	"Данные для логина"
@Success	200					{object}	fixtures.LoginResponse
@Failure	400					{object}	app_errors.AppError
@Router		/auth/login [post]

func (*CoreHandler) Register

func (c *CoreHandler) Register(w http.ResponseWriter, r *http.Request) error

Register godoc

@Summary	Принимает данные пользователя и регистрирует его
@ID			register
@Tags		auth
@Param		user_data	body	fixtures.RegisterRequest	true	"Данные для регистрации"
@Success	204
@Failure	400	{object}	app_errors.AppError
@Router		/auth/register [post]

func (*CoreHandler) Router

func (c *CoreHandler) Router() chi.Router

func (*CoreHandler) SaveVideoFeatures

func (c *CoreHandler) SaveVideoFeatures(w http.ResponseWriter, r *http.Request) error

SaveVideoFeatures godoc

@Summary	Принимает csv файл с фичами из видео
@ID			save csv
@Tags		Save CSV
@Param		file	formData	file	true	"Загружаемый csv"
@Success	204
@Failure	400	{object}	app_errors.AppError
@Router		/face_model/save_features [post]

type ErrorHandlerFunc

type ErrorHandlerFunc func(http.ResponseWriter, *http.Request) error

type TokenGenerator

type TokenGenerator interface {
	CreateAccessToken(_ context.Context, userID string) (string, error)
	GetUserIDFromToken(_ context.Context, contentToken string) (string, error)
}

type TokenHandler

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

func NewTokenHandler

func NewTokenHandler(jwtSecret string) *TokenHandler

func (*TokenHandler) CreateAccessToken

func (c *TokenHandler) CreateAccessToken(_ context.Context, userID string) (string, error)

func (*TokenHandler) GetUserIDFromToken

func (c *TokenHandler) GetUserIDFromToken(_ context.Context, contentToken string) (string, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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