Harden catalog admin: fix translate/quick-add, RCON sync, and confirm UX.
Local Build and Deploy / deploy (push) Successful in 1m18s

Restore broken Quick Add search, correct Translate saves to items_base and FurnitureData, reparent page deletes, sync RCON on create/toggle/BC mutations, and replace native confirms/prompts with dialogs.

Co-authored-by: Cursor <[email protected]>
This commit is contained in:
SimoandCursor committed 2026-07-17 21:12:58 +02:00
1 parent de9f837da1
commit b52e25578d
20 files changed
+557 -216

No files matched your search

+59
View File
@@ -0,0 +1,59 @@
import { withAdmin } from "@/lib/api-handler";
import { apiOk } from "@/lib/api-response";
import { PERMS } from "@/lib/permissions";
import { prisma } from "@/lib/prisma";
/**
* Search items_base for Quick Add / catalog tooling.
* GET ?q=…&limit=30
*/
export const GET = withAdmin(
{ permission: PERMS.CATALOG_VIEW },
async (request) => {
const q = (request.nextUrl.searchParams.get("q") || "").trim();
const limit = Math.min(
Math.max(
Number.parseInt(request.nextUrl.searchParams.get("limit") || "30", 10) ||
30,
1,
),
50,
);
if (q.length < 2) {
return apiOk({ results: [] });
}
const idExact = Number.parseInt(q, 10);
const rows = await prisma.itemsBase.findMany({
where: {
OR: [
{ itemName: { contains: q } },
{ publicName: { contains: q } },
...(Number.isFinite(idExact) && String(idExact) === q
? [{ id: idExact }]
: []),
],
},
select: {
id: true,
itemName: true,
publicName: true,
type: true,
spriteId: true,
},
take: limit,
orderBy: { id: "asc" },
});
return apiOk({
results: rows.map((r) => ({
id: r.id,
itemName: r.itemName ?? "",
publicName: r.publicName ?? "",
type: r.type ?? "s",
spriteId: r.spriteId ?? 0,
})),
});
},
);