workflow data save

This commit is contained in:
yoan
2024-11-12 13:16:23 +08:00
53 changed files with 2053 additions and 796 deletions

View File

@@ -0,0 +1,16 @@
import { Workflow, WorkflowNode } from "@/domain/workflow";
import { getPb } from "./api";
export const get = async (id: string) => {
const response = await getPb().collection("workflow").getOne<Workflow>(id);
return response;
};
export const save = async (data: Record<string, string | boolean | WorkflowNode>) => {
if (data.id) {
return await getPb()
.collection("workflow")
.update<Workflow>(data.id as string, data);
}
return await getPb().collection("workflow").create<Workflow>(data);
};