Add pagination, cross-board activity endpoint, and Project updated_at #180

Closed
opened 2026-03-15 04:13:58 +00:00 by forgejo_admin · 0 comments

Lineage

plan-pal-e-docs → Phase F11 (Design System Overhaul) → F11-backend

Repo

forgejo_admin/pal-e-docs

User Story

As the platform owner viewing the pal-e-app home page
I want to see my most recently updated notes, active board items across all projects, and project activity
So that the home page answers "what changed recently?" instead of showing a static alphabetical dump

Context

Phase F11 is a design system overhaul for pal-e-app. The frontend redesign requires an "activity-first" home page showing recently updated content. The current API has gaps:

  • GET /notes returns ALL notes with no pagination (374 notes, growing)
  • No way to query board items across all boards by recency
  • Project model has no updated_at column

The API already sorts notes by updated_at DESC by default and includes updated_at in responses — so the foundation is solid. These 3 changes are surgical additions, not architectural rewrites.

File Targets

Files to modify:

  • src/pal_e_docs/routes/notes.py — add limit + offset query params to list_notes (line ~358)
  • src/pal_e_docs/routes/boards.py — add new GET /boards/activity endpoint for cross-board recency query
  • src/pal_e_docs/models.py — add updated_at column to Project model (line ~52)
  • src/pal_e_docs/schemas.py — add updated_at to ProjectOut schema (line ~51)
  • New Alembic migration for Project updated_at column

Files NOT to touch:

  • src/pal_e_docs/routes/blocks.py — no changes needed
  • src/pal_e_docs/routes/search.py — search already has limit

Acceptance Criteria

  • GET /notes?limit=10&offset=0 returns exactly 10 notes sorted by updated_at DESC
  • GET /notes?limit=5&project=pal-e-docs returns 5 most recent pal-e-docs notes
  • GET /notes without limit/offset continues to work (backwards compatible — default to returning all)
  • GET /boards/activity?limit=10 returns 10 most recently updated board items across ALL boards
  • GET /boards/activity?column=in_progress&limit=5 returns 5 most recent in-progress items across all boards
  • GET /boards/activity response uses existing BoardItemOut schema
  • Project model has updated_at column with server_default=func.now(), onupdate=func.now()
  • GET /projects response includes updated_at field
  • Alembic migration runs cleanly (alembic upgrade head)
  • All existing tests pass
  • New tests cover: pagination (limit/offset), activity endpoint (with and without column filter), Project updated_at in response

Test Expectations

  • Unit test: test_list_notes_pagination — verify limit/offset params work, verify default behavior unchanged
  • Unit test: test_boards_activity_endpoint — verify cross-board query, column filter, limit, ordering by updated_at DESC
  • Unit test: test_project_updated_at — verify field exists in response, auto-updates on modification
  • Run: pytest tests/ -v

Constraints

  • Match existing route patterns in routes/notes.py and routes/boards.py
  • Use Query() from FastAPI for new parameters (consistent with existing code)
  • Default limit to None on GET /notes for backwards compatibility (no limit = return all, same as current)
  • GET /boards/activity should reuse the existing _item_to_out() helper and BoardItemOut schema
  • Migration must be safe for production (additive only — new column with server_default)
  • Run ruff format before committing

Checklist

  • PR opened
  • Tests pass
  • No unrelated changes
  • phase-pal-e-docs-design-overhaul — parent phase (F11)
  • project-pal-e-docs — project
### Lineage `plan-pal-e-docs` → Phase F11 (Design System Overhaul) → F11-backend ### Repo `forgejo_admin/pal-e-docs` ### User Story As the platform owner viewing the pal-e-app home page I want to see my most recently updated notes, active board items across all projects, and project activity So that the home page answers "what changed recently?" instead of showing a static alphabetical dump ### Context Phase F11 is a design system overhaul for pal-e-app. The frontend redesign requires an "activity-first" home page showing recently updated content. The current API has gaps: - `GET /notes` returns ALL notes with no pagination (374 notes, growing) - No way to query board items across all boards by recency - Project model has no `updated_at` column The API already sorts notes by `updated_at DESC` by default and includes `updated_at` in responses — so the foundation is solid. These 3 changes are surgical additions, not architectural rewrites. ### File Targets Files to modify: - `src/pal_e_docs/routes/notes.py` — add `limit` + `offset` query params to `list_notes` (line ~358) - `src/pal_e_docs/routes/boards.py` — add new `GET /boards/activity` endpoint for cross-board recency query - `src/pal_e_docs/models.py` — add `updated_at` column to `Project` model (line ~52) - `src/pal_e_docs/schemas.py` — add `updated_at` to `ProjectOut` schema (line ~51) - New Alembic migration for Project `updated_at` column Files NOT to touch: - `src/pal_e_docs/routes/blocks.py` — no changes needed - `src/pal_e_docs/routes/search.py` — search already has `limit` ### Acceptance Criteria - [ ] `GET /notes?limit=10&offset=0` returns exactly 10 notes sorted by `updated_at DESC` - [ ] `GET /notes?limit=5&project=pal-e-docs` returns 5 most recent pal-e-docs notes - [ ] `GET /notes` without limit/offset continues to work (backwards compatible — default to returning all) - [ ] `GET /boards/activity?limit=10` returns 10 most recently updated board items across ALL boards - [ ] `GET /boards/activity?column=in_progress&limit=5` returns 5 most recent in-progress items across all boards - [ ] `GET /boards/activity` response uses existing `BoardItemOut` schema - [ ] Project model has `updated_at` column with `server_default=func.now(), onupdate=func.now()` - [ ] `GET /projects` response includes `updated_at` field - [ ] Alembic migration runs cleanly (`alembic upgrade head`) - [ ] All existing tests pass - [ ] New tests cover: pagination (limit/offset), activity endpoint (with and without column filter), Project updated_at in response ### Test Expectations - [ ] Unit test: `test_list_notes_pagination` — verify limit/offset params work, verify default behavior unchanged - [ ] Unit test: `test_boards_activity_endpoint` — verify cross-board query, column filter, limit, ordering by updated_at DESC - [ ] Unit test: `test_project_updated_at` — verify field exists in response, auto-updates on modification - Run: `pytest tests/ -v` ### Constraints - Match existing route patterns in `routes/notes.py` and `routes/boards.py` - Use `Query()` from FastAPI for new parameters (consistent with existing code) - Default `limit` to `None` on `GET /notes` for backwards compatibility (no limit = return all, same as current) - `GET /boards/activity` should reuse the existing `_item_to_out()` helper and `BoardItemOut` schema - Migration must be safe for production (additive only — new column with server_default) - Run `ruff format` before committing ### Checklist - [ ] PR opened - [ ] Tests pass - [ ] No unrelated changes ### Related - `phase-pal-e-docs-design-overhaul` — parent phase (F11) - `project-pal-e-docs` — project
forgejo_admin 2026-03-15 04:24:00 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
forgejo_admin/pal-e-api#180
No description provided.