refactor(db): migrate app pages and APIs from Prisma facade to Drizzle (3)
Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
2cd0863cb8
commit
580972c0a0
40 files changed
+1089
-808
No files matched your search
@@ -1,11 +1,12 @@
|
||||
import { eq } from "drizzle-orm";
|
||||
import { Package } from "lucide-react";
|
||||
import Link from "next/link";
|
||||
import { notFound, redirect } from "next/navigation";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import { deleteShopArticle, updateShopArticle } from "@/actions/admin-shop";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { db, WebsiteShopArticles } from "@/lib/db";
|
||||
import { canAccess, getAdminContext, PERMS } from "@/lib/permissions";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
|
||||
export default async function EditShopArticle({
|
||||
params,
|
||||
@@ -20,12 +21,14 @@ export default async function EditShopArticle({
|
||||
const t = await getTranslations("pages.admin.shop");
|
||||
|
||||
const { id } = await params;
|
||||
let pkg: Awaited<ReturnType<typeof prisma.websiteShopArticles.findUnique>> =
|
||||
null;
|
||||
let pkg: typeof WebsiteShopArticles.$inferSelect | null = null;
|
||||
try {
|
||||
pkg = await prisma.websiteShopArticles.findUnique({
|
||||
where: { id: BigInt(id) },
|
||||
});
|
||||
const [row] = await db
|
||||
.select()
|
||||
.from(WebsiteShopArticles)
|
||||
.where(eq(WebsiteShopArticles.id, BigInt(id)))
|
||||
.limit(1);
|
||||
pkg = row ?? null;
|
||||
} catch {
|
||||
notFound();
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user