/integrations facelift (#858)

This commit is contained in:
Alex Johansson
2021-10-12 11:35:44 +02:00
committed by GitHub
parent 7dc4a55319
commit c3dc18643e
32 changed files with 1259 additions and 716 deletions
+38 -19
View File
@@ -7,7 +7,14 @@ import { hashPassword } from "../lib/auth";
const prisma = new PrismaClient();
async function createUserAndEventType(opts: {
user: { email: string; password: string; username: string; plan: UserPlan; name: string };
user: {
email: string;
password: string;
username: string;
plan: UserPlan;
name: string;
completedOnboarding?: boolean;
};
eventTypes: Array<
Prisma.EventTypeCreateInput & {
_bookings?: Prisma.BookingCreateInput[];
@@ -18,7 +25,7 @@ async function createUserAndEventType(opts: {
...opts.user,
password: await hashPassword(opts.user.password),
emailVerified: new Date(),
completedOnboarding: true,
completedOnboarding: opts.user.completedOnboarding ?? true,
};
const user = await prisma.user.upsert({
where: { email: opts.user.email },
@@ -97,24 +104,14 @@ async function createUserAndEventType(opts: {
async function main() {
await createUserAndEventType({
user: {
email: "free@example.com",
password: "free",
username: "free",
name: "Free Example",
plan: "FREE",
email: "onboarding@example.com",
password: "onboarding",
username: "onboarding",
name: "onboarding",
plan: "TRIAL",
completedOnboarding: false,
},
eventTypes: [
{
title: "30min",
slug: "30min",
length: 30,
},
{
title: "60min",
slug: "60min",
length: 30,
},
],
eventTypes: [],
});
await createUserAndEventType({
@@ -199,6 +196,28 @@ async function main() {
],
});
await createUserAndEventType({
user: {
email: "free@example.com",
password: "free",
username: "free",
name: "Free Example",
plan: "FREE",
},
eventTypes: [
{
title: "30min",
slug: "30min",
length: 30,
},
{
title: "60min",
slug: "60min",
length: 30,
},
],
});
await prisma.$disconnect();
}