PR #246 ยท pramaan-io/pramaan-functions ยท merged 2026-06-03
sequenceDiagram autonumber participant client as Client participant router as App Router participant service as Redesign Service participant store as DB client->>router: POST template-snapshot router->>service: create snapshot service->>store: resolve firm + matter service->>service: copy vocabulary store-->>service: frozen view service-->>client: snapshot view
| Method | in โ out | what it does |
|---|---|---|
MatterRedesignService | (class) | |
_current_user_id | (session) โ UUID | None | |
_visible_template_clause | (firm_id) โ Any |
Hosts snapshot creation, related matter linking, and carry-forward operations โ implements the distinct contracts the PR exposes for the redesign.
| new class | signature |
|---|---|
MatterRedesignService | (class) |
_current_user_id | (session) โ UUID | None |
_visible_template_clause | (firm_id) โ Any |
_matter_by_number | (session, firm_id, matter_number) โ Matter |
_visible_template | (session, firm_id, matter_template_id) โ MatterTemplate |
_snapshot_for_matter | (session, firm_id, matter) โ MatterTemplateSnapshot |
_snapshot_proceeding_kind_view | (row) โ MatterSnapshotProceedingKindView |
_snapshot_filing_type_view | (row) โ MatterSnapshotFilingTypeView |
_participant_label_view | (row) โ MatterParticipantLabelView |
_snapshot_view | (session, matter, snapshot) โ MatterTemplateSnapshotView |
create_template_snapshot | (session, matter_id, req) โ MatterTemplateSnapshotView |
_copy_snapshot_vocabulary | (session, firm_id, matter, snapshot) โ None |
get_template_snapshot | (session, matter_id) โ MatterTemplateSnapshotView |
_related_link_view | (link, source_number, target_number) โ RelatedMatterLinkView |
_matter_number_map | (session, firm_id, matter_ids) โ dict[UUID, int] |
_related_link_for_matter | (session, firm_id, matter, related_matter_link_id) โ RelatedMatterLink |
list_related_matters | (session, matter_id) โ RelatedMatterLinkListResponse |
create_related_matter | (session, matter_id, req) โ RelatedMatterLinkView |
_carry_forward_view | (row) โ RelatedMatterCarryForwardView |
list_carry_forward_records | (session, matter_id, related_matter_link_id) โ RelatedMatterCarryForwardListResponse |
create_carry_forward_record | (session, matter_id, related_matter_link_id, req) โ RelatedMatterCarryForwardView |
src/domains/proceeding/service.py+200 โ2Adds list, create, and update for runtime proceeding stages, exposing the user-authored stage timeline through the service layer.
| new method | signature |
|---|---|
_stage_view | (stage, matter_number) โ ProceedingStageView |
list_proceeding_stages | (session, matter_id, proceeding_id) โ ProceedingStageListResponse |
create_proceeding_stage | (session, matter_id, proceeding_id, req) โ ProceedingStageView |
update_proceeding_stage | (session, matter_id, proceeding_id, stage_id, req) โ ProceedingStageView |
Wires the redesign service methods to app API routes, exposing snapshot, related matter, proceeding stage, and carry-forward endpoints.
| new method | signature |
|---|---|
get_matter_template_snapshot | (matter_id, db) โ MatterTemplateSnapshotView |
create_matter_template_snapshot | (matter_id, req, db, _) โ MatterTemplateSnapshotView |
list_related_matters | (matter_id, db) โ RelatedMatterLinkListResponse |
create_related_matter | (matter_id, req, db, _) โ RelatedMatterLinkView |
list_matter_proceeding_stages | (matter_id, proceeding_id, db) โ ProceedingStageListResponse |
create_matter_proceeding_stage | (matter_id, proceeding_id, req, db, _) โ ProceedingStageView |
update_matter_proceeding_stage | (matter_id, proceeding_id, stage_id, req, db, _) โ ProceedingStageView |
list_related_matter_carry_forward_records | (matter_id, related_matter_link_id, db) โ RelatedMatterCarryForwardListResponse |
create_related_matter_carry_forward_record | (matter_id, related_matter_link_id, req, db, _) โ RelatedMat |
Adds listing and detail operations for matter templates, kept separate from the old matter type semantics per the PR's contract split.
| new class | signature |
|---|---|
MatterTemplateService | (class) |
_visible_template_clause | (firm_id) โ Any |
_list_item | (template) โ MatterTemplateListItem |
_detail_view | (template) โ MatterTemplateDetailView |
list_matter_templates | (session) โ MatterTemplateListResponse |
get_matter_template | (session, matter_template_id) โ MatterTemplateDetailView |
Defines request, view, and response DTOs for related matter links and carry-forward or provenance records.
| new class | signature |
|---|---|
RelatedMatterRelationshipType | (class) |
RelatedMatterStatus | (class) |
RelatedMatterCarryForwardSourceKind | (class) |
RelatedMatterCarryMode | (class) |
RelatedMatterLinkCreateRequest | (class) |
trim_notes | () โ RelatedMatterLinkCreateRequest |
RelatedMatterLinkView | (class) |
RelatedMatterLinkListResponse | (class) |
RelatedMatterCarryForwardCreateRequest | (class) |
RelatedMatterCarryForwardView | (class) |
RelatedMatterCarryForwardListResponse | (class) |
target_matter_id : UUIDrelationship_type : RelatedMatterRelationshipTypenotes : str | Noneid : UUIDsource_matter_id : UUIDsource_matter_number : inttarget_matter_number : intstatus : RelatedMatterStatuscreated_by_user_id : UUID | Nonesource_kind : RelatedMatterCarryForwardSourceKindcarry_mode : RelatedMatterCarryModerelated_matter_link_id : UUIDDefines DTOs for matter-owned template snapshots, including copied vocabulary views for proceeding kinds, filing types, and participant labels.
| new class | signature |
|---|---|
MatterSnapshotVocabularyStatus | (class) |
MatterParticipantLabelAlign | (class) |
MatterTemplateSnapshotCreateRequest | (class) |
MatterSnapshotProceedingKindView | (class) |
MatterSnapshotFilingTypeView | (class) |
MatterParticipantLabelView | (class) |
MatterTemplateSnapshotView | (class) |
matter_template_id : UUIDsnapshot_reason : strid : UUIDsnapshot_id : UUIDsource_proceeding_kind_id : UUID | Nonekey : strname : strdescription : str | Nonestatus : MatterSnapshotVocabularyStatusdisplay_order : intsource_filing_type_id : UUID | Nonerequired : boolcode : strlabel : stralign : MatterParticipantLabelAlignmatter_id : UUIDmatter_number : inttemplate_version : intmatter_type_id : UUIDtemplate_key : strtemplate_name : strcreated_by_user_id : UUID | NoneDefines DTOs for proceeding stages with validators that require a date or timestamp on create.
| new class | signature |
|---|---|
ProceedingStageStatus | (class) |
ProceedingStageCreateRequest | (class) |
require_date_or_timestamp | () โ ProceedingStageCreateRequest |
ProceedingStageUpdateRequest | (class) |
ProceedingStageView | (class) |
ProceedingStageListResponse | (class) |
stage_key : str | Nonetitle : strdescription : str | Nonestage_date : date | Noneoccurred_at : datetime | Noneposition : intstatus : ProceedingStageStatusid : UUIDmatter_id : UUIDmatter_number : intproceeding_id : UUIDcreated_by_user_id : UUID | Noneupdated_by_user_id : UUID | NoneDefines list, detail, and response DTOs for matter templates, kept as a separate contract from matter type DTOs.
| new class | signature |
|---|---|
MatterTemplateSource | (class) |
MatterTemplateStatus | (class) |
MatterTemplateListItem | (class) |
MatterTemplateDetailView | (class) |
MatterTemplateListResponse | (class) |
id : UUIDmatter_type_id : UUIDsource : MatterTemplateSourcekey : strname : strdescription : str | Nonestatus : MatterTemplateStatusversion : intdefault_proceeding_kind_id : UUID | Nonedefault_proceeding_kind_matter_type_id : UUID | Nonetotal : intAdds app API routes that list matter templates and fetch one by id, exposing the new template contract read endpoints.
| new method | signature |
|---|---|
list_matter_templates | (db) โ MatterTemplateListResponse |
get_matter_template | (matter_template_id, db) โ MatterTemplateDetailView |