From 8a76f89f3fc7334b36403b52229435cf03daf21c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ahmet=20Kaan=20G=C3=BCm=C3=BC=C5=9F?= Date: Sat, 12 Sep 2026 20:46:52 +0300 Subject: [PATCH] =?UTF-8?q?=F0=9F=A7=B9=20chore:=20regen=20README=20endpoi?= =?UTF-8?q?nt=20table?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 9eb96cd..8218ea8 100644 --- a/README.md +++ b/README.md @@ -1188,7 +1188,7 @@ window filtering, before paging; negative values are a `400` naming the field. | GET | `/homework/report/{user}` | teacher | A student's homework report across their enrolled courses, paged via `?limit=&offset=` (omit `limit` for all of it): one row per homework in their audience — submitted/late/missing state plus the grade once one exists. Statuses and marks, never the submitted files (observers get the report, not the bytes). Requires teacher+, or a parent linked to the target student. Managers, admins, and parents see every course; a teacher sees only the target's courses they manage. Returns a `{items, total, limit, offset}` envelope. | | GET | `/homework/{id}` | student | Fetch a single homework by id. Visible to whoever can view its course (its enrolled users, creator, assigned teachers, and managers/admins). A student the homework is *not* assigned to gets a 404 — the same no-leak an unseen exam draft gets, so a subset assignment never reveals itself to the students left out of it. To a caller without course-management rights the `assigned` subset comes back narrowed to their own id: being named is theirs to know, the rest of the roster is not. | | PATCH | `/homework/{id}` | teacher | Edit a homework's title, description, due date, subject, or assigned subset. Requires teacher+ and management rights over its course. Omitted fields keep their value; a newly set `due_at` is re-checked against now and a new `subject_id` re-checked against the course. Narrowing `assigned` is refused (409) while it would orphan an existing submission or result. | -| DELETE | `/homework/{id}` | teacher | Delete a homework and everything under it — submissions, their files, and results — then unlink the file blobs from disk. Requires teacher+ and management rights over its course. Held under [`HOMEWORK_LOCK`]'s write lease so no submission can land under the homework mid-delete; the blob names are collected before the rows are wiped (the cascade is one transaction, children first) and removed after, so a crash in between strands at worst an unreachable file. | +| DELETE | `/homework/{id}` | teacher | Delete a homework and everything under it — submissions, their files, and results — then unlink the file blobs from disk. Requires teacher+ and management rights over its course. The cascade is one transaction whose homework-row lock keeps a submission from landing under the homework mid-delete; the blob names are collected inside that transaction, before the rows are wiped, and removed after, so a crash in between strands at worst an unreachable file. | | GET | `/homework/{id}/result` | student | The caller's own grade for a homework. Any authenticated user may read their own; `404` while ungraded (or when the homework doesn't exist). This is the one read a student graded `missing` *without* ever submitting has — their submission endpoints 404 while nothing is submitted. | | POST | `/homework/{id}/results` | teacher | Record (or overwrite) a student's grade for a homework: a status (`done`/`incomplete`/`missing`) plus an optional 0–100 mark. Requires teacher+ and management rights over the homework's course; the target must be a live student, enrolled in the course, and in the homework's audience. Nobody grades themselves. Grading before the due date, or before any submission exists (`missing` for work never handed in), is allowed. A stored grade freezes the student's submission until it is removed. | | DELETE | `/homework/{id}/results/{user}` | teacher | Remove a student's grade from a homework — un-grading, which unfreezes the student's submission and files for further edits. Requires teacher+ and management rights over the homework's course. | @@ -1319,7 +1319,7 @@ window filtering, before paging; negative values are a `400` naming the field. | PATCH | `/users/{id}/preferences` | admin | Update any user's UI preferences. Admin only — everyone else manages their own through `PATCH /users/me/preferences`, which this mirrors field for field. | | GET | `/users/{id}/profile` | student | One user's public profile: display name, bio, avatar meta, their class and course blocks, the badges they have earned, and the motivational counters. Badges carry an id and the instant they were first earned; their labels and icons come from the `badges` catalog at `GET /limits`. Readable by every authenticated account — except a parent, who reads only their own and their linked students'. Never carries email, phone, or birth date; those stay on `GET /users/{id}` (admin) and `GET /auth/me`. The embedded blocks are capped at `max_profile_classes` / `max_profile_courses` (see `GET /limits`) — the full paged lists are `GET /classes/me` and `GET /courses/me`. The course block is also cut to what the *reader* may already see: only courses they would pass `GET /courses/{id}` on. The class block holds the same bar as `GET /classes/user/{id}` — teacher+, a parent linked to this student, or the owner themselves; every other reader gets an empty `classes` array rather than a 403. Every number in `stats` stays the owner's true total either way, including the ones whose underlying reports are gated (`/pomodoro/{id}`, `/marks/user/{id}`, `/attendance/user/{id}`): they are motivational counters, and a magnitude names no course, class, lesson or exam. | | PATCH | `/users/{id}/profile` | admin | Update any user's personal info. Admin only — the school-office path for maintaining records on behalf of students and staff. Same field semantics as `PATCH /users/me`. | -| PATCH | `/users/{id}/role` | admin | Set a user's role. Admin only. An admin cannot change their own role, and the school's **last** admin cannot be demoted by anyone (`409`) — together those keep role management from locking everyone out, including when two admins demote each other at the same instant (the floor is serialized, see `ADMIN_FLOOR_LOCK`). A school that has already lost its admins is recovered with the SurrealQL in the README, since the seed never promotes. Setting any non-`student` role also drops the user's course enrollments — only students enroll, so a promoted user leaves every roster. Demoting below `teacher` drops their course teaching assignments for the mirror reason, and withdraws their published appointment slots, cancelling the live bookings on them: nothing could reach either afterwards — a slot is listed only on its own teacher's calendar and deleted only by a teacher+, and a booking on one is decided only by a teacher+ and cancelled only by its requester, who is refused once the window opens. The requester keeps the booking as `cancelled`, naming the ex-teacher and the reason. Demoting to `parent` additionally gives back the seats they hold on still-open event signup lists: a parent can no longer free them, and nobody else may. Seats on lists that have already closed stay as they are — that roster is history. It also takes the account off every whiteboard roster and **closes every board it created** — permanently read-only, nothing deleted. A demoted creator is a `404` on their own board, the four commands that could end it are the creator's alone, and no route lists a board the caller is not on, so the room would otherwise be commandable by nobody while its participants kept drawing on it. Closed, they keep reading the board, its history and its epochs; only writes are refused. | +| PATCH | `/users/{id}/role` | admin | Set a user's role. Admin only. An admin cannot change their own role, and the school's **last** admin cannot be demoted by anyone (`409`) — together those keep role management from locking everyone out, including when two admins demote each other at the same instant (the floor is a predicate on the role write itself, so the racing demotions serialize on row locks). A school that has already lost its admins is recovered by hand against the database, since the seed never promotes. Setting any non-`student` role also drops the user's course enrollments — only students enroll, so a promoted user leaves every roster. Demoting below `teacher` drops their course teaching assignments for the mirror reason, and withdraws their published appointment slots, cancelling the live bookings on them: nothing could reach either afterwards — a slot is listed only on its own teacher's calendar and deleted only by a teacher+, and a booking on one is decided only by a teacher+ and cancelled only by its requester, who is refused once the window opens. The requester keeps the booking as `cancelled`, naming the ex-teacher and the reason. Demoting to `parent` additionally gives back the seats they hold on still-open event signup lists: a parent can no longer free them, and nobody else may. Seats on lists that have already closed stay as they are — that roster is history. It also takes the account off every whiteboard roster and **closes every board it created** — permanently read-only, nothing deleted. A demoted creator is a `404` on their own board, the four commands that could end it are the creator's alone, and no route lists a board the caller is not on, so the room would otherwise be commandable by nobody while its participants kept drawing on it. Closed, they keep reading the board, its history and its epochs; only writes are refused. | | GET | `/users/{id}/students` | admin | List the students tied to a parent account, sorted by username. Admin only — parents read their own list at `GET /users/me/students`. Paged via `?limit=&offset=` like the other lists. | | POST | `/users/{id}/students` | admin | Tie a student to a parent account. Admin only — family ties are school-office records, like roles. `{id}` must hold the `parent` role and `user_id` the `student` role; a parent may observe any number of students. Idempotent: linking the same pair again keeps the one tie (the `linked_by` stamp moves to the latest linker, like re-enrolling). The tie grants the parent read access to the student's marks, attendance, and pomodoro reports — nothing else, and never any write. | | DELETE | `/users/{id}/students/{student}` | admin | Untie a student from a parent account. Admin only. The student's data is untouched — only the parent's read grant goes away. |