fixed oauth provider type bug

This commit is contained in:
Zai Shi 2024-05-16 10:13:11 +02:00
parent eeb9e2a4ae
commit 13d0743d45

View File

@ -23,7 +23,9 @@ export const usersCrudHandlers = createPrismaCrudHandlers(usersCrud, "projectUse
},
};
},
include: async () => ({}),
include: async () => ({
projectUserOAuthAccounts: true,
}),
createNotFoundError: () => new KnownErrors.UserNotFound(),
crudToPrisma: async (crud, { auth }) => {
const projectId = auth.project.id;
@ -49,7 +51,7 @@ export const usersCrudHandlers = createPrismaCrudHandlers(usersCrud, "projectUse
authMethod: prisma.passwordHash ? 'credential' as const : 'oauth' as const, // not used anymore, for backwards compatibility
hasPassword: !!prisma.passwordHash,
authWithEmail: prisma.authWithEmail,
oauthProviders: auth.project.evaluatedConfig.oauthProviders.map((provider) => provider.id),
oauthProviders: prisma.projectUserOAuthAccounts.map((a) => a.oauthProviderConfigId),
};
},
});