diff options
| author | Mohamed Bassem <me@mbassem.com> | 2026-01-01 10:18:13 +0000 |
|---|---|---|
| committer | Mohamed Bassem <me@mbassem.com> | 2026-01-01 10:18:57 +0000 |
| commit | 4077e2863e5f07917ee59534bfc4a1a5197baa64 (patch) | |
| tree | 620ee40ebc0a559beb55a2671a5d17ebb434cbe6 /packages | |
| parent | 401ea6a917144ccf640850574dca66b61e0e4f35 (diff) | |
| download | karakeep-4077e2863e5f07917ee59534bfc4a1a5197baa64.tar.zst | |
fix: fix wrapped feature to only show bookmarks in 2025
Diffstat (limited to 'packages')
| -rw-r--r-- | packages/trpc/models/users.ts | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/packages/trpc/models/users.ts b/packages/trpc/models/users.ts index b1719200..5d3c3785 100644 --- a/packages/trpc/models/users.ts +++ b/packages/trpc/models/users.ts @@ -872,12 +872,22 @@ export class User { } async hasWrapped(): Promise<boolean> { + // Check for bookmarks created in 2025 + const yearStart = new Date("2025-01-01T00:00:00Z"); + const yearEnd = new Date("2025-12-31T23:59:59Z"); + const [{ numBookmarks }] = await this.ctx.db .select({ numBookmarks: count(bookmarks.id), }) .from(bookmarks) - .where(eq(bookmarks.userId, this.user.id)); + .where( + and( + eq(bookmarks.userId, this.user.id), + gte(bookmarks.createdAt, yearStart), + lte(bookmarks.createdAt, yearEnd), + ), + ); return numBookmarks >= 20; } |
