From 436f93f25e9c2b10cf516b543065fa0c0b1e6f60 Mon Sep 17 00:00:00 2001 From: Mau Barragan Date: Wed, 25 Oct 2023 18:14:41 -0600 Subject: [PATCH] Fixed error the trying to delete --- app/models/profile.server.ts | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/models/profile.server.ts b/app/models/profile.server.ts index 31a663cf..5eeb5c45 100644 --- a/app/models/profile.server.ts +++ b/app/models/profile.server.ts @@ -111,7 +111,7 @@ export async function updateProfile( export async function updateGithubUser(userProfile: UserProfile, githubUser: string = '') { if (userProfile.githubUser === githubUser) return null const { data: userInfo } = await getUserByUsername(githubUser) - if (githubUser.length > 0 || userInfo) { + if (githubUser.length > 0 && userInfo) { const githubProfile = await getGitHubProfileByEmail(userProfile.email); const { data: repos } = await getUserRepos(userInfo.login); if (githubProfile) { @@ -149,7 +149,7 @@ export async function updateGithubUser(userProfile: UserProfile, githubUser: str } } else { - await prisma.gitHubProfile.delete({ where: { email: userProfile.email } }) + await prisma.gitHubProfile.deleteMany({ where: { email: userProfile.email } }) await prisma.gitHubProjects.deleteMany({ where: { owner_email: userProfile.email } })