http

package
v1.3.0 Latest Latest
Warning

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

Go to latest
Published: Aug 17, 2026 License: AGPL-3.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

View Source
const ErrCodeSubmissionTooFrequent = "submission_too_frequent"
View Source
const ErrCodeUnauthorized = "unauthorized_access"

Variables

This section is empty.

Functions

func ErrJwtTokenMissing

func ErrJwtTokenMissing() srvcerror.E

func ErrSubmissionTooFrequent

func ErrSubmissionTooFrequent(delaySeconds int) srvcerror.E

func ErrUnauthorizedUsernameMismatch

func ErrUnauthorizedUsernameMismatch() srvcerror.E

Types

type DetailedSubmView

type DetailedSubmView struct {
	ID        string `json:"id"`
	SubmUUID  string `json:"subm_uuid"`
	Content   string `json:"content,omitempty"`
	Username  string `json:"username"`
	CurrEval  *Eval  `json:"curr_eval"`
	PrLang    PrLang `json:"pr_lang"`
	TaskID    string `json:"task_id"`
	TaskName  string `json:"task_name"`
	CreatedAt string `json:"created_at"`
}

type Eval

type Eval struct {
	EvalUUID  string `json:"eval_uuid"`
	SubmUUID  string `json:"subm_uuid"`
	EvalStage string `json:"eval_stage"`
	ScoreUnit string `json:"score_unit"`
	EvalError string `json:"eval_error"`
	// ErrorMsg   string      `json:"error_msg"`
	Subtasks   []Subtask   `json:"subtasks"`
	TestGroups []TestGroup `json:"test_groups"`
	Verdicts   string      `json:"verdicts"` // q,ac,wa,tle,mle,re,ig -> "QAWTMRI"
	ScoreInfo  ScoreInfo   `json:"score_info"`
}

type MaxScore

type MaxScore struct {
	SubmUuid     string `json:"subm_uuid"`
	Received     int    `json:"received"`
	Possible     int    `json:"possible"`
	CreatedAt    string `json:"created_at"`
	TaskFullName string `json:"task_full_name"`
}

type PaginatedResponse

type PaginatedResponse struct {
	Page       interface{} `json:"page"`
	Pagination Pagination  `json:"pagination"`
}

PaginatedResponse represents a paginated response with data and pagination metadata

type Pagination

type Pagination struct {
	Total   int  `json:"total"`
	Offset  int  `json:"offset"`
	Limit   int  `json:"limit"`
	HasMore bool `json:"hasMore"`
}

Pagination represents pagination metadata

type PrLang

type PrLang struct {
	ShortID  string `json:"short_id"`
	Display  string `json:"display"`
	MonacoID string `json:"monaco_id"`
}

type ScoreInfo

type ScoreInfo struct {
	ScoreBar struct {
		Green  int `json:"green"`
		Red    int `json:"red"`
		Gray   int `json:"gray"`
		Yellow int `json:"yellow"`
		Purple int `json:"purple"`
	} `json:"score_bar"`
	ReceivedScore int  `json:"received"`
	PossibleScore int  `json:"possible"`
	MaxCpuMs      int  `json:"max_cpu_ms"`  // milliseconds
	MaxMemKiB     int  `json:"max_mem_kib"` // kibibytes
	ExceededCpu   bool `json:"exceeded_cpu"`
	ExceededMem   bool `json:"exceeded_mem"`
}

type SubmHttpHandler

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

func NewSubmHttpHandler

func NewSubmHttpHandler(
	submSrvc submsrvc.SubmissionService,
	taskSrvc tasksrvc.TaskService,
	userSrvc usersrvc.UserService,
) *SubmHttpHandler

func (*SubmHttpHandler) GetFullSubm

func (h *SubmHttpHandler) GetFullSubm(w http.ResponseWriter, r *http.Request)

func (*SubmHttpHandler) GetMaxScorePerTask

func (h *SubmHttpHandler) GetMaxScorePerTask(w http.ResponseWriter, r *http.Request)

func (*SubmHttpHandler) GetSubmList

func (h *SubmHttpHandler) GetSubmList(w http.ResponseWriter, r *http.Request)

func (*SubmHttpHandler) ListenToSubmListUpdates

func (h *SubmHttpHandler) ListenToSubmListUpdates(w http.ResponseWriter, r *http.Request)

func (*SubmHttpHandler) PostSubm

func (h *SubmHttpHandler) PostSubm(w http.ResponseWriter, r *http.Request)

func (*SubmHttpHandler) ReevalSubms

func (h *SubmHttpHandler) ReevalSubms(w http.ResponseWriter, r *http.Request)

func (*SubmHttpHandler) RegisterRoutes

func (h *SubmHttpHandler) RegisterRoutes(r *chi.Mux, jwtKey, adminAPIKey []byte, cookieSecure bool, pwdChangedAt auth.PasswordChangedAtLookup)

type SubmListEntry

type SubmListEntry struct {
	ID         string    `json:"id"`
	SubmUuid   string    `json:"subm_uuid"`
	Username   string    `json:"username"`
	TaskId     string    `json:"task_id"`
	TaskName   string    `json:"task_name"`
	PrLangId   string    `json:"pr_lang_id"`
	PrLangName string    `json:"pr_lang_name"`
	ScoreInfo  ScoreInfo `json:"score_info"`
	Status     string    `json:"status"`
	CreatedAt  string    `json:"created_at"`
}

type Subtask

type Subtask struct {
	Points      int    `json:"points"`
	Description string `json:"description"`
	// StTests     []int  `json:"st_tests"`
	StTests [][]int `json:"st_tests"`
}

type TaskPreview

type TaskPreview struct {
	ShortId          string                     `json:"short_id"`
	FullName         string                     `json:"full_name"`
	IllustrImg       tasksrvc.IllustrationImage `json:"illustr_img"`
	DifficultyRating int                        `json:"difficulty_rating"`
	OriginOlympiad   string                     `json:"origin_olympiad"`
	OriginNotes      []tasksrvc.OriginNote      `json:"origin_notes"`
	MdStatementStory string                     `json:"md_statement_story"`
}

type TestGroup

type TestGroup struct {
	Points   int   `json:"points"`
	Subtasks []int `json:"subtasks"`
	// TgTests  []int `json:"tg_tests"`
	TgTests [][]int `json:"tg_tests"`
}

Jump to

Keyboard shortcuts

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