Skip to content

feat(routes): add 'my routes only' filter - #337

Merged
jinglemansweep merged 1 commit into
mainfrom
feat/routes-mine-filter
Jul 24, 2026
Merged

feat(routes): add 'my routes only' filter#337
jinglemansweep merged 1 commit into
mainfrom
feat/routes-mine-filter

Conversation

@jinglemansweep

Copy link
Copy Markdown
Contributor

Summary

Adds a checkbox filter to the Routes page that narrows the list to routes owned by the current user. The filter is URL-driven (?mine=true), cached server-side automatically via the existing key builder, and only shown to operators/admins (members can't own routes).

Changes

Backendapi/routes/routes.py

  • mine: bool = Query(False) on list_routes; when true, filters to created_by == caller_id
  • Legacy NULL created_by routes excluded in this mode
  • No cache/invalidation changes needed — _routes_key_builder already namespaces by sorted query string

Frontendpages/Routes.tsx

  • useSearchParams drives the filter state from the URL
  • Collapsible FilterForm panel with data-testid="routes-mine-toggle" checkbox
  • Gated on canManage (operator/admin only)

i18nroutes.filter_mine added to en.json and nl.json

Tests

Layer Tests
Backend (TestRouteMineFilter) 6: own/other/null/admin/empty/default
Vitest (Routes.test.tsx) 6: param passing, role gating, OIDC-disabled, checkbox state
E2E (routes-operator.spec.ts) 1: toggle filter, assert legacy disappears + owned stays; new seed route with created_by="pw-operator"

All: 81 backend / 331 frontend / pre-commit clean / e2e typecheck clean.

Adds a checkbox filter to the Routes page that narrows the list to
routes owned by the current user. The filter is URL-driven (?mine=true),
cached server-side automatically via the existing key builder, and only
shown to operators/admins (members can't own routes).

Backend: mine query param on GET /api/v1/routes filters by created_by
matching the caller's X-User-Id. Legacy NULL routes are excluded.

Tests:
- Backend: 6 new TestRouteMineFilter tests (own/other/null/admin/default)
- Vitest: 6 new tests (param passing, role gating, checkbox state)
- E2E: new seed route owned by pw-operator + mine filter spec
@codecov

codecov Bot commented Jul 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ All tests successful. No failed tests found.

📢 Thoughts on this report? Let us know!

@jinglemansweep
jinglemansweep merged commit 140bd43 into main Jul 24, 2026
5 checks passed
@jinglemansweep
jinglemansweep deleted the feat/routes-mine-filter branch July 24, 2026 21:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant