feat(housekeeping): cut over administration to ase

This commit is contained in:
Simo committed 2026-08-30 20:35:22 +02:00
1 parent c9e35cf602
commit 2b8f73a91d
457 files changed
+589 -55936

No files matched your search

-63
View File
@@ -1,63 +0,0 @@
"use server";
import { revalidatePath } from "next/cache";
import { redirect } from "next/navigation";
import { executeLegacyEconomyMutation } from "@/features/housekeeping/domains/economy/services/mutations";
import { requirePermission } from "@/lib/admin/guard";
import { PERMS } from "@/lib/permissions";
import { logServerError } from "@/lib/server-log";
function formInput(formData: FormData): Record<string, FormDataEntryValue> {
return Object.fromEntries(formData.entries());
}
export async function createShopArticle(formData: FormData): Promise<void> {
const staff = await requirePermission(PERMS.SHOP_EDIT);
try {
await executeLegacyEconomyMutation(staff, "shop-article.change", {
action: "create",
...formInput(formData),
});
} catch (error) {
logServerError("admin.shop_create_failed", error, { staffId: staff.id });
return;
}
redirect("/admin/shop");
}
export async function updateShopArticle(formData: FormData): Promise<void> {
const staff = await requirePermission(PERMS.SHOP_EDIT);
const input = formInput(formData);
try {
await executeLegacyEconomyMutation(staff, "shop-article.change", {
action: "update",
...input,
});
} catch (error) {
logServerError("admin.shop_update_failed", error, {
staffId: staff.id,
articleId: String(input.id ?? ""),
});
return;
}
revalidatePath(`/admin/shop/${String(input.id ?? "")}`);
redirect("/admin/shop");
}
export async function deleteShopArticle(formData: FormData): Promise<void> {
const staff = await requirePermission(PERMS.SHOP_EDIT);
const input = formInput(formData);
try {
await executeLegacyEconomyMutation(staff, "shop-article.change", {
action: "delete",
...input,
});
} catch (error) {
logServerError("admin.shop_delete_failed", error, {
staffId: staff.id,
articleId: String(input.id ?? ""),
});
return;
}
redirect("/admin/shop");
}