Skip to content

Fix: Add currentAmount aggregation to posts list API for help-request progress#385

Merged
3m1n3nc3 merged 1 commit into
geevapp:mainfrom
Ajibose:fix/355-help-request-progress-aggregation
Jun 26, 2026
Merged

Fix: Add currentAmount aggregation to posts list API for help-request progress#385
3m1n3nc3 merged 1 commit into
geevapp:mainfrom
Ajibose:fix/355-help-request-progress-aggregation

Conversation

@Ajibose

@Ajibose Ajibose commented Jun 26, 2026

Copy link
Copy Markdown
Contributor

Closes #355

Summary

  • Added a single helpContribution.groupBy(_sum: amount) call to the GET /api/posts endpoint, efficiently aggregating raised amounts for all returned posts in one query
  • Each post in the response now includes currentAmount (total raised), defaulting to 0 when no contributions exist
  • Updated mapApiPostToClientPost to explicitly map currentAmount so the client Post shape is always populated
  • Added a unit test verifying the aggregation and zero-fallback behaviour

Test plan

  • Run vitest run tests/api/posts.test.ts — all tests pass including the new currentAmount test
  • Open the feed — help-request posts now display the correct "$X raised" amount and progress bar percentage
  • ContributionForm remaining calculation uses the correct currentAmount from the list response

@drips-wave

drips-wave Bot commented Jun 26, 2026

Copy link
Copy Markdown

@Ajibose Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@3m1n3nc3 3m1n3nc3 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

We had a failing PR that broke our CI, this has been resolved, but merging yours at this state will bring us back where we began. Please sync your fork with the latest updates so we can merge.

… progress

Adds helpContributions _sum aggregation via groupBy to the GET /api/posts
endpoint so each post includes the total amount raised, and updates the
mapper and tests accordingly.

Closes geevapp#355
@Ajibose Ajibose force-pushed the fix/355-help-request-progress-aggregation branch from 2628649 to be0e693 Compare June 26, 2026 14:23
@Ajibose

Ajibose commented Jun 26, 2026

Copy link
Copy Markdown
Contributor Author

We had a failing PR that broke our CI, this has been resolved, but merging yours at this state will bring us back where we began. Please sync your fork with the latest updates so we can merge.

it is alright, it's been fixed

@3m1n3nc3 3m1n3nc3 merged commit 5083bd8 into geevapp:main Jun 26, 2026
2 checks passed
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.

Help-request progress (currentAmount) is never returned by the posts list API — feed shows $0 raised / 0% funded

2 participants