refactor(networks): update network form schema and enhance handling logic

- Replaced zodResolver with standardSchemaResolver for improved schema validation.
- Added new toggle options for network settings, enhancing user interface clarity.
- Refactored network creation and update logic to streamline payload handling.
- Updated network form schema to remove default values, ensuring explicit user input.
- Introduced SERVER_LOCAL sentinel for local Dokploy server identification.
This commit is contained in:
Mauricio Siu
2026-07-21 21:46:40 -06:00
parent f4bcc2e8a8
commit 736a77e112
2 changed files with 174 additions and 222 deletions

View File

@@ -6,6 +6,7 @@ import {
} from "@dokploy/server/db/schema";
import { TRPCError } from "@trpc/server";
import { eq } from "drizzle-orm";
import type { z } from "zod";
import { IS_CLOUD } from "../constants";
import { getRemoteDocker } from "../utils/servers/remote-docker";
@@ -27,7 +28,7 @@ export const findNetworkById = async (networkId: string) => {
};
export const createNetwork = async (
input: typeof apiCreateNetwork._type,
input: z.infer<typeof apiCreateNetwork>,
organizationId: string,
) => {
if (IS_CLOUD) {
@@ -86,7 +87,9 @@ export const createNetwork = async (
return created;
};
export const updateNetwork = async (input: typeof apiUpdateNetwork._type) => {
export const updateNetwork = async (
input: z.infer<typeof apiUpdateNetwork>,
) => {
const { networkId, ...rest } = input;
const [updated] = await db
.update(network)