feat: add quiz, question, answer and attempt models with migrations
This commit is contained in:
28
models/attempt.go
Normal file
28
models/attempt.go
Normal file
@@ -0,0 +1,28 @@
|
||||
// Code generated by summer make. DO NOT EDIT.
|
||||
|
||||
package models
|
||||
|
||||
import "time"
|
||||
|
||||
// Attempt is one user's run through a quiz. The score columns are set when
|
||||
// the attempt is finished.
|
||||
type Attempt struct {
|
||||
ID uint `gorm:"column:id;primaryKey"`
|
||||
QuizID uint `gorm:"column:quiz_id"`
|
||||
UserID uint `gorm:"column:user_id"`
|
||||
StartedAt time.Time `gorm:"column:started_at"`
|
||||
CompletedAt *time.Time `gorm:"column:completed_at"`
|
||||
ScorePoints float64 `gorm:"column:score_points"`
|
||||
MaxPoints int `gorm:"column:max_points"`
|
||||
ScorePercent *float64 `gorm:"column:score_percent"`
|
||||
CreatedAt time.Time `gorm:"column:created_at"`
|
||||
UpdatedAt time.Time `gorm:"column:updated_at"`
|
||||
Quiz *Quiz `gorm:"foreignKey:QuizID"`
|
||||
}
|
||||
|
||||
// TableName is the plugin-prefixed table.
|
||||
func (Attempt) TableName() string { return "golem15_quizzes_attempts" }
|
||||
|
||||
// Fillable is empty: attempts are written by the API, never by mass
|
||||
// assignment.
|
||||
func (Attempt) Fillable() []string { return []string{} }
|
||||
Reference in New Issue
Block a user