Skip to content

Commit

Permalink
feat: correct endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
brMonteiro-G committed Feb 11, 2025
1 parent bfe1c85 commit 859b443
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion app/api/facebook/func.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,11 @@ module.exports = async (context) => {
const { ra, email } = context.body;

// Find user by RA first
const user = await app.models.users.findOne({ ra, 'oauth.facebook': { $exists: true } });
const user = await app.models.users.findOne({
ra,
$or: [{ "oauth.facebookEmail": email }, { "oauth.email": email }],
'oauth.facebook': { $exists: true }
});

if (!user) {
throw new Error('User does not exist');
Expand Down

0 comments on commit 859b443

Please sign in to comment.