Phase 1: database schema, migrations, repository, user seeding
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -0,0 +1,53 @@
|
||||
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
|
||||
}
|
||||
Reference in New Issue
Block a user