PR #254 · pramaan-io/pramaan-functions · merged 2026-06-04
sequenceDiagram autonumber participant mig as Migration participant api as Forum API participant mat as Matter / Proceeding mig->>mig: create business.forums + RLS mig->>api: schemas live api->>api: create / list / update / archive api->>mat: nullable restrictive FKs mat-->>api: delete blocked if referenced mat->>mat: forumId copied from matter default
| Method | in → out | what it does |
|---|---|---|
_enable_forum_rls | () → None | |
_disable_forum_rls | () → None | |
upgrade | () → None |
Alembic migration that creates the business.forums table, turns on row-level security per firm, and adds nullable restrictive foreign keys from matters and proceedings.
| new method | signature |
|---|---|
_enable_forum_rls | () → None |
_disable_forum_rls | () → None |
upgrade | () → None |
downgrade | () → None |
revision : strdown_revision : str | Sequence[str] | Nonebranch_labels : str | Sequence[str] | Nonedepends_on : str | Sequence[str] | Nonesrc/domains/forum/service.py+172 −39Forum domain service that lists, creates, updates, and soft-deletes forums, scoped strictly to the current firm via the session context.
| new method | signature |
|---|---|
_current_firm_id | (session) → UUID |
_current_user_id | (session) → UUID | None |
_view | (forum) → ForumView |
_get_forum | (session, firm_id, forum_id, include_deleted) → Forum |
list_forums | (session, include_archived) → ForumListResponse |
create_forum | (session, req) → ForumView |
update_forum | (session, forum_id, req) → ForumView |
delete_forum | (session, forum_id) → None |
Forum SQLModel entity carrying id, firm_id, name, availability lifecycle, and full audit columns for creation, archival, and soft deletion.
| new class | signature |
|---|---|
Forum | (class) |
id : UUIDfirm_id : UUIDname : stravailability : strcreated_by_user_id : UUID | Nonearchived_at : datetime | Nonearchived_by_user_id : UUID | Nonedeleted_at : datetime | Nonedeleted_by_user_id : UUID | NonePydantic DTOs for forum create, update, view, list, and delete-conflict responses, replacing the legacy forum_summary module entirely.
| new class | signature |
|---|---|
ForumAvailability | (class) |
ForumCreateRequest | (class) |
ForumUpdateRequest | (class) |
ForumView | (class) |
ForumListResponse | (class) |
ForumDeleteConflictResponse | (class) |
name : stravailability : ForumAvailabilityid : UUIDarchived_at : datetime | Nonearchived_by_user_id : UUID | Nonecreated_by_user_id : UUID | Nonematter_count : intproceeding_count : intFastAPI router exposing CRUD /app/forums endpoints, replacing the legacy /app/forums/summary with archive, unarchive, and guarded delete.
| new method | signature |
|---|---|
list_forums | (db, include_archived) → ForumListResponse |
create_forum | (req, db) → ForumView |
update_forum | (forum_id, req, db) → ForumView |
delete_forum | (forum_id, db) → Response |
Adds a forum validator so a proceeding can only reference a forum that belongs to the same firm as the matter it sits under.
| new method | signature |
|---|---|
_validate_forum | (session, firm_id, forum_id) → None |
Matter DTOs drop the legacy forum_type string and now expose default_forum_id as a proper foreign key field on the response shape.
default_forum_id : UUID | Noneforum_type : strMatter service gains a forum validator that confirms a matter's default forum belongs to the calling firm before persisting.
| new method | signature |
|---|---|
_validate_forum | (session, firm_id, forum_id) → None |
OpenAPI generation helper extended with origin-extension attachment, supporting the schema diffs this PR introduces.
| new method | signature |
|---|---|
add_origin_extensions | (payload, origin) → None |
Proceeding entity gains a nullable forum_id column linking each proceeding to the new forums catalog instead of a string label.
forum_id : UUID | NoneMatter entity replaces the forum_type string with a default_forum_id foreign key into the new business.forums catalog.
default_forum_id : UUID | NoneProceeding DTO exposes forum_id as the operative forum venue, replacing the old forum_type echo on the wire.
forum_id : UUID | None