Reapply "Add missing admin action files and navigation links"

This reverts commit 4d515bc400.
This commit is contained in:
Simo committed 2026-07-11 20:52:56 +02:00
1 parent 96ed768f14
commit 5b4228261a
338 files changed
+28143 -5948

No files matched your search

+32 -10
View File
@@ -30,7 +30,9 @@ function reqUInt(formData: FormData, key: string): number {
export async function createShopArticle(formData: FormData): Promise<void> {
const staff = await requireStaff();
const name = String(formData.get("name") ?? "").trim().slice(0, 255);
const name = String(formData.get("name") ?? "")
.trim()
.slice(0, 255);
if (!name) return;
const now = new Date();
@@ -38,15 +40,24 @@ export async function createShopArticle(formData: FormData): Promise<void> {
const created = await prisma.websiteShopArticles.create({
data: {
name,
info: String(formData.get("info") ?? "").trim().slice(0, 255),
iconUrl: String(formData.get("icon") ?? "").trim().slice(0, 255),
color: String(formData.get("color") ?? "").trim().slice(0, 255),
info: String(formData.get("info") ?? "")
.trim()
.slice(0, 255),
iconUrl: String(formData.get("icon") ?? "")
.trim()
.slice(0, 255),
color: String(formData.get("color") ?? "")
.trim()
.slice(0, 255),
costs: reqUInt(formData, "costs"),
giveRank: optUInt(formData, "giveRank"),
credits: optUInt(formData, "credits"),
duckets: optUInt(formData, "duckets"),
diamonds: optUInt(formData, "diamonds"),
badges: (String(formData.get("badges") ?? "").trim().slice(0, 255)) || null,
badges:
String(formData.get("badges") ?? "")
.trim()
.slice(0, 255) || null,
position: reqUInt(formData, "position"),
createdAt: now,
updatedAt: now,
@@ -74,7 +85,9 @@ export async function updateShopArticle(formData: FormData): Promise<void> {
const id = formPositiveBigInt(formData, "id");
if (!id) return;
const name = String(formData.get("name") ?? "").trim().slice(0, 255);
const name = String(formData.get("name") ?? "")
.trim()
.slice(0, 255);
if (!name) return;
try {
@@ -82,15 +95,24 @@ export async function updateShopArticle(formData: FormData): Promise<void> {
where: { id },
data: {
name,
info: String(formData.get("info") ?? "").trim().slice(0, 255),
iconUrl: String(formData.get("icon") ?? "").trim().slice(0, 255),
color: String(formData.get("color") ?? "").trim().slice(0, 255),
info: String(formData.get("info") ?? "")
.trim()
.slice(0, 255),
iconUrl: String(formData.get("icon") ?? "")
.trim()
.slice(0, 255),
color: String(formData.get("color") ?? "")
.trim()
.slice(0, 255),
costs: reqUInt(formData, "costs"),
giveRank: optUInt(formData, "giveRank"),
credits: optUInt(formData, "credits"),
duckets: optUInt(formData, "duckets"),
diamonds: optUInt(formData, "diamonds"),
badges: (String(formData.get("badges") ?? "").trim().slice(0, 255)) || null,
badges:
String(formData.get("badges") ?? "")
.trim()
.slice(0, 255) || null,
position: reqUInt(formData, "position"),
updatedAt: new Date(),
},