Skip to content

fix(bounties,sponsors): add discovery filters on GET /bounties, protect sponsors routes with JwtAuthGuard, and add test coverage (#144, #137, #141, #136) - #187

Open
ghzhost wants to merge 1 commit into
MergeFi:mainfrom
ghzhost:fix/issue-144-137-141-bounty-filters-sponsors-auth
Open

fix(bounties,sponsors): add discovery filters on GET /bounties, protect sponsors routes with JwtAuthGuard, and add test coverage (#144, #137, #141, #136)#187
ghzhost wants to merge 1 commit into
MergeFi:mainfrom
ghzhost:fix/issue-144-137-141-bounty-filters-sponsors-auth

Conversation

@ghzhost

@ghzhost ghzhost commented Aug 24, 2026

Copy link
Copy Markdown

Summary

Addresses multiple issues across bounties discovery, sponsors authentication, test coverage, and e2e test titles:

  1. Bounties Filtering (BountiesController.list only supports filtering by status, despite the API tracking difficulty, asset, and repository/language data #144):

    • Added ListBountiesQueryDto with status, difficulty, asset, language, and repositoryId query filters.
    • Updated BountiesController.list and BountiesService.list to accept query filters and build dynamic queries joining issue and repository when language or repositoryId is supplied.
    • Preserves backward compatibility when filtering by status alone.
  2. Sponsors Auth Guard (SponsorsController has zero authentication guards, exposing a sponsor's full financial dashboard to any unauthenticated caller #137):

    • Added @UseGuards(JwtAuthGuard) and @ApiBearerAuth() to GET /sponsors/:id/dashboard and GET /sponsors/:id/milestones/progress to prevent unauthorized access to financial dashboards.
  3. Sponsors Service Spec Tests (sponsors.service.spec.ts has no test for activeBounties(), activeMilestones(), or milestoneProgress() #141):

    • Added direct unit test coverage for activeBounties (verifying exclusion of terminal statuses paid, refunded, expired).
    • Added direct unit test coverage for activeMilestones (verifying FUNDED and IN_PROGRESS query matching).
    • Added unit test coverage for milestoneProgress (verifying progress calculation and division-by-zero protection).
  4. Users E2E Test Suite (users.e2e-spec.ts's two "should reject unauthenticated requests with 401" tests both actually assert .expect(403) #136):

    • Corrected test titles to accurately reflect that requests are rejected with 403 when the mock guard denies access.

Validation

  • npm run build completed with zero TypeScript errors.
  • npm test -- src/sponsors/ src/bounties/ passed all 26 unit tests.
  • npm run test:e2e passed test/users.e2e-spec.ts.

Closes #144, Closes #137, Closes #141, Closes #136.

@vercel

vercel Bot commented Aug 24, 2026

Copy link
Copy Markdown

Someone is attempting to deploy a commit to the chonilius' projects Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment