From 2619733915452db35446ac8bd00d366b4e0a6866 Mon Sep 17 00:00:00 2001 From: Mauricio Siu <47042324+Siumauricio@users.noreply.github.com> Date: Sat, 8 Nov 2025 13:54:32 -0600 Subject: [PATCH] Refactor user schema and update database references: rename 'users_temp' to 'user' across the codebase, update related database queries, and enhance endpoint specifications for swarm settings in various database schemas. --- .../cluster/modify-swarm-settings.tsx | 85 + .../drizzle/0120_premium_radioactive_man.sql | 38 + apps/dokploy/drizzle/meta/0120_snapshot.json | 6716 +++++++++++++++++ apps/dokploy/drizzle/meta/_journal.json | 19 +- apps/dokploy/pages/api/stripe/webhook.ts | 48 +- apps/dokploy/reset-2fa.ts | 6 +- .../server/api/routers/notification.ts | 18 +- packages/server/auth-schema.ts | 6 +- packages/server/src/db/schema/account.ts | 30 +- packages/server/src/db/schema/backups.ts | 8 +- packages/server/src/db/schema/git-provider.ts | 8 +- packages/server/src/db/schema/mariadb.ts | 4 + packages/server/src/db/schema/mongo.ts | 4 + packages/server/src/db/schema/mysql.ts | 4 + packages/server/src/db/schema/postgres.ts | 4 + packages/server/src/db/schema/redis.ts | 5 +- packages/server/src/db/schema/schedule.ts | 8 +- packages/server/src/db/schema/session.ts | 4 +- packages/server/src/db/schema/shared.ts | 28 + packages/server/src/db/schema/user.ts | 8 +- packages/server/src/lib/auth.ts | 2 +- packages/server/src/services/admin.ts | 26 +- packages/server/src/services/user.ts | 12 +- .../server/src/utils/databases/mariadb.ts | 15 +- packages/server/src/utils/databases/mongo.ts | 15 +- packages/server/src/utils/databases/mysql.ts | 15 +- .../server/src/utils/databases/postgres.ts | 15 +- packages/server/src/utils/databases/redis.ts | 15 +- packages/server/src/utils/docker/utils.ts | 36 + 29 files changed, 7033 insertions(+), 169 deletions(-) create mode 100644 apps/dokploy/drizzle/0120_premium_radioactive_man.sql create mode 100644 apps/dokploy/drizzle/meta/0120_snapshot.json diff --git a/apps/dokploy/components/dashboard/application/advanced/cluster/modify-swarm-settings.tsx b/apps/dokploy/components/dashboard/application/advanced/cluster/modify-swarm-settings.tsx index 4227eeb44..739bd87a5 100644 --- a/apps/dokploy/components/dashboard/application/advanced/cluster/modify-swarm-settings.tsx +++ b/apps/dokploy/components/dashboard/application/advanced/cluster/modify-swarm-settings.tsx @@ -122,6 +122,22 @@ const NetworkSwarmSchema = z.array( const LabelsSwarmSchema = z.record(z.string()); +const EndpointPortConfigSwarmSchema = z + .object({ + Protocol: z.string().optional(), + TargetPort: z.number().optional(), + PublishedPort: z.number().optional(), + PublishMode: z.string().optional(), + }) + .strict(); + +const EndpointSpecSwarmSchema = z + .object({ + Mode: z.string().optional(), + Ports: z.array(EndpointPortConfigSwarmSchema).optional(), + }) + .strict(); + const createStringToJSONSchema = (schema: z.ZodTypeAny) => { return z .string() @@ -178,6 +194,9 @@ const addSwarmSettings = z.object({ labelsSwarm: createStringToJSONSchema(LabelsSwarmSchema).nullable(), networkSwarm: createStringToJSONSchema(NetworkSwarmSchema).nullable(), stopGracePeriodSwarm: z.bigint().nullable(), + endpointSpecSwarm: createStringToJSONSchema( + EndpointSpecSwarmSchema, + ).nullable(), }); type AddSwarmSettings = z.infer; @@ -234,6 +253,7 @@ export const AddSwarmSettings = ({ id, type }: Props) => { labelsSwarm: null, networkSwarm: null, stopGracePeriodSwarm: null, + endpointSpecSwarm: null, }, resolver: zodResolver(addSwarmSettings), }); @@ -275,6 +295,9 @@ export const AddSwarmSettings = ({ id, type }: Props) => { ? JSON.stringify(data.networkSwarm, null, 2) : null, stopGracePeriodSwarm: normalizedStopGracePeriod, + endpointSpecSwarm: data.endpointSpecSwarm + ? JSON.stringify(data.endpointSpecSwarm, null, 2) + : null, }); } }, [form, form.reset, data]); @@ -296,6 +319,7 @@ export const AddSwarmSettings = ({ id, type }: Props) => { labelsSwarm: data.labelsSwarm, networkSwarm: data.networkSwarm, stopGracePeriodSwarm: data.stopGracePeriodSwarm ?? null, + endpointSpecSwarm: data.endpointSpecSwarm, }) .then(async () => { toast.success("Swarm settings updated"); @@ -846,6 +870,67 @@ export const AddSwarmSettings = ({ id, type }: Props) => { )} /> + ( + + Endpoint Spec + + + + + Check the interface + + + + + +
+														{`{
+	Mode?: string | undefined;
+	Ports?: Array<{
+		Protocol?: string | undefined;
+		TargetPort?: number | undefined;
+		PublishedPort?: number | undefined;
+		PublishMode?: string | undefined;
+	}> | undefined;
+}`}
+													
+
+
+
+
+ + + + +
+										
+									
+
+ )} + />