Skip to content
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

Open
wants to merge 33 commits into
base: main
Choose a base branch
from

Conversation

devkiran
Copy link
Collaborator

@devkiran devkiran commented Mar 14, 2025

TODO: merge dubinc/analytics#40 after this PR merges

Copy link

vercel bot commented Mar 14, 2025

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
dub ✅ Ready (Inspect) Visit Preview Mar 26, 2025 11:18am

@devkiran devkiran changed the title fetch click data Fetch the partner and discount for a given clickId Mar 14, 2025
…oduce new getPartnerAndDiscount utility function and update imports accordingly.
@devkiran devkiran marked this pull request as ready for review March 17, 2025 17:20
Copy link
Contributor

@Copilot Copilot AI left a 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, });

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.

2 participants