Skip to content

Implement real GET /api/apis listing backed by the Drizzle apis table instead of the empty placeholder #302

@greatest0fallt1me

Description

@greatest0fallt1me

Description

The backend route src/routes/apis.ts currently returns a hard-coded { apis: [] } placeholder regardless of state. This backend task replaces it with a real listing endpoint that reads from the Drizzle apis table (src/db/schema.ts) and joins endpoint pricing so the marketplace can render registered APIs. It matters because the API marketplace cannot surface any catalog data until this endpoint is real.

Requirements and Context

  • Replace the placeholder handler in src/routes/apis.ts with a query against the apis table defined in src/db/schema.ts.
  • Only return APIs with status = 'active' by default; allow ?status= filtering against apiStatusEnum.
  • Use parsePagination/paginatedResponse from src/lib/pagination.ts for limit/offset.
  • Must be secure, tested, and documented
  • Should be efficient and easy to review

Suggested Execution

  1. Fork the repo and create a branch
    git checkout -b feature/apis-listing-endpoint
  2. Implement changes
    • src/routes/apis.ts — wire the route to a repository read
    • src/repositories/apiRepository.ts — add a paginated list query
    • Map DB rows to the public ApisResponse shape in src/types/index.ts
  3. Test and commit
    • npm test -- src/data/apiRegistry.test.ts src/repositories/apiRepository.test.ts
    • Cover edge cases
    • Include test output and notes in the PR

Example commit message

feat: back GET /api/apis with the Drizzle apis table

Acceptance Criteria

  • GET /api/apis returns active APIs from the database with pagination metadata
  • ?status= filtering validates against apiStatusEnum and rejects unknown values with 400
  • Endpoint pricing is included per API where available
  • Unit and route tests pass

Guidelines

  • Minimum 90% test coverage with Jest; validate inputs and handle errors via src/errors
  • Clear documentation and inline comments
  • Timeframe: 96 hours

Metadata

Metadata

Assignees

Labels

Stellar WaveIssues in the Stellar wave programapiAPI endpoint/contract workbackendBackend service workdatabaseDatabase schema/migrations
No fields configured for Feature.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions