fix: make it runnable

This commit is contained in:
Vyacheslav1557 2024-08-21 03:54:46 +05:00
parent c9c4fc65e7
commit bf508a5f1f
23 changed files with 311 additions and 286 deletions

View file

@ -1,8 +1,10 @@
package models
import "time"
type Contest struct {
Id *int `db:"id"`
Name *string `db:"name"`
CreatedAt *time.Time `db:"created_at"`
UpdatedAt *time.Time `db:"updated_at"`
Id *int `db:"id"`
Name *string `db:"name"`
CreatedAt *time.Time `db:"created_at"`
UpdatedAt *time.Time `db:"updated_at"`
}

View file

@ -1,10 +1,8 @@
package models
import "time"
type Solution struct {
Id *int32 `db:"id"`
UserId *int32 `db:"user_id"`
ContestId *int32 `db:"contest_id"`
Name *string `db:"name"`
type Participant struct {
Id *int32 `db:"id"`
UserId *int32 `db:"user_id"`
ContestId *int32 `db:"contest_id"`
Name *string `db:"name"`
}

View file

@ -1,23 +1,23 @@
package models
import "time"
import "git.sch9.ru/new_gate/ms-tester/internal/lib"
type Result int32
const (
NotTested Result = 0 // change only with schema change
Accepted Result = 1
CompilationError Result = 2
MemoryLimitExceeded Result = 3
TimeLimitExceeded Result = 4
SystemFailDuringTesting Result = 5
Testing Result = 6
NotTested Result = 0 // change only with schema change
Accepted Result = 1
CompilationError Result = 2
MemoryLimitExceeded Result = 3
TimeLimitExceeded Result = 4
SystemFailDuringTesting Result = 5
Testing Result = 6
)
func (result Result) Valid() error {
switch result {
case NotTested, Accepted, TimeLimitExceeded, MemoryLimitExceede, CompilationError, SystemFailDuringTesting:
return nil
}
return lib.ErrBadResult
switch result {
case NotTested, Accepted, TimeLimitExceeded, MemoryLimitExceeded, CompilationError, SystemFailDuringTesting:
return nil
}
return lib.ErrBadResult
}

View file

@ -1,8 +1,8 @@
package models
type Task struct {
Id *int32 `db:"id"`
ContestId *int32 `db:"contest_id"`
TestgroupId *int32 `db:"testgroup_id"`
TaskId *int32 `db:"task_id"`
type SubTask struct {
Id *int32 `db:"id"`
ContestId *int32 `db:"contest_id"`
TestgroupId *int32 `db:"testgroup_id"`
TaskId *int32 `db:"task_id"`
}

View file

@ -1,26 +1,26 @@
package models
import "time"
import "git.sch9.ru/new_gate/ms-tester/internal/lib"
type TestingStrategy int32
const (
EachTestTS TestingStrategy = 1;
CompleteGroupTS TestingStrategy = 2;
EachTestTS TestingStrategy = 1
CompleteGroupTS TestingStrategy = 2
)
type Testgroup struct {
Id *int32 `db:"id"`
ProblemId *int32 `db:"problem_id"`
TestingStrategy *TestingStrategy `db:"testing_strategy"`
Id *int32 `db:"id"`
ProblemId *int32 `db:"problem_id"`
TestingStrategy *TestingStrategy `db:"testing_strategy"`
}
type TestgroupData struct {
Ts TestingStrategy
TestAmount int32
type TestGroupData struct {
Ts TestingStrategy
TestAmount int32
}
func (TestingStrategy ts) Valid() error {
func (ts TestingStrategy) Valid() error {
switch ts {
case EachTestTS, CompleteGroupTS:
return nil