hezarfen_backend
Clone
https://git.tahinli.com/archive/hezarfen_backend.git
0 watching0 forksRust8.3 MiBaf331ecAhmet Kaan Gümüş2 months ago451 commits
| 1 | use crateState; |
| 2 | use Json; |
| 3 | use ; |
| 4 | use ToSchema; |
| 5 | use OpenApiRouter; |
| 6 | use routes; |
| 7 | |
| 8 | use crateSettings; |
| 9 | use crate; |
| 10 | use crateservice; |
| 11 | use crateAppState; |
| 12 | |
| 13 | use ; |
| 14 | |
| 15 | |
| 16 | |
| 17 | |
| 18 | |
| 19 | /// One exam kind the school runs, with its weight in course averages. An exam |
| 20 | /// of this kind counts `weight` times into `Σ(mark×weight) / Σ(weight)`. |
| 21 | |
| 22 | |
| 23 | |
| 24 | |
| 25 | |
| 26 | |
| 27 | |
| 28 | |
| 29 | |
| 30 | |
| 31 | |
| 32 | /// One meal slot the school serves. A published menu snapshots this name, so |
| 33 | /// renaming or retiring a slot never rewrites a past menu. |
| 34 | |
| 35 | |
| 36 | |
| 37 | |
| 38 | |
| 39 | |
| 40 | |
| 41 | |
| 42 | |
| 43 | |
| 44 | |
| 45 | |
| 46 | |
| 47 | |
| 48 | |
| 49 | |
| 50 | |
| 51 | /// One grade-display band: marks at or above `min` (and below the next band's |
| 52 | /// `min`) render as `label`. |
| 53 | |
| 54 | |
| 55 | |
| 56 | |
| 57 | |
| 58 | |
| 59 | |
| 60 | |
| 61 | |
| 62 | |
| 63 | /// The school's policy: which exam kinds exist (and their weights in course |
| 64 | /// averages), which attendance statuses the roll call accepts, and how |
| 65 | /// numeric marks display as grades. |
| 66 | |
| 67 | |
| 68 | |
| 69 | |
| 70 | |
| 71 | , |
| 72 | , |
| 73 | , |
| 74 | ]))] |
| 75 | exam_kinds: , |
| 76 | /// Accepted `status` values for attendance marking. Always contains the |
| 77 | /// core four (`present`, `absent`, `late`, `excused`). |
| 78 | |
| 79 | attendance_statuses: , |
| 80 | /// Grade-display bands, highest first. Empty = marks display numeric-only. |
| 81 | grade_bands: , |
| 82 | /// Per-file size limit for note uploads, in bytes. |
| 83 | |
| 84 | max_file_bytes: i64, |
| 85 | /// How many prior turns of a thread the chatbot is given as context. |
| 86 | |
| 87 | chatbot_history_turns: i64, |
| 88 | /// How many chatbot threads one user may keep. |
| 89 | |
| 90 | max_chatbot_threads: i64, |
| 91 | /// Character limit on one chat message. |
| 92 | |
| 93 | max_chatbot_message_len: i64, |
| 94 | /// Meal slots menus may be published for, each with the UTC minute it is |
| 95 | /// served at (`null` = unset → the cutoff counts back from midnight UTC). |
| 96 | /// Empty = the school runs no meal program. |
| 97 | |
| 98 | |
| 99 | |
| 100 | |
| 101 | |
| 102 | meal_slots: , |
| 103 | /// Dietary tags a dish and a student's profile may carry. |
| 104 | |
| 105 | dietary_tags: , |
| 106 | /// How many minutes before a slot's `serving_minute` booking and |
| 107 | /// cancelling close. `null` = no cutoff. |
| 108 | |
| 109 | meal_cancel_cutoff_minutes: , |
| 110 | } |
| 111 | |
| 112 | |
| 113 | |
| 114 | |
| 115 | |
| 116 | |
| 117 | |
| 118 | |
| 119 | |
| 120 | |
| 121 | |
| 122 | |
| 123 | |
| 124 | |
| 125 | |
| 126 | |
| 127 | |
| 128 | |
| 129 | |
| 130 | |
| 131 | |
| 132 | |
| 133 | |
| 134 | |
| 135 | |
| 136 | |
| 137 | |
| 138 | |
| 139 | |
| 140 | |
| 141 | |
| 142 | |
| 143 | |
| 144 | |
| 145 | |
| 146 | |
| 147 | |
| 148 | |
| 149 | |
| 150 | |
| 151 | |
| 152 | |
| 153 | |
| 154 | |
| 155 | |
| 156 | |
| 157 | |
| 158 | |
| 159 | |
| 160 | |
| 161 | |
| 162 | |
| 163 | |
| 164 | |
| 165 | |
| 166 | |
| 167 | |
| 168 | |
| 169 | |
| 170 | |
| 171 | |
| 172 | |
| 173 | |
| 174 | |
| 175 | |
| 176 | |
| 177 | |
| 178 | |
| 179 | |
| 180 | |
| 181 | |
| 182 | |
| 183 | |
| 184 | |
| 185 | |
| 186 | |
| 187 | |
| 188 | |
| 189 | |
| 190 | |
| 191 | |
| 192 | |
| 193 | |
| 194 | |
| 195 | |
| 196 | |
| 197 | |
| 198 | |
| 199 | |
| 200 | |
| 201 | |
| 202 | |
| 203 | |
| 204 | |
| 205 | |
| 206 | |
| 207 | /// The school's current policy. Any authenticated user — clients need it to |
| 208 | /// render pickers and grades. Falls back to the built-in defaults until a |
| 209 | /// manager edits it. |
| 210 | |
| 211 | |
| 212 | |
| 213 | |
| 214 | |
| 215 | |
| 216 | |
| 217 | |
| 218 | |
| 219 | |
| 220 | async |
| 221 | |
| 222 | |
| 223 | |
| 224 | |
| 225 | |
| 226 | |
| 227 | |
| 228 | /// Update the school's policy. Requires manager+. Omitted fields keep their |
| 229 | /// value; a present field replaces its list wholesale. Existing rows are |
| 230 | /// untouched — a removed exam kind or status lives on in old records; only |
| 231 | /// new writes are held to the new lists. Kind weights, though, apply live: |
| 232 | /// mark reports read them at request time, so editing a weight re-weights |
| 233 | /// every exam of that kind. For that reason a kind whose exams already carry |
| 234 | /// marks cannot be dropped from the list (409) — those marks would silently |
| 235 | /// re-weight to 1; an unmarked kind leaves freely, and an exam whose kind is |
| 236 | /// gone counts with weight 1 but cannot be graded (409) until the kind |
| 237 | /// returns — the other end of the same rule. `max_file_bytes` likewise |
| 238 | /// applies at upload time only — already-stored files keep their size, and the |
| 239 | /// chatbot knobs apply to the next chat request only. `meal_slots` follows the |
| 240 | /// exam-kind rule: a slot a menu was already published for cannot be dropped |
| 241 | /// (409), because the menu snapshotted its name. Slot names must not contain |
| 242 | /// `/ \ ? # %` (400) — a menu's id carries the name into a URL — but a name |
| 243 | /// already on the school's stored list is exempt, so a list written before that |
| 244 | /// rule can still be edited around it. |
| 245 | |
| 246 | |
| 247 | |
| 248 | |
| 249 | |
| 250 | |
| 251 | |
| 252 | |
| 253 | |
| 254 | |
| 255 | |
| 256 | |
| 257 | |
| 258 | |
| 259 | |
| 260 | async |
| 261 | |
| 262 | |
| 263 | |
| 264 | |
| 265 | |
| 266 | |
| 267 | |
| 268 | |
| 269 | |
| 270 | |
| 271 | |
| 272 | |
| 273 | |
| 274 | |
| 275 | |
| 276 | |
| 277 | |
| 278 | |
| 279 | |
| 280 | |
| 281 | |
| 282 | |
| 283 | |
| 284 | |
| 285 | |
| 286 | |
| 287 | |
| 288 | |
| 289 | |
| 290 | |
| 291 | |
| 292 | |
| 293 | |
| 294 | |
| 295 | |
| 296 | |
| 297 | |
| 298 | |
| 299 | |
| 300 | |
| 301 | |
| 302 | |
| 303 | |
| 304 | |
| 305 | |
| 306 | |
| 307 | |
| 308 |