Uecko_ERP/docs/customer-invoices/proforma-list-contract.md
david a264f43b95 feat: enhance proforma listing and archiving functionality
- 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.
2026-07-29 22:24:53 +02:00

1.2 KiB

Proforma List Contract

UI model

  • frontend keeps archiveView=active|archived|all as semantic UI state
  • frontend keeps status=all|draft|sent|approved|rejected|issued
  • archiveView is not a backend query param

Backend contract

GET /proformas stays based on Criteria:

  • q
  • pageNumber
  • pageSize
  • orderBy
  • order
  • filters[]

Allowed filters

  • archived_at IS_NULL
  • archived_at IS_NOT_NULL
  • status EQUALS draft|sent|approved|rejected|issued

Scope rules

  • active view -> archived_at IS_NULL
  • archived view -> archived_at IS_NOT_NULL
  • all view -> no archived_at filter
  • status all -> no status filter
  • any concrete status -> status EQUALS <value>
  • q applies after the scope is defined by filters[]

Resource visibility

  • GET /proformas defaults to active scope
  • GET /proformas/:id returns archived proformas too
  • soft-deleted proformas never appear in list results
  • soft-deleted proformas are treated as non-existent by GET /proformas/:id

Frontend persistence

  • URL stores archiveView
  • URL stores status
  • URL stores q
  • localStorage["proformas:list:grid"] keeps only table preferences