Truthy value was impossible on completedOnboarding, either undefined/false (#2243)

This commit is contained in:
Alex van Andel 2022-03-22 19:43:57 +00:00 committed by GitHub
parent 7716b4c15f
commit 77266535e5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -23,25 +23,27 @@ async function createUserAndEventType(opts: {
} }
>; >;
}) { }) {
const userData: Prisma.UserCreateArgs["data"] = { const userData = {
...opts.user, ...opts.user,
password: await hashPassword(opts.user.password), password: await hashPassword(opts.user.password),
emailVerified: new Date(), emailVerified: new Date(),
completedOnboarding: opts.user.completedOnboarding ?? true, completedOnboarding: opts.user.completedOnboarding ?? true,
locale: "en", locale: "en",
schedules: opts.user.completedOnboarding schedules:
? { opts.user.completedOnboarding ?? true
create: { ? {
name: "Working Hours", create: {
availability: { name: "Working Hours",
createMany: { availability: {
data: getAvailabilityFromSchedule(DEFAULT_SCHEDULE), createMany: {
data: getAvailabilityFromSchedule(DEFAULT_SCHEDULE),
},
}, },
}, },
}, }
} : undefined,
: undefined,
}; };
const user = await prisma.user.upsert({ const user = await prisma.user.upsert({
where: { email: opts.user.email }, where: { email: opts.user.email },
update: userData, update: userData,