feat: add solution storage
This commit is contained in:
parent
edf55aa4b7
commit
5e86cf19a3
6 changed files with 137 additions and 268 deletions
10
internal/models/participant.go
Normal file
10
internal/models/participant.go
Normal file
|
@ -0,0 +1,10 @@
|
|||
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"`
|
||||
}
|
22
internal/models/result.go
Normal file
22
internal/models/result.go
Normal file
|
@ -0,0 +1,22 @@
|
|||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
type Result int32
|
||||
|
||||
const (
|
||||
NotTested Result = 0
|
||||
Accepted Result = 1
|
||||
TimeLimitExceeded Result = 2
|
||||
MemoryLimitExceeded Result = 3
|
||||
CompilationError Result = 4
|
||||
SystemFailDuringTesting Result = 5
|
||||
)
|
||||
|
||||
func (result Result) Valid() error {
|
||||
switch result {
|
||||
case NotTested, Accepted, TimeLimitExceeded, MemoryLimitExceede, CompilationError, SystemFailDuringTesting:
|
||||
return nil
|
||||
}
|
||||
return lib.ErrBadResult
|
||||
}
|
|
@ -5,7 +5,7 @@ import "time"
|
|||
type Solution struct {
|
||||
Id *int32 `db:"id"`
|
||||
ParticipantId *int32 `db:"participant_id"`
|
||||
ProblemId *int32 `db:"problem_id"`
|
||||
TaskId *int32 `db:"task_id"`
|
||||
LanguageId *int32 `db:"language_id"`
|
||||
SolutionHash *string `db:"solution_hash"`
|
||||
Result *int32 `db:"result"`
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue