mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-07-22 14:25:24 +02:00
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:
@@ -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)
|
||||
|
||||
Reference in New Issue
Block a user