Skip to content

armgit / Cap

Public Imported from GitHub
0

Open source Loom alternative. Beautiful, shareable screen recordings.

perf(api): skip owner DB query when ownerId does not match userId

Richie McIlroy682536728ce9
diff --git a/apps/web/app/api/analytics/track/route.ts b/apps/web/app/api/analytics/track/route.ts
index 4f8b27dfb..708b4095e 100644
--- a/apps/web/app/api/analytics/track/route.ts
+++ b/apps/web/app/api/analytics/track/route.ts
@@ -102,7 +102,7 @@ export async function POST(request: NextRequest) {
return currentUser.id;
},
});
- if (userId) {
+ if (userId && body.ownerId && userId === body.ownerId) {
const ownerIdResult = yield* Effect.tryPromise(() =>
db()
.select({ ownerId: videos.ownerId })