Fixed #1015 - Teams user registration is broken (#1090)

* Fixed #1015 - Teams user registration is broken

* Type fixes for avilability form in onboarding

* Re adds missing strings

* Updates user availability in one query

Tested and working correctly

* Fixes seeder and tests

Co-authored-by: Omar López <zomars@me.com>
This commit is contained in:
Alex van Andel
2021-11-11 05:44:53 +00:00
committed by GitHub
co-authored by Omar López
parent 16fba702fb
commit bf659c0b16
11 changed files with 267 additions and 217 deletions
+6
View File
@@ -3,6 +3,7 @@ import dayjs from "dayjs";
import { uuid } from "short-uuid";
import { hashPassword } from "../lib/auth";
import { DEFAULT_SCHEDULE, getAvailabilityFromSchedule } from "../lib/availability";
const prisma = new PrismaClient();
@@ -26,6 +27,11 @@ async function createUserAndEventType(opts: {
password: await hashPassword(opts.user.password),
emailVerified: new Date(),
completedOnboarding: opts.user.completedOnboarding ?? true,
availability: {
createMany: {
data: getAvailabilityFromSchedule(DEFAULT_SCHEDULE),
},
},
};
const user = await prisma.user.upsert({
where: { email: opts.user.email },