feat: materials by zjazd in the student API and admin

The material admin form gets the "Na zjazd" picker, every student
material JSON carries meeting_id, and GET /materials accepts meeting=
inside the published-only scope, so the Pulpit hero can list the
zjazd's materials next to its readings.
This commit is contained in:
Jakub Zych
2026-10-27 01:44:38 +01:00
parent 3241cc9894
commit ff2f97eb2b
9 changed files with 58 additions and 16 deletions

View File

@@ -23,6 +23,8 @@ type Material 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"`
Type string `gorm:"column:type"`
Body *string `gorm:"column:body"`
@@ -43,7 +45,7 @@ func (Material) MorphName() string { return `Jz\Bm\Models\Material` }
// Fillable lists the columns mass assignment may set.
func (Material) Fillable() []string {
return []string{"course_id", "title", "type", "body", "source", "url", "published_at"}
return []string{"course_id", "meeting_id", "title", "type", "body", "source", "url", "published_at"}
}
// Rules are checked by the admin API on every save.

View File

@@ -36,6 +36,13 @@ fields:
label: jz.bm::lang.common.url
type: text
span: right
meeting:
label: jz.bm::lang.common.meeting
type: relation
nameFrom: number
span: left
emptyOption: jz.bm::lang.common.none
comment: jz.bm::lang.common.meeting_comment
tags:
label: jz.bm::lang.materials.tags
type: relation