feat: per-student owned flag on readings

- new table jz_bm_reading_ownership and its migration
  20261026120000_create_jz_bm_reading_ownership
- PUT and DELETE /_bm/api/v1/readings/{id}/owned, idempotent
- owned_at on every reading in /readings and /courses/{id}
- read semantics, progress routes and counts unchanged
This commit is contained in:
2026-10-26 11:11:22 +01:00
parent 85cae45cb9
commit cf84f1d0e8
12 changed files with 142 additions and 14 deletions

View File

@@ -0,0 +1,16 @@
package models
import "time"
// ReadingOwnership records that a user (a golem15.user users row) owns a
// copy of a reading. One row per reading and user, kept apart from the read
// mark in ReadingProgress.
type ReadingOwnership struct {
ID uint `gorm:"column:id;primaryKey"`
ReadingID uint `gorm:"column:reading_id"`
UserID uint `gorm:"column:user_id"`
OwnedAt time.Time `gorm:"column:owned_at"`
}
// TableName is the plugin table.
func (ReadingOwnership) TableName() string { return "jz_bm_reading_ownership" }