mirror of
https://github.com/Dokploy/dokploy.git
synced 2026-02-25 20:35:10 +00:00
fix: enhance server validation in createNetwork function
- Updated the createNetwork function to ensure serverId is required when in cloud mode, improving error handling for network creation. - Added braces for clarity in the conditional statement, enhancing code readability.
This commit is contained in:
@@ -30,13 +30,15 @@ export const createNetwork = async (
|
||||
input: typeof apiCreateNetwork._type,
|
||||
organizationId: string,
|
||||
) => {
|
||||
if (IS_CLOUD)
|
||||
if (IS_CLOUD) {
|
||||
if (!input.serverId) {
|
||||
throw new TRPCError({
|
||||
code: "BAD_REQUEST",
|
||||
message: "Server is required",
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
const created = await db.transaction(async (tx) => {
|
||||
const [row] = await tx
|
||||
.insert(network)
|
||||
|
||||
Reference in New Issue
Block a user