[Bug-1038] Align app forums contract

Story 1038Epic None7 files · +151/−127

PR #258 · pramaan-io/pramaan-functions · merged 2026-06-05

How it flows

sequenceDiagram
  autonumber
  participant dto as DTO
  participant svc as Service
  participant oas as OpenAPI spec
  participant tst as Contract test
  dto->>dto: Define ForumView
  svc->>svc: _view mapper
  dto->>oas: make openapi
  oas->>tst: assert shape

src/domains/forum/

Methodin → outwhat it does
ForumView(class)timestamped response model with audit fields
_view(forum) → ForumViewmaps a Forum entity into the wire-shape view

What changed, file by file

Adds a private helper that maps a Forum entity into the new ForumView shape, keeping app-facing responses aligned with the DTO.

new methodsignature
_view(forum) → ForumView

Replaces the old catalog-style DTO with a timestamped ForumView class carrying audit fields (archived_at, archived_by, created_by).

new classsignature
ForumView(class)
New fields: archived_at : datetime | Nonearchived_by_user_id : UUID | Nonecreated_by_user_id : UUID | None

Off the table / Locked in

DB-free OpenAPI test runs every CI
Catalog fields gone from spec
Downstream app regen still pending
Integration test blocked on DB role

Files changed (7)

File±
openapi/app-api.json ★+68 −61
src/domains/forum/dtos/__init__.py+2 −8
src/domains/forum/dtos/forum.py ★+8 −34
src/domains/forum/service.py ★+11 −14
tests/contract/generate_fixtures.py+8 −3
tests/contract/test_app_forums_openapi.py+47
tests/integration/test_app_forums.py+7 −7