Skip to content

API to pull your potato history#449

Merged
cleptric merged 4 commits into
mainfrom
potato-history-api
Jul 15, 2026
Merged

API to pull your potato history#449
cleptric merged 4 commits into
mainfrom
potato-history-api

Conversation

@HazAT

@HazAT HazAT commented Jul 10, 2026

Copy link
Copy Markdown
Member

You can see your potatoes in the app, but there's no way to get them out — say into a spreadsheet or dashboard to watch your potato empire grow over time.

New /api/potatoes endpoint: every potato you sent or received, paginated (nope), no message content (never stored any) — just when, how many, and with whom. Works with your API token. 🥔📈

Add GET /api/potatoes returning the authenticated user's individual
potato transactions without message content — just id, amount,
direction (sent/received), counterparty user_id, and created
timestamp. Designed for exporting potato history into external
systems for over-time analysis.

Query parameters:
- page: page number (CakePHP NumericPaginator)
- per_page: page size, default 100, capped at 500
- direction: 'sent' or 'received' to filter; omit for both

The response wraps items in a 'potatoes' array plus a 'pagination'
object (page, per_page, total, total_pages, has_next) so consumers can
walk all pages. Only 'page' is allowed as a paginator parameter;
sorting is fixed to created DESC.

Works with both session auth and the existing Bearer API token
authenticator on the /api scope, so external systems can pull data
using the token shown on the profile page.
@HazAT HazAT requested a review from a team as a code owner July 10, 2026 11:08
Comment thread src/Controller/Api/PotatoesController.php Outdated
@HazAT HazAT mentioned this pull request Jul 10, 2026
Messages.created is a datetime without fractional seconds, so
multi-recipient potato awards create several rows with identical
timestamps. Ordering only by created made page boundaries
non-deterministic between requests, which could produce duplicate or
missing rows for consumers walking all pages.

Flagged by Cursor Bugbot on PR #449.
Comment thread src/Controller/Api/PotatoesController.php Outdated

@cursor cursor Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 6191785. Configure here.

->where(['Messages.receiver_user_id' => $this->Authentication->getIdentity()->getIdentifier()])
->orderBy(['Messages.created' => 'DESC'])
->disableHydration()
->all();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Missing promised history pagination

Medium Severity

The PR describes /api/potatoes as paginated potato history, but list loads every matching sent and received row with no limit, page parameter, or paging metadata. For long-lived accounts that can mean two full unbounded result sets in one response, which undercuts the export/dashboard use case and risks slow or heavy replies as history grows.

Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 6191785. Configure here.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

broken promises

@cleptric cleptric merged commit 6de975d into main Jul 15, 2026
17 checks passed
@cleptric cleptric deleted the potato-history-api branch July 15, 2026 19:18
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.

2 participants