- 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
32 lines
875 B
TypeScript
32 lines
875 B
TypeScript
import { apiOk } from "@/lib/api";
|
|
import { withAdmin } from "@/lib/api-handler";
|
|
import { PERMS } from "@/lib/permissions";
|
|
import {
|
|
getClothingSetList,
|
|
getClothingSetStats,
|
|
} from "@/lib/services/clothing-set-import";
|
|
|
|
export const GET = withAdmin(
|
|
{ permission: PERMS.ASSETS_IMPORT },
|
|
async (request) => {
|
|
if (request.nextUrl.searchParams.get("action") === "stats") {
|
|
return apiOk(
|
|
(await getClothingSetStats()) as unknown as Record<string, unknown>,
|
|
);
|
|
}
|
|
const search = request.nextUrl.searchParams.get("search") || "";
|
|
const page = Number.parseInt(
|
|
request.nextUrl.searchParams.get("page") || "1",
|
|
10,
|
|
);
|
|
const setType = request.nextUrl.searchParams.get("setType") || undefined;
|
|
const { items, meta } = await getClothingSetList({
|
|
search,
|
|
page: page || 1,
|
|
perPage: 100,
|
|
setType,
|
|
});
|
|
return apiOk({ items, meta });
|
|
},
|
|
);
|