feat: add preview image builder

This commit is contained in:
BennyKok
2024-01-04 22:29:22 +08:00
parent 314eb9fd16
commit 9937252777
18 changed files with 1085 additions and 56 deletions
+13 -1
View File
@@ -1,4 +1,5 @@
import { insertMachineSchema } from "@/db/schema";
import { insertMachineSchema, machinesTable } from "@/db/schema";
import { createInsertSchema } from "drizzle-zod";
export const addMachineSchema = insertMachineSchema.pick({
name: true,
@@ -6,3 +7,14 @@ export const addMachineSchema = insertMachineSchema.pick({
type: true,
auth_token: true,
});
export const insertCustomMachineSchema = createInsertSchema(machinesTable, {
name: (schema) => schema.name.default("My Machine"),
type: (schema) => schema.type.default("modal-serverless"),
});
export const addCustomMachineSchema = insertCustomMachineSchema.pick({
name: true,
type: true,
snapshot: true,
});