Restore missing catalog admin API routes so Visual Manager works.
Co-authored-by: Cursor <[email protected]>
This commit is contained in:
1 parent
ce8c3503e9
commit
11d3cf31cc
6 files changed
+490
-10
No files matched your search
@@ -0,0 +1,32 @@
|
||||
import { withAdmin } from "@/lib/api-handler";
|
||||
import { apiOk } from "@/lib/api-response";
|
||||
import { PERMS } from "@/lib/permissions";
|
||||
import { lookupHabboIt } from "@/lib/services/habbo-furnidata-cache";
|
||||
|
||||
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 suggestions: Record<string, { name: string; description: string }> =
|
||||
{};
|
||||
|
||||
await Promise.all(
|
||||
classnames.map(async (classname) => {
|
||||
const entry = await lookupHabboIt(classname);
|
||||
if (!entry) return;
|
||||
suggestions[classname] = {
|
||||
name: entry.name ?? "",
|
||||
description: entry.description ?? "",
|
||||
};
|
||||
}),
|
||||
);
|
||||
|
||||
return apiOk({ suggestions });
|
||||
},
|
||||
);
|
||||
Reference in new issue
Block a user