π½οΈ give a menu on an impossible day a cutoff
Browse files at this commit5fdba75e6b8162be9302b624ae3b81e5a2bfd2a5Parent: bd941b9- fix
- π½οΈ give a menu on an impossible day a cutoff
4 changed files +65 -10
- README.md +10 -2
- src/domain/meal_booking.rs +34 -2
- src/domain/menu.rs +20 -5
- src/lib.rs +1 -1
README.mdmodified+10 -2
| @@ -977,7 +977,7 @@ window filtering, before paging; negative values are a `400` naming the field. | |||
| 977 | | GET | `/terms/{id}` | student | Get one term | | 977 | | GET | `/terms/{id}` | student | Get one term | |
| 978 | | PATCH | `/terms/{id}` | manager | Edit a term (the merged range must stay ordered) | | 978 | | PATCH | `/terms/{id}` | manager | Edit a term (the merged range must stay ordered) | |
| 979 | | DELETE | `/terms/{id}` | manager | Delete a term β `409` while any course or class still links to it | | 979 | | DELETE | `/terms/{id}` | manager | Delete a term β `409` while any course or class still links to it | |
| 980 | -| POST | `/meals/menus` | manager | `{date, slot, capacity?}` β publish a menu; `date` is `YYYY-MM-DD` text, `slot` must be one of the school's `meal_slots` and may not contain `/ \ ? # %` (it becomes part of the menu's URL id); `409` when that day+slot is already published | | 980 | +| POST | `/meals/menus` | manager | `{date, slot, capacity?}` β publish a menu; `date` is `YYYY-MM-DD` text and must be a real calendar day (`2026-02-29` is a `400`: a menu on a day that does not exist has no serving instant, so no booking cutoff), `slot` must be one of the school's `meal_slots` and may not contain `/ \ ? # %` (it becomes part of the menu's URL id); `409` when that day+slot is already published | |
| 981 | | GET | `/meals/menus` | student | List menus with their dishes, newest day first Β· `?from=&to=` inclusive `YYYY-MM-DD` range Β· paged | | 981 | | GET | `/meals/menus` | student | List menus with their dishes, newest day first Β· `?from=&to=` inclusive `YYYY-MM-DD` range Β· paged | |
| 982 | | GET | `/meals/menus/{id}` | student | One menu with its dishes | | 982 | | GET | `/meals/menus/{id}` | student | One menu with its dishes | |
| 983 | | PATCH | `/meals/menus/{id}` | manager | `{capacity}` β the only mutable field (`null` = uncapped); `date` and `slot` are immutable | | 983 | | PATCH | `/meals/menus/{id}` | manager | `{capacity}` β the only mutable field (`null` = uncapped); `date` and `slot` are immutable | |
| @@ -1701,7 +1701,15 @@ The school publishes **one menu per calendar day and meal slot** (`POST | |||
| 1701 | slot" is an equality test on the school's own day, and a midnight-in-millis | 1701 | slot" is an equality test on the school's own day, and a midnight-in-millis |
| 1702 | day is only unique for one timezone. Fixed-width and zero-padded, so the | 1702 | day is only unique for one timezone. Fixed-width and zero-padded, so the |
| 1703 | text sorts chronologically β which is what the inclusive `?from=&to=` range | 1703 | text sorts chronologically β which is what the inclusive `?from=&to=` range |
| 1704 | - filter and the newest-day-first ordering are built on. | 1704 | + filter and the newest-day-first ordering are built on. It must be a **real |
| 1705 | + calendar day**, leap years included: `2026-02-29` is a `400`, here and as a | ||
| 1706 | + `?from=&to=` bound. A menu published on a day that does not exist was not the | ||
| 1707 | + inert typo it looks β it was fully actionable (seats, charges, dishes, | ||
| 1708 | + attendance marks) while having **no booking or cancel cutoff at all**, since | ||
| 1709 | + the deadline is counted back from an instant that day has none of. Menus | ||
| 1710 | + stored on such a day before this rule refuse booking and cancelling outright | ||
| 1711 | + (`409`) whenever a cutoff is configured: a deadline that cannot be worked out | ||
| 1712 | + fails closed, and the menu has to be republished on a real day. | ||
| 1705 | - **`slot` is a snapshot**, not a link into settings. It must be one of the | 1713 | - **`slot` is a snapshot**, not a link into settings. It must be one of the |
| 1706 | school's `meal_slots` (`GET /settings`) *when the menu is written*, and it | 1714 | school's `meal_slots` (`GET /settings`) *when the menu is written*, and it |
| 1707 | is stored as text β so retiring a slot later never rewrites a menu already | 1715 | is stored as text β so retiring a slot later never rewrites a menu already |
src/domain/meal_booking.rsmodified+34 -2
| @@ -664,11 +664,26 @@ fn served_at(date: &MenuDate, serving_minute: Option<i64>) -> Option<Timestamp> | |||
| 664 | 664 | ||
| 665 | /// Booking and cancelling both close `cutoff.minutes` before the meal is | 665 | /// Booking and cancelling both close `cutoff.minutes` before the meal is |
| 666 | /// served. `None` = the school set no cutoff, so neither ever closes. | 666 | /// served. `None` = the school set no cutoff, so neither ever closes. |
| 667 | +/// | ||
| 668 | +/// A date no serving instant can be computed from **fails closed**. A menu on | ||
| 669 | +/// an impossible day (a 31st of February β refused by [`MenuDate`] now, but | ||
| 670 | +/// rows written before that rule are still on the volume) otherwise skipped the | ||
| 671 | +/// deadline entirely, silently and forever, however large the school set it: | ||
| 672 | +/// the one menu with no cutoff at all would be the one nobody meant to publish. | ||
| 673 | +/// Refusing is the only answer that keeps "the deadline binds every menu" true; | ||
| 674 | +/// the menu has to be republished on a real day to become bookable again. | ||
| 667 | fn check_cutoff(date: &MenuDate, slot: &MenuSlot, cutoff: &MealCutoff) -> Result<(), AppError> { | 675 | fn check_cutoff(date: &MenuDate, slot: &MenuSlot, cutoff: &MealCutoff) -> Result<(), AppError> { |
| 668 | - let serving = served_at(date, cutoff.serving_minute(slot)); | 676 | + // A school with no cutoff configured closes nothing anyway, so an |
| 669 | - let (Some(minutes), Some(serving)) = (cutoff.minutes, serving) else { | 677 | + // impossible date is not refused there either β that would take the canteen |
| 678 | + // offline for a deadline the school never set. | ||
| 679 | + let Some(minutes) = cutoff.minutes else { | ||
| 670 | return Ok(()); | 680 | return Ok(()); |
| 671 | }; | 681 | }; |
| 682 | + let Some(serving) = served_at(date, cutoff.serving_minute(slot)) else { | ||
| 683 | + return Err(AppError::Conflict( | ||
| 684 | + "the menu's date is not a real calendar day, so its cutoff cannot be worked out", | ||
| 685 | + )); | ||
| 686 | + }; | ||
| 672 | let deadline = serving | 687 | let deadline = serving |
| 673 | .as_millis() | 688 | .as_millis() |
| 674 | .saturating_sub(minutes.saturating_mul(60_000)); | 689 | .saturating_sub(minutes.saturating_mul(60_000)); |
| @@ -1175,6 +1190,23 @@ mod tests { | |||
| 1175 | assert!(check_cutoff(&past, &lunch(), &cutoff(Some(60), Some(720))).is_err()); | 1190 | assert!(check_cutoff(&past, &lunch(), &cutoff(Some(60), Some(720))).is_err()); |
| 1176 | } | 1191 | } |
| 1177 | 1192 | ||
| 1193 | + /// A menu stored on a day that does not exist has no serving instant, so no | ||
| 1194 | + /// deadline can be counted back from it β and it must therefore refuse, not | ||
| 1195 | + /// pass. `MenuDate::try_new` rejects such a date now; this is a row written | ||
| 1196 | + /// before that rule, read back off the store exactly as the domain reads it | ||
| 1197 | + /// (the column is `TYPE string`), which is the only way one can still turn | ||
| 1198 | + /// up. Passing is what let it be booked and cancelled with no cutoff ever. | ||
| 1199 | + #[test] | ||
| 1200 | + fn an_impossible_day_has_no_open_deadline() { | ||
| 1201 | + let impossible = MenuDate::from_value(Value::String("2026-02-29".into())).unwrap(); | ||
| 1202 | + assert!(MenuDate::try_new(impossible.as_str()).is_err()); | ||
| 1203 | + assert!(check_cutoff(&impossible, &lunch(), &cutoff(Some(60), Some(720))).is_err()); | ||
| 1204 | + assert!(check_cutoff(&impossible, &lunch(), &cutoff(Some(60), None)).is_err()); | ||
| 1205 | + // A school that set no cutoff closes nothing anyway, impossible day or | ||
| 1206 | + // not: refusing there would take the canteen offline for no deadline. | ||
| 1207 | + assert!(check_cutoff(&impossible, &lunch(), &cutoff(None, Some(720))).is_ok()); | ||
| 1208 | + } | ||
| 1209 | + | ||
| 1178 | /// The instant the deadline counts back from: midnight UTC of the day plus | 1210 | /// The instant the deadline counts back from: midnight UTC of the day plus |
| 1179 | /// the slot's serving minute, and midnight itself when the slot has none. | 1211 | /// the slot's serving minute, and midnight itself when the slot has none. |
| 1180 | #[test] | 1212 | #[test] |
src/domain/menu.rsmodified+20 -5
| @@ -175,14 +175,18 @@ impl MenuDate { | |||
| 175 | } | 175 | } |
| 176 | let digits = | 176 | let digits = |
| 177 | |from: usize, to: usize| -> Option<u32> { value.get(from..to)?.parse::<u32>().ok() }; | 177 | |from: usize, to: usize| -> Option<u32> { value.get(from..to)?.parse::<u32>().ok() }; |
| 178 | - let (Some(_year), Some(month), Some(day)) = (digits(0, 4), digits(5, 7), digits(8, 10)) | 178 | + let (Some(year), Some(month), Some(day)) = (digits(0, 4), digits(5, 7), digits(8, 10)) |
| 179 | else { | 179 | else { |
| 180 | return Err(invalid); | 180 | return Err(invalid); |
| 181 | }; | 181 | }; |
| 182 | - // Day count per month is not checked: the calendar rules (leap years) | 182 | + // The day has to be a **real** one, leap years and all. A 31st of |
| 183 | - // would be the only thing this file knows about time, and a 31st of | 183 | + // February is not the harmless typo it looks: a menu is published on it |
| 184 | - // February menu is a typo nobody can act on, not a data hazard. | 184 | + // and is then fully actionable β seats, charges, dishes, attendance |
| 185 | - if !(1..=12).contains(&month) || !(1..=31).contains(&day) { | 185 | + // marks β but no instant can be computed for it, so the booking and |
| 186 | + // cancel cutoff has nothing to count back from and never closes at all. | ||
| 187 | + // The month/day ranges are this check's own business, hence no separate | ||
| 188 | + // bounds test above (`from_ymd_opt` refuses month 0 and day 32 alike). | ||
| 189 | + if chrono::NaiveDate::from_ymd_opt(year as i32, month, day).is_none() { | ||
| 186 | return Err(invalid); | 190 | return Err(invalid); |
| 187 | } | 191 | } |
| 188 | Ok(Self(value.to_string())) | 192 | Ok(Self(value.to_string())) |
| @@ -506,6 +510,17 @@ mod tests { | |||
| 506 | assert!(MenuDate::try_new("2026-01-32").is_err()); | 510 | assert!(MenuDate::try_new("2026-01-32").is_err()); |
| 507 | assert!(MenuDate::try_new("26-01-02").is_err()); | 511 | assert!(MenuDate::try_new("26-01-02").is_err()); |
| 508 | assert!(MenuDate::try_new("").is_err()); | 512 | assert!(MenuDate::try_new("").is_err()); |
| 513 | + // A day that no calendar has. Not a harmless typo: the serving instant | ||
| 514 | + // a menu's cutoff counts back from cannot be computed for it, so such a | ||
| 515 | + // menu used to be bookable and cancellable with no deadline at all. | ||
| 516 | + for impossible in ["2026-02-29", "2026-04-31", "2026-06-31", "2026-11-31"] { | ||
| 517 | + assert!( | ||
| 518 | + MenuDate::try_new(impossible).is_err(), | ||
| 519 | + "{impossible} is not a real day" | ||
| 520 | + ); | ||
| 521 | + } | ||
| 522 | + // β¦and the leap day that does exist is still a menu day. | ||
| 523 | + assert!(MenuDate::try_new("2024-02-29").is_ok()); | ||
| 509 | // Sorting the text must sort the calendar β the range filter relies on it. | 524 | // Sorting the text must sort the calendar β the range filter relies on it. |
| 510 | assert!( | 525 | assert!( |
| 511 | MenuDate::try_new("2026-01-09").unwrap() < MenuDate::try_new("2026-01-10").unwrap() | 526 | MenuDate::try_new("2026-01-09").unwrap() < MenuDate::try_new("2026-01-10").unwrap() |
src/lib.rsmodified+1 -1
| @@ -58,7 +58,7 @@ use crate::state::AppState; | |||
| 58 | (name = "bank", description = "The question bank: reusable question templates, **private by default**. A template is visible to its owner (and admins) alone until its owner explicitly publishes it by `PATCH`ing `visibility` to `school`, at which point every teacher+ sees it β saving a question to the bank must never broadcast its `correct` answer key as a side effect. A template the caller may not see is a `404` on every route, never a `403` (a 403 would confirm it exists). A teacher+ reads what they can see (`GET /bank-questions`: `?subject=` origin filter, `?owner=` (a user id or `me`), `?q=` text search, `?visibility=private|school` β the last narrows the caller's own view and never widens it, so `private` means \"my drafts\", never another teacher's) and instantiates any visible template into their own exam (`POST /exams/{id}/questions/from-bank/{bid}`, which copies the template β text, points, `choice`/`text` spec, illustration, and option pictures β into a fresh exam question under the target subject, source untouched); a teacher also saves an existing exam question back into the bank (`POST /exams/{id}/questions/{qid}/to-bank`). A template's `subject` is origin metadata only β the bank spans courses, so the same-course rule is checked at instantiate time against the target exam's course, never on the bank row. Editing, deleting, or publishing a template needs ownership (its owner, or an admin β 403 otherwise), and every one of those rights is re-checked against the caller's live role: `owner` is a historical column no demotion sweeps, so an account below `teacher` reads and edits nothing here, its own templates included; as a consequence of that admin bypass, an admin may publish or unpublish another teacher's private template, which is accepted by design. Templates never freeze, since they carry no exam tie. Images mirror exam question images (one illustration, one picture per option on `choice` templates; raster types only, β€ the school's `max_file_bytes`), owner-gated to write and readable by whoever may see the template"), | 58 | (name = "bank", description = "The question bank: reusable question templates, **private by default**. A template is visible to its owner (and admins) alone until its owner explicitly publishes it by `PATCH`ing `visibility` to `school`, at which point every teacher+ sees it β saving a question to the bank must never broadcast its `correct` answer key as a side effect. A template the caller may not see is a `404` on every route, never a `403` (a 403 would confirm it exists). A teacher+ reads what they can see (`GET /bank-questions`: `?subject=` origin filter, `?owner=` (a user id or `me`), `?q=` text search, `?visibility=private|school` β the last narrows the caller's own view and never widens it, so `private` means \"my drafts\", never another teacher's) and instantiates any visible template into their own exam (`POST /exams/{id}/questions/from-bank/{bid}`, which copies the template β text, points, `choice`/`text` spec, illustration, and option pictures β into a fresh exam question under the target subject, source untouched); a teacher also saves an existing exam question back into the bank (`POST /exams/{id}/questions/{qid}/to-bank`). A template's `subject` is origin metadata only β the bank spans courses, so the same-course rule is checked at instantiate time against the target exam's course, never on the bank row. Editing, deleting, or publishing a template needs ownership (its owner, or an admin β 403 otherwise), and every one of those rights is re-checked against the caller's live role: `owner` is a historical column no demotion sweeps, so an account below `teacher` reads and edits nothing here, its own templates included; as a consequence of that admin bypass, an admin may publish or unpublish another teacher's private template, which is accepted by design. Templates never freeze, since they carry no exam tie. Images mirror exam question images (one illustration, one picture per option on `choice` templates; raster types only, β€ the school's `max_file_bytes`), owner-gated to write and readable by whoever may see the template"), |
| 59 | (name = "attendance", description = "Attendance summary reports: event tallies + per-course lesson roll call with rates. Own report at `/me`; another user's needs teacher+ (teachers narrowed to their courses) or a parent link to that student"), | 59 | (name = "attendance", description = "Attendance summary reports: event tallies + per-course lesson roll call with rates. Own report at `/me`; another user's needs teacher+ (teachers narrowed to their courses) or a parent link to that student"), |
| 60 | (name = "exams", description = "Exams (per course, weighted by their kind β see `settings`): results, sync/async/open scheduling, attempts (students only β staff never sit) with retakes (`max_attempts`, 0 = unlimited) and a live rejoin door (`allow_rejoin`), questions/answers, and live monitoring (no-shows flagged `absent` once the window closes). Questions may carry images: one illustration per question (any kind β the map the prompt asks about) and one picture per option on `choice` questions, uploaded per slot (multipart, raster types only, β€ the school's `max_file_bytes`) and frozen with the rest of the question once attempts exist; bytes are served to course managers and to enrolled students once they hold an attempt. Students mirror this on the answer side β one drawing per question inside their attempt (`POST /exams/{id}/attempt/answers/{qid}/image`, same raster types and size cap), saved like any answer through the writable-attempt gate and read back by the student (own) or a course manager (grading). Each sitting keeps its own answers, drawings, and mark keyed by the attempt `seq` β a retake starts from a blank sheet without erasing the prior one; the grading views show the latest sitting, a course manager reads any prior one via `GET /exams/{id}/students/{user}/attempts[/{seq}/answers]` (and the mark history at `.../marks`), and the latest seq is the grade-of-record. When the teacher turns on `allow_review`, a marked student reads back the answer key (`GET /exams/{id}/review/questions`, `correct` included) and their own sittings through `GET /exams/{id}/review/attempts[/{seq}/answers[/{qid}/image]]` (own-scoped β never another student's, and only once an `ExamResult` proves they were marked). Those reads are refused (`409`) while the caller's own latest sitting on that exam is in progress, and a question sharing a question-bank template with a question in *another* exam the caller has a sitting open on comes back with `correct: null` β and with no correctness flag and no `auto_score` contribution on the answer sheet β since the bank copies `correct` into every instantiation. A question links to a template whichever way it got there, and both directions are matched: the template it was instantiated from (`from_bank`) and the one minted by saving it into the bank (`banked_as`), so a hand-written question that was saved to the bank and then instantiated elsewhere is hidden too. That redaction is per question, keyed on the template: the rest of the reviewed exam reads normally, a question with no bank link in either direction is never hidden, and the key comes back once the other sitting is submitted or expires. Known limit, accepted: deleting a template clears both columns on every question that pointed at it, so a pair whose template was since deleted keeps the identical `correct` with nothing left to join them by. A modeless exam is offline-graded β attempts on it are a 409. An exam still being written can be saved as a **draft** (`draft: true` on create, published later by `PATCH`ing `draft: false`): drafts are visible only to the course's managers (students get 404s), cannot be sat or graded, and once attempts or results exist an exam cannot be re-drafted. Not in this spec (WebSocket): the student exam room at `GET /exams/{id}/attempt/ws` β JSON frames; entering clears the attempt's `left_at`, leaving mid-attempt stamps it. See the README's \"Taking an exam\" section for the protocol. `GET /exams` takes an optional `?starts_after=&ends_after=` schedule window (unix-millis), applied after visibility and draft filtering, that keeps only upcoming/unfinished exams and lists them soonest-first (window-less exams β no `mode`, or `open` β drop out); without it the list stays newest-first"), | 60 | (name = "exams", description = "Exams (per course, weighted by their kind β see `settings`): results, sync/async/open scheduling, attempts (students only β staff never sit) with retakes (`max_attempts`, 0 = unlimited) and a live rejoin door (`allow_rejoin`), questions/answers, and live monitoring (no-shows flagged `absent` once the window closes). Questions may carry images: one illustration per question (any kind β the map the prompt asks about) and one picture per option on `choice` questions, uploaded per slot (multipart, raster types only, β€ the school's `max_file_bytes`) and frozen with the rest of the question once attempts exist; bytes are served to course managers and to enrolled students once they hold an attempt. Students mirror this on the answer side β one drawing per question inside their attempt (`POST /exams/{id}/attempt/answers/{qid}/image`, same raster types and size cap), saved like any answer through the writable-attempt gate and read back by the student (own) or a course manager (grading). Each sitting keeps its own answers, drawings, and mark keyed by the attempt `seq` β a retake starts from a blank sheet without erasing the prior one; the grading views show the latest sitting, a course manager reads any prior one via `GET /exams/{id}/students/{user}/attempts[/{seq}/answers]` (and the mark history at `.../marks`), and the latest seq is the grade-of-record. When the teacher turns on `allow_review`, a marked student reads back the answer key (`GET /exams/{id}/review/questions`, `correct` included) and their own sittings through `GET /exams/{id}/review/attempts[/{seq}/answers[/{qid}/image]]` (own-scoped β never another student's, and only once an `ExamResult` proves they were marked). Those reads are refused (`409`) while the caller's own latest sitting on that exam is in progress, and a question sharing a question-bank template with a question in *another* exam the caller has a sitting open on comes back with `correct: null` β and with no correctness flag and no `auto_score` contribution on the answer sheet β since the bank copies `correct` into every instantiation. A question links to a template whichever way it got there, and both directions are matched: the template it was instantiated from (`from_bank`) and the one minted by saving it into the bank (`banked_as`), so a hand-written question that was saved to the bank and then instantiated elsewhere is hidden too. That redaction is per question, keyed on the template: the rest of the reviewed exam reads normally, a question with no bank link in either direction is never hidden, and the key comes back once the other sitting is submitted or expires. Known limit, accepted: deleting a template clears both columns on every question that pointed at it, so a pair whose template was since deleted keeps the identical `correct` with nothing left to join them by. A modeless exam is offline-graded β attempts on it are a 409. An exam still being written can be saved as a **draft** (`draft: true` on create, published later by `PATCH`ing `draft: false`): drafts are visible only to the course's managers (students get 404s), cannot be sat or graded, and once attempts or results exist an exam cannot be re-drafted. Not in this spec (WebSocket): the student exam room at `GET /exams/{id}/attempt/ws` β JSON frames; entering clears the attempt's `left_at`, leaving mid-attempt stamps it. See the README's \"Taking an exam\" section for the protocol. `GET /exams` takes an optional `?starts_after=&ends_after=` schedule window (unix-millis), applied after visibility and draft filtering, that keeps only upcoming/unfinished exams and lists them soonest-first (window-less exams β no `mode`, or `open` β drop out); without it the list stays newest-first"), |
| 61 | - (name = "meals", description = "The school's food program. A manager+ publishes one menu per calendar day and meal slot (`POST /meals/menus` β `date` is text, `YYYY-MM-DD`, and `slot` must be one of the school's `meal_slots` from `GET /settings`, and may not contain `/ \\ ? # %` β the slot name is copied into the menu's record id, which is a URL path segment, so such a menu could never be addressed again; the same characters are refused at `PATCH /settings`), optionally capped by a `capacity`; the day+slot pair is unique, so a second publish for the same meal is a `409` β edit the first one instead. The slot is snapshotted as text, never a link, so retiring a slot in settings leaves every published menu intact (and a slot a menu already used cannot be retired at all, `409`). Only `capacity` is patchable: `date` and `slot` are immutable, since a menu on another day is another menu. Dishes hang off a menu (`POST /meals/menus/{id}/dishes`, at most 50, edited and removed at `/meals/dishes/{did}`, both `404` once the dish's menu is gone β every dish write moves its menu's revision in the same transaction, which makes the menu's existence part of the write), each with an optional description, dietary tags drawn from the school's `dietary_tags`, and a `price_minor` in **minor units** (kuruΕ) as an integer β this API never speaks decimals or floats about money. Deleting a menu takes its dishes **and its attendance marks** with it, in the same transaction as the row: a menu's id is deterministic on day+slot, so anything left behind would resurface attached to the next menu published for that meal. Cancelled bookings deliberately stay β their `attempt` counter is what keeps the ledger's `(booking, attempt)` ids unique. A student carries a **dietary profile** of tags from that same `dietary_tags` list plus a free-text note for the kitchen (`GET /meals/profiles/me`, `GET /meals/profiles/{user}` β own always, otherwise teacher+ or a parent link β and `PATCH /meals/profiles/{user}`, **manager+**: an allergen list is a safety record the school keeps, not a self-service preference, so a student editing their own is a `403`). Because both sides are tagged from one vocabulary, every dish a menu read returns carries a `conflicts` list β the intersection of the dish's tags with the *calling user's* profile tags, empty when they do not overlap and empty for every reader without a profile (a manager sees `conflicts: []`, which is correct, not a bug). Reads are open to every authenticated user (a student needs to see what is being served) except the two money reads below; every write is manager+. Students take seats on a menu (`POST /meals/menus/{id}/bookings`): a student books for themselves, a parent for a student they hold a link to (the one write a `parent_link` authorises) β staff never book for a child (`403`). One row per (menu, student), so booking twice is the same seat; a full menu is a `409`, and that cap is a single conditional write on a counter kept on the menu row β taken and spent in the same transaction that places the booking, since counting rows and then writing one is write-skew. Cancelling (`DELETE /meals/bookings/{bid}`, answering `200` with the flipped row β its student, their parent, or **any manager+**, so a seat and its charge stay reachable once the student it was booked for is no longer a student) is a **status transition, not a delete**: the row stays as `cancelled` with a `cancelled_at` stamp so the freed seat remains auditable, only `booked` rows count against the capacity, and re-booking flips the same row back. The call is **idempotent** β cancelling an already-cancelled seat is a `200` that replays the refund, not a `409`, so a cancel cut short between the flip and the reversal is recovered by simply repeating it. The flip releases **only the attempt the call read** (the same `attempt` fence the re-booking side carries), so a seat taken again while the cancel was in flight is a `409` rather than a silent cancellation of that brand-new seat β unfenced it freed a seat the API had just answered `201` for, refunded nothing (the money is keyed to the older attempt, already reversed) and burnt the new attempt's reversal id for good. The school's `meal_cancel_cutoff_minutes` closes both ends at once β inside that window neither booking nor cancelling lands (`409`) β but it binds **students and parents only**: a manager+ is not held to it, since a deadline meant to stop students gaming the kitchen's headcount is no reason to leave staff holding a seat they cannot free, on a menu that then refuses its own deletion forever and a charge that can never be reversed. It is measured back from the instant the meal is served: the menu's `date` plus the slot's `serving_minute` from `GET /settings` (minutes past midnight **UTC** β this API stores no school timezone, so staff enter UTC). A slot with no `serving_minute` set falls back to midnight UTC of that date, the pre-serving-time behaviour. The slot list is read live at booking and cancelling time, so correcting a serving time moves the deadline of menus already published for it. A menu with a live booking refuses deletion (`409`). `GET /meals/bookings/me` returns the seats held for the caller plus, for a parent, the seats held for every student they *currently* hold a link to β the links are re-read on every call rather than trusted from the booking's `booked_by` stamp, so an unlinked parent stops seeing the child's seats at once, including ones they booked themselves; `GET /meals/menus/{id}/bookings` is the kitchen's per-menu list (manager+), cancelled rows included. The money is an **append-only ledger** β no route edits or deletes a line, and no balance is stored anywhere: it is always the fold `credits + reversals - charges` in minor units, so a negative balance means the student owes the school. Booking is what charges, at a **price snapshot** (the menu's dishes summed the moment the seat is taken and frozen onto the booking row; the claim that takes the seat asserts the menu is still at the revision the price was read at, and every dish write bumps that revision, so a dish landing between the sum and the seat refuses the booking, which re-reads and prices itself again), so a later price edit never moves an existing charge and re-booking after a cancel bills the then-current price; a menu whose dishes sum past the chargeable maximum refuses the booking outright (`400`) rather than seating anyone unbilled. Booking the same seat twice bills once β the charge and its reversal are keyed by (booking, attempt), and the seat and its flip move in one transaction, so eight simultaneous `POST`s hold one seat and write one charge line, a retried cancel refunds once, and a half-written attempt heals when the request is repeated. A seat taken while the menu was free records *that it was free*, so pricing the menu afterwards never bills it retroactively. Cancelling appends a `reversal` for that exact amount pointing at the charge, written by the **same transaction that flips the seat** rather than after it β as two writes a crash in between gave the seat back and left the student billed, with no later cancel able to repay it, since the money is keyed to the attempt the flip had already consumed; the reversal lands only when the charge it undoes is really there, checked inside that transaction, because a refund with no charge behind it invents money. The charge row itself stays. Who actually ate is recorded separately by teacher+ (`POST /meals/menus/{id}/attendance` with `{student_id, status}` β `served` or `missed`, the canteen's own fixed pair rather than the school's editable roll-call statuses; one row per (menu, person), so re-marking flips that row; the target need only exist, since a canteen also feeds staff and a mark records what happened rather than who was entitled; a `404` when the menu is unpublished mid-request, because the menu row is the write's own target and a mark left on a deleted menu would resurface on the next one published for that day and slot), read back per menu (`GET /meals/menus/{id}/attendance`) or per student (`GET /meals/attendance/{user}`, `?from=&to=` inclusive `YYYY-MM-DD` bounds on the menu's day, gated like the other per-student reports: teacher+ or a parent link). Meal attendance has **zero billing effect**: a no-show still pays, since the seat was reserved and the food was cooked β no penalty, no refund-on-missed, no auto-reversal; and a walk-in marked `served` without a booking is recorded but never charged, since charging is booking's job alone. `POST /meals/credits` records money received (`{student_id, amount_minor, method?, note?}`, whose target must be a student or anyone already carrying meal-ledger lines β a debt outlives its debtor's role change and has to stay settleable, while a mistyped staff id carries no lines and is still a `400`) and is **admin-only**, not manager β the backend speaks to no payment gateway and stores no card data; an over-credit is corrected with a compensating line, never a fix-up. `GET /meals/balance/me`, `/meals/balance/{user}`, and `/meals/ledger/{user}` (paged) read it: your own always, another student's only as **manager+** or as a parent linked to them β **a teacher gets a `403`**, the same rule every `/payments` route holds, because canteen debt is family debt and what a family owes is not classroom information"), | 61 | + (name = "meals", description = "The school's food program. A manager+ publishes one menu per calendar day and meal slot (`POST /meals/menus` β `date` is text, `YYYY-MM-DD`, and must be a **real calendar day**, leap years included: a menu on a day that does not exist (`2026-02-29`) has no serving instant, so it carried no booking or cancel cutoff at all while being fully actionable otherwise, and a menu stored on such a day before that rule now refuses both (`409`) whenever a cutoff is configured β the deadline fails closed rather than never closing. `slot` must be one of the school's `meal_slots` from `GET /settings`, and may not contain `/ \\ ? # %` β the slot name is copied into the menu's record id, which is a URL path segment, so such a menu could never be addressed again; the same characters are refused at `PATCH /settings`), optionally capped by a `capacity`; the day+slot pair is unique, so a second publish for the same meal is a `409` β edit the first one instead. The slot is snapshotted as text, never a link, so retiring a slot in settings leaves every published menu intact (and a slot a menu already used cannot be retired at all, `409`). Only `capacity` is patchable: `date` and `slot` are immutable, since a menu on another day is another menu. Dishes hang off a menu (`POST /meals/menus/{id}/dishes`, at most 50, edited and removed at `/meals/dishes/{did}`, both `404` once the dish's menu is gone β every dish write moves its menu's revision in the same transaction, which makes the menu's existence part of the write), each with an optional description, dietary tags drawn from the school's `dietary_tags`, and a `price_minor` in **minor units** (kuruΕ) as an integer β this API never speaks decimals or floats about money. Deleting a menu takes its dishes **and its attendance marks** with it, in the same transaction as the row: a menu's id is deterministic on day+slot, so anything left behind would resurface attached to the next menu published for that meal. Cancelled bookings deliberately stay β their `attempt` counter is what keeps the ledger's `(booking, attempt)` ids unique. A student carries a **dietary profile** of tags from that same `dietary_tags` list plus a free-text note for the kitchen (`GET /meals/profiles/me`, `GET /meals/profiles/{user}` β own always, otherwise teacher+ or a parent link β and `PATCH /meals/profiles/{user}`, **manager+**: an allergen list is a safety record the school keeps, not a self-service preference, so a student editing their own is a `403`). Because both sides are tagged from one vocabulary, every dish a menu read returns carries a `conflicts` list β the intersection of the dish's tags with the *calling user's* profile tags, empty when they do not overlap and empty for every reader without a profile (a manager sees `conflicts: []`, which is correct, not a bug). Reads are open to every authenticated user (a student needs to see what is being served) except the two money reads below; every write is manager+. Students take seats on a menu (`POST /meals/menus/{id}/bookings`): a student books for themselves, a parent for a student they hold a link to (the one write a `parent_link` authorises) β staff never book for a child (`403`). One row per (menu, student), so booking twice is the same seat; a full menu is a `409`, and that cap is a single conditional write on a counter kept on the menu row β taken and spent in the same transaction that places the booking, since counting rows and then writing one is write-skew. Cancelling (`DELETE /meals/bookings/{bid}`, answering `200` with the flipped row β its student, their parent, or **any manager+**, so a seat and its charge stay reachable once the student it was booked for is no longer a student) is a **status transition, not a delete**: the row stays as `cancelled` with a `cancelled_at` stamp so the freed seat remains auditable, only `booked` rows count against the capacity, and re-booking flips the same row back. The call is **idempotent** β cancelling an already-cancelled seat is a `200` that replays the refund, not a `409`, so a cancel cut short between the flip and the reversal is recovered by simply repeating it. The flip releases **only the attempt the call read** (the same `attempt` fence the re-booking side carries), so a seat taken again while the cancel was in flight is a `409` rather than a silent cancellation of that brand-new seat β unfenced it freed a seat the API had just answered `201` for, refunded nothing (the money is keyed to the older attempt, already reversed) and burnt the new attempt's reversal id for good. The school's `meal_cancel_cutoff_minutes` closes both ends at once β inside that window neither booking nor cancelling lands (`409`) β but it binds **students and parents only**: a manager+ is not held to it, since a deadline meant to stop students gaming the kitchen's headcount is no reason to leave staff holding a seat they cannot free, on a menu that then refuses its own deletion forever and a charge that can never be reversed. It is measured back from the instant the meal is served: the menu's `date` plus the slot's `serving_minute` from `GET /settings` (minutes past midnight **UTC** β this API stores no school timezone, so staff enter UTC). A slot with no `serving_minute` set falls back to midnight UTC of that date, the pre-serving-time behaviour. The slot list is read live at booking and cancelling time, so correcting a serving time moves the deadline of menus already published for it. A menu with a live booking refuses deletion (`409`). `GET /meals/bookings/me` returns the seats held for the caller plus, for a parent, the seats held for every student they *currently* hold a link to β the links are re-read on every call rather than trusted from the booking's `booked_by` stamp, so an unlinked parent stops seeing the child's seats at once, including ones they booked themselves; `GET /meals/menus/{id}/bookings` is the kitchen's per-menu list (manager+), cancelled rows included. The money is an **append-only ledger** β no route edits or deletes a line, and no balance is stored anywhere: it is always the fold `credits + reversals - charges` in minor units, so a negative balance means the student owes the school. Booking is what charges, at a **price snapshot** (the menu's dishes summed the moment the seat is taken and frozen onto the booking row; the claim that takes the seat asserts the menu is still at the revision the price was read at, and every dish write bumps that revision, so a dish landing between the sum and the seat refuses the booking, which re-reads and prices itself again), so a later price edit never moves an existing charge and re-booking after a cancel bills the then-current price; a menu whose dishes sum past the chargeable maximum refuses the booking outright (`400`) rather than seating anyone unbilled. Booking the same seat twice bills once β the charge and its reversal are keyed by (booking, attempt), and the seat and its flip move in one transaction, so eight simultaneous `POST`s hold one seat and write one charge line, a retried cancel refunds once, and a half-written attempt heals when the request is repeated. A seat taken while the menu was free records *that it was free*, so pricing the menu afterwards never bills it retroactively. Cancelling appends a `reversal` for that exact amount pointing at the charge, written by the **same transaction that flips the seat** rather than after it β as two writes a crash in between gave the seat back and left the student billed, with no later cancel able to repay it, since the money is keyed to the attempt the flip had already consumed; the reversal lands only when the charge it undoes is really there, checked inside that transaction, because a refund with no charge behind it invents money. The charge row itself stays. Who actually ate is recorded separately by teacher+ (`POST /meals/menus/{id}/attendance` with `{student_id, status}` β `served` or `missed`, the canteen's own fixed pair rather than the school's editable roll-call statuses; one row per (menu, person), so re-marking flips that row; the target need only exist, since a canteen also feeds staff and a mark records what happened rather than who was entitled; a `404` when the menu is unpublished mid-request, because the menu row is the write's own target and a mark left on a deleted menu would resurface on the next one published for that day and slot), read back per menu (`GET /meals/menus/{id}/attendance`) or per student (`GET /meals/attendance/{user}`, `?from=&to=` inclusive `YYYY-MM-DD` bounds on the menu's day, gated like the other per-student reports: teacher+ or a parent link). Meal attendance has **zero billing effect**: a no-show still pays, since the seat was reserved and the food was cooked β no penalty, no refund-on-missed, no auto-reversal; and a walk-in marked `served` without a booking is recorded but never charged, since charging is booking's job alone. `POST /meals/credits` records money received (`{student_id, amount_minor, method?, note?}`, whose target must be a student or anyone already carrying meal-ledger lines β a debt outlives its debtor's role change and has to stay settleable, while a mistyped staff id carries no lines and is still a `400`) and is **admin-only**, not manager β the backend speaks to no payment gateway and stores no card data; an over-credit is corrected with a compensating line, never a fix-up. `GET /meals/balance/me`, `/meals/balance/{user}`, and `/meals/ledger/{user}` (paged) read it: your own always, another student's only as **manager+** or as a parent linked to them β **a teacher gets a `403`**, the same rule every `/payments` route holds, because canteen debt is family debt and what a family owes is not classroom information"), |
| 62 | (name = "payments", description = "School fees: the plans, who is on them, and the money. A manager+ writes a **fee plan** (`POST /payments/plans` β a name and 1 to 60 installments, each `{amount_minor, due_at}` in **minor units** (kuruΕ) as an integer and unix milliseconds; `due_at` **may be in the past**, since a school adopting the app mid-year assigns plans whose first installments were already due). Writing a plan bills nobody: **assigning it does** (`POST /payments/plans/{id}/assignments` with `{student_ids}`, at most 200 per call), and that appends *every* installment as a `charge` line at once, each carrying its own due date. There is no scheduler and no sweep. Assignment is **replay-safe by identity** β an assignment is keyed (plan, student) and every charge it raises (plan, student, installment) β so re-assigning bills nothing a second time (reported per student as `already_assigned`), and an assignment cut short after three of twelve charges landed completes itself when the call is repeated. Only students carry a fee record, so any other target comes back `rejected` without losing the rest of the batch. A plan that has been assigned to anyone can no longer be edited or deleted (`409`): its charges are frozen copies of the installments as they stood, so an edit would only make the plan and the money disagree β write a new plan instead. That freeze is a **counter on the plan row**, incremented in the same transaction as the assignment it counts, and the edit and the delete are conditional writes against it β so a manager editing a plan at the very instant it is being assigned is decided one way or the other by the database, never left half-applied, and the installments a first assignment bills are read back from the stored plan at the moment it freezes. The money is an **append-only ledger**: no route edits or deletes a line, every stored field is `READONLY`, and a mistake is corrected by appending the opposing line so that both the mistake and the correction stay visible. **No balance is stored anywhere** β it is always the fold `credits + reversals - charges - refunds` in minor units, so a negative balance means the family owes the school, and every amount is stored positive with the sign living in the `kind`. `POST /payments/credits` records money received against **one named charge** (`{charge_id, amount_minor, method?, note?}`) β allocation is recorded, never inferred from a balance, and partial payments are the norm; `POST /payments/refunds` hands money back against **one named payment** (`{credit_id, β¦}`), which is also the only way a mistaken credit is corrected, since a credit is never reversed; both take an optional **`request_key`** (`[A-Za-z0-9-]`, 1β64 characters β no `_`, which is the separator inside a ledger line's id) that makes the call **retry-safe by identity**: the line is keyed `<target>_k_<key>` (`_kr_` for a refund), so a client retry after a network timeout returns the line the first attempt wrote instead of recording the money twice β even when that payment filled the charge exactly, since the replay is answered before the over-payment cap is consulted. The same key sent with a different `amount_minor` or target is a `409`, never the stored line: that is a client bug, and answering `201` would hide it. Omit the key and two identical posts are two payments, as a desk taking the same amount twice really is. `POST /payments/reversals` (`{line_id, note?}`) undoes a `charge` or a `refund` for its exact amount and nothing else (`400` otherwise), is keyed `<line>_r` and so reverses once however often it is retried. A reversed charge is no longer owed, so it takes no payment: `POST /payments/credits` against one is a `409` that says it was **reversed**, not that it was paid in full β a reversal fills the same room a payment does, and a bursar told \"paid in full\" about money that never arrived would go looking for it. Payments and refunds are capped by the line they target (`409` past it) β that cap is a cross-record sum, which the database cannot enforce on its own β it holds because the backend runs as one process and the sum, and the append it authorizes, are taken under one lock. Should an over-payment ever be recorded anyway, it is visible in the statement and undone by a refund, and both lines stay true records of money that really arrived. The backend speaks to no payment gateway and stores no card data; `method` is free text (\"cash\", \"havale\", β¦). Every write here is **manager+** β teachers never touch fees. Reads are narrower than the other per-student reports: `GET /payments/ledger/{user}` (paged raw lines), `/payments/statement/me`, `/payments/statement/{user}` (the per-charge rows are paged too, in an `entries: {items, total, limit, offset}` envelope β the window is taken **after** the fold, so `balance_minor` and every `overdue` reading are the same on every page), `/payments/balance/me` and `/payments/balance/{user}` are readable by the student themselves, by a parent holding a live link to them, and by manager+ β **a teacher gets a `403`**, because what a family owes the school is not classroom information. The statement is a per-charge rollup β plan, installment amount and due date, what it collected, what went back out, what is still outstanding, whether the charge was reversed, and whether it is `overdue` (still owed and its `due_at` has passed) β all folded from the raw lines on every request and stored nowhere"), | 62 | (name = "payments", description = "School fees: the plans, who is on them, and the money. A manager+ writes a **fee plan** (`POST /payments/plans` β a name and 1 to 60 installments, each `{amount_minor, due_at}` in **minor units** (kuruΕ) as an integer and unix milliseconds; `due_at` **may be in the past**, since a school adopting the app mid-year assigns plans whose first installments were already due). Writing a plan bills nobody: **assigning it does** (`POST /payments/plans/{id}/assignments` with `{student_ids}`, at most 200 per call), and that appends *every* installment as a `charge` line at once, each carrying its own due date. There is no scheduler and no sweep. Assignment is **replay-safe by identity** β an assignment is keyed (plan, student) and every charge it raises (plan, student, installment) β so re-assigning bills nothing a second time (reported per student as `already_assigned`), and an assignment cut short after three of twelve charges landed completes itself when the call is repeated. Only students carry a fee record, so any other target comes back `rejected` without losing the rest of the batch. A plan that has been assigned to anyone can no longer be edited or deleted (`409`): its charges are frozen copies of the installments as they stood, so an edit would only make the plan and the money disagree β write a new plan instead. That freeze is a **counter on the plan row**, incremented in the same transaction as the assignment it counts, and the edit and the delete are conditional writes against it β so a manager editing a plan at the very instant it is being assigned is decided one way or the other by the database, never left half-applied, and the installments a first assignment bills are read back from the stored plan at the moment it freezes. The money is an **append-only ledger**: no route edits or deletes a line, every stored field is `READONLY`, and a mistake is corrected by appending the opposing line so that both the mistake and the correction stay visible. **No balance is stored anywhere** β it is always the fold `credits + reversals - charges - refunds` in minor units, so a negative balance means the family owes the school, and every amount is stored positive with the sign living in the `kind`. `POST /payments/credits` records money received against **one named charge** (`{charge_id, amount_minor, method?, note?}`) β allocation is recorded, never inferred from a balance, and partial payments are the norm; `POST /payments/refunds` hands money back against **one named payment** (`{credit_id, β¦}`), which is also the only way a mistaken credit is corrected, since a credit is never reversed; both take an optional **`request_key`** (`[A-Za-z0-9-]`, 1β64 characters β no `_`, which is the separator inside a ledger line's id) that makes the call **retry-safe by identity**: the line is keyed `<target>_k_<key>` (`_kr_` for a refund), so a client retry after a network timeout returns the line the first attempt wrote instead of recording the money twice β even when that payment filled the charge exactly, since the replay is answered before the over-payment cap is consulted. The same key sent with a different `amount_minor` or target is a `409`, never the stored line: that is a client bug, and answering `201` would hide it. Omit the key and two identical posts are two payments, as a desk taking the same amount twice really is. `POST /payments/reversals` (`{line_id, note?}`) undoes a `charge` or a `refund` for its exact amount and nothing else (`400` otherwise), is keyed `<line>_r` and so reverses once however often it is retried. A reversed charge is no longer owed, so it takes no payment: `POST /payments/credits` against one is a `409` that says it was **reversed**, not that it was paid in full β a reversal fills the same room a payment does, and a bursar told \"paid in full\" about money that never arrived would go looking for it. Payments and refunds are capped by the line they target (`409` past it) β that cap is a cross-record sum, which the database cannot enforce on its own β it holds because the backend runs as one process and the sum, and the append it authorizes, are taken under one lock. Should an over-payment ever be recorded anyway, it is visible in the statement and undone by a refund, and both lines stay true records of money that really arrived. The backend speaks to no payment gateway and stores no card data; `method` is free text (\"cash\", \"havale\", β¦). Every write here is **manager+** β teachers never touch fees. Reads are narrower than the other per-student reports: `GET /payments/ledger/{user}` (paged raw lines), `/payments/statement/me`, `/payments/statement/{user}` (the per-charge rows are paged too, in an `entries: {items, total, limit, offset}` envelope β the window is taken **after** the fold, so `balance_minor` and every `overdue` reading are the same on every page), `/payments/balance/me` and `/payments/balance/{user}` are readable by the student themselves, by a parent holding a live link to them, and by manager+ β **a teacher gets a `403`**, because what a family owes the school is not classroom information. The statement is a per-charge rollup β plan, installment amount and due date, what it collected, what went back out, what is still outstanding, whether the charge was reversed, and whether it is `overdue` (still owed and its `due_at` has passed) β all folded from the raw lines on every request and stored nowhere"), |
| 63 | (name = "marks", description = "Weighted mark reports per course and overall, labeled by the school's grade bands when configured. Each mark counts its exam kind's settings-configured weight times (weight 1 when the kind was since removed from settings). Own report at `/me`; another user's needs teacher+ (teachers narrowed to their courses) or a parent link to that student"), | 63 | (name = "marks", description = "Weighted mark reports per course and overall, labeled by the school's grade bands when configured. Each mark counts its exam kind's settings-configured weight times (weight 1 when the kind was since removed from settings). Own report at `/me`; another user's needs teacher+ (teachers narrowed to their courses) or a parent link to that student"), |
| 64 | (name = "settings", description = "School policy, one singleton: exam kinds with their course-average weights, attendance statuses, grade-display bands, and the per-file upload size limit (`max_file_bytes` β note files and question images alike). An exam kind whose exams already carry marks cannot be removed from the list (409) β those marks would silently re-weight. Also the food program: the meal slots menus are published for β each with an optional `serving_minute`, the minutes past midnight **UTC** at which it is served (there is deliberately no school-timezone setting, so a UTC+3 school enters `540` for a noon meal; `null` = unset, and the cutoff then counts from midnight UTC) β the dietary tags a dish or a student's profile may carry, and `meal_cancel_cutoff_minutes` β one knob closing both booking and cancelling ahead of a slot's serving time (`null` = no cutoff). A slot a menu was already published for cannot be removed (409), same reason. A slot name may not contain `/ \\ ? # %` (400) β the name is copied verbatim into a menu's record id, which is a URL path segment β but a name the school's stored list already carries is exempt from that rule, since re-validating it would leave a list written before the rule existed unable to be edited at all: re-sending the name is a 400 and dropping it is a 409 once a menu used it. A grandfathered name still cannot carry a new menu, and dropping it is still the only way to remove it. Read: any authenticated user; edit: manager+"), | 64 | (name = "settings", description = "School policy, one singleton: exam kinds with their course-average weights, attendance statuses, grade-display bands, and the per-file upload size limit (`max_file_bytes` β note files and question images alike). An exam kind whose exams already carry marks cannot be removed from the list (409) β those marks would silently re-weight. Also the food program: the meal slots menus are published for β each with an optional `serving_minute`, the minutes past midnight **UTC** at which it is served (there is deliberately no school-timezone setting, so a UTC+3 school enters `540` for a noon meal; `null` = unset, and the cutoff then counts from midnight UTC) β the dietary tags a dish or a student's profile may carry, and `meal_cancel_cutoff_minutes` β one knob closing both booking and cancelling ahead of a slot's serving time (`null` = no cutoff). A slot a menu was already published for cannot be removed (409), same reason. A slot name may not contain `/ \\ ? # %` (400) β the name is copied verbatim into a menu's record id, which is a URL path segment β but a name the school's stored list already carries is exempt from that rule, since re-validating it would leave a list written before the rule existed unable to be edited at all: re-sending the name is a 400 and dropping it is a 409 once a menu used it. A grandfathered name still cannot carry a new menu, and dropping it is still the only way to remove it. Read: any authenticated user; edit: manager+"), |