27 lines
988 B
TypeScript
27 lines
988 B
TypeScript
"use server";
|
|
|
|
import { revalidatePath } from "next/cache";
|
|
import {
|
|
createPeopleMutationInvocation,
|
|
peopleMutationService,
|
|
} from "@/features/housekeeping/domains/people/services/mutations";
|
|
import { createCorrelationId } from "@/features/housekeeping/foundation/contracts";
|
|
import { requirePermission } from "@/lib/admin/guard";
|
|
import { formPositiveBigInt } from "@/lib/form-data";
|
|
import { PERMS } from "@/lib/permissions";
|
|
|
|
export async function dismissApplication(formData: FormData): Promise<void> {
|
|
const staff = await requirePermission(PERMS.USERS_EDIT);
|
|
const rawId = formPositiveBigInt(formData, "id");
|
|
if (!rawId) return;
|
|
const applicationId = rawId.toString();
|
|
|
|
await peopleMutationService.execute(
|
|
createPeopleMutationInvocation(staff, createCorrelationId()),
|
|
"application.decide",
|
|
{ applicationId, decision: "dismiss" },
|
|
);
|
|
// Preserve the tolerant legacy action: already-gone/DB failure still refreshes.
|
|
revalidatePath("/ase/people/staff/applications");
|
|
}
|