2
0

Add Dashboard

This commit is contained in:
Baptiste Arnaud
2021-12-06 15:48:50 +01:00
parent 5e14a94dea
commit 54a641b819
47 changed files with 2002 additions and 168 deletions

View File

@ -0,0 +1,30 @@
import { PrismaClient } from '.prisma/client'
const prisma = new PrismaClient()
const teardownTestData = async () => prisma.user.deleteMany()
export const seedDb = async () => {
await teardownTestData()
await createUsers()
await createFolders()
return createTypebots()
}
const createUsers = () =>
prisma.user.createMany({
data: [
{ id: 'test1', email: 'test1@gmail.com', emailVerified: new Date() },
{ id: 'test2', email: 'test2@gmail.com', emailVerified: new Date() },
],
})
const createFolders = () =>
prisma.dashboardFolder.createMany({
data: [{ ownerId: 'test2', name: 'Folder #1', id: 'folder1' }],
})
const createTypebots = () =>
prisma.typebot.createMany({
data: [{ name: 'Typebot #1', ownerId: 'test2' }],
})

View File

@ -3,6 +3,7 @@ import {
FacebookSocialLogin,
GoogleSocialLogin,
} from 'cypress-social-logins/src/Plugins'
import { seedDb } from './database'
/// <reference types="cypress" />
/**
@ -14,6 +15,7 @@ const handler = (on: any) => {
GoogleSocialLogin: GoogleSocialLogin,
FacebookSocialLogin: FacebookSocialLogin,
GitHubSocialLogin: GitHubSocialLogin,
seed: seedDb,
})
}