style: format code biome
Local Build and Deploy / deploy (push) Failing after 46s

This commit is contained in:
openhands committed 2026-07-13 21:57:41 +02:00
1 parent 8efd032cc6
commit df38dccbf1
735 files changed
+128321 -120870

No files matched your search

+16 -16
View File
@@ -6,21 +6,21 @@ import { prisma } from "@/lib/prisma";
export const dynamic = "force-dynamic";
export async function GET(_req: Request) {
try {
const data = await prisma.websiteShopCategories.findMany({
orderBy: [{ order: "asc" }, { name: "asc" }],
select: {
id: true,
name: true,
description: true,
icon: true,
order: true,
},
});
try {
const data = await prisma.websiteShopCategories.findMany({
orderBy: [{ order: "asc" }, { name: "asc" }],
select: {
id: true,
name: true,
description: true,
icon: true,
order: true,
},
});
return apiJson({ data });
} catch {
// DB unreachable — never 500; return empty data.
return apiJson({ data: [] }, { status: 200 });
}
return apiJson({ data });
} catch {
// DB unreachable — never 500; return empty data.
return apiJson({ data: [] }, { status: 200 });
}
}
+53 -45
View File
@@ -7,52 +7,60 @@ import { prisma } from "@/lib/prisma";
export const dynamic = "force-dynamic";
export async function GET(req: Request) {
const sp = new URL(req.url).searchParams;
const { page, perPage, skip, take } = pagination(sp);
const sp = new URL(req.url).searchParams;
const { page, perPage, skip, take } = pagination(sp);
// Optional ?category=<id> filter (website_shop_category_id is a BigInt).
const categoryRaw = sp.get("category");
let where: { categoryId?: bigint } = {};
if (categoryRaw !== null) {
const categoryId = positiveBigInt(categoryRaw);
if (!categoryId) return apiError("A valid category id is required", 422);
where = { categoryId };
}
// Optional ?category=<id> filter (website_shop_category_id is a BigInt).
const categoryRaw = sp.get("category");
let where: { categoryId?: bigint } = {};
if (categoryRaw !== null) {
const categoryId = positiveBigInt(categoryRaw);
if (!categoryId) return apiError("A valid category id is required", 422);
where = { categoryId };
}
try {
const [total, data] = await Promise.all([
prisma.websiteShopArticles.count({ where }),
prisma.websiteShopArticles.findMany({
where,
orderBy: [{ position: "asc" }, { name: "asc" }],
skip,
take,
select: {
id: true,
categoryId: true,
name: true,
info: true,
iconUrl: true,
color: true,
costs: true,
giveRank: true,
isGiftable: true,
credits: true,
duckets: true,
diamonds: true,
badges: true,
furniture: true,
position: true,
},
}),
]);
try {
const [total, data] = await Promise.all([
prisma.websiteShopArticles.count({ where }),
prisma.websiteShopArticles.findMany({
where,
orderBy: [{ position: "asc" }, { name: "asc" }],
skip,
take,
select: {
id: true,
categoryId: true,
name: true,
info: true,
iconUrl: true,
color: true,
costs: true,
giveRank: true,
isGiftable: true,
credits: true,
duckets: true,
diamonds: true,
badges: true,
furniture: true,
position: true,
},
}),
]);
return apiJson({
data,
meta: { page, perPage, total, lastPage: Math.max(1, Math.ceil(total / perPage)) },
});
} catch {
// DB unreachable — never 500; return an empty, well-formed payload.
return apiJson({ data: [], meta: { page, perPage, total: 0, lastPage: 1 } }, { status: 200 });
}
return apiJson({
data,
meta: {
page,
perPage,
total,
lastPage: Math.max(1, Math.ceil(total / perPage)),
},
});
} catch {
// DB unreachable — never 500; return an empty, well-formed payload.
return apiJson(
{ data: [], meta: { page, perPage, total: 0, lastPage: 1 } },
{ status: 200 },
);
}
}