mirror of
https://github.com/Dokploy/dokploy
synced 2025-06-26 18:27:59 +00:00
refactor: rename builders to server
This commit is contained in:
43
packages/server/src/db/schema/certificate.ts
Normal file
43
packages/server/src/db/schema/certificate.ts
Normal file
@@ -0,0 +1,43 @@
|
||||
import { boolean, pgTable, text } from "drizzle-orm/pg-core";
|
||||
import { createInsertSchema } from "drizzle-zod";
|
||||
import { nanoid } from "nanoid";
|
||||
import { z } from "zod";
|
||||
import { generateAppName } from "./utils";
|
||||
|
||||
export const certificates = pgTable("certificate", {
|
||||
certificateId: text("certificateId")
|
||||
.notNull()
|
||||
.primaryKey()
|
||||
.$defaultFn(() => nanoid()),
|
||||
name: text("name").notNull(),
|
||||
certificateData: text("certificateData").notNull(),
|
||||
privateKey: text("privateKey").notNull(),
|
||||
certificatePath: text("certificatePath")
|
||||
.notNull()
|
||||
.$defaultFn(() => generateAppName("certificate"))
|
||||
.unique(),
|
||||
autoRenew: boolean("autoRenew"),
|
||||
});
|
||||
|
||||
export const apiCreateCertificate = createInsertSchema(certificates, {
|
||||
name: z.string().min(1),
|
||||
certificateData: z.string().min(1),
|
||||
privateKey: z.string().min(1),
|
||||
autoRenew: z.boolean().optional(),
|
||||
});
|
||||
|
||||
export const apiFindCertificate = z.object({
|
||||
certificateId: z.string().min(1),
|
||||
});
|
||||
|
||||
export const apiUpdateCertificate = z.object({
|
||||
certificateId: z.string().min(1),
|
||||
name: z.string().min(1).optional(),
|
||||
certificateData: z.string().min(1).optional(),
|
||||
privateKey: z.string().min(1).optional(),
|
||||
autoRenew: z.boolean().optional(),
|
||||
});
|
||||
|
||||
export const apiDeleteCertificate = z.object({
|
||||
certificateId: z.string().min(1),
|
||||
});
|
||||
Reference in New Issue
Block a user