feat: revision-check material writes
- add jz_bm_materials.revision (default 1), read-only for GORM
- bump it only on content changes (models.ReviseMaterial)
- PUT /materials/{id} locks the row and answers 409 to a stale revision
- management answers carry revision and updated_at, the student detail
carries revision
This commit is contained in:
@@ -241,11 +241,13 @@ func newMaterialListJSON(m models.Material, files int64) materialListJSON {
|
||||
|
||||
// materialDetailJSON is a published material the caller may see, with its
|
||||
// body and files. CanManage is true for the caller who may change its access.
|
||||
// Revision is the content revision an edit sends back.
|
||||
type materialDetailJSON struct {
|
||||
materialListJSON
|
||||
Body *string `json:"body"`
|
||||
Files []fileJSON `json:"files"`
|
||||
CanManage bool `json:"can_manage"`
|
||||
Revision uint `json:"revision"`
|
||||
}
|
||||
|
||||
// fileJSON is one attached file.
|
||||
|
||||
Reference in New Issue
Block a user