Files
Epicnabbo-Catalogus-Updated…/src/app/api/admin/catalog/suggest/route.ts
T
simoleo89andCursor b52e25578d Harden catalog admin: fix translate/quick-add, RCON sync, and confirm UX.
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]>
2026-07-17 21:12:58 +02:00

30 lines
805 B
TypeScript

import { withAdmin } from "@/lib/api-handler";
import { apiOk } from "@/lib/api-response";
import { PERMS } from "@/lib/permissions";
import { batchLookupByClassnames } from "@/lib/services/habbofurni";
export const GET = withAdmin(
{ permission: PERMS.CATALOG_VIEW },
async (request) => {
const raw = request.nextUrl.searchParams.get("classnames") || "";
const classnames = raw
.split(",")
.map((s) => s.trim())
.filter(Boolean)
.slice(0, 100);
const found = await batchLookupByClassnames(classnames);
const suggestions: Record<string, { name: string; description: string }> =
{};
for (const [classname, entry] of found) {
suggestions[classname] = {
name: entry.name ?? "",
description: entry.description ?? "",
};
}
return apiOk({ suggestions });
},
);