forge
Explore
Log in

Don't you dare go Hollow

Commits

Commits on af331ecc8a4a0c661bcdbc905b95bb2cf77a72deFiltered to src/db/note.rsClear filter

2026-09-12

🗃️ feat!: port boards, notes and rag to sqlx/PostgresAhmet Kaan Gümüş · c928ecf
🗃️ feat!: port boards, notes and rag to sqlx/Postgres

- board/note/course_note/rag_output db layers: static query!/query_as! against
  the union-schema prepare DB; PagedList/FieldUpdate for the runtime builders
- file caps via the cap claim CTE at each call site; board create claims
  app_user.board_count, delete releases it in the same tx
- BOARD_ROSTER_LOCK deleted: invite is one guarded atomic-array union
  (coalesce(array_agg(DISTINCT unnest(participants || $n))) with a
  cardinality cap on the row version the UPDATE acts on)
- stroke dual-counter claim: one UPDATE bumps both counters, lifetime cap +
  open guard + epoch in the WHERE; zero rows re-read via cap::full_kind
- board clear: pre-image read under SELECT ... FOR UPDATE, refusal precedence
  preserved (closed > not-creator > locked > blank), guarded epoch bump,
  marker insert, one tx (CLEAR_REFUSED THROW now Rust-level refusals)
- rag_output.payload JSONB (sqlx::types::Json), sources uuid[] cascade via
  $n = ANY(sources); note/course_note delete cascades sweep rag_output
  in-tx (real FKs refuse dangling derived rows)
- board rosters: uuid[] + GIN, membership reads $n = ANY(participants)
- dead SurrealQL-shaped constants removed (BOARD_OPEN_GUARD, BOARD_STROKE_TABLE,
  counter/file-count field constants); uuid::Uuid imports for my domain files

2026-09-11

🧹 chore: split note/session/settings into domain/db/service layersAhmet Kaan Gümüş · efea304
🧹 chore: split note/session/settings into domain/db/service layers

Pilot wave of the three-layer split. All query execution for the three
domains now lives in src/db/{note,session,settings}.rs as free fns taking
db first; web handlers call service::<x>::* only; domain keeps pure types.

- service/settings.rs gains the PATCH workflow (apply) and SETTINGS_LOCK —
  it spans a multi-call pair (retire names, CAS save, restore), so it is a
  service lock, not a db lock. The service takes its own input records
  (SettingsPatch/*Input) so wire DTOs stay in web and list validation keeps
  its original order, including the try_kept grandfathering that needs the
  stored list.
- Note/Session/Settings fields the db layer mints or CAS-binds become
  pub(crate); Settings::record_id becomes pub(crate).
- Unit tests rode with their fns: note delete cascade → db/note, session
  purge → db/session, settings load/save/CAS → db/settings, the whole
  settings edit workflow suite → service/settings.
- Doc links re-pointed (user, class_blueprint, bank_question, exam,
  note_file, tests/regress_roles); NoteId::generate's stale
  'Note::list_for_user' link now names db::note::list_for.
- Known residual for a later wave: web/notes.rs:411 file.delete() is
  note_file-domain persistence (note_file splits in C3).