Files
Jānis Kacēns 5199c1fa16 Phase 4: upload, LLM extraction, import review flow
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
2026-05-11 13:15:04 +03:00

73 lines
1.3 KiB
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
}
// Draft holds LLM-extracted questions pending user review before import.
type Draft struct {
ID string
UserID int64
Source string
Questions []DraftQuestion
CreatedAt time.Time
}
type DraftQuestion struct {
Text string `json:"text"`
Answers []DraftAnswer `json:"answers"`
}
type DraftAnswer struct {
Text string `json:"text"`
IsCorrect bool `json:"is_correct"`
}
type UserQuestionStat struct {
UserID int64
QuestionID string
TimesSeen int
TimesCorrect int
LastSeenAt sql.NullTime
}