Skip to content

#181 upload report endpoint#192

Open
tsudhakar87 wants to merge 14 commits intomainfrom
181-upload-report-endpoint
Open

#181 upload report endpoint#192
tsudhakar87 wants to merge 14 commits intomainfrom
181-upload-report-endpoint

Conversation

@tsudhakar87
Copy link
Copy Markdown
Contributor

@tsudhakar87 tsudhakar87 commented Apr 12, 2026

ℹ️ Issue

Closes #181

📝 Description

  • Added a GET /reports/upload-url endpoint that returns a presigned url
    • basically frontend/client will send a GET request to this endpoint to the get the url, then send a PUT request to that presigned url with the file name + content
  • Added a POST /reports endpoint that inserts s3 url to db
    • after sending the get and put requests, the frontend/client will send a POST request to also insert to the db
    • so if we want to retrieve a specific report we can retrieve the s3 url from the db, then fetch that s3 url to get the actual file content that's there
  • Modified the previous endpoint that generated reports to be POST /reports/generate

✔️ Verification

  • added tests

Local Verification Process

  1. Start the stack from apps/backend/ with make up
  2. Register a new user via POST /auth/register
  3. Verify email via POST /auth/verify-email using the code sent to your inbox
  4. Log in via POST /auth/login and copy the AccessToken from the response
  5. Decode the token at jwt.io and copy the sub field
  6. Insert your user into Docker's postgres using docker exec -it branch-postgres psql ... —
    must use docker exec not local psql since there are two postgres instances on port 5432
  7. Make yourself admin in the same way (UPDATE branch.users SET is_admin = TRUE)
  8. Open http://localhost:3005/reports/swagger and authorize with Bearer
  9. Test POST /reports with a fake objectUrl — no AWS credentials needed
  10. Verify the report appears in GET /reports
  11. GET /reports/upload-url validates auth/params without AWS, but returning a working
    presigned URL requires real AWS credentials in .env
Screenshot 2026-04-17 at 9 07 32 PM

🏕️ (Optional) Future Work / Notes

@tsudhakar87 tsudhakar87 changed the title 181 upload report endpoint #181 upload report endpoint Apr 12, 2026
@tsudhakar87 tsudhakar87 marked this pull request as ready for review April 12, 2026 23:20
@tsudhakar87 tsudhakar87 requested a review from Vaibhav978 as a code owner April 12, 2026 23:20
@github-actions github-actions bot requested a review from mehanana April 12, 2026 23:20
github-actions bot added a commit that referenced this pull request Apr 12, 2026
tsudhakar87 and others added 2 commits April 12, 2026 19:57
- Rename teammate's POST /reports → POST /reports/generate to coexist
  with our manual-upload POST /reports endpoint
- Fix saveReportRecord to include required title field
- Merge env vars: REPORTS_BUCKET_NAME, AWS creds, Cognito vars
- Keep @aws-sdk/s3-request-presigner, bump client-s3 to ^3.995.0

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@tsudhakar87 tsudhakar87 marked this pull request as draft April 13, 2026 00:05
@tsudhakar87 tsudhakar87 marked this pull request as ready for review April 18, 2026 01:15
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.

Add Upload Report Endpoint

2 participants