From 41cc4965e2902db819648e54f210267f6bafbc2e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Malfait?= Date: Sat, 8 Jul 2023 08:22:51 +0200 Subject: [PATCH] Autosave local storage and commentThreadcount --- .vscode/settings.json | 1 + front/src/generated/graphql.tsx | 20 ++++---- .../components/CommentThreadCreateMode.tsx | 18 +++++-- .../components/CommentThreadEditMode.tsx | 31 ++++++++++-- .../RightDrawerCreateCommentThread.tsx | 49 +++++++++++++++++-- .../modules/comments/components/Timeline.tsx | 13 +++-- front/src/modules/comments/services/select.ts | 2 + .../components/CompanyEditableNameCell.tsx | 4 +- .../src/modules/companies/services/select.ts | 2 +- front/src/modules/companies/services/show.ts | 2 +- .../components/EditablePeopleFullName.tsx | 4 +- front/src/modules/people/services/select.ts | 2 +- front/src/modules/ui/themes/themes.ts | 2 + front/src/testing/mock-data/companies.ts | 16 +++--- front/src/testing/mock-data/people.ts | 10 ++-- .../resolvers/comment-thread.resolver.ts | 18 ++++--- .../company/company-relations.resolver.ts | 14 +++--- .../core/person/person-relations.resolver.ts | 14 +++--- server/src/database/seeds/comments.ts | 6 +-- 19 files changed, 158 insertions(+), 70 deletions(-) diff --git a/.vscode/settings.json b/.vscode/settings.json index 9696c8c8077..2311f191663 100644 --- a/.vscode/settings.json +++ b/.vscode/settings.json @@ -31,6 +31,7 @@ "!javascript", "!json", "!typescript", + "!typescriptreact", "md", "mdx" ], diff --git a/front/src/generated/graphql.tsx b/front/src/generated/graphql.tsx index 7c63f6cb43a..0bc1bdcdaa9 100644 --- a/front/src/generated/graphql.tsx +++ b/front/src/generated/graphql.tsx @@ -630,7 +630,7 @@ export enum CommentableType { export type Company = { __typename?: 'Company'; - _commentCount: Scalars['Int']; + _commentThreadCount: Scalars['Int']; accountOwner?: Maybe; accountOwnerId?: Maybe; address: Scalars['String']; @@ -1149,7 +1149,7 @@ export type NullableStringFieldUpdateOperationsInput = { export type Person = { __typename?: 'Person'; - _commentCount: Scalars['Int']; + _commentThreadCount: Scalars['Int']; city: Scalars['String']; commentThreads: Array; comments: Array; @@ -1941,7 +1941,7 @@ export type GetCommentThreadQueryVariables = Exact<{ }>; -export type GetCommentThreadQuery = { __typename?: 'Query', findManyCommentThreads: Array<{ __typename?: 'CommentThread', id: string, createdAt: string, author: { __typename?: 'User', id: string, firstName: string, lastName: string }, comments?: Array<{ __typename?: 'Comment', id: string, body: string, createdAt: string, updatedAt: string, author: { __typename?: 'User', id: string, displayName: string, firstName: string, lastName: string, avatarUrl?: string | null } }> | null, commentThreadTargets?: Array<{ __typename?: 'CommentThreadTarget', id: string, commentableId: string, commentableType: CommentableType }> | null }> }; +export type GetCommentThreadQuery = { __typename?: 'Query', findManyCommentThreads: Array<{ __typename?: 'CommentThread', id: string, createdAt: string, body?: string | null, title?: string | null, author: { __typename?: 'User', id: string, firstName: string, lastName: string }, comments?: Array<{ __typename?: 'Comment', id: string, body: string, createdAt: string, updatedAt: string, author: { __typename?: 'User', id: string, displayName: string, firstName: string, lastName: string, avatarUrl?: string | null } }> | null, commentThreadTargets?: Array<{ __typename?: 'CommentThreadTarget', id: string, commentableId: string, commentableType: CommentableType }> | null }> }; export type AddCommentThreadTargetOnCommentThreadMutationVariables = Exact<{ commentThreadId: Scalars['String']; @@ -1975,14 +1975,14 @@ export type GetCompaniesQueryVariables = Exact<{ }>; -export type GetCompaniesQuery = { __typename?: 'Query', companies: Array<{ __typename?: 'Company', id: string, domainName: string, name: string, createdAt: string, address: string, employees?: number | null, _commentCount: number, accountOwner?: { __typename?: 'User', id: string, email: string, displayName: string, firstName: string, lastName: string } | null }> }; +export type GetCompaniesQuery = { __typename?: 'Query', companies: Array<{ __typename?: 'Company', id: string, domainName: string, name: string, createdAt: string, address: string, employees?: number | null, _commentThreadCount: number, accountOwner?: { __typename?: 'User', id: string, email: string, displayName: string, firstName: string, lastName: string } | null }> }; export type GetCompanyQueryVariables = Exact<{ id: Scalars['String']; }>; -export type GetCompanyQuery = { __typename?: 'Query', findUniqueCompany: { __typename?: 'Company', id: string, domainName: string, name: string, createdAt: string, address: string, employees?: number | null, _commentCount: number, accountOwner?: { __typename?: 'User', id: string, email: string, displayName: string } | null } }; +export type GetCompanyQuery = { __typename?: 'Query', findUniqueCompany: { __typename?: 'Company', id: string, domainName: string, name: string, createdAt: string, address: string, employees?: number | null, _commentThreadCount: number, accountOwner?: { __typename?: 'User', id: string, email: string, displayName: string } | null } }; export type UpdateCompanyMutationVariables = Exact<{ id?: InputMaybe; @@ -2023,7 +2023,7 @@ export type GetPeopleQueryVariables = Exact<{ }>; -export type GetPeopleQuery = { __typename?: 'Query', people: Array<{ __typename?: 'Person', id: string, phone: string, email: string, city: string, firstName: string, lastName: string, createdAt: string, _commentCount: number, company?: { __typename?: 'Company', id: string, name: string, domainName: string } | null }> }; +export type GetPeopleQuery = { __typename?: 'Query', people: Array<{ __typename?: 'Person', id: string, phone: string, email: string, city: string, firstName: string, lastName: string, createdAt: string, _commentThreadCount: number, company?: { __typename?: 'Company', id: string, name: string, domainName: string } | null }> }; export type UpdatePeopleMutationVariables = Exact<{ id?: InputMaybe; @@ -2521,6 +2521,8 @@ export const GetCommentThreadDocument = gql` findManyCommentThreads(where: {id: {equals: $commentThreadId}}) { id createdAt + body + title author { id firstName @@ -2712,7 +2714,7 @@ export const GetCompaniesDocument = gql` createdAt address employees - _commentCount + _commentThreadCount accountOwner { id email @@ -2761,7 +2763,7 @@ export const GetCompanyDocument = gql` createdAt address employees - _commentCount + _commentThreadCount accountOwner { id email @@ -2940,7 +2942,7 @@ export const GetPeopleDocument = gql` firstName lastName createdAt - _commentCount + _commentThreadCount company { id name diff --git a/front/src/modules/comments/components/CommentThreadCreateMode.tsx b/front/src/modules/comments/components/CommentThreadCreateMode.tsx index c320a329800..d3d0a999bbd 100644 --- a/front/src/modules/comments/components/CommentThreadCreateMode.tsx +++ b/front/src/modules/comments/components/CommentThreadCreateMode.tsx @@ -65,18 +65,26 @@ const StyledEditableTitleInput = styled.input` export function CommentThreadCreateMode({ commentableEntityArray, + editor, + title, + handleTitleChange, }: { commentableEntityArray: CommentableEntity[]; + editor: BlockNoteEditor | null; + title: string; + handleTitleChange: (newTitle: string) => void; }) { - const editor: BlockNoteEditor | null = useBlockNote({ - theme: 'light', - }); - return ( - + ) => + handleTitleChange(event.target.value) + } + /> } diff --git a/front/src/modules/comments/components/CommentThreadEditMode.tsx b/front/src/modules/comments/components/CommentThreadEditMode.tsx index 87993f54ebd..2cd3d7a15c2 100644 --- a/front/src/modules/comments/components/CommentThreadEditMode.tsx +++ b/front/src/modules/comments/components/CommentThreadEditMode.tsx @@ -1,5 +1,7 @@ -import { BlockNoteEditor } from '@blocknote/core'; +import React, { useState } from 'react'; +import { BlockNoteEditor, PartialBlock } from '@blocknote/core'; import { BlockNoteView, useBlockNote } from '@blocknote/react'; +import { useTheme } from '@emotion/react'; import styled from '@emotion/styled'; import { PropertyBox } from '@/ui/components/property-box/PropertyBox'; @@ -78,11 +80,29 @@ export function CommentThreadEditMode({ skip: !commentThreadId, }); + const [editorReady, setEditorReady] = useState(false); + + console.log(); + const editor: BlockNoteEditor | null = useBlockNote({ - theme: 'light', - // initialContent: commentThread.body, + theme: useTheme().name === 'light' ? 'light' : 'dark', + initialContent: undefined, + onEditorContentChange: (editor) => { + // Todo: save operation here + console.log('save'); + }, + onEditorReady: (editor) => { + setEditorReady(true); + }, }); + React.useEffect(() => { + if (editorReady && data?.findManyCommentThreads[0]?.body) { + const newContent = JSON.parse(data.findManyCommentThreads[0].body); + editor?.replaceBlocks(editor.topLevelBlocks, newContent); + } + }, [data, editor, editorReady]); + if (typeof data?.findManyCommentThreads[0] === 'undefined') { return null; } @@ -95,7 +115,10 @@ export function CommentThreadEditMode({ - + } diff --git a/front/src/modules/comments/components/RightDrawerCreateCommentThread.tsx b/front/src/modules/comments/components/RightDrawerCreateCommentThread.tsx index a65306b0754..65b563399a3 100644 --- a/front/src/modules/comments/components/RightDrawerCreateCommentThread.tsx +++ b/front/src/modules/comments/components/RightDrawerCreateCommentThread.tsx @@ -1,4 +1,8 @@ +import { useEffect, useState } from 'react'; import { getOperationName } from '@apollo/client/utilities'; +import { BlockNoteEditor } from '@blocknote/core'; +import { useBlockNote } from '@blocknote/react'; +import { useTheme } from '@emotion/react'; import { useRecoilState, useRecoilValue } from 'recoil'; import { v4 } from 'uuid'; @@ -20,6 +24,8 @@ import { commentableEntityArrayState } from '../states/commentableEntityArraySta import { CommentThreadCreateMode } from './CommentThreadCreateMode'; export function RightDrawerCreateCommentThread() { + const [title, setTitle] = useState(''); + const [commentableEntityArray] = useRecoilState(commentableEntityArrayState); const openRightDrawer = useOpenRightDrawer(); @@ -29,8 +35,10 @@ export function RightDrawerCreateCommentThread() { const currentUser = useRecoilValue(currentUserState); - function handleNewCommentThread(commentText: string) { - if (!isNonEmptyString(commentText)) { + const identifier = JSON.stringify(commentableEntityArray); + + function handleNewCommentThread(title: string, body: string) { + if (!(isNonEmptyString(title) || isNonEmptyString(body))) { return; } @@ -44,7 +52,7 @@ export function RightDrawerCreateCommentThread() { createCommentThreadWithComment({ variables: { authorId: currentUser.id, - commentText: commentText, + commentText: body, commentThreadId: v4(), createdAt: new Date().toISOString(), commentThreadTargetArray: commentableEntityArray.map( @@ -64,19 +72,52 @@ export function RightDrawerCreateCommentThread() { onCompleted(data) { // TODO : redirect to drawer comment thread with data.createOneCommentThread.id openRightDrawer('comments'); + localStorage.setItem('editorTitle' + identifier, ''); + localStorage.setItem('editorBody' + identifier, ''); }, }); } + const initialBody: string | null = localStorage.getItem( + 'editorBody' + identifier, + ); + + const editor: BlockNoteEditor | null = useBlockNote({ + theme: useTheme().name === 'light' ? 'light' : 'dark', + initialContent: initialBody ? JSON.parse(initialBody) : undefined, + onEditorContentChange: (editor) => { + localStorage.setItem( + 'editorBody' + identifier, + JSON.stringify(editor.topLevelBlocks), + ); + }, + }); + + useEffect(() => { + const initialTitle: string = + localStorage.getItem('editorTitle' + identifier) ?? ''; + setTitle(initialTitle); + }, [identifier]); + + function onTitleUpdate(newTitle: string) { + setTitle(newTitle); + localStorage.setItem('editorTitle' + identifier, newTitle); + } + return ( handleNewCommentThread('text')} + onClick={() => + handleNewCommentThread(title, JSON.stringify(editor?.topLevelBlocks)) + } /> diff --git a/front/src/modules/comments/components/Timeline.tsx b/front/src/modules/comments/components/Timeline.tsx index af9cae6d22d..21279b1a602 100644 --- a/front/src/modules/comments/components/Timeline.tsx +++ b/front/src/modules/comments/components/Timeline.tsx @@ -2,6 +2,7 @@ import { Tooltip } from 'react-tooltip'; import styled from '@emotion/styled'; import { IconNotes, IconPlus } from '@/ui/icons/index'; +import { useOpenRightDrawer } from '@/ui/layout/right-drawer/hooks/useOpenRightDrawer'; import { beautifyExactDate, beautifyPastDateRelativeToNow, @@ -181,7 +182,7 @@ export function Timeline({ entity }: { entity: CommentableEntity }) { }, }); - const openRightDrawer = useOpenCommentThreadRightDrawer(); + const openCommentThreadRightDrawer = useOpenCommentThreadRightDrawer(); const commentThreads: CommentThreadForDrawer[] = queryResult?.findManyCommentThreads ?? []; @@ -204,6 +205,8 @@ export function Timeline({ entity }: { entity: CommentableEntity }) { ); const exactCreatedAt = beautifyExactDate(commentThread.createdAt); + console.log(JSON.parse(commentThread.body ?? '')[0].content[0].text); + return ( <> @@ -242,9 +245,13 @@ export function Timeline({ entity }: { entity: CommentableEntity }) { - openRightDrawer(commentThread.id)}> + openCommentThreadRightDrawer(commentThread.id)} + > {commentThread.title} - {commentThread.body} + + {JSON.parse(commentThread.body ?? '')[0].content[0].text} + diff --git a/front/src/modules/comments/services/select.ts b/front/src/modules/comments/services/select.ts index e04712be9dc..82b4851f179 100644 --- a/front/src/modules/comments/services/select.ts +++ b/front/src/modules/comments/services/select.ts @@ -49,6 +49,8 @@ export const GET_COMMENT_THREAD = gql` findManyCommentThreads(where: { id: { equals: $commentThreadId } }) { id createdAt + body + title author { id firstName diff --git a/front/src/modules/companies/components/CompanyEditableNameCell.tsx b/front/src/modules/companies/components/CompanyEditableNameCell.tsx index 8eb47220409..410941a5eee 100644 --- a/front/src/modules/companies/components/CompanyEditableNameCell.tsx +++ b/front/src/modules/companies/components/CompanyEditableNameCell.tsx @@ -13,7 +13,7 @@ import CompanyChip from './CompanyChip'; type OwnProps = { company: Pick< GetCompaniesQuery['companies'][0], - 'id' | 'name' | 'domainName' | '_commentCount' | 'accountOwner' + 'id' | 'name' | 'domainName' | '_commentThreadCount' | 'accountOwner' >; }; @@ -51,7 +51,7 @@ export function CompanyEditableNameChipCell({ company }: OwnProps) { ChipComponent={CompanyChip} rightEndContents={[ , ]} diff --git a/front/src/modules/companies/services/select.ts b/front/src/modules/companies/services/select.ts index 96373225b80..1077d33341f 100644 --- a/front/src/modules/companies/services/select.ts +++ b/front/src/modules/companies/services/select.ts @@ -22,7 +22,7 @@ export const GET_COMPANIES = gql` createdAt address employees - _commentCount + _commentThreadCount accountOwner { id email diff --git a/front/src/modules/companies/services/show.ts b/front/src/modules/companies/services/show.ts index 1370b760b83..da4db603f25 100644 --- a/front/src/modules/companies/services/show.ts +++ b/front/src/modules/companies/services/show.ts @@ -11,7 +11,7 @@ export const GET_COMPANY = gql` createdAt address employees - _commentCount + _commentThreadCount accountOwner { id email diff --git a/front/src/modules/people/components/EditablePeopleFullName.tsx b/front/src/modules/people/components/EditablePeopleFullName.tsx index be7ca60daad..a0c8ee2d017 100644 --- a/front/src/modules/people/components/EditablePeopleFullName.tsx +++ b/front/src/modules/people/components/EditablePeopleFullName.tsx @@ -9,7 +9,7 @@ import { CommentableType, Person } from '~/generated/graphql'; import { PersonChip } from './PersonChip'; type OwnProps = { - person: Pick; + person: Pick; onChange: (firstName: string, lastName: string) => void; }; @@ -63,7 +63,7 @@ export function EditablePeopleFullName({ person, onChange }: OwnProps) { diff --git a/front/src/modules/people/services/select.ts b/front/src/modules/people/services/select.ts index 2b1d1d39c9a..1a732d1fb96 100644 --- a/front/src/modules/people/services/select.ts +++ b/front/src/modules/people/services/select.ts @@ -24,7 +24,7 @@ export const GET_PEOPLE = gql` firstName lastName createdAt - _commentCount + _commentThreadCount company { id name diff --git a/front/src/modules/ui/themes/themes.ts b/front/src/modules/ui/themes/themes.ts index 22eb1eb5b39..49fa50fd9e7 100644 --- a/front/src/modules/ui/themes/themes.ts +++ b/front/src/modules/ui/themes/themes.ts @@ -32,6 +32,7 @@ export const lightTheme = { selectedCardHover: color.blue20, selectedCard: color.blue10, font: fontLight, + name: 'light', }, }; export type ThemeType = typeof lightTheme; @@ -45,6 +46,7 @@ export const darkTheme: ThemeType = { selectedCardHover: color.blue70, selectedCard: color.blue80, font: fontDark, + name: 'dark', }, }; diff --git a/front/src/testing/mock-data/companies.ts b/front/src/testing/mock-data/companies.ts index a535c717203..2a8cb16ec19 100644 --- a/front/src/testing/mock-data/companies.ts +++ b/front/src/testing/mock-data/companies.ts @@ -9,7 +9,7 @@ type MockedCompany = Pick< | 'createdAt' | 'address' | 'employees' - | '_commentCount' + | '_commentThreadCount' > & { accountOwner: Pick< User, @@ -25,7 +25,7 @@ export const mockedCompaniesData: Array = [ createdAt: '2023-04-26T10:08:54.724515+00:00', address: '17 rue de clignancourt', employees: 12, - _commentCount: 1, + _commentThreadCount: 1, accountOwner: { email: 'charles@test.com', displayName: 'Charles Test', @@ -43,7 +43,7 @@ export const mockedCompaniesData: Array = [ createdAt: '2023-04-26T10:12:42.33625+00:00', address: '', employees: 1, - _commentCount: 1, + _commentThreadCount: 1, accountOwner: null, __typename: 'Company', }, @@ -54,7 +54,7 @@ export const mockedCompaniesData: Array = [ createdAt: '2023-04-26T10:10:32.530184+00:00', address: '', employees: 1, - _commentCount: 1, + _commentThreadCount: 1, accountOwner: null, __typename: 'Company', }, @@ -65,7 +65,7 @@ export const mockedCompaniesData: Array = [ createdAt: '2023-03-21T06:30:25.39474+00:00', address: '', employees: 10, - _commentCount: 0, + _commentThreadCount: 0, accountOwner: null, __typename: 'Company', }, @@ -76,7 +76,7 @@ export const mockedCompaniesData: Array = [ createdAt: '2023-04-26T10:13:29.712485+00:00', address: '10 rue de la Paix', employees: 1, - _commentCount: 2, + _commentThreadCount: 2, accountOwner: null, __typename: 'Company', }, @@ -87,7 +87,7 @@ export const mockedCompaniesData: Array = [ createdAt: '2023-04-26T10:09:25.656555+00:00', address: '', employees: 1, - _commentCount: 13, + _commentThreadCount: 13, accountOwner: null, __typename: 'Company', }, @@ -98,7 +98,7 @@ export const mockedCompaniesData: Array = [ createdAt: '2023-04-26T10:09:25.656555+00:00', address: '', employees: 1, - _commentCount: 1, + _commentThreadCount: 1, accountOwner: null, __typename: 'Company', }, diff --git a/front/src/testing/mock-data/people.ts b/front/src/testing/mock-data/people.ts index da76f50c47a..9531d011fae 100644 --- a/front/src/testing/mock-data/people.ts +++ b/front/src/testing/mock-data/people.ts @@ -9,7 +9,7 @@ type MockedPerson = Pick< | '__typename' | 'phone' | 'city' - | '_commentCount' + | '_commentThreadCount' | 'createdAt' > & { company: Pick; @@ -29,7 +29,7 @@ export const mockedPeopleData: Array = [ __typename: 'Company', }, phone: '06 12 34 56 78', - _commentCount: 1, + _commentThreadCount: 1, createdAt: '2023-04-20T13:20:09.158312+00:00', city: 'Paris', @@ -47,7 +47,7 @@ export const mockedPeopleData: Array = [ __typename: 'Company', }, phone: '06 12 34 56 78', - _commentCount: 1, + _commentThreadCount: 1, createdAt: '2023-04-20T13:20:09.158312+00:00', city: 'Paris', @@ -65,7 +65,7 @@ export const mockedPeopleData: Array = [ __typename: 'Company', }, phone: '06 12 34 56 78', - _commentCount: 1, + _commentThreadCount: 1, createdAt: '2023-04-20T13:20:09.158312+00:00', city: 'Paris', @@ -83,7 +83,7 @@ export const mockedPeopleData: Array = [ __typename: 'Company', }, phone: '06 12 34 56 78', - _commentCount: 2, + _commentThreadCount: 2, createdAt: '2023-04-20T13:20:09.158312+00:00', city: 'Paris', diff --git a/server/src/core/comment/resolvers/comment-thread.resolver.ts b/server/src/core/comment/resolvers/comment-thread.resolver.ts index 53b982eb1d9..27ee88107a5 100644 --- a/server/src/core/comment/resolvers/comment-thread.resolver.ts +++ b/server/src/core/comment/resolvers/comment-thread.resolver.ts @@ -45,19 +45,25 @@ export class CommentThreadResolver { @PrismaSelector({ modelName: 'CommentThread' }) prismaSelect: PrismaSelect<'CommentThread'>, ): Promise> { - const newCommentData = args.data.comments?.createMany?.data + /*const newCommentData = args.data.comments?.createMany?.data ? args.data.comments?.createMany?.data?.map((comment) => ({ ...comment, ...{ workspaceId: workspace.id }, })) : []; + + TODO: check/discuss (strange bug) + + */ + + const createData = { + ...args.data, + // comments: { createMany: { data: newCommentData } }, + workspace: { connect: { id: workspace.id } }, + }; const createdCommentThread = await this.commentThreadService.create({ - data: { - ...args.data, - ...{ comments: { createMany: { data: newCommentData } } }, - ...{ workspace: { connect: { id: workspace.id } } }, - }, + data: createData, select: prismaSelect.value, }); diff --git a/server/src/core/company/company-relations.resolver.ts b/server/src/core/company/company-relations.resolver.ts index 3f38af17cee..5f84259647b 100644 --- a/server/src/core/company/company-relations.resolver.ts +++ b/server/src/core/company/company-relations.resolver.ts @@ -63,15 +63,13 @@ export class CompanyRelationsResolver { @ResolveField(() => Int, { nullable: false, }) - async _commentCount(@Root() company: Company): Promise { - return this.commentService.count({ + async _commentThreadCount(@Root() company: Company): Promise { + return this.commentThreadService.count({ where: { - commentThread: { - commentThreadTargets: { - some: { - commentableId: company.id, - commentableType: 'Company', - }, + commentThreadTargets: { + some: { + commentableId: company.id, + commentableType: 'Company', }, }, }, diff --git a/server/src/core/person/person-relations.resolver.ts b/server/src/core/person/person-relations.resolver.ts index 5681e2d8670..0e9e0e2c150 100644 --- a/server/src/core/person/person-relations.resolver.ts +++ b/server/src/core/person/person-relations.resolver.ts @@ -63,15 +63,13 @@ export class PersonRelationsResolver { @ResolveField(() => Int, { nullable: false, }) - async _commentCount(@Root() person: Person): Promise { - return this.commentService.count({ + async _commentThreadCount(@Root() person: Person): Promise { + return this.commentThreadService.count({ where: { - commentThread: { - commentThreadTargets: { - some: { - commentableId: person.id, - commentableType: 'Person', - }, + commentThreadTargets: { + some: { + commentableId: person.id, + commentableType: 'Person', }, }, }, diff --git a/server/src/database/seeds/comments.ts b/server/src/database/seeds/comments.ts index a3464a3cf84..18cfe3522a7 100644 --- a/server/src/database/seeds/comments.ts +++ b/server/src/database/seeds/comments.ts @@ -7,7 +7,7 @@ export const seedComments = async (prisma: PrismaClient) => { id: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb400', workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419', title: 'Performance update', - body: 'In the North American region, we have observed a strong growth rate of 18% in sales. Europe followed suit with a significant 14% increase, while Asia-Pacific sustained its performance with a steady 10% rise. Special kudos to the North American team for the excellent work done in penetrating new markets and establishing stronger footholds in the existing ones.', + body: '[{"id":"555df0c3-ab88-4c62-abae-c9b557c37c5b","type":"paragraph","props":{"textColor":"default","backgroundColor":"default","textAlignment":"left"},"content":[{"type":"text","text":"In the North American region, we have observed a strong growth rate of 18% in sales. Europe followed suit with a significant 14% increase, while Asia-Pacific sustained its performance with a steady 10% rise. Special kudos to the North American team for the excellent work done in penetrating new markets and establishing stronger footholds in the existing ones.","styles":{}}],"children":[]},{"id":"13530934-b3ce-4332-9238-3760aa4acb3e","type":"paragraph","props":{"textColor":"default","backgroundColor":"default","textAlignment":"left"},"content":[],"children":[]}]', authorId: 'twenty-ge256b39-3ec3-4fe3-8997-b76aa0bfa408', }, }); @@ -54,7 +54,7 @@ export const seedComments = async (prisma: PrismaClient) => { id: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfc408', workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419', title: 'Buyout Proposal', - body: 'We are considering the potential acquisition of [Company], a leading company in [Industry/Specific Technology]. This company has demonstrated remarkable success and pioneering advancements in their field, paralleling our own commitment to progress. By integrating their expertise with our own, we believe that we can amplify our growth, broaden our offerings, and fortify our position at the forefront of technology. This prospective partnership could help to ensure our continued leadership in the industry and allow us to deliver even more innovative solutions for our customers.', + body: '[{"id":"333df0c3-ab88-4c62-abae-c9b557c37c5b","type":"paragraph","props":{"textColor":"default","backgroundColor":"default","textAlignment":"left"},"content":[{"type":"text","text":"We are considering the potential acquisition of [Company], a leading company in [Industry/Specific Technology]. This company has demonstrated remarkable success and pioneering advancements in their field, paralleling our own commitment to progress. By integrating their expertise with our own, we believe that we can amplify our growth, broaden our offerings, and fortify our position at the forefront of technology. This prospective partnership could help to ensure our continued leadership in the industry and allow us to deliver even more innovative solutions for our customers.","styles":{}}],"children":[]},{"id":"13530934-b3ce-4332-9238-3760aa4acb3e","type":"paragraph","props":{"textColor":"default","backgroundColor":"default","textAlignment":"left"},"content":[],"children":[]}]', authorId: 'twenty-ge256b39-3ec3-4fe3-8997-b76aa0bfa408', }, }); @@ -89,7 +89,7 @@ export const seedComments = async (prisma: PrismaClient) => { id: 'twenty-dev-fe256b39-3ec3-4fe3-8997-b76aaabfb408', workspaceId: 'twenty-dev-7ed9d212-1c25-4d02-bf25-6aeccf7ea420', title: 'Call summary', - body: 'Valuation & Due Diligence: The CFO highlighted the financial implications, pointing out that the acquisition will be accretive to earnings. The M&A team has been directed to commence due diligence and work closely with legal counsel to assess all aspects of the acquisition.', + body: '[{"id":"555df0c3-ab88-4c62-abae-c9b557c37c5b","type":"paragraph","props":{"textColor":"default","backgroundColor":"default","textAlignment":"left"},"content":[{"type":"text","text":"Valuation & Due Diligence: The CFO highlighted the financial implications, pointing out that the acquisition will be accretive to earnings. The M&A team has been directed to commence due diligence and work closely with legal counsel to assess all aspects of the acquisition.","styles":{}}],"children":[]},{"id":"13530934-b3ce-4332-9238-3760aa4acb3e","type":"paragraph","props":{"textColor":"default","backgroundColor":"default","textAlignment":"left"},"content":[],"children":[]}]', authorId: 'twenty-dev-gk256b39-3ec3-4fe3-8997-b76aa0boa408', }, });