hezarfen_backend
Clone
https://git.tahinli.com/archive/hezarfen_backend.git
0 watching0 forksRust8.3 MiB6d68754Ahmet Kaan Gümüş2 months ago566 commits
| 1 | //! The grade ladder: the validated position a class section — and, one layer |
| 2 | //! up, its course blueprint — occupies on the school's single axis of years. |
| 3 | //! |
| 4 | //! It replaces the old free-text `ClassGrade`: "9", "10-A" and "anaokulu" were |
| 5 | //! three spellings no query could order, group or blueprint against without a |
| 6 | //! school-wide convention nobody enforced. The ladder is an integer |
| 7 | //! `0..=12` — `0` is anaokulu, `1..=12` the school years — so "every section |
| 8 | //! at one grade" is one equality and the blueprint is keyed by the same value |
| 9 | //! the class carries. |
| 10 | //! |
| 11 | //! The wire format is the **integer** itself: every DTO carries |
| 12 | //! `grade_level: 0..=12`, and the only strings are [`GradeLevel::label`]'s |
| 13 | //! display/AI-scope labels (`"Anaokulu"`, `"1"`..`"12"`), which are rendered, |
| 14 | //! never parsed back. |
| 15 | //! |
| 16 | //! The bounds live in [`crate::constant`] beside every other published limit |
| 17 | //! (`GET /limits` serves them); this module owns the type. |
| 18 | |
| 19 | use crate; |
| 20 | use crateValidationError; |
| 21 | |
| 22 | /// One rung of the grade ladder: `0` = anaokulu, `1..=12` = school years. |
| 23 | /// |
| 24 | /// `sqlx(transparent)` over the `i16` is what makes the column a plain |
| 25 | /// `SMALLINT` — the driver checks the type, the `CHECK |
| 26 | /// (grade_level BETWEEN 0 AND 12)` in the DDL is the stored mirror of |
| 27 | /// [`GradeLevel::new`], and nothing out of range can be constructed in Rust. |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | |
| 33 | ; |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | |
| 52 | |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | |
| 64 | |
| 65 | |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | |
| 72 | |
| 73 | |
| 74 | |
| 75 | |
| 76 | |
| 77 | |
| 78 | |
| 79 | |
| 80 | |
| 81 | |
| 82 | |
| 83 | |
| 84 | |
| 85 | |
| 86 | |
| 87 | |
| 88 | |
| 89 |