// Code generated by summer make. DO NOT EDIT. package models import ( "time" "gorm.io/gorm" ) // DeadlineKinds lists the allowed Deadline.Kind values. var DeadlineKinds = []string{"zaliczenie", "egzamin", "praca", "organizacyjne", "inne"} // Deadline is one entry of the terminarz: an exam, a submission or an // administrative date, optionally tied to a course. type Deadline struct { ID uint `gorm:"column:id;primaryKey"` Title string `gorm:"column:title"` DueAt time.Time `gorm:"column:due_at"` CourseID *uint `gorm:"column:course_id"` Course *Course `gorm:"foreignKey:CourseID"` Kind string `gorm:"column:kind"` Description *string `gorm:"column:description"` CreatedAt time.Time `gorm:"column:created_at"` UpdatedAt time.Time `gorm:"column:updated_at"` } // TableName is the plugin table. func (Deadline) TableName() string { return "jz_bm_deadlines" } // Fillable lists the columns mass assignment may set. func (Deadline) Fillable() []string { return []string{"title", "due_at", "course_id", "kind", "description"} } // Rules are checked by the admin API on every save. func (Deadline) Rules() map[string]string { return map[string]string{ "title": "required|max:255", "due_at": "required", "kind": "required|in:zaliczenie,egzamin,praca,organizacyjne,inne", } } // BeforeSave stores NULL for empty optional text. func (d *Deadline) BeforeSave(*gorm.DB) error { blank(&d.Description) return nil }