feat: add OAuth2 authentication (Google/GitHub/Discord)

This commit is contained in:
Divlo
2022-03-06 15:41:30 +00:00
parent 9e6bf25c83
commit 91a0e2a76f
16 changed files with 556 additions and 17 deletions

View File

@ -65,7 +65,10 @@ export const putCurrentUser: FastifyPluginAsync = async (fastify) => {
const { redirectURI } = request.params
const userValidation = await prisma.user.findFirst({
where: {
OR: [{ email }, { name }],
OR: [
...(email != null ? [{ email }] : [{}]),
...(name != null ? [{ name }] : [{}])
],
AND: [{ id: { not: request.user.current.id } }]
}
})