Remove hasura and hasura-auth (#134)
* Remove hasura and hasura-auth * Move all models to prisma * Start implementing graphql * chore: clean package json * chore: make the code build * chore: get initial graphql.tsx file * feature: use typegql as qgl server * refactor: small refactoring * refactor: clean tests * bugfix: make all filters not case sensitive * chore: remove unused imports --------- Co-authored-by: Sammy Teillet <sammy.teillet@gmail.com>
This commit is contained in:
103
server/src/database/migrations/20230523144316_init/migration.sql
Normal file
103
server/src/database/migrations/20230523144316_init/migration.sql
Normal file
@ -0,0 +1,103 @@
|
||||
-- CreateTable
|
||||
CREATE TABLE "users" (
|
||||
"id" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"deletedAt" TIMESTAMP(3),
|
||||
"lastSeen" TIMESTAMP(3),
|
||||
"disabled" BOOLEAN NOT NULL DEFAULT false,
|
||||
"displayName" TEXT NOT NULL,
|
||||
"email" TEXT NOT NULL,
|
||||
"avatarUrl" TEXT,
|
||||
"locale" TEXT NOT NULL,
|
||||
"phoneNumber" TEXT,
|
||||
"passwordHash" TEXT,
|
||||
"emailVerified" BOOLEAN NOT NULL DEFAULT false,
|
||||
"metadata" JSONB,
|
||||
|
||||
CONSTRAINT "users_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "workspaces" (
|
||||
"id" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"deletedAt" TIMESTAMP(3),
|
||||
"domainName" TEXT NOT NULL,
|
||||
"displayName" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "workspaces_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "workspace_members" (
|
||||
"id" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"deletedAt" TIMESTAMP(3),
|
||||
"userId" TEXT NOT NULL,
|
||||
"workspaceId" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "workspace_members_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "companies" (
|
||||
"id" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"deletedAt" TIMESTAMP(3),
|
||||
"name" TEXT NOT NULL,
|
||||
"domainName" TEXT NOT NULL,
|
||||
"address" TEXT NOT NULL,
|
||||
"employees" INTEGER NOT NULL,
|
||||
"accountOwnerId" TEXT NOT NULL,
|
||||
"workspaceId" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "companies_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateTable
|
||||
CREATE TABLE "people" (
|
||||
"id" TEXT NOT NULL,
|
||||
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
|
||||
"updatedAt" TIMESTAMP(3) NOT NULL,
|
||||
"deletedAt" TIMESTAMP(3),
|
||||
"firstname" TEXT NOT NULL,
|
||||
"lastname" TEXT NOT NULL,
|
||||
"email" TEXT NOT NULL,
|
||||
"phone" TEXT NOT NULL,
|
||||
"city" TEXT NOT NULL,
|
||||
"companyId" TEXT NOT NULL,
|
||||
"workspaceId" TEXT NOT NULL,
|
||||
|
||||
CONSTRAINT "people_pkey" PRIMARY KEY ("id")
|
||||
);
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "users_email_key" ON "users"("email");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "workspaces_domainName_key" ON "workspaces"("domainName");
|
||||
|
||||
-- CreateIndex
|
||||
CREATE UNIQUE INDEX "workspace_members_userId_key" ON "workspace_members"("userId");
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "workspace_members" ADD CONSTRAINT "workspace_members_userId_fkey" FOREIGN KEY ("userId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "workspace_members" ADD CONSTRAINT "workspace_members_workspaceId_fkey" FOREIGN KEY ("workspaceId") REFERENCES "workspaces"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "companies" ADD CONSTRAINT "companies_accountOwnerId_fkey" FOREIGN KEY ("accountOwnerId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "companies" ADD CONSTRAINT "companies_workspaceId_fkey" FOREIGN KEY ("workspaceId") REFERENCES "workspaces"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "people" ADD CONSTRAINT "people_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "companies"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "people" ADD CONSTRAINT "people_workspaceId_fkey" FOREIGN KEY ("workspaceId") REFERENCES "workspaces"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
|
||||
@ -0,0 +1,17 @@
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "companies" DROP CONSTRAINT "companies_accountOwnerId_fkey";
|
||||
|
||||
-- DropForeignKey
|
||||
ALTER TABLE "people" DROP CONSTRAINT "people_companyId_fkey";
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "companies" ALTER COLUMN "accountOwnerId" DROP NOT NULL;
|
||||
|
||||
-- AlterTable
|
||||
ALTER TABLE "people" ALTER COLUMN "companyId" DROP NOT NULL;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "companies" ADD CONSTRAINT "companies_accountOwnerId_fkey" FOREIGN KEY ("accountOwnerId") REFERENCES "users"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
|
||||
-- AddForeignKey
|
||||
ALTER TABLE "people" ADD CONSTRAINT "people_companyId_fkey" FOREIGN KEY ("companyId") REFERENCES "companies"("id") ON DELETE SET NULL ON UPDATE CASCADE;
|
||||
@ -0,0 +1,2 @@
|
||||
-- AlterTable
|
||||
ALTER TABLE "companies" ALTER COLUMN "employees" DROP NOT NULL;
|
||||
3
server/src/database/migrations/migration_lock.toml
Normal file
3
server/src/database/migrations/migration_lock.toml
Normal file
@ -0,0 +1,3 @@
|
||||
# Please do not edit this file manually
|
||||
# It should be added in your version-control system (i.e. Git)
|
||||
provider = "postgresql"
|
||||
@ -2,29 +2,96 @@ generator client {
|
||||
provider = "prisma-client-js"
|
||||
}
|
||||
|
||||
generator typegraphql {
|
||||
provider = "typegraphql-prisma"
|
||||
output = "../../node_modules/@generated/type-graphql"
|
||||
}
|
||||
|
||||
datasource db {
|
||||
provider = "postgresql"
|
||||
url = env("SERVER_DATABASE_URL")
|
||||
}
|
||||
|
||||
model User {
|
||||
id String @id
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
deletedAt DateTime?
|
||||
lastSeen DateTime?
|
||||
disabled Boolean @default(false)
|
||||
displayName String
|
||||
email String @unique
|
||||
avatarUrl String?
|
||||
locale String
|
||||
phoneNumber String?
|
||||
passwordHash String?
|
||||
emailVerified Boolean @default(false)
|
||||
metadata Json?
|
||||
WorkspaceMember WorkspaceMember?
|
||||
companies Company[]
|
||||
|
||||
@@map("users")
|
||||
}
|
||||
|
||||
model Workspace {
|
||||
id String @id
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
deletedAt DateTime?
|
||||
domainName String @unique
|
||||
displayName String
|
||||
WorkspaceMember WorkspaceMember[]
|
||||
companies Company[]
|
||||
people Person[]
|
||||
|
||||
@@map("workspaces")
|
||||
}
|
||||
|
||||
model WorkspaceMember {
|
||||
id String @id
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt
|
||||
deleted_at DateTime?
|
||||
user_id String @unique
|
||||
workspace_id String
|
||||
id String @id
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
deletedAt DateTime?
|
||||
userId String @unique
|
||||
user User @relation(fields: [userId], references: [id])
|
||||
workspaceId String
|
||||
workspace Workspace @relation(fields: [workspaceId], references: [id])
|
||||
|
||||
@@map("workspace_members")
|
||||
}
|
||||
|
||||
model Workspace {
|
||||
id String @id
|
||||
created_at DateTime @default(now())
|
||||
updated_at DateTime @updatedAt
|
||||
deleted_at DateTime?
|
||||
domain_name String @unique
|
||||
display_name String
|
||||
model Company {
|
||||
id String @id
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
deletedAt DateTime?
|
||||
name String
|
||||
domainName String
|
||||
address String
|
||||
employees Int?
|
||||
accountOwnerId String?
|
||||
accountOwner User? @relation(fields: [accountOwnerId], references: [id])
|
||||
people Person[]
|
||||
workspaceId String
|
||||
workspace Workspace @relation(fields: [workspaceId], references: [id])
|
||||
|
||||
@@map("workspaces")
|
||||
@@map("companies")
|
||||
}
|
||||
|
||||
model Person {
|
||||
id String @id
|
||||
createdAt DateTime @default(now())
|
||||
updatedAt DateTime @updatedAt
|
||||
deletedAt DateTime?
|
||||
firstname String
|
||||
lastname String
|
||||
email String
|
||||
phone String
|
||||
city String
|
||||
companyId String?
|
||||
company Company? @relation(fields: [companyId], references: [id])
|
||||
workspaceId String
|
||||
workspace Workspace @relation(fields: [workspaceId], references: [id])
|
||||
|
||||
@@map("people")
|
||||
}
|
||||
|
||||
150
server/src/database/seeds/companies.ts
Normal file
150
server/src/database/seeds/companies.ts
Normal file
@ -0,0 +1,150 @@
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
export const seedCompanies = async (prisma: PrismaClient) => {
|
||||
await prisma.company.upsert({
|
||||
where: { id: 'fe256b39-3ec3-4fe3-8997-b76aa0bfa408' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
|
||||
name: 'Linkedin',
|
||||
domainName: 'linkedin.com',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
})
|
||||
await prisma.company.upsert({
|
||||
where: { id: '118995f3-5d81-46d6-bf83-f7fd33ea6102' },
|
||||
update: {},
|
||||
create: {
|
||||
id: '118995f3-5d81-46d6-bf83-f7fd33ea6102',
|
||||
name: 'Facebook',
|
||||
domainName: 'facebook.com',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
})
|
||||
await prisma.company.upsert({
|
||||
where: { id: '04b2e9f5-0713-40a5-8216-82802401d33e' },
|
||||
update: {},
|
||||
create: {
|
||||
id: '04b2e9f5-0713-40a5-8216-82802401d33e',
|
||||
name: 'Qonto',
|
||||
domainName: 'qonto.com',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
await prisma.company.upsert({
|
||||
where: { id: '460b6fb1-ed89-413a-b31a-962986e67bb4' },
|
||||
update: {},
|
||||
create: {
|
||||
id: '460b6fb1-ed89-413a-b31a-962986e67bb4',
|
||||
name: 'Microsoft',
|
||||
domainName: 'microsoft.com',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
await prisma.company.upsert({
|
||||
where: { id: '89bb825c-171e-4bcc-9cf7-43448d6fb278' },
|
||||
update: {},
|
||||
create: {
|
||||
id: '89bb825c-171e-4bcc-9cf7-43448d6fb278',
|
||||
name: 'Airbnb',
|
||||
domainName: 'airbnb.com',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
await prisma.company.upsert({
|
||||
where: { id: '0d940997-c21e-4ec2-873b-de4264d89025' },
|
||||
update: {},
|
||||
create: {
|
||||
id: '0d940997-c21e-4ec2-873b-de4264d89025',
|
||||
name: 'Google',
|
||||
domainName: 'google.com',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
await prisma.company.upsert({
|
||||
where: { id: '1d3a1c6e-707e-44dc-a1d2-30030bf1a944' },
|
||||
update: {},
|
||||
create: {
|
||||
id: '1d3a1c6e-707e-44dc-a1d2-30030bf1a944',
|
||||
name: 'Netflix',
|
||||
domainName: 'netflix.com',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
await prisma.company.upsert({
|
||||
where: { id: '7a93d1e5-3f74-492d-a101-2a70f50a1645' },
|
||||
update: {},
|
||||
create: {
|
||||
id: '7a93d1e5-3f74-492d-a101-2a70f50a1645',
|
||||
name: 'Libeo',
|
||||
domainName: 'libeo.io',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.company.upsert({
|
||||
where: { id: '9d162de6-cfbf-4156-a790-e39854dcd4eb' },
|
||||
update: {},
|
||||
create: {
|
||||
id: '9d162de6-cfbf-4156-a790-e39854dcd4eb',
|
||||
name: 'Claap',
|
||||
domainName: 'claap.com',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.company.upsert({
|
||||
where: { id: 'aaffcfbd-f86b-419f-b794-02319abe8637' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'aaffcfbd-f86b-419f-b794-02319abe8637',
|
||||
name: 'Hasura',
|
||||
domainName: 'hasura.io',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.company.upsert({
|
||||
where: { id: 'f33dc242-5518-4553-9433-42d8eb82834b' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'f33dc242-5518-4553-9433-42d8eb82834b',
|
||||
name: 'Wework',
|
||||
domainName: 'wework.com',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.company.upsert({
|
||||
where: { id: 'a7bc68d5-f79e-40dd-bd06-c36e6abb4678' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'a7bc68d5-f79e-40dd-bd06-c36e6abb4678',
|
||||
name: 'Samsung',
|
||||
domainName: 'samsung.com',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
await prisma.company.upsert({
|
||||
where: { id: 'a674fa6c-1455-4c57-afaf-dd5dc086361d' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'a674fa6c-1455-4c57-afaf-dd5dc086361d',
|
||||
name: 'Algolia',
|
||||
domainName: 'algolia.com',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
}
|
||||
15
server/src/database/seeds/index.ts
Normal file
15
server/src/database/seeds/index.ts
Normal file
@ -0,0 +1,15 @@
|
||||
import { PrismaClient } from "@prisma/client";
|
||||
import { seedCompanies } from "./companies";
|
||||
import { seedWorkspaces } from "./workspaces";
|
||||
import { seedPeople } from "./people";
|
||||
|
||||
|
||||
const seed = async () => {
|
||||
const prisma = new PrismaClient()
|
||||
await seedWorkspaces(prisma)
|
||||
await seedCompanies(prisma)
|
||||
await seedPeople(prisma)
|
||||
await prisma.$disconnect()
|
||||
}
|
||||
|
||||
seed()
|
||||
182
server/src/database/seeds/people.ts
Normal file
182
server/src/database/seeds/people.ts
Normal file
@ -0,0 +1,182 @@
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
export const seedPeople = async (prisma: PrismaClient) => {
|
||||
await prisma.person.upsert({
|
||||
where: { id: '86083141-1c0e-494c-a1b6-85b1c6fefaa5' },
|
||||
update: {},
|
||||
create: {
|
||||
id: '86083141-1c0e-494c-a1b6-85b1c6fefaa5',
|
||||
firstname: 'Christoph',
|
||||
lastname: 'Callisto',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33789012345',
|
||||
city: 'Seattle',
|
||||
companyId: 'fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
|
||||
email: 'christoph.calisto@linkedin.com'
|
||||
},
|
||||
})
|
||||
|
||||
await prisma.person.upsert({
|
||||
where: { id: '0aa00beb-ac73-4797-824e-87a1f5aea9e0' },
|
||||
update: {},
|
||||
create: {
|
||||
id: '0aa00beb-ac73-4797-824e-87a1f5aea9e0',
|
||||
firstname: 'Sylvie',
|
||||
lastname: 'Palmer',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33780123456',
|
||||
city: 'Los Angeles',
|
||||
companyId: 'fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
|
||||
email: 'sylvie.palmer@linkedin.com'
|
||||
},
|
||||
})
|
||||
|
||||
await prisma.person.upsert({
|
||||
where: { id: '93c72d2e-f517-42fd-80ae-14173b3b70ae' },
|
||||
update: {},
|
||||
create: {
|
||||
id: '93c72d2e-f517-42fd-80ae-14173b3b70ae',
|
||||
firstname: 'Christopher',
|
||||
lastname: 'Gonzalez',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33789012345',
|
||||
city: 'Seattle',
|
||||
companyId: '04b2e9f5-0713-40a5-8216-82802401d33e',
|
||||
email: 'christopher.gonzalez@qonto.com'
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.person.upsert({
|
||||
where: { id: 'eeeacacf-eee1-4690-ad2c-8619e5b56a2e' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'eeeacacf-eee1-4690-ad2c-8619e5b56a2e',
|
||||
firstname: 'Ashley',
|
||||
lastname: 'Parker',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33780123456',
|
||||
city: 'Los Angeles',
|
||||
companyId: '04b2e9f5-0713-40a5-8216-82802401d33e',
|
||||
email: 'ashley.parker@qonto.com'
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.person.upsert({
|
||||
where: { id: '9b324a88-6784-4449-afdf-dc62cb8702f2' },
|
||||
update: {},
|
||||
create: {
|
||||
id: '9b324a88-6784-4449-afdf-dc62cb8702f2',
|
||||
firstname: 'Nicholas',
|
||||
lastname: 'Wright',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33781234567',
|
||||
city: 'Seattle',
|
||||
companyId: '460b6fb1-ed89-413a-b31a-962986e67bb4',
|
||||
email: 'nicholas.wright@microsoft.com'
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.person.upsert({
|
||||
where: { id: '1d151852-490f-4466-8391-733cfd66a0c8' },
|
||||
update: {},
|
||||
create: {
|
||||
id: '1d151852-490f-4466-8391-733cfd66a0c8',
|
||||
firstname: 'Isabella',
|
||||
lastname: 'Scott',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33782345678',
|
||||
city: 'New York',
|
||||
companyId: '460b6fb1-ed89-413a-b31a-962986e67bb4',
|
||||
email: 'isabella.scott@microsoft.com'
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.person.upsert({
|
||||
where: { id: '98406e26-80f1-4dff-b570-a74942528de3' },
|
||||
update: {},
|
||||
create: {
|
||||
id: '98406e26-80f1-4dff-b570-a74942528de3',
|
||||
firstname: 'Matthew',
|
||||
lastname: 'Green',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33783456789',
|
||||
city: 'Seattle',
|
||||
companyId: '460b6fb1-ed89-413a-b31a-962986e67bb4',
|
||||
email: 'matthew.green@microsoft.com'
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.person.upsert({
|
||||
where: { id: 'a2e78a5f-338b-46df-8811-fa08c7d19d35' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'a2e78a5f-338b-46df-8811-fa08c7d19d35',
|
||||
firstname: 'Elizabeth',
|
||||
lastname: 'Baker',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33784567890',
|
||||
city: 'New York',
|
||||
companyId: '89bb825c-171e-4bcc-9cf7-43448d6fb278',
|
||||
email: 'elizabeth.baker@airbnb.com'
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.person.upsert({
|
||||
where: { id: 'ca1f5bf3-64ad-4b0e-bbfd-e9fd795b7016' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'ca1f5bf3-64ad-4b0e-bbfd-e9fd795b7016',
|
||||
firstname: 'Christopher',
|
||||
lastname: 'Nelson',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33785678901',
|
||||
city: 'San Francisco',
|
||||
companyId: '89bb825c-171e-4bcc-9cf7-43448d6fb278',
|
||||
email: 'christopher.nelson@airbnb.com'
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.person.upsert({
|
||||
where: { id: '56955422-5d54-41b7-ba36-f0d20e1417ae' },
|
||||
update: {},
|
||||
create: {
|
||||
id: '56955422-5d54-41b7-ba36-f0d20e1417ae',
|
||||
firstname: 'Avery',
|
||||
lastname: 'Carter',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33786789012',
|
||||
city: 'New York',
|
||||
companyId: '89bb825c-171e-4bcc-9cf7-43448d6fb278',
|
||||
email: 'avery.carter@airbnb.com'
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.person.upsert({
|
||||
where: { id: '755035db-623d-41fe-92e7-dd45b7c568e1' },
|
||||
update: {},
|
||||
create: {
|
||||
id: '755035db-623d-41fe-92e7-dd45b7c568e1',
|
||||
firstname: 'Ethan',
|
||||
lastname: 'Mitchell',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33787890123',
|
||||
city: 'Los Angeles',
|
||||
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
|
||||
email: 'ethan.mitchell@google.com'
|
||||
},
|
||||
});
|
||||
|
||||
await prisma.person.upsert({
|
||||
where: { id: '240da2ec-2d40-4e49-8df4-9c6a049190df' },
|
||||
update: {},
|
||||
create: {
|
||||
id: '240da2ec-2d40-4e49-8df4-9c6a049190df',
|
||||
firstname: 'Madison',
|
||||
lastname: 'Perez',
|
||||
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33788901234',
|
||||
city: 'Seattle',
|
||||
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
|
||||
email: 'madison.perez@google.com'
|
||||
},
|
||||
});
|
||||
}
|
||||
21
server/src/database/seeds/workspaces.ts
Normal file
21
server/src/database/seeds/workspaces.ts
Normal file
@ -0,0 +1,21 @@
|
||||
import { PrismaClient } from '@prisma/client'
|
||||
export const seedWorkspaces = async (prisma: PrismaClient) => {
|
||||
await prisma.workspace.upsert({
|
||||
where: { domainName: 'twenty.com' },
|
||||
update: {},
|
||||
create: {
|
||||
id: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
displayName: 'Twenty',
|
||||
domainName: 'twenty.com',
|
||||
},
|
||||
})
|
||||
await prisma.workspace.upsert({
|
||||
where: { domainName: 'claap.com' },
|
||||
update: {},
|
||||
create: {
|
||||
id: '7ed9d212-1c25-4d02-bf25-6aeccf7ea420',
|
||||
displayName: 'Claap',
|
||||
domainName: 'claap.com',
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user