PH1.3 — API platform: pagination, idempotency, ETag, soft-delete repository, crud_router #68
No reviewers
Labels
No labels
in-progress
in-review
ready-for-agent
seam-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
patrick/Polaris!68
Loading…
Reference in a new issue
No description provided.
Delete branch "feature/api-platform"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
What this does
Builds the shared plumbing every master-data screen (crews, vehicles, sites, catalogue, ...) will need: consistent pagination and filtering, safe concurrent edits (so two people editing the same record can't silently overwrite each other), protection against a flaky connection causing the same "create" to happen twice, soft delete instead of permanent delete, and a required "reason" on every change so the audit trail actually says why something changed.
Nothing user-facing changes yet — this is the reusable factory that upcoming CRUD tickets will build their actual endpoints on top of, not an endpoint itself.
Known limitation, flagged for later
The duplicate-request protection currently lives in memory rather than the database, because the next available migration slot is already claimed by another in-flight ticket. Practically this means: on an API restart or with multiple API instances running, that specific protection resets — worst case is a retried request isn't deduplicated (same as if this feature didn't exist yet), never a wrong or double result. Flagged as a follow-up for whoever picks up the next migration.
Also made two small, isolated additions to shared files outside this ticket's own scope, needed to get "reason" flowing through to the audit log — called out on the issue for visibility.
Closes #11.
🤖 Generated with Claude Code
https://claude.ai/code/session_013YioTVKBPoE6thZqbnTtnM
list_query_params(filterable_fields=..., sortable_fields=...) is a FastAPI dependency factory parsing page/size/sort and an allowlisted set of filter query params into a polaris.db.repository.ListQuery. Sorting an unlisted field is a 422; an unrecognised filter param is silently ignored. Page[T] is the {items, total} response shape (docs/09-api.md). PH1.3, issue #11. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_013YioTVKBPoE6thZqbnTtnM