mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-20 02:58:53 +00:00
* feat(create-turbo): apply official-starter transform * refactor: move folder * wip: monorepo * feat: add builf * refactor: add pr * update * add .env * refactor: update build * refactor: update build docker * refactor: add progress plain * refactor: remove node pty * refactor: remove * remove * refactor: update * refacotr: uopdate * refactor: add remix app * add env * refactor: add pnpm start * refactor: remove * refactor: remove folders * refactor: remove .dockerfile * chore: update biome * test * choe: add husky * remove .docker folder * feat: add docs website * refactor: add husky * chore(version): bump version * refactor: add new changes * refactor: update circle path * refactor: update * refactor: update * refactor: update dockerfile * refactor: update dockerfile * refactor: update command * refactor: update * refactor: update dockerfile * refactor: add tsx * refactor: update dockerfile * refactor: add deps * refactor: up[date * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: yuodate * refactor: remove * refactor: uncomment * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: updare * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: imprt * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: remove * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: change path * refactor: update * refactor: update * refactor: upoadte * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: add * refactor: update * refactor: update * refactor: add * refactor: update * refactor: remove * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: removed * refactor: update * refactor: update * refactor: update * refactor: add config * refactor: update * refactor: add * refactor: update * refactor: update * refactor: remove * refactor: update * refactor: remove * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: add docs * refactor: update * refactor: add website * refactor: update * refactor: update * refactor: update * refactor: update * refactor: add ignore builds * refactor: update * refactor: update * refactor: add * refactor: update * refactor: update * refactor: remove needs * refactor: update * refactor: update * refactor: add config * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: remove * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: add * refactor: update * refactor: update * refactor: update * refactor: update * refactor: upodate * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update * refactor: update package json * refactor: add biome * refactor: add sponsors * refactor: update * refactor: update * refactor: remove * refactor: update * refactor: update * refactor: update * refactor: update scripts * refactor: remove * refactor: update * refactor: remove --------- Co-authored-by: Turbobot <[email protected]>
99 lines
2.8 KiB
TypeScript
99 lines
2.8 KiB
TypeScript
import { relations, sql } from "drizzle-orm";
|
|
import { boolean, pgEnum, pgTable, text, timestamp } from "drizzle-orm/pg-core";
|
|
import { createInsertSchema } from "drizzle-zod";
|
|
import { nanoid } from "nanoid";
|
|
import { z } from "zod";
|
|
import { admins } from "./admin";
|
|
import { applications } from "./application";
|
|
import { auth } from "./auth";
|
|
/**
|
|
* This is an example of how to use the multi-project schema feature of Drizzle ORM. Use the same
|
|
* database instance for multiple projects.
|
|
*
|
|
* @see https://orm.drizzle.team/docs/goodies#multi-project-schema
|
|
*/
|
|
export const registryType = pgEnum("RegistryType", ["selfHosted", "cloud"]);
|
|
|
|
export const registry = pgTable("registry", {
|
|
registryId: text("registryId")
|
|
.notNull()
|
|
.primaryKey()
|
|
.$defaultFn(() => nanoid()),
|
|
registryName: text("registryName").notNull(),
|
|
imagePrefix: text("imagePrefix"),
|
|
username: text("username").notNull(),
|
|
password: text("password").notNull(),
|
|
registryUrl: text("registryUrl").notNull(),
|
|
createdAt: text("createdAt")
|
|
.notNull()
|
|
.$defaultFn(() => new Date().toISOString()),
|
|
registryType: registryType("selfHosted").notNull().default("cloud"),
|
|
adminId: text("adminId")
|
|
.notNull()
|
|
.references(() => admins.adminId, { onDelete: "cascade" }),
|
|
});
|
|
|
|
export const registryRelations = relations(registry, ({ one, many }) => ({
|
|
admin: one(admins, {
|
|
fields: [registry.adminId],
|
|
references: [admins.adminId],
|
|
}),
|
|
applications: many(applications),
|
|
}));
|
|
|
|
const createSchema = createInsertSchema(registry, {
|
|
registryName: z.string().min(1),
|
|
username: z.string().min(1),
|
|
password: z.string().min(1),
|
|
registryUrl: z.string().min(1),
|
|
adminId: z.string().min(1),
|
|
registryId: z.string().min(1),
|
|
registryType: z.enum(["selfHosted", "cloud"]),
|
|
imagePrefix: z.string().nullable().optional(),
|
|
});
|
|
|
|
export const apiCreateRegistry = createSchema
|
|
.pick({})
|
|
.extend({
|
|
registryName: z.string().min(1),
|
|
username: z.string().min(1),
|
|
password: z.string().min(1),
|
|
registryUrl: z.string(),
|
|
registryType: z.enum(["selfHosted", "cloud"]),
|
|
imagePrefix: z.string().nullable().optional(),
|
|
})
|
|
.required();
|
|
|
|
export const apiTestRegistry = createSchema.pick({}).extend({
|
|
registryName: z.string().min(1),
|
|
username: z.string().min(1),
|
|
password: z.string().min(1),
|
|
registryUrl: z.string(),
|
|
registryType: z.enum(["selfHosted", "cloud"]),
|
|
imagePrefix: z.string().nullable().optional(),
|
|
});
|
|
|
|
export const apiRemoveRegistry = createSchema
|
|
.pick({
|
|
registryId: true,
|
|
})
|
|
.required();
|
|
|
|
export const apiFindOneRegistry = createSchema
|
|
.pick({
|
|
registryId: true,
|
|
})
|
|
.required();
|
|
|
|
export const apiUpdateRegistry = createSchema.partial().extend({
|
|
registryId: z.string().min(1),
|
|
});
|
|
|
|
export const apiEnableSelfHostedRegistry = createSchema
|
|
.pick({
|
|
registryUrl: true,
|
|
username: true,
|
|
password: true,
|
|
})
|
|
.required();
|