From d5137d5d3a1fb5047fbd9567e69864d08b0f92c4 Mon Sep 17 00:00:00 2001 From: Jason Parks Date: Sun, 23 Mar 2025 14:04:30 -0600 Subject: [PATCH] fix: handle repository id null case consistently --- .../general/generic/save-gitea-provider.tsx | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/apps/dokploy/components/dashboard/application/general/generic/save-gitea-provider.tsx b/apps/dokploy/components/dashboard/application/general/generic/save-gitea-provider.tsx index fadbc4bb..53e8cd9d 100644 --- a/apps/dokploy/components/dashboard/application/general/generic/save-gitea-provider.tsx +++ b/apps/dokploy/components/dashboard/application/general/generic/save-gitea-provider.tsx @@ -67,8 +67,8 @@ const GiteaProviderSchema = z.object({ .object({ repo: z.string().min(1, "Repo is required"), owner: z.string().min(1, "Owner is required"), - giteaPathNamespace: z.string(), - id: z.number().nullable(), + giteaPathNamespace: z.string().min(1), + id: z.number().nullable().optional(), }) .required(), branch: z.string().min(1, "Branch is required"), @@ -129,7 +129,7 @@ export const SaveGiteaProvider = ({ applicationId }: Props) => { { owner: repository?.owner, repositoryName: repository?.repo, - id: repository?.id || 0, + id: repository?.id ?? 0, // Use nullish coalescing to provide 0 as a fallback giteaId: giteaId, }, { @@ -145,7 +145,7 @@ export const SaveGiteaProvider = ({ applicationId }: Props) => { repo: data.giteaRepository || "", owner: data.giteaOwner || "", giteaPathNamespace: data.giteaPathNamespace || "", - id: data.giteaProjectId, + id: data.giteaProjectId || null, // Handle null case explicitly }, buildPath: data.giteaBuildPath || "/", giteaId: data.giteaId || "", @@ -162,7 +162,7 @@ export const SaveGiteaProvider = ({ applicationId }: Props) => { giteaBuildPath: data.buildPath, giteaId: data.giteaId, applicationId, - giteaProjectId: data.repository.id, + giteaProjectId: data.repository.id || null, // Handle null case explicitly giteaPathNamespace: data.repository.giteaPathNamespace, watchPaths: data.watchPaths, }) @@ -502,4 +502,4 @@ export const SaveGiteaProvider = ({ applicationId }: Props) => { ); -}; +}; \ No newline at end of file