feat: implement GET /bounties/:id endpoint (closes #21)#34
Open
kenchambers wants to merge 1 commit intodevasignhq:mainfrom
Open
feat: implement GET /bounties/:id endpoint (closes #21)#34kenchambers wants to merge 1 commit intodevasignhq:mainfrom
kenchambers wants to merge 1 commit intodevasignhq:mainfrom
Conversation
Scaffolds the packages/api directory with Hono + Drizzle ORM and implements the GET /bounties/:id route with full bounty detail response. What's included ─────────────── packages/api/src/db/schema/ users.ts — users table (issue devasignhq#7) bounties.ts — bounties table with difficulty + status enums (issue devasignhq#8) applications.ts — applications table w/ unique(bounty_id, applicant_id) (issue devasignhq#9) index.ts — barrel re-export packages/api/src/db/index.ts Neon serverless driver + Drizzle connection (issue devasignhq#6) packages/api/src/index.ts Hono app with CORS, logger, error handler, health check (issue devasignhq#2) packages/api/src/routes/bounties.ts GET /bounties/:id handler — resolves issue devasignhq#21 • UUID format validated before touching the database (400 on bad format) • INNER JOIN to users for creator (id, username, avatarUrl) • LEFT JOIN to users for assignee (null when unassigned) • Separate count() query for applicationCount • 404 with structured error when bounty not found packages/api/src/types/bounty.types.ts BountyDetailResponse, BountyDetailApiResponse packages/api/src/lib/errors.ts notFound(), badRequest(), internalError() helpers packages/api/tests/bounties.test.ts 5 Vitest tests — all passing: ✓ 200 open unassigned bounty — full payload ✓ 200 assigned bounty — assignee object populated ✓ 404 bounty not found ✓ 400 invalid UUID — db never called ✓ all required response fields present Run tests: cd packages/api && npm test
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements
GET /bounties/:idas specified in issue #21 — full bounty detail with creator info, application count, assignee info, and current status.This PR also scaffolds the
packages/apipackage (Hono + Drizzle ORM + Neon PostgreSQL) since it is the foundation all API issues depend on.What's included
Database schemas (Drizzle)
packages/api/src/db/schema/users.tspackages/api/src/db/schema/bounties.tspackages/api/src/db/schema/applications.tspackages/api/src/db/index.tsAPI entry point
packages/api/src/index.ts— Hono app with CORS, request logger, error handler, andGET /health(issue #2).Route: GET /bounties/:id
packages/api/src/routes/bounties.tsResponse shape:
{ "data": { "id": "<uuid>", "githubIssueId": 42, "repoOwner": "acme", "repoName": "frontend", "title": "Fix layout bug", "description": "...", "amountUsdc": "500.000000", "techTags": ["React", "CSS"], "difficulty": "intermediate", "status": "open", "deadline": "2026-03-01T00:00:00.000Z", "applicationCount": 3, "creator": { "id": "...", "username": "alice", "avatarUrl": "https://..." }, "assignee": null, "createdAt": "2026-02-01T00:00:00.000Z", "updatedAt": "2026-02-10T00:00:00.000Z" } }Error responses:
400— id is not a valid UUID (db is never queried)404— bounty not foundTests
5 Vitest unit tests — all green:
Run them locally:
Verification steps
cd packages/api && npm test— all 5 passDATABASE_URLinpackages/api/.env(see.env.example)npm run db:generate && npm run db:migratenpm run devand hitGET /bounties/<valid-uuid>