feat: zjazd (meeting) on readings and materials
The Pulpit hero lists what to read for the current or next zjazd, so readings and materials get a nullable meeting_id (FK to jz_bm_meetings, ON DELETE SET NULL, indexed). The reading admin form gets a "Na zjazd" picker, the student reading JSON carries meeting_id, and the management /readings records filter and validate it.
This commit is contained in:
@@ -13,6 +13,8 @@ type Reading struct {
|
||||
ID uint `gorm:"column:id;primaryKey"`
|
||||
CourseID *uint `gorm:"column:course_id"`
|
||||
Course *Course `gorm:"foreignKey:CourseID"`
|
||||
MeetingID *uint `gorm:"column:meeting_id"`
|
||||
Meeting *Meeting `gorm:"foreignKey:MeetingID"`
|
||||
Title string `gorm:"column:title"`
|
||||
Author *string `gorm:"column:author"`
|
||||
Source *string `gorm:"column:source"`
|
||||
@@ -28,7 +30,7 @@ func (Reading) TableName() string { return "jz_bm_readings" }
|
||||
|
||||
// Fillable lists the columns mass assignment may set.
|
||||
func (Reading) Fillable() []string {
|
||||
return []string{"course_id", "title", "author", "source", "url", "is_required", "sort_order"}
|
||||
return []string{"course_id", "meeting_id", "title", "author", "source", "url", "is_required", "sort_order"}
|
||||
}
|
||||
|
||||
// Rules are checked by the admin API on every save.
|
||||
|
||||
@@ -31,3 +31,10 @@ fields:
|
||||
type: number
|
||||
span: left
|
||||
default: 0
|
||||
meeting:
|
||||
label: jz.bm::lang.common.meeting
|
||||
type: relation
|
||||
nameFrom: number
|
||||
span: right
|
||||
emptyOption: jz.bm::lang.common.none
|
||||
comment: jz.bm::lang.common.meeting_comment
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# The reading form inside the course form's relation manager: the course is
|
||||
# the parent, so there is no course picker.
|
||||
# the parent, so there is no course picker, and a relation form has no
|
||||
# relation pickers, so the meeting (zjazd) is set on the readings screen.
|
||||
fields:
|
||||
title:
|
||||
label: jz.bm::lang.common.title
|
||||
|
||||
Reference in New Issue
Block a user