Skip to content

Commit 9d85157

Browse files
authored
Auth flow from pr574 (#599)
* feat: apply card sharing backend changes with auth fix * chore: update npm cleanup references * fix: restore oauth callback validation type * fix: restore oauth callback zod validation --------- Signed-off-by: Pushkar Kulkarni <omplayz4456@gmail.com>
1 parent ba56e95 commit 9d85157

11 files changed

Lines changed: 1000 additions & 462 deletions

File tree

.github/pull_request_template.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,10 +43,10 @@ Closes #
4343

4444
## Checklist
4545

46-
- [ ] My code follows the project's coding style (`pnpm -r run lint` passes).
47-
- [ ] TypeScript compiles without errors (`pnpm -r run typecheck`).
46+
- [ ] My code follows the project's coding style (`npm run lint` passes).
47+
- [ ] TypeScript compiles without errors (`npm run typecheck --workspaces --if-present`).
4848
- [ ] I have added or updated tests for the changes I made.
49-
- [ ] All tests pass locally (`pnpm -r run test`).
49+
- [ ] All tests pass locally (`npm run test --workspaces --if-present`).
5050
- [ ] I have updated documentation where necessary.
5151
- [ ] No new `console.log` or debug statements left in the code.
5252
- [ ] Breaking changes are documented in this PR description.

apps/backend/prisma/migrations/20260312125106_init/migration.sql

Lines changed: 0 additions & 99 deletions
This file was deleted.

apps/backend/prisma/migrations/20260312162249_analytics_models/migration.sql

Lines changed: 0 additions & 38 deletions
This file was deleted.

apps/backend/prisma/schema.prisma

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -95,19 +95,40 @@ model PlatformLink {
9595
@@map("platform_links")
9696
}
9797

98+
enum CardVisibility {
99+
PUBLIC // Anyone can view the card
100+
UNLISTED // Anyone with the link can view, but not publicly listed
101+
PRIVATE // Only the card owner can view
102+
}
103+
98104
model Card {
99105
id String @id @default(uuid())
100106
userId String @map("user_id")
107+
101108
title String
109+
description String?
110+
111+
slug String @unique
112+
113+
visibility CardVisibility @default(PUBLIC)
114+
115+
qrEnabled Boolean @default(true)
116+
117+
viewCount Int @default(0)
118+
102119
isDefault Boolean @default(false) @map("is_default")
103120
createdAt DateTime @default(now()) @map("created_at")
104121
updatedAt DateTime @updatedAt @map("updated_at")
105122
106123
user User @relation(fields: [userId], references: [id], onDelete: Cascade)
124+
107125
cardLinks CardLink[]
108126
views CardView[]
127+
109128
110129
@@map("cards")
130+
@@index([userId])
131+
@@index([viewCount])
111132
}
112133

113134
model CardLink {
@@ -145,7 +166,7 @@ model CardView {
145166
cardId String? @map("card_id") // null = default profile view
146167
ownerId String @map("owner_id") // card/profile owner
147168
viewerId String? @map("viewer_id") // null = anonymous web viewer
148-
viewerIp String? @map("viewer_ip")
169+
viewerIp String? @map("viewer_ip") //hashed
149170
viewerAgent String? @map("viewer_agent")
150171
source String @default("qr") // "qr" | "link" | "web" | "app"
151172
createdAt DateTime @default(now()) @map("created_at")
@@ -155,6 +176,8 @@ model CardView {
155176
viewer User? @relation("cardViewer", fields: [viewerId], references: [id], onDelete: SetNull)
156177
157178
@@map("card_views")
179+
@@index([cardId])
180+
@@index([ownerId])
158181
}
159182

160183
model FollowLog {

0 commit comments

Comments
 (0)