-
Notifications
You must be signed in to change notification settings - Fork 2.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fetch the partner and discount for a given clickId #2163
base: main
Are you sure you want to change the base?
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
…oduce new getPartnerAndDiscount utility function and update imports accordingly.
…iscount data retrieval
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull Request Overview
This PR adds new endpoints and updates existing ones to fetch and sync partner and discount information in various parts of the application, ensuring that the corresponding partner and discount data is included where needed. Key changes include:
- Introducing a new cron API endpoint to sync link discount changes.
- Updating multiple APIs (click tracking, link transfer, link creation, etc.) to include partner and discount data using getPartnerAndDiscount.
- Minor adjustments in IP address handling and workspace data fetching (e.g., including additional fields).
Reviewed Changes
Copilot reviewed 30 out of 30 changed files in this pull request and generated no comments.
Show a summary per file
File | Description |
---|---|
apps/web/app/api/cron/links/sync-discounts/route.ts | Adds cron job endpoint for syncing discounts with partner and link data. |
apps/web/app/api/clicks/[clickId]/route.ts | Implements fetching click events with partner and discount info. |
apps/web/lib/ip-address.ts | Centralizes IP address retrieval based on environment. |
apps/web/lib/api/partners/get-partner-discount.ts | Provides function to retrieve partner and discount data from a link. |
Multiple API and action files | Update calls to getPartnerAndDiscount and link caching to include partner/discount details. |
Other files (middleware, actions, utilities) | Minor changes for consistency in handling partner and discount data. |
Comments suppressed due to low confidence (2)
apps/web/app/api/track/click/route.ts:73
- The getPartnerAndDiscount function is being called with an object containing partnerId and programId, which might differ from the expected signature. Please verify that the correct version is imported and used consistently.
const response = await getPartnerAndDiscount({ partnerId: linkData.partnerId, programId: linkData.programId, });
apps/web/lib/middleware/link.ts:116
- The invocation of getPartnerAndDiscount with an object parameter here may be inconsistent with its signature elsewhere. Ensure that the function’s expected parameters are standardized across the codebase.
const response = await getPartnerAndDiscount({ partnerId: linkData.partnerId, programId: linkData.programId, });
TODO: merge dubinc/analytics#40 after this PR merges