PR #185 · pramaan-io/pramaan-functions · merged 2026-05-20
sequenceDiagram autonumber participant client as Client participant router as Router participant service as Service participant repo as Repository participant db as Database client->>router: GET /matter-types router->>service: list_matter_types() service->>repo: visible + sort repo->>db: RLS-scoped query db->>repo: rows + counts repo->>service: MatterTypeRow service->>client: ListResponse
| Method | in → out | what it does |
|---|---|---|
SystemMatterTypeSeed | (id, name, subtitle, forum_type, participant_labels, seeded_filing_types, SYSTEM_MATTER_TYPE_SEEDS) | frozen dataclass holding id, name, subtitle, forum, participant labels and filing types for one system matter type |
participant_label_payload | (seed) → list[dict[str, Any]] | turns a seed's participant labels into the JSONB payload that goes into the row |
filing_type_payload | (seed) → list[dict[str, Any]] | turns a seed's filing types into the JSONB payload that goes into the row |
upgrade | () → None | creates the matter_types table, partial unique indexes, grants, RLS, and freezes the five system seed payloads |
Alembic migration that creates the matter_types table, partial unique indexes, grants, RLS, and freezes the five system seed payloads.
| new method | signature |
|---|---|
_participant_label | (order, label, plural, role, align, required) → dict[str, object] |
_filing_type | (name, description, required) → dict[str, object] |
upgrade | () → None |
downgrade | () → None |
revision : strdown_revision : str | Sequence[str] | Nonebranch_labels : str | Sequence[str] | Nonedepends_on : str | Sequence[str] | NoneFrozen dataclass seeds for the five locked system matter types plus helpers to project labels and filing types into JSONB payloads.
| new class | signature |
|---|---|
ParticipantLabelSeed | (order, label, plural, role, align, required, FilingTypeSeed, name, description) |
SystemMatterTypeSeed | (id, name, subtitle, forum_type, participant_labels, seeded_filing_types, SYSTEM_MATTER_TYPE_SEEDS) |
participant_label_payload | (seed) → list[dict[str, Any]] |
filing_type_payload | (seed) → list[dict[str, Any]] |
source : strSQLModel entity for matter_types covering both system and firm rows with source, name, subtitle and JSONB participant and filing type fields.
| new class | signature |
|---|---|
MatterType | (type) |
id : UUIDfirm_id : UUID | Nonesource : strname : strsubtitle : str | NonePydantic DTOs for list items, detail views, participant labels and filing types exposed by the read API.
| new class | signature |
|---|---|
MatterTypeSource | (class) |
MatterTypeParticipantRoleToken | (class) |
MatterTypeParticipantAlign | (class) |
FilingTypeSource | (class) |
MatterTypeParticipantLabelView | (class) |
MatterTypeFilingTypeView | (class) |
MatterTypeListItem | (class) |
MatterTypeDetailView | (class) |
participant_label_orders_must_be_unique | (value) → list[MatterTypeParticipantLabelView] |
MatterTypeListResponse | (class) |
order : intlabel : strplural : strrole : MatterTypeParticipantRoleTokenalign : MatterTypeParticipantAlignrequired : boolname : strdescription : strsource : MatterTypeSourceid : UUIDsubtitle : str | Noneparticipants_count : intfiling_types_count : inttotal : intDB access for listing and fetching matter types using a visibility clause and a stable sort expression.
| new class | signature |
|---|---|
MatterTypeRow | (class) |
_visible_clause | () → Any |
_sort_expression | () → Any |
list_matter_types | (db) → list[MatterTypeRow] |
get_matter_type | (db, matter_type_id) → MatterTypeRow | None |
matter_type : MatterTypeparticipants_count : intfiling_types_count : intService layer that turns repository rows into list responses and detail views for the read API.
| new class | signature |
|---|---|
MatterTypeService | (class) |
_detail_view | (row) → MatterTypeDetailView |
list_matter_types | (db) → MatterTypeListResponse |
get_matter_type | (db, matter_type_id) → MatterTypeDetailView |
matter_type : MatterTypeFastAPI router exposing the read-only list and detail endpoints for matter types.
| new method | signature |
|---|---|
list_matter_types | (db) → MatterTypeListResponse |
get_matter_type | (matter_type_id, db) → MatterTypeDetailView |