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:
@@ -74,11 +74,11 @@ func TestPluginActivates(t *testing.T) {
|
||||
if p.ID() != "jz.bm" || !slices.Equal(p.Requires(), []string{"golem15.user"}) {
|
||||
t.Errorf("ID %q Requires %v", p.ID(), p.Requires())
|
||||
}
|
||||
if n := len(p.Models()); n != 10 {
|
||||
t.Errorf("Models = %d, want 10", n)
|
||||
if n := len(p.Models()); n != 11 {
|
||||
t.Errorf("Models = %d, want 11", n)
|
||||
}
|
||||
if n := len(p.Migrations()); n != 13 {
|
||||
t.Errorf("Migrations = %d, want 13", n)
|
||||
if n := len(p.Migrations()); n != 14 {
|
||||
t.Errorf("Migrations = %d, want 14", n)
|
||||
}
|
||||
if !slices.ContainsFunc(p.Commands(), func(c bonfire.Command) bool { return c.Name == "bm:seed" }) {
|
||||
t.Error("bm:seed is not registered")
|
||||
@@ -111,6 +111,8 @@ func TestRoutes(t *testing.T) {
|
||||
"GET /_bm/api/v1/readings",
|
||||
"PUT /_bm/api/v1/readings/{id}/progress",
|
||||
"DELETE /_bm/api/v1/readings/{id}/progress",
|
||||
"PUT /_bm/api/v1/readings/{id}/owned",
|
||||
"DELETE /_bm/api/v1/readings/{id}/owned",
|
||||
"GET /_bm/api/v1/materials",
|
||||
"GET /_bm/api/v1/materials/{id}",
|
||||
"GET /_bm/api/v1/calendar-feed",
|
||||
|
||||
Reference in New Issue
Block a user