Add comments to Prisma Schema and GraphQL server (#162)

* Lowercase all relations in prisma/graphql schema

* Add Comments data model and graphql schema

* Make comments availalble on the api through resolvers and guard them

* Update front graphql schema

* Fix PR
This commit is contained in:
Charles Bochet
2023-05-31 15:41:53 +02:00
committed by GitHub
parent 8bd91139ca
commit a3a3c1924f
311 changed files with 8480 additions and 202 deletions

View File

@ -0,0 +1,55 @@
-- CreateEnum
CREATE TYPE "CommentableType" AS ENUM ('Person', 'Company');
-- CreateTable
CREATE TABLE "comment_threads" (
"id" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"deletedAt" TIMESTAMP(3),
"workspaceId" TEXT NOT NULL,
CONSTRAINT "comment_threads_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "comments" (
"id" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"deletedAt" TIMESTAMP(3),
"body" TEXT NOT NULL,
"authorId" TEXT NOT NULL,
"commentThreadId" TEXT NOT NULL,
"workspaceId" TEXT NOT NULL,
CONSTRAINT "comments_pkey" PRIMARY KEY ("id")
);
-- CreateTable
CREATE TABLE "comment_thread_targets" (
"id" TEXT NOT NULL,
"createdAt" TIMESTAMP(3) NOT NULL DEFAULT CURRENT_TIMESTAMP,
"updatedAt" TIMESTAMP(3) NOT NULL,
"deletedAt" TIMESTAMP(3),
"commentThreadId" TEXT NOT NULL,
"commentableType" "CommentableType" NOT NULL,
"commentableId" TEXT NOT NULL,
CONSTRAINT "comment_thread_targets_pkey" PRIMARY KEY ("id")
);
-- AddForeignKey
ALTER TABLE "comment_threads" ADD CONSTRAINT "comment_threads_workspaceId_fkey" FOREIGN KEY ("workspaceId") REFERENCES "workspaces"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "comments" ADD CONSTRAINT "comments_authorId_fkey" FOREIGN KEY ("authorId") REFERENCES "users"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "comments" ADD CONSTRAINT "comments_commentThreadId_fkey" FOREIGN KEY ("commentThreadId") REFERENCES "comment_threads"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "comments" ADD CONSTRAINT "comments_workspaceId_fkey" FOREIGN KEY ("workspaceId") REFERENCES "workspaces"("id") ON DELETE RESTRICT ON UPDATE CASCADE;
-- AddForeignKey
ALTER TABLE "comment_thread_targets" ADD CONSTRAINT "comment_thread_targets_commentThreadId_fkey" FOREIGN KEY ("commentThreadId") REFERENCES "comment_threads"("id") ON DELETE RESTRICT ON UPDATE CASCADE;

View File

@ -11,6 +11,30 @@ datasource db {
generator nestgraphql {
provider = "node node_modules/prisma-nestjs-graphql"
output = "../../src/api/@generated"
decorate_1_type = "*CommentThreadTargetCreateNestedManyWithoutCommentThreadInput"
decorate_1_field = "!(createMany)"
decorate_1_name = "HideField"
decorate_1_from = "@nestjs/graphql"
decorate_1_arguments = "[]"
decorate_2_type = "*CommentCreateNestedManyWithoutCommentThreadInput"
decorate_2_field = "!(createMany)"
decorate_2_name = "HideField"
decorate_2_from = "@nestjs/graphql"
decorate_2_arguments = "[]"
decorate_3_type = "*UserCreateNestedOneWithoutCommentsInput"
decorate_3_field = "!(connect)"
decorate_3_name = "HideField"
decorate_3_from = "@nestjs/graphql"
decorate_3_arguments = "[]"
decorate_4_type = "*CommentThreadCreateNestedOneWithoutCommentsInput"
decorate_4_field = "!(connect)"
decorate_4_name = "HideField"
decorate_4_from = "@nestjs/graphql"
decorate_4_arguments = "[]"
}
model User {
@ -28,9 +52,10 @@ model User {
passwordHash String?
emailVerified Boolean @default(false)
metadata Json?
WorkspaceMember WorkspaceMember?
workspaceMember WorkspaceMember?
companies Company[]
RefreshTokens RefreshToken[]
refreshTokens RefreshToken[]
comments Comment[]
@@map("users")
}
@ -44,9 +69,11 @@ model Workspace {
domainName String @unique
displayName String
logo String?
WorkspaceMember WorkspaceMember[]
workspaceMember WorkspaceMember[]
companies Company[]
people Person[]
commentThreads CommentThread[]
comments Comment[]
@@map("workspaces")
}
@ -108,7 +135,6 @@ model Person {
@@map("people")
}
/// @TypeGraphQL.omit(input: true)
model RefreshToken {
id String @id
createdAt DateTime @default(now())
@ -120,3 +146,55 @@ model RefreshToken {
@@map("refresh_tokens")
}
model CommentThread {
id String @id
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?
commentThreadTargets CommentThreadTarget[]
comments Comment[]
/// @TypeGraphQL.omit(input: true)
workspaceId String
/// @TypeGraphQL.omit(input: true)
workspace Workspace @relation(fields: [workspaceId], references: [id])
@@map("comment_threads")
}
model Comment {
id String @id
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?
body String
authorId String
author User @relation(fields: [authorId], references: [id])
commentThreadId String
commentThread CommentThread @relation(fields: [commentThreadId], references: [id])
/// @TypeGraphQL.omit(input: true)
workspaceId String
/// @TypeGraphQL.omit(input: true)
workspace Workspace @relation(fields: [workspaceId], references: [id])
@@map("comments")
}
enum CommentableType {
Person
Company
}
model CommentThreadTarget {
id String @id
createdAt DateTime @default(now())
updatedAt DateTime @updatedAt
deletedAt DateTime?
commentThreadId String
commentThread CommentThread @relation(fields: [commentThreadId], references: [id])
commentableType CommentableType
commentableId String
@@map("comment_thread_targets")
}

View File

@ -0,0 +1,110 @@
import { PrismaClient } from '@prisma/client';
export const seedComments = async (prisma: PrismaClient) => {
await prisma.commentThread.upsert({
where: { id: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb400' },
update: {},
create: {
id: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb400',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
},
});
await prisma.commentThreadTarget.upsert({
where: { id: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb600' },
update: {},
create: {
id: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb600',
commentableType: 'Company',
commentableId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
commentThreadId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb400',
},
});
await prisma.comment.upsert({
where: { id: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb200' },
update: {},
create: {
id: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb200',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
body: 'Hi Félix ! How do you like your Twenty workspace?',
commentThreadId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb400',
authorId: 'twenty-ge256b39-3ec3-4fe3-8997-b76aa0bfa408',
},
});
await prisma.comment.upsert({
where: { id: 'twenty-fe256b40-3ec3-4fe3-8997-b76aa0bfb200' },
update: {},
create: {
id: 'twenty-fe256b40-3ec3-4fe3-8997-b76aa0bfb200',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
body: 'I love it!',
commentThreadId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb400',
authorId: 'twenty-gk256b39-3ec3-4fe3-8997-b76aa0bfa408',
},
});
await prisma.commentThread.upsert({
where: { id: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfc408' },
update: {},
create: {
id: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfc408',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
},
});
await prisma.commentThreadTarget.upsert({
where: { id: 'twenty-fe256b39-3ec3-4fe3-8997-a76aa0bfb600' },
update: {},
create: {
id: 'twenty-fe256b39-3ec3-4fe3-8997-a76aa0bfb600',
commentableType: 'Person',
commentableId: 'twenty-755035db-623d-41fe-92e7-dd45b7c568e1',
commentThreadId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfc408',
},
});
await prisma.comment.upsert({
where: { id: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb100' },
update: {},
create: {
id: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb100',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
body: 'I really like this comment thread feature!',
commentThreadId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfc408',
authorId: 'twenty-ge256b39-3ec3-4fe3-8997-b76aa0bfa408',
},
});
await prisma.commentThread.upsert({
where: { id: 'twenty-dev-fe256b39-3ec3-4fe3-8997-b76aaabfb408' },
update: {},
create: {
id: 'twenty-dev-fe256b39-3ec3-4fe3-8997-b76aaabfb408',
workspaceId: 'twenty-dev-7ed9d212-1c25-4d02-bf25-6aeccf7ea420',
},
});
await prisma.commentThreadTarget.upsert({
where: { id: 'twenty-dev-fe256b39-3ec3-4fe3-8997-a76aa0bfba00' },
update: {},
create: {
id: 'twenty-dev-fe256b39-3ec3-4fe3-8997-a76aa0bfba00',
commentableType: 'Company',
commentableId: 'twenty-dev-a674fa6c-1455-4c57-afaf-dd5dc086361e',
commentThreadId: 'twenty-dev-fe256b39-3ec3-4fe3-8997-b76aaabfb408',
},
});
await prisma.comment.upsert({
where: { id: 'twenty-dev-fe256b39-3ec3-4fe3-8997-b76aa0bfb000' },
update: {},
create: {
id: 'twenty-dev-fe256b39-3ec3-4fe3-8997-b76aa0bfb000',
workspaceId: 'twenty-dev-7ed9d212-1c25-4d02-bf25-6aeccf7ea420',
body: 'I really like this comment thread feature!',
commentThreadId: 'twenty-dev-fe256b39-3ec3-4fe3-8997-b76aaabfb408',
authorId: 'twenty-dev-gk256b39-3ec3-4fe3-8997-b76aa0boa408',
},
});
};

View File

@ -1,161 +1,161 @@
import { PrismaClient } from '@prisma/client';
export const seedCompanies = async (prisma: PrismaClient) => {
await prisma.company.upsert({
where: { id: 'fe256b39-3ec3-4fe3-8997-b76aa0bfa408' },
where: { id: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfa408' },
update: {},
create: {
id: 'fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
id: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
name: 'Linkedin',
domainName: 'linkedin.com',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
address: '',
},
});
await prisma.company.upsert({
where: { id: '118995f3-5d81-46d6-bf83-f7fd33ea6102' },
where: { id: 'twenty-118995f3-5d81-46d6-bf83-f7fd33ea6102' },
update: {},
create: {
id: '118995f3-5d81-46d6-bf83-f7fd33ea6102',
id: 'twenty-118995f3-5d81-46d6-bf83-f7fd33ea6102',
name: 'Facebook',
domainName: 'facebook.com',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
address: '',
},
});
await prisma.company.upsert({
where: { id: '04b2e9f5-0713-40a5-8216-82802401d33e' },
where: { id: 'twenty-04b2e9f5-0713-40a5-8216-82802401d33e' },
update: {},
create: {
id: '04b2e9f5-0713-40a5-8216-82802401d33e',
id: 'twenty-04b2e9f5-0713-40a5-8216-82802401d33e',
name: 'Qonto',
domainName: 'qonto.com',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
address: '',
},
});
await prisma.company.upsert({
where: { id: '460b6fb1-ed89-413a-b31a-962986e67bb4' },
where: { id: 'twenty-460b6fb1-ed89-413a-b31a-962986e67bb4' },
update: {},
create: {
id: '460b6fb1-ed89-413a-b31a-962986e67bb4',
id: 'twenty-460b6fb1-ed89-413a-b31a-962986e67bb4',
name: 'Microsoft',
domainName: 'microsoft.com',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
address: '',
},
});
await prisma.company.upsert({
where: { id: '89bb825c-171e-4bcc-9cf7-43448d6fb278' },
where: { id: 'twenty-89bb825c-171e-4bcc-9cf7-43448d6fb278' },
update: {},
create: {
id: '89bb825c-171e-4bcc-9cf7-43448d6fb278',
id: 'twenty-89bb825c-171e-4bcc-9cf7-43448d6fb278',
name: 'Airbnb',
domainName: 'airbnb.com',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
address: '',
},
});
await prisma.company.upsert({
where: { id: '0d940997-c21e-4ec2-873b-de4264d89025' },
where: { id: 'twenty-0d940997-c21e-4ec2-873b-de4264d89025' },
update: {},
create: {
id: '0d940997-c21e-4ec2-873b-de4264d89025',
id: 'twenty-0d940997-c21e-4ec2-873b-de4264d89025',
name: 'Google',
domainName: 'google.com',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
address: '',
},
});
await prisma.company.upsert({
where: { id: '1d3a1c6e-707e-44dc-a1d2-30030bf1a944' },
where: { id: 'twenty-1d3a1c6e-707e-44dc-a1d2-30030bf1a944' },
update: {},
create: {
id: '1d3a1c6e-707e-44dc-a1d2-30030bf1a944',
id: 'twenty-1d3a1c6e-707e-44dc-a1d2-30030bf1a944',
name: 'Netflix',
domainName: 'netflix.com',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
address: '',
},
});
await prisma.company.upsert({
where: { id: '7a93d1e5-3f74-492d-a101-2a70f50a1645' },
where: { id: 'twenty-7a93d1e5-3f74-492d-a101-2a70f50a1645' },
update: {},
create: {
id: '7a93d1e5-3f74-492d-a101-2a70f50a1645',
id: 'twenty-7a93d1e5-3f74-492d-a101-2a70f50a1645',
name: 'Libeo',
domainName: 'libeo.io',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
address: '',
},
});
await prisma.company.upsert({
where: { id: '9d162de6-cfbf-4156-a790-e39854dcd4eb' },
where: { id: 'twenty-9d162de6-cfbf-4156-a790-e39854dcd4eb' },
update: {},
create: {
id: '9d162de6-cfbf-4156-a790-e39854dcd4eb',
id: 'twenty-9d162de6-cfbf-4156-a790-e39854dcd4eb',
name: 'Claap',
domainName: 'claap.com',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
address: '',
},
});
await prisma.company.upsert({
where: { id: 'aaffcfbd-f86b-419f-b794-02319abe8637' },
where: { id: 'twenty-aaffcfbd-f86b-419f-b794-02319abe8637' },
update: {},
create: {
id: 'aaffcfbd-f86b-419f-b794-02319abe8637',
id: 'twenty-aaffcfbd-f86b-419f-b794-02319abe8637',
name: 'Hasura',
domainName: 'hasura.io',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
address: '',
},
});
await prisma.company.upsert({
where: { id: 'f33dc242-5518-4553-9433-42d8eb82834b' },
where: { id: 'twenty-f33dc242-5518-4553-9433-42d8eb82834b' },
update: {},
create: {
id: 'f33dc242-5518-4553-9433-42d8eb82834b',
id: 'twenty-f33dc242-5518-4553-9433-42d8eb82834b',
name: 'Wework',
domainName: 'wework.com',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
address: '',
},
});
await prisma.company.upsert({
where: { id: 'a7bc68d5-f79e-40dd-bd06-c36e6abb4678' },
where: { id: 'twenty-a7bc68d5-f79e-40dd-bd06-c36e6abb4678' },
update: {},
create: {
id: 'a7bc68d5-f79e-40dd-bd06-c36e6abb4678',
id: 'twenty-a7bc68d5-f79e-40dd-bd06-c36e6abb4678',
name: 'Samsung',
domainName: 'samsung.com',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
address: '',
},
});
await prisma.company.upsert({
where: { id: 'a674fa6c-1455-4c57-afaf-dd5dc086361d' },
where: { id: 'twenty-a674fa6c-1455-4c57-afaf-dd5dc086361d' },
update: {},
create: {
id: 'a674fa6c-1455-4c57-afaf-dd5dc086361d',
id: 'twenty-a674fa6c-1455-4c57-afaf-dd5dc086361d',
name: 'Algolia',
domainName: 'algolia.com',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
address: '',
},
});
await prisma.company.upsert({
where: { id: 'a674fa6c-1455-4c57-afaf-dd5dc086361e' },
where: { id: 'twenty-dev-a674fa6c-1455-4c57-afaf-dd5dc086361e' },
update: {},
create: {
id: 'a674fa6c-1455-4c57-afaf-dd5dc086361e',
id: 'twenty-dev-a674fa6c-1455-4c57-afaf-dd5dc086361e',
name: 'Instagram',
domainName: 'instagram.com',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea420',
workspaceId: 'twenty-dev-7ed9d212-1c25-4d02-bf25-6aeccf7ea420',
address: '',
},
});

View File

@ -2,12 +2,16 @@ import { PrismaClient } from '@prisma/client';
import { seedCompanies } from './companies';
import { seedWorkspaces } from './workspaces';
import { seedPeople } from './people';
import { seedComments } from './comments';
import { seedUsers } from './users';
const seed = async () => {
const prisma = new PrismaClient();
await seedWorkspaces(prisma);
await seedUsers(prisma);
await seedCompanies(prisma);
await seedPeople(prisma);
await seedComments(prisma);
await prisma.$disconnect();
};

View File

@ -1,226 +1,226 @@
import { PrismaClient } from '@prisma/client';
export const seedPeople = async (prisma: PrismaClient) => {
await prisma.person.upsert({
where: { id: '86083141-1c0e-494c-a1b6-85b1c6fefaa5' },
where: { id: 'twenty-86083141-1c0e-494c-a1b6-85b1c6fefaa5' },
update: {},
create: {
id: '86083141-1c0e-494c-a1b6-85b1c6fefaa5',
id: 'twenty-86083141-1c0e-494c-a1b6-85b1c6fefaa5',
firstname: 'Christoph',
lastname: 'Callisto',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
phone: '+33789012345',
city: 'Seattle',
companyId: 'fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
companyId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
email: 'christoph.calisto@linkedin.com',
},
});
await prisma.person.upsert({
where: { id: '0aa00beb-ac73-4797-824e-87a1f5aea9e0' },
where: { id: 'twenty-0aa00beb-ac73-4797-824e-87a1f5aea9e0' },
update: {},
create: {
id: '0aa00beb-ac73-4797-824e-87a1f5aea9e0',
id: 'twenty-0aa00beb-ac73-4797-824e-87a1f5aea9e0',
firstname: 'Sylvie',
lastname: 'Palmer',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
phone: '+33780123456',
city: 'Los Angeles',
companyId: 'fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
companyId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
email: 'sylvie.palmer@linkedin.com',
},
});
await prisma.person.upsert({
where: { id: '93c72d2e-f517-42fd-80ae-14173b3b70ae' },
where: { id: 'twenty-93c72d2e-f517-42fd-80ae-14173b3b70ae' },
update: {},
create: {
id: '93c72d2e-f517-42fd-80ae-14173b3b70ae',
id: 'twenty-93c72d2e-f517-42fd-80ae-14173b3b70ae',
firstname: 'Christopher',
lastname: 'Gonzalez',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
phone: '+33789012345',
city: 'Seattle',
companyId: '04b2e9f5-0713-40a5-8216-82802401d33e',
companyId: 'twenty-04b2e9f5-0713-40a5-8216-82802401d33e',
email: 'christopher.gonzalez@qonto.com',
},
});
await prisma.person.upsert({
where: { id: 'eeeacacf-eee1-4690-ad2c-8619e5b56a2e' },
where: { id: 'twenty-eeeacacf-eee1-4690-ad2c-8619e5b56a2e' },
update: {},
create: {
id: 'eeeacacf-eee1-4690-ad2c-8619e5b56a2e',
id: 'twenty-eeeacacf-eee1-4690-ad2c-8619e5b56a2e',
firstname: 'Ashley',
lastname: 'Parker',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
phone: '+33780123456',
city: 'Los Angeles',
companyId: '04b2e9f5-0713-40a5-8216-82802401d33e',
companyId: 'twenty-04b2e9f5-0713-40a5-8216-82802401d33e',
email: 'ashley.parker@qonto.com',
},
});
await prisma.person.upsert({
where: { id: '9b324a88-6784-4449-afdf-dc62cb8702f2' },
where: { id: 'twenty-9b324a88-6784-4449-afdf-dc62cb8702f2' },
update: {},
create: {
id: '9b324a88-6784-4449-afdf-dc62cb8702f2',
id: 'twenty-9b324a88-6784-4449-afdf-dc62cb8702f2',
firstname: 'Nicholas',
lastname: 'Wright',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
phone: '+33781234567',
city: 'Seattle',
companyId: '460b6fb1-ed89-413a-b31a-962986e67bb4',
companyId: 'twenty-460b6fb1-ed89-413a-b31a-962986e67bb4',
email: 'nicholas.wright@microsoft.com',
},
});
await prisma.person.upsert({
where: { id: '1d151852-490f-4466-8391-733cfd66a0c8' },
where: { id: 'twenty-1d151852-490f-4466-8391-733cfd66a0c8' },
update: {},
create: {
id: '1d151852-490f-4466-8391-733cfd66a0c8',
id: 'twenty-1d151852-490f-4466-8391-733cfd66a0c8',
firstname: 'Isabella',
lastname: 'Scott',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
phone: '+33782345678',
city: 'New York',
companyId: '460b6fb1-ed89-413a-b31a-962986e67bb4',
companyId: 'twenty-460b6fb1-ed89-413a-b31a-962986e67bb4',
email: 'isabella.scott@microsoft.com',
},
});
await prisma.person.upsert({
where: { id: '98406e26-80f1-4dff-b570-a74942528de3' },
where: { id: 'twenty-98406e26-80f1-4dff-b570-a74942528de3' },
update: {},
create: {
id: '98406e26-80f1-4dff-b570-a74942528de3',
id: 'twenty-98406e26-80f1-4dff-b570-a74942528de3',
firstname: 'Matthew',
lastname: 'Green',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
phone: '+33783456789',
city: 'Seattle',
companyId: '460b6fb1-ed89-413a-b31a-962986e67bb4',
companyId: 'twenty-460b6fb1-ed89-413a-b31a-962986e67bb4',
email: 'matthew.green@microsoft.com',
},
});
await prisma.person.upsert({
where: { id: 'a2e78a5f-338b-46df-8811-fa08c7d19d35' },
where: { id: 'twenty-a2e78a5f-338b-46df-8811-fa08c7d19d35' },
update: {},
create: {
id: 'a2e78a5f-338b-46df-8811-fa08c7d19d35',
id: 'twenty-a2e78a5f-338b-46df-8811-fa08c7d19d35',
firstname: 'Elizabeth',
lastname: 'Baker',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
phone: '+33784567890',
city: 'New York',
companyId: '89bb825c-171e-4bcc-9cf7-43448d6fb278',
companyId: 'twenty-89bb825c-171e-4bcc-9cf7-43448d6fb278',
email: 'elizabeth.baker@airbnb.com',
},
});
await prisma.person.upsert({
where: { id: 'ca1f5bf3-64ad-4b0e-bbfd-e9fd795b7016' },
where: { id: 'twenty-ca1f5bf3-64ad-4b0e-bbfd-e9fd795b7016' },
update: {},
create: {
id: 'ca1f5bf3-64ad-4b0e-bbfd-e9fd795b7016',
id: 'twenty-ca1f5bf3-64ad-4b0e-bbfd-e9fd795b7016',
firstname: 'Christopher',
lastname: 'Nelson',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
phone: '+33785678901',
city: 'San Francisco',
companyId: '89bb825c-171e-4bcc-9cf7-43448d6fb278',
companyId: 'twenty-89bb825c-171e-4bcc-9cf7-43448d6fb278',
email: 'christopher.nelson@airbnb.com',
},
});
await prisma.person.upsert({
where: { id: '56955422-5d54-41b7-ba36-f0d20e1417ae' },
where: { id: 'twenty-56955422-5d54-41b7-ba36-f0d20e1417ae' },
update: {},
create: {
id: '56955422-5d54-41b7-ba36-f0d20e1417ae',
id: 'twenty-56955422-5d54-41b7-ba36-f0d20e1417ae',
firstname: 'Avery',
lastname: 'Carter',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
phone: '+33786789012',
city: 'New York',
companyId: '89bb825c-171e-4bcc-9cf7-43448d6fb278',
companyId: 'twenty-89bb825c-171e-4bcc-9cf7-43448d6fb278',
email: 'avery.carter@airbnb.com',
},
});
await prisma.person.upsert({
where: { id: '755035db-623d-41fe-92e7-dd45b7c568e1' },
where: { id: 'twenty-755035db-623d-41fe-92e7-dd45b7c568e1' },
update: {},
create: {
id: '755035db-623d-41fe-92e7-dd45b7c568e1',
id: 'twenty-755035db-623d-41fe-92e7-dd45b7c568e1',
firstname: 'Ethan',
lastname: 'Mitchell',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
phone: '+33787890123',
city: 'Los Angeles',
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
companyId: 'twenty-0d940997-c21e-4ec2-873b-de4264d89025',
email: 'ethan.mitchell@google.com',
},
});
await prisma.person.upsert({
where: { id: '240da2ec-2d40-4e49-8df4-9c6a049190ef' },
where: { id: 'twenty-240da2ec-2d40-4e49-8df4-9c6a049190ef' },
update: {},
create: {
id: '240da2ec-2d40-4e49-8df4-9c6a049190ef',
id: 'twenty-240da2ec-2d40-4e49-8df4-9c6a049190ef',
firstname: 'Madison',
lastname: 'Perez',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
phone: '+33788901234',
city: 'Seattle',
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
companyId: 'twenty-0d940997-c21e-4ec2-873b-de4264d89025',
email: 'madison.perez@google.com',
},
});
await prisma.person.upsert({
where: { id: '240da2ec-2d40-4e49-8df4-9c6a049190df' },
where: { id: 'twenty-240da2ec-2d40-4e49-8df4-9c6a049190df' },
update: {},
create: {
id: '240da2ec-2d40-4e49-8df4-9c6a049190df',
id: 'twenty-240da2ec-2d40-4e49-8df4-9c6a049190df',
firstname: 'Bertrand',
lastname: 'Voulzy',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
phone: '+33788901234',
city: 'Seattle',
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
companyId: 'twenty-0d940997-c21e-4ec2-873b-de4264d89025',
email: 'bertrand.voulzy@google.com',
},
});
await prisma.person.upsert({
where: { id: '240da2ec-2d40-4e49-8df4-9c6a049190dg' },
where: { id: 'twenty-240da2ec-2d40-4e49-8df4-9c6a049190dg' },
update: {},
create: {
id: '240da2ec-2d40-4e49-8df4-9c6a049190dg',
id: 'twenty-240da2ec-2d40-4e49-8df4-9c6a049190dg',
firstname: 'Louis',
lastname: 'Duss',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
phone: '+33788901234',
city: 'Seattle',
companyId: '0d940997-c21e-4ec2-873b-de4264d89025',
companyId: 'twenty-0d940997-c21e-4ec2-873b-de4264d89025',
email: 'louis.duss@google.com',
},
});
await prisma.person.upsert({
where: { id: '240da2ec-2d40-4e49-8df4-9c6a049190dh' },
where: { id: 'twenty-dev-240da2ec-2d40-4e49-8df4-9c6a049190dh' },
update: {},
create: {
id: '240da2ec-2d40-4e49-8df4-9c6a049190dh',
id: 'twenty-dev-240da2ec-2d40-4e49-8df4-9c6a049190dh',
firstname: 'Lorie',
lastname: 'Vladim',
workspaceId: '7ed9d212-1c25-4d02-bf25-6aeccf7ea420',
workspaceId: 'twenty-dev-7ed9d212-1c25-4d02-bf25-6aeccf7ea420',
phone: '+33788901235',
city: 'Seattle',
companyId: 'a674fa6c-1455-4c57-afaf-dd5dc086361e',
companyId: 'twenty-dev-a674fa6c-1455-4c57-afaf-dd5dc086361e',
email: 'lorie.vladim@google.com',
},
});

View File

@ -0,0 +1,53 @@
import { PrismaClient } from '@prisma/client';
export const seedUsers = async (prisma: PrismaClient) => {
await prisma.user.upsert({
where: { id: 'twenty-ge256b39-3ec3-4fe3-8997-b76aa0bfa408' },
update: {},
create: {
id: 'twenty-ge256b39-3ec3-4fe3-8997-b76aa0bfa408',
displayName: 'Charles Bochet',
email: 'charles@test.com',
locale: 'en',
workspaceMember: {
create: {
id: 'twenty-7ef9d213-1c25-4d02-bf35-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
},
},
},
});
await prisma.user.upsert({
where: { id: 'twenty-gk256b39-3ec3-4fe3-8997-b76aa0bfa408' },
update: {},
create: {
id: 'twenty-gk256b39-3ec3-4fe3-8997-b76aa0bfa408',
displayName: 'Félix Malfait',
email: 'felix@test.com',
locale: 'en',
workspaceMember: {
create: {
id: 'twenty-7ed9d213-1c25-4d02-bf35-6aeccf7ea419',
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
},
},
},
});
await prisma.user.upsert({
where: { id: 'twenty-dev-gk256b39-3ec3-4fe3-8997-b76aa0boa408' },
update: {},
create: {
id: 'twenty-dev-gk256b39-3ec3-4fe3-8997-b76aa0boa408',
displayName: 'Charles Bochet Dev',
email: 'charles-dev@test.com',
locale: 'en',
workspaceMember: {
create: {
id: 'twenty-dev-7ed9d213-1c25-4d02-bf35-6aeccf7oa419',
workspaceId: 'twenty-dev-7ed9d212-1c25-4d02-bf25-6aeccf7ea420',
},
},
},
});
};

File diff suppressed because one or more lines are too long