mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
28 lines
669 B
TypeScript
28 lines
669 B
TypeScript
import { createInsertSchema } from "drizzle-zod";
|
|
import { z } from "zod";
|
|
import { nanoid } from "nanoid";
|
|
import { pgTable, text } from "drizzle-orm/pg-core";
|
|
|
|
export const source = pgTable("project", {
|
|
projectId: text("projectId")
|
|
.notNull()
|
|
.primaryKey()
|
|
.$defaultFn(() => nanoid()),
|
|
name: text("name").notNull(),
|
|
description: text("description"),
|
|
createdAt: text("createdAt")
|
|
.notNull()
|
|
.$defaultFn(() => new Date().toISOString()),
|
|
});
|
|
|
|
const createSchema = createInsertSchema(source, {
|
|
name: z.string().min(1),
|
|
description: z.string(),
|
|
projectId: z.string(),
|
|
});
|
|
|
|
export const apiCreate = createSchema.pick({
|
|
name: true,
|
|
description: true,
|
|
});
|