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: 22 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 CoreHandler

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

func NewCoreHandler

func NewCoreHandler(modelSaver ModelSaver,
	featureRepository FeatureRepository,
	transactor postgresql.Transactor,
	validator *validator.Validate,
	logger *zap.Logger) *CoreHandler

func (*CoreHandler) GetModels

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

GetModels godoc

@Summary	Возвращает ссылки на модели по id пользователя
@ID			get models
@Tags		Models
@Param		features_data	body		fixtures.GetModelsRequest	true	"ID пользователя"
@Success	200				{object}	map[string]string
@Failure	400				{object}	app_errors.AppError
@Router		/get_models [post]

func (*CoreHandler) IncreaseFeatures

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

IncreaseFeatures godoc

@Summary	Принимает количество новых фич по моделям
@ID			increase features
@Tags		Features
@Param		features_data	body	fixtures.IncreaseFeaturesRequest	true	"Данные о количестве фич"
@Success	204
@Failure	400	{object}	app_errors.AppError
@Router		/increase_features [post]

func (*CoreHandler) Router

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

func (*CoreHandler) SaveModel

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

SaveModel godoc

@Summary	Принимает ml модель
@ID			save model
@Tags		Models
@Param		file	formData	file	true	"Загружаемая ml-модель"
@Success	204
@Failure	400	{object}	app_errors.AppError
@Router		/save_model [post]

type ErrorHandlerFunc

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

type FeatureRepository

type FeatureRepository interface {
	ChangeFeaturesCount(ctx context.Context, userID, modelType string, faceFeaturesCount int) error
	CreateModel(ctx context.Context, userID, modelType string) error
	GetModelByUserID(ctx context.Context, userID, modelType string) (*data.MLModel, error)
	GetModelsByUserID(ctx context.Context, userID string) ([]data.MLModel, error)
	SetFeaturesCountUsed(ctx context.Context, userID, modelType string, faceFeaturesCount int) error
	SetModelS3Key(ctx context.Context, s3Key, modelType, userID string) error
	SetModelStatus(ctx context.Context, status string, modelType string, userID string) error
}

type ModelSaver

type ModelSaver interface {
	SaveFile(ctx context.Context, fileName string, file io.Reader) error
	GetPresignURL(ctx context.Context, fileName string) (string, error)
}

type Producer

type Producer interface {
	Publish(queue string, message []byte) error
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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