Truthy value was impossible on completedOnboarding, either undefined/false (#2243)
This commit is contained in:
parent
7716b4c15f
commit
77266535e5
1 changed files with 13 additions and 11 deletions
|
@ -23,25 +23,27 @@ async function createUserAndEventType(opts: {
|
|||
}
|
||||
>;
|
||||
}) {
|
||||
const userData: Prisma.UserCreateArgs["data"] = {
|
||||
const userData = {
|
||||
...opts.user,
|
||||
password: await hashPassword(opts.user.password),
|
||||
emailVerified: new Date(),
|
||||
completedOnboarding: opts.user.completedOnboarding ?? true,
|
||||
locale: "en",
|
||||
schedules: opts.user.completedOnboarding
|
||||
? {
|
||||
create: {
|
||||
name: "Working Hours",
|
||||
availability: {
|
||||
createMany: {
|
||||
data: getAvailabilityFromSchedule(DEFAULT_SCHEDULE),
|
||||
schedules:
|
||||
opts.user.completedOnboarding ?? true
|
||||
? {
|
||||
create: {
|
||||
name: "Working Hours",
|
||||
availability: {
|
||||
createMany: {
|
||||
data: getAvailabilityFromSchedule(DEFAULT_SCHEDULE),
|
||||
},
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
: undefined,
|
||||
}
|
||||
: undefined,
|
||||
};
|
||||
|
||||
const user = await prisma.user.upsert({
|
||||
where: { email: opts.user.email },
|
||||
update: userData,
|
||||
|
|
Loading…
Reference in a new issue