Commits
2026-09-24
✨ feat(courses): per-section course lists behind the catalogue rowAhmet Kaan Gümüş · 6ecaebc
✨ feat(courses): per-section course lists behind the catalogue row `CourseSectionRef` and `CourseResponse.sections`: every catalogue row now carries its sections (instance id, resolved title, class, grade level, hours, teachers, roster size), truncated to `MAX_COURSE_SECTIONS` while `class_course_count` keeps the untruncated total. `list_courses`/`get_course` populate it through one batched builder — seven statements per page, nothing per row — and a non-manager sees only the sections they reach. `GET /courses/me` and the profile course block switch from catalogue rows to one row per section with the section's resolved title. Reach is the union of the class-roster/homeroom/taught set and the user's own instance enrollments, so a hand-placed enrollment keeps appearing exactly as it did before.
2026-09-23
✨ feat(profile): add gender, address, and emergency contact to the user row Local-Gate: 1f2b0abcf3798a63b2c5365e0d15c9f708f45833 (1523 passed, 430s)Ahmet Kaan Gümüş · f151345
✨ feat(profile): add gender, address, and emergency contact to the user row Local-Gate: 1f2b0abcf3798a63b2c5365e0d15c9f708f45833 (1523 passed, 430s)
2026-09-20
✨ feat(users): give students a school-issued student numberAhmet Kaan Gümüş · 777c7df
✨ feat(users): give students a school-issued student number
Every school numbers its students its own way ("1234", "9-B/17"), and the
account carried no field for it: the office kept the mapping outside the
product. The number is now a first-class optional field on the user row,
unique inside the school (per-school uniqueness is the per-school database)
and held by students only.
- migrations/school/20260920000001_student_number.sql: `app_user
.student_number TEXT NULL`, the partial unique index over its non-NULL
values, and a CHECK (student_number IS NULL OR role = 'student'). The boot
sweep applies the file to already-provisioned schools like every other
school migration.
- domain: `StudentNumber`, a validated newtype (trimmed, non-blank, at most
MAX_STUDENT_NUMBER_LEN = 32) in the shape of `Username`, plus the one
spelling of the non-student refusal both the web gate and the database map
answer; `User` carries `Option<StudentNumber>`.
- db: `create_with_role` binds it into the mint; `set_profile` writes it and
maps the index's 23505 to the coded 409 and the row's 23514 to the same 400
the handler gate answers; `set_role_cascade` clears it in the same statement
that leaves the `student` role. The CHECK is what closes the read-then-write
race the handler-side gate cannot see: a profile save carrying a number from
a `student` snapshot while a promotion commits first is refused by the row
itself, and a test pins exactly that (it writes a teacher holding a number
without the CHECK).
- web: `POST /users` and both profile doors (`PATCH /users/me`,
`PATCH /users/{id}/profile`) accept it under the merge semantics the other
patchable fields have (omitted = keep, blank = clear), with the role gate as
a 400 and a duplicate as a 409 carrying `code: student_number_taken`.
`UserResponse` (admin reads, create/patch echoes, `/auth/me`) and `PersonRef`
(pickers, students lists) carry it; the school-wide public profile
deliberately does not — an office identifier is not broadcast school-wide.
- /limits publishes `max_student_number_len`; spec_bounds pins both new
`max_length` annotations and the README's bound count moves to 224.
- tests: the mint and both patch doors — trimmed storage, 33 chars a 400,
whitespace read as absent, a duplicate a coded 409 on both paths, a
non-student a 400, blank clearing, a promotion clearing with the role change
(and a demotion back not restoring it), and the stale-snapshot race at the
db layer.
Evidence: the partial index refuses a duplicate (23505 naming
app_user_student_number) and admits both rows once dropped inside a
rolled-back transaction; with the 409 mapping removed both write paths answer
500 and the tests fail; with the CHECK removed the race test writes the
forbidden row (role: Teacher, student_number: Some(...)) and fails.
Local-Gate: 2c10aae51c575b7f4207fa310d8938070c0fbb80 (1509 passed, 572s)2026-09-17
📝 docs: rewrite the Turkish comments and doc comments in EnglishAhmet Kaan Gümüş · 7fec874
📝 docs: rewrite the Turkish comments and doc comments in English The Rust repo's own language is English; Turkish had leaked in from the sibling AI services. Translate every comment and doc comment to English using the code's own vocabulary (şube -> class section, dönem -> term, sınıf öğretmeni -> homeroom teacher, ortak sınav -> shared exam, karne -> report card, …). Quoted Turkish letters/words that are themselves the data under test (the text-fold examples in `text_fold`/`settings`, the non-ASCII filename sample) are kept. The README endpoint table is generated from those doc comments, so it is regenerated. AGENTS.md records the convention going forward: Turkish survives only where it is the data under test or user-visible content.
🔧 chore: give ResolvedTenant its core home and make constant.rs a leafAhmet Kaan Gümüş · d0dce85
🔧 chore: give ResolvedTenant its core home and make constant.rs a leaf Two structural defects a knowledge-graph pass over src/+tests/+migrations surfaced. Both were verified against the real `use` lines before being called defects — a module cycle is legal Rust, so only the layering facts count. No behavior change: every moved item is byte-identical in name, type, value, element order and doc text. - `ResolvedTenant` was *declared* in `src/web/tenant_state.rs` but *built and returned* by `Tenants::resolve` (`src/tenant.rs`), so the core tenant registry imported the web layer. The struct moves to `src/tenant.rs`; its `impl FromRequestParts` stays in the web module (same crate, local type). That deletes the crate's only core→web import edge, and with it the three module cycles running through `state.rs` and `ai::server`. - `constant.rs` is documented "Validation limits, in one place" but imported four domain enums to hold non-limit vocabularies: `ROLES` → `domain/role.rs`, `THEMES`/`LANGUAGES` → `domain/preferences.rs`, `SENDER_FOLDERS`/ `RECIPIENT_FOLDERS` → `domain/message.rs`, and the 34-row `BADGES` catalogue → `domain/badge.rs`. Each now lives in the module that owns its type, so `constant.rs` imports nothing from `crate::domain` and ten `constant ↔ domain` cycles disappear. `AI_PRINCIPAL_KEY` and `PALETTE_COLOR_*` stayed put. Measured on the same corpus: 20 → 7 reported import cycles — all ten constant↔domain and all three tenant↔web cycles gone. The surviving seven are intra-layer domain cycles plus the ai↔web pair; the AI bridge is a peer front-end reusing web authorization helpers, which is deliberate, not an inversion. Tests: the published-or-excluded guard in `limits_completeness` read only `src/constant.rs`, so the five moved tables silently left its scan — the one place this move weakened coverage. It now covers them by name, and its `references()` check no longer counts a bare `use` line as "published", which the first witness attempt proved had made the guard vacuous. Witnessed by mutating BADGES and then ROLES out of `/limits`: each FAILs naming the moved table, and each restore is sha256-identical. Gates: no SQL touched (.sqlx and migrations clean), prepare DB unchanged; SQLX_OFFLINE=true cargo check --all-targets, clippy -D warnings, limits_completeness, spec_bounds all green; cargo nextest run 1386/1386 across 47 binaries (doc_sync included).
2026-09-16
✨ feat: the class×course instance is the academic anchor (K-12 remodel)Ahmet Kaan Gümüş · ae84034
✨ feat: the class×course instance is the academic anchor (K-12 remodel)
`course` was a school-wide singleton: enrollment, exams, sessions,
roll-call and homework all keyed on it, so two class sections teaching the same
course shared one roster, one exam set and one timetable. This moves the
academic anchor to `class_course` — the per-class instance — and rebuilds
the academic model around Turkish K-12.
Schema (migrations/school/20260916000001_k12_remodel.sql): `class_course`
becomes an instance (ders_saati, counts_toward_karne, enrollment_count,
class_course_teacher); enrollment re-keys to (class_course, app_user);
exam carries class_course + term (+ exam_audience for shared exams);
course_session / session_attendance / homework re-key; `class_member` is a
soft-leave history table (uuid PK, joined_at/left_at, partial unique index
on the live stint); `academic_year` sits above `term`; `class_group` links
a year, not a term; new `course_membership` (clubs/study), `karne_snapshot`;
settings gain branches/excuse_kinds/absence limits/timezone; profile gains
branch. Drops/recreates the identity-changing tables (pre-customer; the
migration resets every counter on a kept table that pointed at a dropped
one).
Layers: domain/db/service/web rewritten to the instance seam, with
`ensure_instance_teacher` gating instance writes (D10), the report card computed per
instance and weighted by ders_saati, an absence report, `/instances`
and `/academic-years` nests, and `/classes/{id}/instances`. Capacity and
the seat-claim 409 are gone; detach sweeps the whole instance subtree and
unlinks its blob keys.
Gates: cargo check --all-targets, SQLX_OFFLINE check (cache regenerated),
doc_sync, spec_bounds, limits_completeness, clippy -D warnings all green;
cargo nextest run 1370/1370.2026-09-12
2026-09-11
2026-09-08
2026-08-12
📝 fix: stop swagger offering the ai role as assignableAhmet Kaan Gümüş · b97b802
📝 fix: stop swagger offering the ai role as assignable
The `SetRole` body pointed at the response-side `Role` schema, which names
`ai` — the QUIC bridge's own service principal. Swagger UI therefore offered
`ai` in the try-it-out form for `PATCH /users/{id}/role`, where the server has
always answered 400: `Role::try_from_str` searches `ROLES`, the five human
roles. The "never assignable" note lived on the variant, and utoipa emits only
type-level doc comments, so nothing of it reached the document.
Request bodies now reference a documentation-only `AssignableRole` enum with
exactly those five; the response schema keeps `ai` (a service principal really
does read back as one) and carries the explanation where utoipa will emit it.
No server behavior changes — the string still funnels through
`Role::try_from_str`.
The user-search `?role=` param and the event role-audience DTO are plain
strings in the spec, so neither advertised `ai`; both are left alone.
`role_ai_is_unreachable_over_http` gains step 6, pinning the emitted enums so
the drift cannot come back.🤖 feat: add service-only Role::AiAhmet Kaan Gümüş · 3a01d26
🤖 feat: add service-only Role::Ai The principal an out-of-process AI service carries over the QUIC bridge. Declared first in the enum so the derived Ord puts it under every role: it clears no `at_least` bar and fails every exact `== Role::Student` / `== Role::Parent` gate. Absent from ROLES, which is what makes it unassignable — `try_from_str` searches that table, so "ai" is rejected like any unknown word, and /limits keeps listing the five human roles. Role still carries no serde derive, so nothing deserializes it off the wire. `User::ai_principal` builds it in memory only, on the literal record key `ai_service` that no minted ULID can collide with, with an empty password hash that verifies against nothing. Never written to the database. The web DTO gains the variant because the mapping is exhaustive, so "ai" appears in the OpenAPI Role schema — documented there as never assignable.
2026-08-05
👤 fix: show a person under the name they chose, everywhereAhmet Kaan Gümüş · 4e4a808
👤 fix: show a person under the name they chose, everywhere
`PersonRef::new` built `display_name` from `name` + `surname` only and never
read the stored `display_name`, so anybody who chose one was still rendered
under their legal name by every route that embeds a person — messages,
`/users/search`, course creator/teachers, rosters, exam results, appointments,
meals, payments, the question pool. Meanwhile `GET /users/{id}/profile` served
the chosen name, and `GET /users/{id}` is admin-only, so the profile was the
one surface telling the truth.
The rule was written twice: `ProfileResponse` did the three documented steps
(stored, else the join, else null) and borrowed only the join half from
`PersonRef`, which had the other half missing. Two hand-kept copies of one
documented rule is how it drifted, so the resolve now lives once, in
`PersonRef::new`; the profile calls it whole. The test that was missing is the
one that fails on drift: a display name differing from the join, asserted on a
`PersonRef` route and against the profile's own answer, at all three steps.
Second, unrelated to the resolve but on the same doc: `profile_of` claimed only
`stats.courses` and `stats.classes` cross a gate the reader would fail. Eight
more do — `pomodoro_focus_ms`, `pomodoro_focus_ms_total`,
`lessons_attended_total`, `homework_submitted_total`, `homework_on_time_total`,
`exam_sat_total`, `high_mark_total` mirror data behind `ensure_can_observe`,
and for an exactly-teacher reader they are wider than the reports themselves.
The disclosure stays (motivational counters, no object named); the comment,
the schema description, the tag and the README now say so accurately.📝 fix: close the homework orphan window and the subset roster leakAhmet Kaan Gümüş · 420deef
📝 fix: close the homework orphan window and the subset roster leak
upload_submission_file streamed the whole multipart body before taking
HOMEWORK_LOCK, and HomeworkSubmission::upsert had no parent gate, so a
DELETE /homework/{id} inside that multi-second window let the late write
recreate submission, file, blob and badge credit under vanished
homework — all unreachable afterwards. Both halves are fixed: the gate
re-runs under the lease, and the upsert now moves a value on the
homework row.
HomeworkResult::grade gets the same treatment, in the order its own
ponytail asked for: transaction_with_retry first, then the parent gate.
delete_course now takes HOMEWORK_LOCK as well as EXAM_LOCK.
HomeworkResponse.assigned returned the full subset roster to every
assigned student, while the course roster itself is teacher+ only — the
opposite of what the code comment says it intends. It is now narrowed to
the viewer.
HomeworkFile::delete moves to transaction_with_retry like its siblings.2026-08-04
feat: 🪪 give every person a public profileAhmet Kaan Gümüş · b326165
feat: 🪪 give every person a public profile Avatar, bio, display name, live class/course blocks and read-time stat counters, so the school has something to motivate students with. The fields ride the user row rather than a profile table: the row already carries the self-service columns and their field-scoped writers, so a separate table would only add a "profile row missing" state every read must degrade, plus a second write to the admin-seed path. DDL only, no backfill — every pre-existing row reads null, or 0 for derived stats. Contact fields stay off the public projection and keep their old gate. Reads are school-wide except for parents, who reach only their own profile and their currently-linked students'; the link and the target's live role are re-read per call, so a promoted-out student stops being readable at once. The courses block is intersected with what the viewer can already see, since a course title a caller is 403'd from reading directly must not leak through someone else's profile. stats.courses stays the owner's true total — an aggregate reveals magnitude, not identity — so a stranger sees an empty block beside a non-zero count. Classes stay a narrowed id/name/grade projection: a homeroom section is the social signal, a private club name is not. Stats are computed at read and floored at 0. Exam average, homework rate and attendance rate are deliberately absent: those tables are indexed such that a per-user aggregate is a full table scan. Avatars reuse the one-image-on-the-owning-row pattern and the school's existing max_file_bytes, raster only. Deleting one is admin-reachable because an offensive avatar is a real school problem and no user-delete route exists to fall back on. Also floors pomodoro focus time at both ends: a backwards clock could record a negative stint, which the profile would have served as a negative total. No badges yet — those are auto-earned only and land next.
2026-07-30
feat: 🎨 sync the accent color like theme and languageAhmet Kaan Gümüş · 9490623
feat: 🎨 sync the accent color like theme and language
The frontend's palette picker kept the chosen accent in localStorage, so
it never followed the user to another device. `palette_color` joins
`theme` and `language` as a third per-user preference: a nullable hex
color on the user row, self-managed and admin-editable through the same
two PATCH routes, `null` until chosen.
The value set is deliberately open — any `#rrggbb` — rather than an enum
of the frontend's palette entries, so adding a palette is a frontend-only
change. Mixed case is accepted and stored lowercase, which is why
`/limits` publishes the accept-set pattern (`^#[0-9a-fA-F]{6}$`) and not
the storage form: a client validating its own input against the published
regex has to agree with the server, and a test now compiles that regex
and runs it over the validator's own accept/reject examples.2026-07-24
✨ feat(exams): let students review their own graded examAhmet Kaan Gümüş · 4db4ff2
✨ feat(exams): let students review their own graded exam
Add a per-exam teacher toggle `allow_review` (default false, opt-in,
mirrors `allow_rejoin`) and three student self-review endpoints:
GET /exams/{id}/review/attempts
GET /exams/{id}/review/attempts/{seq}/answers
GET /exams/{id}/review/attempts/{seq}/answers/{qid}/image
All are CurrentUser-scoped (no {user} param, so a student only ever
sees their own data) and gated by reviewable_exam(): 404 on missing or
draft exam, 403 when allow_review is off, 404 until an ExamResult row
exists for that student (proves the teacher marked them). Readers are
the same ones the teacher history endpoints use.
Schema: DEFINE FIELD allow_review DEFAULT false + a separate backfill
query flipping legacy NONE rows to false — no existing exam auto-exposes
answer sheets. Podman-verified: 9 legacy rows migrated null->false.2026-07-22
2026-07-21
✨ feat(courses): manager-assigned course teachersAhmet Kaan Gümüş · 5ff771b
✨ feat(courses): manager-assigned course teachers
A course used to have exactly one manager: its creator. A teacher taking
over someone else's class needed manager+, which is the wrong bar for
ordinary staffing.
Courses now carry a `teachers` list alongside the (still immutable)
`creator`. Manager+ assigns and unassigns via POST/DELETE
/courses/{id}/teachers; the assignee must already hold teacher+, since
every gate behind the assignment re-checks that bar anyway.
The rights split in two:
- can_manage_course: creator, assigned teacher, or manager+. Everything
inside the course — edit, enroll, exams, sessions, subjects, grading,
roll call. Every existing gate routes through this one helper, so
assignment reaches all of them at once.
- owns_course: creator or manager+ only. Deleting the course and changing
who teaches it. An assigned teacher runs a course; they don't own it,
and can't delete it out from under the person who made it.
Staffing is deliberately manager-only: a course's own creator cannot hand
management rights to their peers.
Stale data: rows written before the field decode as unassigned (a serde
default on the field) and the boot backfill fills them to []. DDL and
backfill stay in separate batches — sharing one silently strips keys on
SurrealDB 3. Verified against the real volume, not just the in-memory
tests: a legacy-shaped row backfilled, rendered, and took an assignment.
A demotion below teacher sweeps the user off every course they were
assigned to, mirroring how promotion drops enrollments.2026-07-19
✨ feat(users): read-only parent role with student tiesAhmet Kaan Gümüş · ec44315
✨ feat(users): read-only parent role with student ties
Parent sits below student in the hierarchy: clears no staff bar and
fails every exact student gate, so it can only observe. Admins tie
students to a parent under /users/{id}/students; the tie alone opens
the student's marks/attendance/pomodoro reports (full, unnarrowed)
plus the parent's own /users/me/students list. A role change off
either end of a tie sweeps it, mirroring the enrollment sweep.✨ feat(courses)!: embed the creator as a person refAhmet Kaan Gümüş · c996ce4
✨ feat(courses)!: embed the creator as a person ref
CourseResponse.creator was a bare user id, so the frontend catalog
resolved names by downloading users separately — a call that broke
with the blank-q rule and left students seeing raw ULIDs. Courses now
join the creator on like sessions and enrollments already do: one
person_map over the page's creators, PersonRef::resolve degrading to
the bare id if the row is gone.
BREAKING: course payloads return creator as {id, username,
display_name} instead of a string.✨ feat(exams): draft exams hidden until publishedAhmet Kaan Gümüş · d8fdbf0
✨ feat(exams): draft exams hidden until published Exam prep is long work: draft: true keeps an exam private to its course's managers while it's written. Students get 404s (not 403/409 — existence must not leak) on get/attempt/ws and filtered lists; sitting and grading are blocked. Publish via PATCH draft: false; re-drafting is 409 once attempts or results exist. grade now holds an EXAM_LOCK read lease so a mark can't race a re-draft. Modeless exams renamed offline-graded/unscheduled everywhere — "draft" now means only this. Old rows backfill published at boot.
2026-07-17
✨ feat(subjects)!: course subjects, required on every exam questionAhmet Kaan Gümüş · 022aaaa
✨ feat(subjects)!: course subjects, required on every exam question
Each course now owns its curriculum as subjects (name + optional
description; course link fixed at creation). Every exam question must
be tagged with a subject of its exam's own course, so exam content is
attributable to a topic.
- POST/GET /courses/{id}/subjects (manage / course-visibility, paged)
- GET/PATCH/DELETE /subjects/{id}; delete is a 409 while any question
still references the subject — re-tag or delete those questions first
- course delete cascades its subjects
BREAKING: question create/update payloads require subject_id, and
questions written before subjects existed are destroyed on boot
(answers first) — nothing truthful to backfill, pre-customer clean
break.2026-07-16
✨ feat(courses): add kind course|study (supervised study)Ahmet Kaan Gümüş · f29537c
✨ feat(courses): add kind course|study (supervised study) Supervised study sessions are courses under a different label: `kind` is settable at creation, PATCH-editable, and returned on every course response. Behavior (enrollment, exams, sessions, marks) is identical for both kinds. Boot backfills pre-kind rows to `kind = 'course'`; new writes default the same way.
✨ feat(users): per-user UI preferences (theme, language)Ahmet Kaan Gümüş · 7168ba0
✨ feat(users): per-user UI preferences (theme, language)
Theme (light/dark) and language (tr/en) live on the user row and
return on every user response. PATCH /users/me/preferences is
self-service for any role; PATCH /users/{id}/preferences is the
admin path. Same merge semantics as the profile patch: omitted
keeps, "" clears, anything else validates or the patch is a 400.
Null means "never chose": clients fall back to the device
preference (prefers-color-scheme, browser language), so there is
deliberately no server-side default to stomp device detection.
Pre-feature rows read back null through the option<string> columns
— no backfill needed.2026-07-14
✨ feat(exams)!: move weight off exams onto their kindAhmet Kaan Gümüş · 3681441
✨ feat(exams)!: move weight off exams onto their kind
Weighting is school policy, not per-exam data: each settings
exam_kinds entry is now {name, weight} (1-100, defaults all 1) and
mark reports resolve weights at read time, so editing a kind
reweights every exam of that kind at once; an exam keeping a
since-removed kind counts as 1.
BREAKING CHANGE: exams lose `weight` on the wire and in storage,
settings `exam_kinds` become objects. No data migration (pre-customer
clean break) — delete ./data/hezarfen.db and reboot.2026-07-13
✨ feat(exams): open mode, attempt limits, retakes, rejoin doorAhmet Kaan Gümüş · 9835fe7
✨ feat(exams): open mode, attempt limits, retakes, rejoin door
Unscheduled exams were dead ends: attempts answered 409 "nothing to
sit", and every exam was hard-wired to a single sitting.
- mode "open": sittable anytime, no window; duration_ms optional per
attempt (absent = unlimited time). Modeless exams stay offline
drafts — still 409, so a student can't freeze a draft's questions.
- max_attempts (0 = unlimited, default 1): terminal attempts can be
followed by numbered retakes that start from a blank answer sheet;
the previous sitting's answers are wiped on the next start.
- allow_rejoin: live teacher toggle. Leaving the exam room (WS close
mid-attempt) stamps left_at; with the door closed, re-entry and all
saves 409 until reopened. Finish stays allowed either way.
- Attempt deadline generalized to min(ends_at, started_at + duration),
either side optional; none = ends only by submission.
Boot migration backfills max_attempts/allow_rejoin/seq on existing
rows and replaces the single-attempt unique index (exam, user) with
(exam, user, seq) via REMOVE INDEX IF EXISTS. Sitting #1 keeps the
legacy {exam}_{user} record id, so pre-upgrade attempts stay valid.✨ feat(school): editable policy settings + academic termsAhmet Kaan Gümüş · ea8bfeb
✨ feat(school): editable policy settings + academic terms Every school differs; the varying parts become data instead of code: - settings singleton (GET any user, PATCH manager+): exam kinds, attendance statuses, grade-display bands. Absent row = old hardcoded defaults, so existing databases behave unchanged. - core four attendance statuses stay mandatory — the attendance rate is defined over them; school extras tally rate-neutral under a new `custom` bucket in reports. - grade bands are display-only over the canonical 0-100 marks: reports gain grade/average_grade/overall_grade labels, stored marks never change with the display scale. - terms are rows (semester/trimester/quarter all fit); courses link via nullable term_id, term delete unlinks, past dates allowed for mid-year calendar backfill. - settings edits never rewrite stored rows: retired kinds and statuses live on in old records; only new writes validate against the current lists.
2026-07-12
✨ feat(attendance): course sessions, roll call, work log, reportsAhmet Kaan Gümüş · 5b6aac1
✨ feat(attendance): course sessions, roll call, work log, reports
- course_session: a course's lesson (teacher, topic, required starts_at,
optional ends_at); managed under course rights like exams; explicit
teacher_id must hold teacher+; lists ordered by starts_at (timetable)
- session_attendance roll call: one row per session+user by composite id,
course denormalized so reports need no join; students never self-mark —
the session's teacher or a course manager marks enrolled students, and
the teacher's own presence row is manager+ only (no self-declared
presence); session/course deletes cascade roll-call rows
- work_entry staff timesheet (teacher+): check-in/out stamped by the
server clock only, so a client clock or crafted request can't forge
presence; one open stint per user held atomically — INSERT IGNORE on
the deterministic open_{user} id, check-out takes it via DELETE RETURN
BEFORE and re-files under a ULID; manager+ reads any log, corrects
closed stints (ordered instants), deletes entries
- attendance reports at /attendance/me and /attendance/{user} (teacher+),
mirroring the marks report: event tallies + session tallies +
per-course breakdown; rate = (present+late)/(present+absent+late) —
late attends, excused counts against no one; unenrolling hides marks
but never absences (attendance is a historical record)
- RequireManager extractor; check_time_range shared by events/sessions✨ feat(exams): scheduled attempts, live monitor, questions, answers, exam roomAhmet Kaan Gümüş · ade4fed
✨ feat(exams): scheduled attempts, live monitor, questions, answers, exam room
- exam scheduling as one validated unit: mode sync|async + window
(+ per-student duration_ms for async); unscheduled stays offline-graded
- exam_attempt: one row per exam+user by composite id; start = attendance
signal, finish = submission; status/deadline recomputed from the current
schedule on every read (mode frozen once attempts exist, times extend live)
- teacher live monitor: GET /exams/{id}/live snapshot + SSE /live/stream
- exam_question: choice|text authored per exam, kind bundle (choices+correct)
validated as a unit, frozen once attempts start, ULID order
- exam_answer: upsert per question+user via composite id, kind-coherent,
server-clock stamped; pure auto_score over choice questions as a grading
suggestion — final mark stays human via /results
- student exam room WebSocket at /exams/{id}/attempt/ws: state ticks,
autosave acks, finish/expire lifecycle, gates rejected pre-upgrade with
proper HTTP statuses; shares the REST write path
- PersonRef embeds (id + username + display name) in people-bearing
responses, plus teacher+ GET /users/search
- cascades: exam/course deletes sweep attempts, questions, answers, results2026-07-11
✨ feat(courses): courses, enrollment, and course-scoped weighted examsAhmet Kaan Gümüş · cd56c5b
✨ feat(courses): courses, enrollment, and course-scoped weighted exams
Courses become the unit exams and enrollments hang off. Teachers create
them; editing, deleting, enrolling, and adding exams require course
management rights (creator, or manager/admin). Enrollment rows use a
deterministic composite (course, user) id, so enrolling is one atomic
idempotent UPSERT with no find-then-insert race. Deleting a course
cascades its exams, their results, and enrollments in one transaction.
Exams move inside a course (POST /courses/{id}/exams) and gain a weight
(1-100) that says how many times they count into the course average;
kinds grow to homework, quiz, midterm, final, project, and oral —
informational only, weight drives the math. Grading now demands course
management rights and an enrolled target; moving an exam between
courses is deliberately impossible so results can't be stranded.
Routes: courses CRUD, GET /courses/me for the caller's enrollments,
roster listing, enroll/unenroll, and per-course exam creation/listing.✨ feat(profile): optional personal info on user accountsAhmet Kaan Gümüş · baceaf5
✨ feat(profile): optional personal info on user accounts
Every account (any role) gains name, surname, email, phone, and birth
date as optional fields backed by validated newtypes: PersonName keeps
unicode and trims, Email and Phone get pragmatic shape validators, and
BirthDate parses real calendar dates in YYYY-MM-DD form and refuses the
future. Existing rows read back as None via option<string> columns.
Endpoints: PATCH /users/me lets any authenticated user edit their own
info; GET /users/{id} and PATCH /users/{id}/profile give admins the
school-office path for maintaining records. Patch semantics per field:
omitted keeps the current value, an empty string clears it, anything
else is validated and set. UserResponse now carries the new fields.✨ feat(web): axum handlers, DTOs, and auth extractorsAhmet Kaan Gümüş · 3c4822c
✨ feat(web): axum handlers, DTOs, and auth extractors The HTTP layer over the domain. DTOs are plain strings on the wire; handlers parse them into validated newtypes before touching the database. Responses share one UserResponse shape (id, username, role). Auth is a session cookie: login sets an HttpOnly, SameSite=Lax `session` cookie (Secure when configured) backed by a server-side row; logout is idempotent. Extractors encode access control by type — CurrentUser for any logged-in caller, RequireTeacher / RequireAdmin for role-gated routes — with the role re-read every request so a change takes effect on the next call. Routers: auth (register/login/logout/me), users (admin listing + role changes), notes (per-user CRUD), events + attendance, and exams + results. Ownership and role rules live in the handlers: event/exam edits are creator-or-manager+, grading is teacher+ and never targets oneself, and admins can't change their own role.