fix: seed script (#13868)
This commit is contained in:
@@ -38,13 +38,9 @@ export async function createUserAndEventType({
|
||||
appId: string;
|
||||
} | null)[];
|
||||
}) {
|
||||
const { password, ...restOfUser } = user;
|
||||
const userData = {
|
||||
...user,
|
||||
password: {
|
||||
create: {
|
||||
hash: await hashPassword(user.password),
|
||||
},
|
||||
},
|
||||
...restOfUser,
|
||||
emailVerified: new Date(),
|
||||
completedOnboarding: user.completedOnboarding ?? true,
|
||||
locale: "en",
|
||||
@@ -69,6 +65,21 @@ export async function createUserAndEventType({
|
||||
create: userData,
|
||||
});
|
||||
|
||||
await prisma.userPassword.upsert({
|
||||
where: { userId: theUser.id },
|
||||
update: {
|
||||
hash: await hashPassword(user.password),
|
||||
},
|
||||
create: {
|
||||
hash: await hashPassword(user.password),
|
||||
user: {
|
||||
connect: {
|
||||
id: theUser.id,
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
console.log(
|
||||
`👤 Upserted '${user.username}' with email "${user.email}" & password "${user.password}". Booking page 👉 ${process.env.NEXT_PUBLIC_WEBAPP_URL}/${user.username}`
|
||||
);
|
||||
|
||||
Reference in New Issue
Block a user