await usersService.createUser({
pseudonym: accessToken.pseudonym,
username: accessToken.pseudonym,
profilePhoto: accessToken.profilePhoto,
emailpassword_users: {
create: undefined,
connectOrCreate: {
where: {
user_id: accessToken.id,
email: accessToken.email,
},
create: undefined,
},
connect: {
user_id: accessToken.id,
email: accessToken.email,
},
},
});
}
return await originalImplementation.thirdPartySignInUpPOST?.(
input,
);
} catch (e: any) {
if (
e.message === 'Cannot sign up as email already exists'
) {
return {
status: 'GENERAL_ERROR',
message:
'Seems like you already have an account with another method. Please use that instead.',
};
}
throw e;
}
},
//disable create session for sign up
emailPasswordSignUpPOST: async function (input) {
if (
originalImplementation.emailPasswordSignUpPOST === undefined
) {
throw new Error('Should never come here');
}
input.userContext.isSignUp = true;
return originalImplementation.emailPasswordSignUpPOST(input);
},