mirror of
https://github.com/andwati/dokploy.git
synced 2026-11-23 04:18:45 +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,
|
input: typeof apiCreateNetwork._type,
|
||||||
organizationId: string,
|
organizationId: string,
|
||||||
) => {
|
) => {
|
||||||
if (IS_CLOUD)
|
if (IS_CLOUD) {
|
||||||
if (!input.serverId) {
|
if (!input.serverId) {
|
||||||
throw new TRPCError({
|
throw new TRPCError({
|
||||||
code: "BAD_REQUEST",
|
code: "BAD_REQUEST",
|
||||||
message: "Server is required",
|
message: "Server is required",
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
const created = await db.transaction(async (tx) => {
|
const created = await db.transaction(async (tx) => {
|
||||||
const [row] = await tx
|
const [row] = await tx
|
||||||
.insert(network)
|
.insert(network)
|
||||||
|
|||||||
Reference in New Issue
Block a user