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:
Mauricio Siu
2026-02-22 01:58:28 -06:00
parent e7c38d4c54
commit d542972522

View File

@@ -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)