Skip to content

feat(campaign): add getCampaignClaimers method and related tests for pagination and validation#1462

Open
harryburger wants to merge 1 commit into
developmentfrom
feat/campaign-claimers-endpoint
Open

feat(campaign): add getCampaignClaimers method and related tests for pagination and validation#1462
harryburger wants to merge 1 commit into
developmentfrom
feat/campaign-claimers-endpoint

Conversation

@harryburger

Copy link
Copy Markdown
Contributor

📝 Summary

This pull request adds a new API endpoint to retrieve the list of claimers for a campaign, including detailed claim information, and introduces all supporting model, controller, schema, and test logic. The endpoint supports pagination and returns metadata along with claimer details such as address, claimed amount, and transaction information.

New Campaign Claimers Endpoint

API and Routing:

  • Added a new GET endpoint /campaign/claimers to the CapitalDistributor router, with OpenAPI-style documentation and pagination support. The endpoint returns a paginated list of addresses that claimed a campaign reward, including claim details.

Controller Logic:

  • Implemented getCampaignClaimers in CapitalDistributorController to validate parameters, check campaign existence, and delegate to the model for data retrieval.
  • Added parameter validation schema for the new endpoint in CapitalDistributorSchema.

Model and Types:

  • Added getCampaignClaimers static method to CampaignReward model, which aggregates and paginates claimer data, flattening claim information for each user.
  • Introduced the ICampaignClaimer type to define the returned claimer structure.

Testing

Unit Tests:

  • Added comprehensive unit tests for the model method, controller, and router, covering successful retrieval, pagination, missing parameters, campaign not found, and error handling. [1] [2] [3]
  • Updated router tests to check the new route and ensure correct route stack order. [1] [2]

✅ Checklist

🔍 Code Review

  • Self-reviewed all code changes
  • Ask AI/Copilot code review
  • Removed all debug code, console.logs, and dead code
  • Implemented error handling with try/catch blocks where needed

🧪 Testing

  • All test suites pass locally
  • Added comprehensive unit tests for new features
  • Included integration tests for end-to-end scenarios
  • Successfully tested on remote server

🔒 Security

  • Verified no secrets or credentials are exposed
  • Reviewed for common security vulnerabilities
  • Verified commit authorship - Reviewed all commits to ensure they're from team members (check for compromised accounts)

@harryburger
harryburger requested a review from a team as a code owner July 19, 2026 09:35
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.

1 participant