21 lines
785 B
TypeScript
21 lines
785 B
TypeScript
"use server";
|
|
|
|
import { z } from "zod";
|
|
import { PERMS } from "@/lib/permissions";
|
|
import { adminAction } from "@/lib/safe-action";
|
|
import { actionOk } from "@/lib/safe-action-shared";
|
|
import { cleanupConvertedSwfs, deleteImportedItem } from "@/lib/services/furni-import";
|
|
|
|
export const cleanSwfFiles = adminAction({ permission: PERMS.ASSETS_IMPORT }, async () => {
|
|
const result = await cleanupConvertedSwfs();
|
|
return actionOk(result as unknown as Record<string, unknown>);
|
|
});
|
|
|
|
const deleteSchema = z.object({ classname: z.string().trim().min(1) });
|
|
|
|
export const deleteImportedFurni = adminAction(
|
|
{ permission: PERMS.ASSETS_IMPORT, schema: deleteSchema },
|
|
async (ctx) =>
|
|
actionOk((await deleteImportedItem(ctx.data.classname)) as unknown as Record<string, unknown>),
|
|
);
|