hezarfen_backend
Clone
https://git.tahinli.com/archive/hezarfen_backend.git
0 watching0 forksRust8.3 MiB6d68754Ahmet Kaan Gümüş2 months ago566 commits
| 1 | //! Class workflows: the archived-year guard every class write re-checks, and |
| 2 | //! the thin route-facing wrappers the handlers call. The queries live in |
| 3 | //! [`crate::db::class_group`]. |
| 4 | |
| 5 | use crateDatabase; |
| 6 | use crateclass_group; |
| 7 | use crateAcademicYearId; |
| 8 | use crate; |
| 9 | use crateGradeLevel; |
| 10 | use crateUserId; |
| 11 | use crateAppError; |
| 12 | |
| 13 | /// Refuse the write when this class's year is archived — a pre-flight guard, |
| 14 | /// accepted race (see README concurrency model): a year archived after this |
| 15 | /// read still lets the write through. |
| 16 | pub async |
| 17 | |
| 18 | |
| 19 | |
| 20 | |
| 21 | |
| 22 | |
| 23 | /// Create a class, claiming the year reference in the same transaction — |
| 24 | /// see [`class_group::create`]. |
| 25 | pub async |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | |
| 34 | |
| 35 | |
| 36 | /// The row, for callers that only inspect it — the web layer's |
| 37 | /// `class_or_404` reads through here. |
| 38 | pub async |
| 39 | |
| 40 | |
| 41 | |
| 42 | /// Every class, newest first — or one rung's, when `grade_level` narrows it: |
| 43 | /// the read behind the class index. |
| 44 | pub async |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | /// The classes `ids` names, in no particular order — the join behind the two |
| 54 | /// membership reads. |
| 55 | pub async |
| 56 | |
| 57 | |
| 58 | |
| 59 | /// Every class `user` is the homeroom teacher of, newest first — the visible |
| 60 | /// set a homeroom teacher reads their own instances through (D10), the read |
| 61 | /// behind `visible_instances` in the web layer. |
| 62 | pub async |
| 63 | |
| 64 | |
| 65 | |
| 66 | /// Write only the fields the PATCH carried; a year move claims the new year |
| 67 | /// and releases the old one inside the very transaction that moves the link. |
| 68 | pub async |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | /// Delete the class and give its year reference back; `false` = refused, |
| 80 | /// nothing was written (the class still holds students or courses). |
| 81 | pub async |
| 82 | |
| 83 | |
| 84 | |
| 85 | /// Strip `user` from every class they were the homeroom teacher of — the |
| 86 | /// sweep for a user demoted below `teacher`. |
| 87 | pub async |
| 88 | |
| 89 |