Replace PostgreSQL and Docker deployment with embedded Turso, Drizzle relational queries v2, native systemd deployment on port 43821, and fresh SQLite migrations.
Hop-State: A_06FP5KEDBTB4A9ZT7QB498G Hop-Proposal: R_06FP5KDWMCKVVMQZT4MVZ28 Hop-Task: T_06FP5DZ7T0G45FG93PT90B8 Hop-Attempt: AT_06FP5DZ7T0PKQW99V27JCV8
This commit is contained in:
@@ -45,14 +45,12 @@ export async function GET(request: Request) {
|
||||
const limit = Math.min(parseInt(searchParams.get('limit') || '30'), 50);
|
||||
const unreadOnly = searchParams.get('unread') === 'true';
|
||||
|
||||
const conditions = [eq(notifications.userId, user.id)];
|
||||
if (unreadOnly) {
|
||||
conditions.push(isNull(notifications.readAt));
|
||||
}
|
||||
|
||||
const rows = await db.query.notifications.findMany({
|
||||
where: and(...conditions),
|
||||
orderBy: [desc(notifications.createdAt)],
|
||||
where: {
|
||||
userId: user.id,
|
||||
...(unreadOnly ? { readAt: { isNull: true as const } } : {}),
|
||||
},
|
||||
orderBy: () => [desc(notifications.createdAt)],
|
||||
limit,
|
||||
});
|
||||
|
||||
|
||||
Reference in New Issue
Block a user