Feature/analytics intelligence engine#133
Conversation
- Remove EngagementEvent model, enum, and migration; reuse CardView - Rewrite trackEvent() to create cardView rows with hashed viewerIp - Revert docker-compose Postgres port to 5432:5432 - Remove package-lock.json (project uses pnpm) - Resolve schema conflict with upstream Event/EventAttendee models Co-authored-by: Cursor <cursoragent@cursor.com>
|
@Harxhit , there are schema changes here, could you please review this? |
There was a problem hiding this comment.
Please revert this as we do not need it.
| userId String @map("user_id") | ||
| viewerId String? @map("viewer_id") | ||
|
|
||
| cardId String? @map("card_id") |
| id String @id @default(uuid()) | ||
|
|
||
| userId String @map("user_id") | ||
| viewerId String? @map("viewer_id") |
| cardId String? @map("card_id") // null = default profile view | ||
| ownerId String @map("owner_id") // card/profile owner | ||
| viewerId String? @map("viewer_id") // null = anonymous web viewer | ||
| viewerIp String? @map("viewer_ip") |
There was a problem hiding this comment.
Need to hash the IP here.
| @@ -30,18 +30,20 @@ model User { | |||
| viewedCards CardView[] @relation("cardViewer") | |||
| followLogs FollowLog[] | |||
There was a problem hiding this comment.
FollowLog model creation is missing.
| LINK_CLICK | ||
| FOLLOW_ATTEMPT | ||
| FOLLOW_SUCCESS | ||
| QR_SCAN |
|
|
||
| eventType: 'PROFILE_VIEW', | ||
|
|
||
| source: (request.query as any)?.source || 'link', |
There was a problem hiding this comment.
Could we not use any here breaks the type safety.
There was a problem hiding this comment.
Revert changes in this file.
There was a problem hiding this comment.
CardView and EngagementEvent are doing the same job
|
@Ritesh2332 Please add the issues this PR closes so I can get better context and understand whether it also includes the API layer. Also fix the merge conflicts. |
|
Addressed the requested review feedback:
Ready for re-review. |
|
@Ritesh2332 Please fix merge conflicts. |
Resolve conflicts in schema, auth, and public routes while keeping analytics trackEvent and upstream team/OAuth improvements. Co-authored-by: Cursor <cursoragent@cursor.com>
| - devcard-pgdata:/var/lib/postgresql/data | ||
| healthcheck: | ||
| test: ['CMD-SHELL', 'pg_isready -U devcard'] | ||
| test: [ 'CMD-SHELL', 'pg_isready -U devcard' ] |
There was a problem hiding this comment.
Nothing changed here, so please remove the blank space changes.
|
@Ritesh2332 is attempting to deploy a commit to the Prashantkumar Khatri's projects Team on Vercel. A member of the Team first needs to authorize it. |
CI — Checks FailedBackend — FAIL
Mobile — SKIP
Web — SKIP
Last updated: |
Resolve auth, public routes, and schema conflicts; keep trackEvent analytics with upstream service layer. Co-authored-by: Cursor <cursoragent@cursor.com>
Summary
This PR improves analytics tracking for public profile and card views by enhancing the existing
CardViewsystem instead of introducing a separate analytics schema.The implementation adds reusable tracking utilities, privacy-safe IP hashing, and cleaner route-level tracking while keeping the backend architecture lightweight and easier to maintain.
It also improves type safety in public analytics routes and lays the groundwork for future analytics and engagement insights.
Closes #28
What Changed
CardViewinfrastructure for analytics trackingmainHow to Test
CardViewentries are created in PostgreSQL.