24 lines
773 B
TypeScript
24 lines
773 B
TypeScript
"use server";
|
|
|
|
import { revalidatePath } from "next/cache";
|
|
import {
|
|
contentMutationService,
|
|
createContentMutationInvocation,
|
|
} from "@/features/housekeeping/domains/content/services/mutations";
|
|
import { createCorrelationId } from "@/features/housekeeping/foundation/contracts";
|
|
import { requirePermission } from "@/lib/admin/guard";
|
|
import { PERMS } from "@/lib/permissions";
|
|
|
|
export async function deletePhoto(formData: FormData): Promise<void> {
|
|
const staff = await requirePermission(PERMS.PAGES_EDIT);
|
|
const id = Number(formData.get("id"));
|
|
if (!(id > 0)) return;
|
|
await contentMutationService.execute(
|
|
createContentMutationInvocation(staff, createCorrelationId()),
|
|
"photo.delete",
|
|
{ id },
|
|
);
|
|
revalidatePath("/admin/photos");
|
|
revalidatePath("/photos");
|
|
}
|