refactor(db): finish Drizzle migration for remaining actions and services

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-08-01 13:27:59 +02:00
1 parent 22234fe102
commit 65b2fbee6a
19 files changed
+422 -342

No files matched your search

+16 -7
View File
@@ -1,6 +1,7 @@
import { existsSync } from "node:fs";
import path from "node:path";
import { prisma } from "@/lib/prisma";
import { sql } from "drizzle-orm";
import { db } from "@/lib/db";
import { fetchSourceFurnidata } from "@/lib/services/clone-import";
import { listSources } from "@/lib/services/clone-sources";
import { getFurniAssetDirs } from "@/lib/services/furni-asset-dirs";
@@ -90,14 +91,18 @@ export async function runCatalogAudit(
type: string;
}>;
try {
items = await prisma.$queryRaw<
const [rows] = (await db.execute(sql`
SELECT id, item_name, public_name, type FROM items_base ORDER BY id
`)) as unknown as [
Array<{
id: number;
item_name: string;
public_name: string;
type: string;
}>
>`SELECT id, item_name, public_name, type FROM items_base ORDER BY id`;
}>,
unknown,
];
items = rows;
} catch (err) {
onEvent?.({
type: "error",
@@ -116,9 +121,13 @@ export async function runCatalogAudit(
catalog_name: string;
}>;
try {
catalogItems = await prisma.$queryRaw<
Array<{ id: number; item_ids: string; catalog_name: string }>
>`SELECT id, item_ids, catalog_name FROM catalog_items ORDER BY id`;
const [rows] = (await db.execute(sql`
SELECT id, item_ids, catalog_name FROM catalog_items ORDER BY id
`)) as unknown as [
Array<{ id: number; item_ids: string; catalog_name: string }>,
unknown,
];
catalogItems = rows;
} catch (err) {
onEvent?.({
type: "error",