Skip to content

feat(api): implement detailed GET /bounties/:id response#90

Open
automaton365-sys wants to merge 1 commit intodevasignhq:mainfrom
automaton365-sys:fix/21-bounty-detail
Open

feat(api): implement detailed GET /bounties/:id response#90
automaton365-sys wants to merge 1 commit intodevasignhq:mainfrom
automaton365-sys:fix/21-bounty-detail

Conversation

@automaton365-sys
Copy link

Implements issue #21 by enriching bounty detail response.

Added to

  • info: ,
  • info (when assigned): ,
  • keeps and existing bounty fields

Implementation

  • Query bounty by id
  • Fetch creator and assignee users
  • Count applications linked to the bounty
  • Return merged response payload

Tests

  • Added with:
    • success case (enriched payload)
    • 404 case
  • Ran targeted tests:

Fixes #21
/claim #21

@devasign-app
Copy link

devasign-app bot commented Mar 3, 2026

🟠 AI Code Review Results

Status: Changes Needed
Confidence: 95%


🟠 Merge Score: 68/100

🔴 ██████████████░░░░░░ 68%

Recommendation: ❌ This PR needs significant improvements before it should be merged.

The PR successfully enriches the bounty detail response and includes good test coverage. However, it introduces a significant inconsistency in the API response by mixing camelCase and snake_case properties. This should be resolved before merging to ensure a clean and predictable API contract for clients.

💡 Code Suggestions (1)

🔴 High Priority (1)

  1. packages/api/src/routes/bounties.ts (Line 158)
    ✨ The JSON response body mixes camelCase properties (from spreading the bounty object) and snake_case properties (application_count, avatar_url). This creates an inconsistent API contract for clients.

💭 Reasoning: Standardizing the API response to a single case convention (e.g., snake_case, as started with the new fields) improves developer experience for API consumers, reduces ambiguity, and prevents bugs on the client-side. Explicitly mapping fields also prevents accidentally leaking internal data structures or database column names.

Suggested Code:

    return c.json({
        id: bounty.id,
        title: bounty.title,
        status: bounty.status,
        // Add other bounty fields here, converting to snake_case if necessary (e.g., createdAt -> created_at)
        creator: {
            username: creator?.username ?? null,
            avatar_url: creator?.avatarUrl ?? null,
        },
        assignee: assignee
            ? {
                username: assignee.username ?? null,
                avatar_url: assignee.avatarUrl ?? null,
            }
            : null,
        application_count: Number(applicationCountRows[0]?.count ?? 0),
    });
📊 Review Metadata
  • Processing Time: 172s
  • Analysis Date: 3/3/2026, 12:09:41 PM

🤖 This review was generated by AI. While we strive for accuracy, please use your judgment when applying suggestions.

💬 Questions about this review? Open an issue or contact support.

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.

Implement GET /bounties/:id — bounty detail

1 participant