Files
qbank/internal/models/models.go
T
2026-05-11 11:38:31 +03:00

54 lines
896 B
Go

package models
import (
"database/sql"
"time"
)
type User struct {
ID int64
Name string
PasswordHash string
CreatedAt time.Time
}
type Question struct {
ID string // sha256(text)[:8 bytes] hex = 16 chars
Text string
Source string
CreatedAt time.Time
}
type Answer struct {
ID int64
QuestionID string
Text string
IsCorrect bool
Position int
}
type Test struct {
ID int64
UserID int64
CreatedAt time.Time
CompletedAt sql.NullTime
NQuestions int
QuestionIDs []string // unmarshaled from JSON
}
type TestAnswer struct {
TestID int64
QuestionID string
SelectedAnswerID sql.NullInt64
IsCorrect sql.NullBool
AnsweredAt sql.NullTime
}
type UserQuestionStat struct {
UserID int64
QuestionID string
TimesSeen int
TimesCorrect int
LastSeenAt sql.NullTime
}