http

package
v0.0.0-...-3771ea2 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2025 License: MIT Imports: 21 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Group

type Group struct {
	Groups []service.Group
}

type NewGroup

type NewGroup struct {
	Name string `json:"group_name" validate:"required"`
}

type NewQuestion

type NewQuestion struct {
	Text      string `json:"text"       validate:"required"`
	GroupName string `json:"group_name" validate:"required"`
	RoundType string `json:"round_type" validate:"required"`
}

type NewQuestionTranslation

type NewQuestionTranslation struct {
	Text string `json:"text" validate:"required"`
}

type Question

type Question struct {
	Questions []service.Question
}

type QuestionServicer

type QuestionServicer interface {
	Add(ctx context.Context, text string, group string, roundType string) (service.Question, error)
	AddTranslation(
		ctx context.Context,
		questionID uuid.UUID,
		text string,
		locale string,
	) (service.QuestionTranslation, error)
	GetQuestions(
		ctx context.Context,
		filters service.GetQuestionFilters,
		limit int32,
		pageNum int32,
	) ([]service.Question, error)
	DisableQuestion(ctx context.Context, id uuid.UUID) error
	EnableQuestion(ctx context.Context, id uuid.UUID) error
	AddGroup(ctx context.Context, name string) (service.Group, error)
	GetGroups(ctx context.Context) ([]service.Group, error)
}

type Server

type Server struct {
	Logger          *slog.Logger
	Websocket       websocketer
	Config          ServerConfig
	Server          *http.Server
	QuestionService QuestionServicer
}

func NewServer

func NewServer(
	websocketer websocketer,
	logger *slog.Logger,
	staticFS http.FileSystem,
	keyfunc jwt.Keyfunc,
	questionService QuestionServicer,
	config ServerConfig,

) *Server

func (*Server) Serve

func (s *Server) Serve(ctx context.Context) error

func (*Server) Shutdown

func (s *Server) Shutdown(ctx context.Context) error

type ServerConfig

type ServerConfig struct {
	Host          string
	Port          int
	Environment   string
	DefaultLocale i18n.Code
	AuthDisabled  bool
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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