mirror of
https://github.com/AustinKelsay/plebdevs.git
synced 2025-05-19 00:12:00 +00:00
Revert create user model, add log for debugging
This commit is contained in:
parent
2ccf3b6e7b
commit
69843bff73
@ -132,22 +132,6 @@ export const addCoursePurchaseToUser = async (userId, purchaseData) => {
|
|||||||
};
|
};
|
||||||
|
|
||||||
export const createUser = async (data) => {
|
export const createUser = async (data) => {
|
||||||
// Check if a user with the given email already exists
|
|
||||||
let existingUser = null;
|
|
||||||
// todo: special condition for email login, should be handled before getting here
|
|
||||||
if (data?.email) {
|
|
||||||
existingUser = await prisma.user.findUnique({
|
|
||||||
where: { email: data?.email },
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
if (existingUser) {
|
|
||||||
console.log("user already exists", existingUser);
|
|
||||||
// If user exists, return the existing user
|
|
||||||
return existingUser;
|
|
||||||
}
|
|
||||||
|
|
||||||
// If user does not exist, create a new user
|
|
||||||
return await prisma.user.create({
|
return await prisma.user.create({
|
||||||
data: {
|
data: {
|
||||||
...data,
|
...data,
|
||||||
|
@ -149,6 +149,9 @@ export const authOptions = {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
const fullUser = await getUserByPubkey(pk);
|
const fullUser = await getUserByPubkey(pk);
|
||||||
|
if (fullUser && fullUser.email === "austinkelsay@protonmail.com") {
|
||||||
|
console.log("FULLLSNDE", fullUser);
|
||||||
|
}
|
||||||
token.user = fullUser;
|
token.user = fullUser;
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.error("Ephemeral key pair generation error:", error);
|
console.error("Ephemeral key pair generation error:", error);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user