refactor(db): migrate app pages and APIs from Prisma facade to Drizzle (5)

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-08-01 14:15:39 +02:00
1 parent 9aa4f331bf
commit 30b54e99e7
40 files changed
+1183 -784

No files matched your search

+9 -4
View File
@@ -1,9 +1,10 @@
import { count, eq } from "drizzle-orm";
import Image from "next/image";
import Link from "next/link";
import { getTranslations } from "next-intl/server";
import { cached } from "@/lib/cache";
import { db, User } from "@/lib/db";
import { resolveHotelName } from "@/lib/hotel-name";
import { prisma } from "@/lib/prisma";
import { siteSettings } from "@/lib/services/site-settings";
export async function SiteHeader() {
@@ -16,9 +17,13 @@ export async function SiteHeader() {
let online: number;
try {
online = await cached("online_count", 10_000, () =>
prisma.user.count({ where: { online: "1" } }),
);
online = await cached("online_count", 10_000, async () => {
const [row] = await db
.select({ total: count() })
.from(User)
.where(eq(User.online, "1"));
return row?.total ?? 0;
});
} catch {
online = 0;
}