- Updated proforma listing behavior to utilize `Criteria filters[]` for managing archived and active proformas. - Removed `archived` query parameter from backend; frontend now manages `archiveView` state. - Implemented new filters for `archived_at` and `status` in the proforma listing API. - Adjusted proforma creation and deletion contracts to reflect changes in archiving logic. - Introduced new utility functions for building proforma listing criteria based on UI state. - Updated frontend components to support new filtering options and maintain state in the URL. - Added SQL index for improved performance on proforma queries. - Created new TypeScript types for managing proforma list filters and criteria.
1.6 KiB
1.6 KiB
Proforma archive contract
Rules
- Archive uses
archived_atand does not changestatus. - Only
draftandrejectedproformas can be archived in V1. - Only
draftandrejectedarchived proformas can be unarchived in V1. - Archived proformas remain available through
GET /proformas/:id. - Deleted proformas remain excluded from every flow.
- Numbering is never reused and
document_series.next_numberis untouched. - Archived
draftproformas can be deleted directly without unarchiving.
Endpoints
PATCH /proformas/:proforma_id/archivePATCH /proformas/:proforma_id/unarchive
Both endpoints:
- return
200with the updated proforma snapshot - return
404when the proforma does not exist, belongs to another company, or is deleted - return
409when the state is not allowed, when the proforma is already archived/non-archived, or when it is linked to an issued invoice
Listing behavior
GET /proformasexcludes archived proformas by default throughfilters[]=archived_at IS_NULL- the backend does not expose
archive_viewas a query param - the frontend keeps
archiveView=active|archived|allonly as UI state and translates it toCriteria filters[] - active view sends
archived_at IS_NULL - archived view sends
archived_at IS_NOT_NULL - all view sends no
archived_atfilter qalways applies inside the scope produced byfilters[]
Notes
archivedis a visibility dimension, not a business status- V1 does not support archiving
sent,approved, orissued - V1 does not add
archived_byorarchive_reason - soft-deleted proformas stay excluded structurally by
deleted_at