forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on mainFiltered to src/database.rsClear filter

2026-07-19

✨ feat(messages): one-to-one mail with per-side foldersAhmet Kaan Gümüş · f4b3828
✨ feat(messages): one-to-one mail with per-side folders

Any user writes to any user (the one place a parent acts); only
self-send is refused. A single row serves both parties, each owning
their copy: the recipient files through inbox/archive/trash with a
read flag the sender sees as a receipt, the sender through
sent/trash. Folder and read writes are field-scoped so the two
writers never clobber each other. Permanent delete works only from
the trash and drops the row once both sides are gone. Messages carry
an optional free-text label badge, and ?read=false with limit=1
turns the page total into the unread badge.
✨ 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(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.
✨ feat(pomodoro): server-stamped student focus logAhmet Kaan Gümüş · 73d4367
✨ feat(pomodoro): server-stamped student focus log

Students start/finish pomodoro focus sessions; the server stamps both
instants, so recorded focus time is honest. Starting discards a dangling
unfinished session instead of conflicting — a crashed timer never blocks
the next one. Logs return the page envelope plus total_focus_ms (unpaged
sum of finished durations); teachers+ read any student's log. Breaks and
the work/break rhythm stay in the frontend — the backend stores no timing
policy.
✨ feat(exams): images on questions and choice optionsAhmet Kaan Gümüş · dbeb122
✨ feat(exams): images on questions and choice options

Teachers pin one illustration to any question (the map above the
prompt) and one picture per option on choice questions — the options
themselves can be images. Multipart upload per slot, replace by
re-upload, frozen with the question once attempts exist.

- rows in question_image (deterministic id per slot, UPSERT = replace);
  blobs beside note files under FILES_PATH, capped by max_file_bytes
- raster allowlist png/jpeg/webp/gif — SVG can script and these bytes
  render inline to students; served with nosniff + private, no-store
- students fetch bytes behind the sitting wall (enrollment + started
  attempt, no early peek); course managers anytime
- replacing a question's choices drops its option pictures (the
  illustration stays) — old pictures belong to the old options
- blob cleanup wired into image replace/delete and question, exam,
  and course deletes (exam cascade result slot shifted 5 -> 6)

2026-07-18

🐛 fix(users): drop enrollments when a user leaves the student roleAhmet Kaan Gümüş · 6917977
🐛 fix(users): drop enrollments when a user leaves the student role

Enrollment is student-only, but promotion left the rows behind: the
ex-student stayed on course rosters, inflated the live monitor's
enrolled/absent counts, and kept course view access. Security paths
always re-checked the live role — this is roster hygiene, not a hole.

PATCH /users/{id}/role to any non-student role now sweeps the target's
enrollments, and a boot backfill deletes rows already stale on disk
(including rows whose user record is gone: user.role = NONE).

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(events)!: registration audience replaces hand-picked usersAhmet Kaan Gümüş · 31e155a
✨ feat(events)!: registration audience replaces hand-picked users

Events gain a `registration` audience: a signup list built one seat
at a time — teachers place students (students never register, not
even themselves), staff take only their own seat, never another's.
An optional capacity caps the list (seat count re-checked inside the
insert transaction), and the list freezes the moment the event
starts, both directions. Seats resolve live like every audience:
roster, marking gate, and who-missed report inherit unchanged.

- POST /events/{id}/register {user_id?}: idempotent seat upsert
  (enrollment's composite-id trick); 409 when full or started
- DELETE /events/{id}/register/{user}: same self-or-student rule;
  a deleted account's leftover seat is any teacher's to free
- event delete cascades signup rows; audience switches leave them
  inert (they resurface if the kind returns)
- migration split into DDL + backfill queries: statements in one
  batch see the batch-start schema, so a backfill next to a fresh
  DEFINE FIELD silently lost the keys it wrote (audience became {})

BREAKING CHANGE: the hand-picked `users` audience kind is gone —
requests naming it are rejected. Existing users-audience events
convert on boot: each listed user becomes a registration row
credited to the event creator and the audience becomes an uncapped
registration list.
✨ feat(events)!: audience targeting + teacher-only attendanceAhmet Kaan Gümüş · bd9e7d8
✨ feat(events)!: audience targeting + teacher-only attendance

Every event now carries an audience — school (default), one exact
role, a course's live enrollment, or a hand-picked user list (<=100)
— defining its expected-attendee roster. Resolved at read time, never
snapshotted, so role changes and (un)enrollment move people in and
out by themselves. Visibility is unchanged: everyone sees every event.

- GET /events/{id}/roster: who-missed report (teacher+), expected
  list joined with marks, status null = never marked
- marks for people later dropped from the audience stay in the
  attendance listing but leave the roster report
- pre-audience rows backfill to school-wide on boot

BREAKING CHANGE: POST /events/{id}/attendance requires teacher+ —
students can no longer mark attendance, not even their own — and the
target must be in the event's audience (400 otherwise). Event
responses gain an audience object.
✨ 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-15

✨ feat(notes): file attachments with school-set size capAhmet Kaan Gümüş · f1b532b
✨ feat(notes): file attachments with school-set size cap

Blobs live on disk under FILES_PATH (same volume as the DB), named by
the row's ULID so user input never shapes a path; the note_file row
keeps only metadata. DB-blob storage rejected: multi-MB PDFs bloat
surrealkv's LSM tree and buffer whole in RAM on every read.

- POST/GET /notes/{id}/files, GET/DELETE /notes/{id}/files/{file_id};
  owner-only through the owning note, staff included
- max_file_bytes in settings (1 KiB-25 MiB hard cap, default 5 MiB),
  enforced on streamed bytes (413), inside the settings CAS guard;
  option<int> so pre-field volumes boot without a backfill
- 10 files per note; deleting a note removes rows first, blobs after,
  so a crash strands at worst an unreachable blob

2026-07-14

🐛 fix(db)!: drop backfills that crashed bootAhmet Kaan Gümüş · 992619b
🐛 fix(db)!: drop backfills that crashed boot

Single-field backfills fail on volumes predating the attempt/rejoin
fields: UPDATE re-validates the whole record, so backfilling
max_attempts tripped bool coercion on the still-NONE allow_rejoin
before its own backfill could run. DEFAULT only applies on CREATE,
so it never rescues existing records.

Pre-customer policy is clean breaks over migrations: remove the exam
and exam_attempt backfills plus the old-index compat drop instead of
merging them into one statement.

BREAKING CHANGE: volumes created before the attempt/rejoin fields no
longer boot; wipe the data volume (podman volume rm
hezarfen_backend_hezarfen-data) and reseed.
✨ 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, results

2026-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(db): embedded SurrealDB connection and schemaAhmet Kaan Gümüş · 0b4bc10
✨ feat(db): embedded SurrealDB connection and schema

init opens the file-backed surrealkv store and applies the schema;
init_mem gives tests a fresh in-memory database with the same schema.

The migration is one idempotent SCHEMAFULL block (DEFINE ... IF NOT
EXISTS), safe to run on every boot. Every column is typed, foreign
keys are record<..> links, and unique indexes enforce the invariants
that matter: one username, one session token, one attendance row per
event+user, and one result per exam+user.

Table-name constants are exported so the domain layer never spells a
table as a bare string.