Allow users to export their game list as CSV #47

Open
opened 2024-01-14 14:45:21 -06:00 by jimmyb · 0 comments
Owner

Users should be able to download their own MyVideoGameList game-list data as a CSV file.

The current Laravel checkout has game_lists persistence, a GameList model, owner-only update/delete policies, profile/header links reserving /list/{username}, and controller stubs for list pages and list entry management. The public/user list surface itself is not fully rebuilt yet, and there is no CSV export route. This issue tracks adding an authenticated, owner-only CSV export that includes the user’s active game-list entries and useful related game/platform metadata.

Scope

  • Authenticated current-user CSV export.
  • Active, non-deleted game_lists rows only.
  • Game and platform metadata available through existing relationships/IDs.
  • Export action/link from the user’s own list page once rebuilt.
  • Safe CSV formatting for notes and user-entered fields.
  • Existing Laravel response/download patterns.

Acceptance Criteria

  • Signed-in users can download a CSV export of their own game list.
  • Guests are redirected to login and cannot export.
  • Users cannot export another user’s private list data.
  • Exported rows exclude soft-deleted game-list entries.
  • Exported rows include useful columns such as game title, platform, ownership, status, rating, priority, difficulty, hours played, replay value, started date, finished date, replaying flag, notes, and source game ID.
  • Status, ownership, hours-played, replay-value, and other coded values are exported as readable labels where practical.
  • CSV output handles commas, quotes, newlines, formulas, and other user-entered content safely.
  • Empty lists produce a valid CSV with headers and no data rows.
  • The response uses an appropriate text/csv content type and a clear filename such as myvideogamelist-{username}-list.csv.
  • Deleted or disabled games do not break the export; unavailable related game/platform data falls back safely.
  • User-facing export controls support light/dark mode and follow existing Laravel/Tailwind list patterns when the list page is rebuilt.

Test Coverage Required

  • Feature test confirming an authenticated user can export their own list as CSV.
  • Feature test confirming guests cannot export.
  • Authorization test confirming users cannot export another user’s list.
  • Feature test confirming soft-deleted list rows are excluded.
  • Regression test confirming empty lists return a valid header-only CSV.
  • CSV safety tests for commas, quotes, newlines, and formula-like notes or titles.
  • Regression test confirming readable labels for coded list fields.
  • Regression test confirming missing/deleted game or platform data does not crash export.
  • Tests should use Pest and focused list/export coverage.
  • Run the focused export tests, then run vendor/bin/pint --dirty before closing the issue.

Progress Checklist

  • game_lists table exists
  • GameList model exists
  • Profile/header links reserve user list pages
  • Game-list owner update/delete policy checks exist
  • Game-list rows store status, rating, notes, dates, and platform IDs
  • Add authenticated CSV export route/action
  • Authorize export for the current user only
  • Build query for active list rows with game/platform data
  • Map coded list values to readable CSV labels
  • Generate safe streamed CSV response and filename
  • Add export link/control to the owner’s list page when rebuilt
  • Add tests for export content, authorization, empty lists, soft deletes, CSV escaping, and missing related data
  • Confirm CSV export fits the rebuilt list-page workflow
Users should be able to download their own MyVideoGameList game-list data as a CSV file. The current Laravel checkout has `game_lists` persistence, a `GameList` model, owner-only update/delete policies, profile/header links reserving `/list/{username}`, and controller stubs for list pages and list entry management. The public/user list surface itself is not fully rebuilt yet, and there is no CSV export route. This issue tracks adding an authenticated, owner-only CSV export that includes the user’s active game-list entries and useful related game/platform metadata. ## Scope - Authenticated current-user CSV export. - Active, non-deleted `game_lists` rows only. - Game and platform metadata available through existing relationships/IDs. - Export action/link from the user’s own list page once rebuilt. - Safe CSV formatting for notes and user-entered fields. - Existing Laravel response/download patterns. ## Acceptance Criteria - Signed-in users can download a CSV export of their own game list. - Guests are redirected to login and cannot export. - Users cannot export another user’s private list data. - Exported rows exclude soft-deleted game-list entries. - Exported rows include useful columns such as game title, platform, ownership, status, rating, priority, difficulty, hours played, replay value, started date, finished date, replaying flag, notes, and source game ID. - Status, ownership, hours-played, replay-value, and other coded values are exported as readable labels where practical. - CSV output handles commas, quotes, newlines, formulas, and other user-entered content safely. - Empty lists produce a valid CSV with headers and no data rows. - The response uses an appropriate `text/csv` content type and a clear filename such as `myvideogamelist-{username}-list.csv`. - Deleted or disabled games do not break the export; unavailable related game/platform data falls back safely. - User-facing export controls support light/dark mode and follow existing Laravel/Tailwind list patterns when the list page is rebuilt. ## Test Coverage Required - Feature test confirming an authenticated user can export their own list as CSV. - Feature test confirming guests cannot export. - Authorization test confirming users cannot export another user’s list. - Feature test confirming soft-deleted list rows are excluded. - Regression test confirming empty lists return a valid header-only CSV. - CSV safety tests for commas, quotes, newlines, and formula-like notes or titles. - Regression test confirming readable labels for coded list fields. - Regression test confirming missing/deleted game or platform data does not crash export. - Tests should use Pest and focused list/export coverage. - Run the focused export tests, then run `vendor/bin/pint --dirty` before closing the issue. ## Progress Checklist - [x] `game_lists` table exists - [x] `GameList` model exists - [x] Profile/header links reserve user list pages - [x] Game-list owner update/delete policy checks exist - [x] Game-list rows store status, rating, notes, dates, and platform IDs - [ ] Add authenticated CSV export route/action - [ ] Authorize export for the current user only - [ ] Build query for active list rows with game/platform data - [ ] Map coded list values to readable CSV labels - [ ] Generate safe streamed CSV response and filename - [ ] Add export link/control to the owner’s list page when rebuilt - [ ] Add tests for export content, authorization, empty lists, soft deletes, CSV escaping, and missing related data - [ ] Confirm CSV export fits the rebuilt list-page workflow
Codex changed title from Allow Users to Export List Data as CSV to Allow users to export their game list as CSV 2026-05-26 01:03:54 -05:00
Sign in to join this conversation.
No milestone
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
MyVideoGameList/myvideogamelist.com#47
No description provided.