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,3 +1,4 @@
|
||||
import { asc } from "drizzle-orm";
|
||||
import { getTranslations } from "next-intl/server";
|
||||
import {
|
||||
createRadioRank,
|
||||
@@ -6,7 +7,7 @@ import {
|
||||
} from "@/actions/admin-radio-extra";
|
||||
import { StatusCard } from "@/components/admin/dashboard";
|
||||
import { Button } from "@/components/ui/button";
|
||||
import { prisma } from "@/lib/prisma";
|
||||
import { db, RadioRanks } from "@/lib/db";
|
||||
|
||||
type Rank = {
|
||||
id: bigint;
|
||||
@@ -23,16 +24,16 @@ export default async function AdminRadioRanksPage() {
|
||||
let dbError = false;
|
||||
|
||||
try {
|
||||
ranks = await prisma.radioRanks.findMany({
|
||||
select: {
|
||||
id: true,
|
||||
name: true,
|
||||
description: true,
|
||||
badgeCode: true,
|
||||
isActive: true,
|
||||
},
|
||||
orderBy: { id: "asc" },
|
||||
});
|
||||
ranks = await db
|
||||
.select({
|
||||
id: RadioRanks.id,
|
||||
name: RadioRanks.name,
|
||||
description: RadioRanks.description,
|
||||
badgeCode: RadioRanks.badgeCode,
|
||||
isActive: RadioRanks.isActive,
|
||||
})
|
||||
.from(RadioRanks)
|
||||
.orderBy(asc(RadioRanks.id));
|
||||
} catch {
|
||||
dbError = true;
|
||||
ranks = [];
|
||||
|
||||
Reference in new issue
Block a user