Skip to content

implement post /donations endpoint with validation and auth#280

Merged
shreeyaadhikari merged 17 commits into
mainfrom
implement-post/donations
Jul 13, 2026
Merged

implement post /donations endpoint with validation and auth#280
shreeyaadhikari merged 17 commits into
mainfrom
implement-post/donations

Conversation

@shreeyaadhikari

@shreeyaadhikari shreeyaadhikari commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

ℹ️ Issue

Closes #245

📝 Description

Implements the POST /donations endpoint in donors.

Changes made:

  1. Added POST /donations route in handler.ts that inserts a new row into branch.project_donations with donor_id, project_id, and amount
  2. Added input validation that rejects missing fields, non-integer IDs, and non-positive amounts w/ a 400 response
  3. Added a 409 response for duplicate donations
  4. Added tests covering success case, validation error cases, and unauthenticated case

✔️ Verification

Added tests in \donors\test\donors.test.ts:

image

@shreeyaadhikari shreeyaadhikari marked this pull request as ready for review July 7, 2026 20:17
@github-actions github-actions Bot requested a review from mehanana July 7, 2026 20:17
github-actions Bot added a commit that referenced this pull request Jul 7, 2026

@mehanana mehanana 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.

looks great!

@nshoreibah-kvyo nshoreibah-kvyo 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.

Couple easy comments but looks good!

|--------|------|-------------|
| GET | /health | Health check |
| GET | /donors | |
| GET | /donations | |

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Can we add this GET /donations back?

@shreeyaadhikari shreeyaadhikari Jul 11, 2026

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

The README hasn't changed on my local machine, I'm not quite sure how to change this.
Tried to change it on GitHub but wouldn't let me.

@nourshoreibah nourshoreibah Jul 13, 2026

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

You should be able to fix it by pulling main then running git checkout main -- apps/backend/lambdas/donors/README.md to use the version from main, making the change to add the new API method, then committing!

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

I did that and it worked, but once the checks started running the GET/donations changed to POST/donations

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Oh weird it must be a bug with CI then, sorry feel free to merge

Comment thread apps/backend/lambdas/donors/handler.ts

@nourshoreibah nourshoreibah left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I just realized the bot only sees request changes so requesting changes

@shreeyaadhikari shreeyaadhikari added this pull request to the merge queue Jul 13, 2026
Merged via the queue into main with commit ad8ad3a Jul 13, 2026
18 checks passed
@shreeyaadhikari shreeyaadhikari deleted the implement-post/donations branch July 13, 2026 20:29
github-actions Bot added a commit that referenced this pull request Jul 13, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Backend] POST /donations missing (declared in openapi, not implemented)

4 participants