Conversation
There was a problem hiding this comment.
Pull request overview
This PR implements a new affiliate collection and API endpoints to support the affiliate code creation flow. The implementation includes schema definition, API routes, controllers, services, validation logic, and configuration for default affiliate program parameters.
Changes:
- Added new
/affiliatesAPI endpoints with full CRUD operations - Implemented affiliate lifecycle hooks with validation for code format, wallet addresses, and program parameters
- Added configuration support for affiliate program defaults via environment variables
Reviewed changes
Copilot reviewed 8 out of 9 changed files in this pull request and generated 7 comments.
Show a summary per file
| File | Description |
|---|---|
| src/gen/types.ts | Generated TypeScript types for affiliate and restricted token list API endpoints |
| src/api/affiliate/services/affiliate.ts | Strapi service factory for affiliate collection |
| src/api/affiliate/routes/affiliate.ts | Strapi router factory for affiliate endpoints |
| src/api/affiliate/documentation/1.0.0/affiliate.json | OpenAPI documentation for affiliate endpoints |
| src/api/affiliate/controllers/affiliate.ts | Strapi controller factory for affiliate operations |
| src/api/affiliate/content-types/affiliate/schema.json | Database schema defining affiliate collection structure |
| src/api/affiliate/content-types/affiliate/lifecycles.ts | Lifecycle hooks with validation logic for affiliate creation and updates |
| config/affiliate.ts | Configuration file for affiliate program default parameters |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
alfetopito
left a comment
There was a problem hiding this comment.
Looks good, just one comment regarding the code length.
Additionally, can you improve the description a bit, with some screenshots and explanation of the feature?
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com>
shoom3301
left a comment
There was a problem hiding this comment.
A couple of code style nitpicks
Summary
Implements
Adds a new collection called
affiliate, when you create codes through the admin UI in Strapi CMS the empty fields are filled with our preset defaults on save. Additionally you can enable or disable a code.Security
we must make sure the collection is not readable without an api key. Reads and writes by the FE will be done via a BFF service.
Testing
nvm use 20yarn devThe reason for this is to make the accounting simpler, for new params new codes must be created.