Skip to content

implement post /donations endpoint with validation and auth#280

Open
shreeyaadhikari wants to merge 4 commits into
mainfrom
implement-post/donations
Open

implement post /donations endpoint with validation and auth#280
shreeyaadhikari wants to merge 4 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!

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)

2 participants