- fix(studio): stop markBatchDone infinite recursion so batches complete - refactor(api): merge api-response into api and drop the duplicate module - refactor(media): extract shared media loader and URL validator - refactor(ui): extract shared LoadingSpinner for site and admin groups - refactor(dates): consolidate raw date formatting into formatDate util - refactor(logs): share a single generic log-list loader across tables - refactor(theme): merge both ColorField components and reuse contrast helpers - refactor(import): extract shared ImportErrorBanner and SearchInput - chore(): remove dead theme-editor-tabs after inlining tab components
36 lines
1010 B
TypeScript
36 lines
1010 B
TypeScript
import { apiOk } from "@/lib/api";
|
|
import { withAdmin } from "@/lib/api-handler";
|
|
import { PERMS } from "@/lib/permissions";
|
|
import { getHabboGamedataHotel } from "@/lib/services/habbo-gamedata-hotel";
|
|
import { batchLookupByClassnames } from "@/lib/services/habbofurni";
|
|
|
|
export const GET = withAdmin(
|
|
{ permission: PERMS.CATALOG_VIEW },
|
|
async (request) => {
|
|
const hotel = await getHabboGamedataHotel();
|
|
const raw = request.nextUrl.searchParams.get("classnames") || "";
|
|
const classnames = raw
|
|
.split(",")
|
|
.map((s) => s.trim())
|
|
.filter(Boolean)
|
|
.slice(0, 100);
|
|
|
|
if (classnames.length === 0) {
|
|
return apiOk({ hotel, suggestions: {} });
|
|
}
|
|
|
|
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({ hotel, suggestions });
|
|
},
|
|
);
|