-
Notifications
You must be signed in to change notification settings - Fork 2.5k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Browse files
Browse the repository at this point in the history
* Add message seed data * Change order of attributes * add personIds * fix messageParticipants attributes * add imports in data-seed-dev-workspace * Update messageParticipant.ts Delete comments --------- Co-authored-by: Charles Bochet <[email protected]>
- Loading branch information
1 parent
9dda6a8
commit d2b237e
Showing
7 changed files
with
461 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
64 changes: 64 additions & 0 deletions
64
packages/twenty-server/src/database/typeorm-seeds/workspace/connectedAccount.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { DataSource } from 'typeorm'; | ||
|
||
const tableName = 'connectedAccount'; | ||
|
||
export const seedConnectedAccount = async ( | ||
workspaceDataSource: DataSource, | ||
schemaName: string, | ||
) => { | ||
await workspaceDataSource | ||
.createQueryBuilder() | ||
.insert() | ||
.into(`${schemaName}.${tableName}`, [ | ||
'id', | ||
'createdAt', | ||
'updatedAt', | ||
'deletedAt', | ||
'lastSyncHistoryId', | ||
'accountOwnerId', | ||
'refreshToken', | ||
'accessToken', | ||
'provider', | ||
'handle', | ||
]) | ||
.orIgnore() | ||
.values([ | ||
{ | ||
id: '6773281b-9ac0-4390-9a1a-ab4d2c4e1bb7', | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
deletedAt: null, | ||
lastSyncHistoryId: 'exampleLastSyncHistory', | ||
accountOwnerId: '20202020-0687-4c41-b707-ed1bfca972a7', | ||
refreshToken: 'exampleRefreshToken', | ||
accessToken: 'exampleAccessToken', | ||
provider: 'google', | ||
handle: 'incoming', | ||
}, | ||
{ | ||
id: '67373de8-0cc8-4d60-a3a4-803245698908', | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
deletedAt: null, | ||
lastSyncHistoryId: 'exampleLastSyncHistory', | ||
accountOwnerId: '20202020-77d5-4cb6-b60a-f4a835a85d61', | ||
refreshToken: 'exampleRefreshToken', | ||
accessToken: 'exampleAccessToken', | ||
provider: 'google', | ||
handle: 'incoming', | ||
}, | ||
{ | ||
id: 'f2a8cf93-cafc-4323-908d-e5b42ad69fdf', | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
deletedAt: null, | ||
lastSyncHistoryId: 'exampleLastSyncHistory', | ||
accountOwnerId: '20202020-1553-45c6-a028-5a9064cce07f', | ||
refreshToken: 'exampleRefreshToken', | ||
accessToken: 'exampleAccessToken', | ||
provider: 'google', | ||
handle: 'incoming', | ||
}, | ||
]) | ||
.execute(); | ||
}; |
64 changes: 64 additions & 0 deletions
64
packages/twenty-server/src/database/typeorm-seeds/workspace/message.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
import { DataSource } from 'typeorm'; | ||
|
||
const tableName = 'message'; | ||
|
||
export const seedMessage = async ( | ||
workspaceDataSource: DataSource, | ||
schemaName: string, | ||
) => { | ||
await workspaceDataSource | ||
.createQueryBuilder() | ||
.insert() | ||
.into(`${schemaName}.${tableName}`, [ | ||
'id', | ||
'createdAt', | ||
'updatedAt', | ||
'deletedAt', | ||
'receivedAt', | ||
'text', | ||
'subject', | ||
'direction', | ||
'messageThreadId', | ||
'headerMessageId', | ||
]) | ||
.orIgnore() | ||
.values([ | ||
{ | ||
id: '99ef24a8-2b8a-405d-8f42-e820ca921421', | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
deletedAt: null, | ||
receivedAt: new Date(), | ||
text: 'Hello, \n I hope this email finds you well. I am writing to request a meeting. I believe it would be beneficial for both parties to collaborate and explore potential opportunities. Would you be available for a meeting sometime next week? Please let me know your availability, and I will arrange a suitable time. \n Looking forward to your response.\n Best regards', | ||
subject: 'Meeting Request', | ||
direction: 'outgoing', | ||
messageThreadId: 'f66b3db3-8bfa-453b-b99b-bc435a7d4da8', | ||
headerMessageId: '99ef24a8-2b8a-405d-8f42-e820ca921421', | ||
}, | ||
{ | ||
id: '8f804a9a-04c8-4f24-93f2-764948e95014', | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
deletedAt: null, | ||
receivedAt: new Date(), | ||
text: 'Good Morning,\n I am writing to inquire about information. Could you please provide me with details regarding this topic? \n Your assistance in this matter would be greatly appreciated. Thank you in advance for your prompt response. \n Best regards,Tim', | ||
subject: 'Inquiry Regarding Topic', | ||
direction: 'outgoing', | ||
messageThreadId: 'a05c4e4c-634a-4fde-aa7c-28a0eaf203ca', | ||
headerMessageId: '8f804a9a-04c8-4f24-93f2-764948e95014', | ||
}, | ||
{ | ||
id: '3939d68a-ac6b-4f86-87a2-5f5f9d1b6481', | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
deletedAt: null, | ||
receivedAt: new Date(), | ||
text: 'Good Evening,\nI wanted to extend my sincere gratitude for taking the time to meet with me earlier today. It was a pleasure discussing with you, and I am excited about the potential opportunities for collaboration. \n Please feel free to reach out if you have any further questions or require additional information. I look forward to our continued communication. Best regards.', | ||
subject: 'Thank You for the Meeting', | ||
direction: 'incoming', | ||
messageThreadId: 'f66b3db3-8bfa-453b-b99b-bc435a7d4da8', | ||
headerMessageId: '3939d68a-ac6b-4f86-87a2-5f5f9d1b6481', | ||
}, | ||
]) | ||
.execute(); | ||
}; |
93 changes: 93 additions & 0 deletions
93
packages/twenty-server/src/database/typeorm-seeds/workspace/messageChannel.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,93 @@ | ||
import { DataSource } from 'typeorm'; | ||
|
||
const tableName = 'messageChannel'; | ||
|
||
export const seedMessageChannel = async ( | ||
workspaceDataSource: DataSource, | ||
schemaName: string, | ||
) => { | ||
await workspaceDataSource | ||
.createQueryBuilder() | ||
.insert() | ||
.into(`${schemaName}.${tableName}`, [ | ||
'id', | ||
'createdAt', | ||
'updatedAt', | ||
'deletedAt', | ||
'isContactAutoCreationEnabled', | ||
'type', | ||
'connectedAccountId', | ||
'handle', | ||
'visibility', | ||
]) | ||
.orIgnore() | ||
.values([ | ||
{ | ||
id: '815e647f-9b80-4c2c-a597-383db48de1d6', | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
deletedAt: null, | ||
isContactAutoCreationEnabled: true, | ||
type: 'email', | ||
connectedAccountId: '6773281b-9ac0-4390-9a1a-ab4d2c4e1bb7', | ||
handle: 'outgoing', | ||
visibility: 'share_everything', | ||
}, | ||
{ | ||
id: 'cc2a5b92-09ed-4eb9-8b23-62aa4fd81d83', | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
deletedAt: null, | ||
isContactAutoCreationEnabled: true, | ||
type: 'email', | ||
connectedAccountId: '6773281b-9ac0-4390-9a1a-ab4d2c4e1bb7', | ||
handle: 'incoming', | ||
visibility: 'share_everything', | ||
}, | ||
{ | ||
id: '756118c6-5ffe-4b32-814a-983d5e4911cd', | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
deletedAt: null, | ||
isContactAutoCreationEnabled: true, | ||
type: 'email', | ||
connectedAccountId: '67373de8-0cc8-4d60-a3a4-803245698908', | ||
handle: 'outgoing', | ||
visibility: 'share_everything', | ||
}, | ||
{ | ||
id: '24b91637-9dad-4329-8180-62647a2d7510', | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
deletedAt: null, | ||
isContactAutoCreationEnabled: true, | ||
type: 'email', | ||
connectedAccountId: '67373de8-0cc8-4d60-a3a4-803245698908', | ||
handle: 'incoming', | ||
visibility: 'share_everything', | ||
}, | ||
{ | ||
id: '3991bcbc-e2f1-49b5-85d2-5d3a3386990c', | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
deletedAt: null, | ||
isContactAutoCreationEnabled: true, | ||
type: 'email', | ||
connectedAccountId: 'f2a8cf93-cafc-4323-908d-e5b42ad69fdf', | ||
handle: 'outgoing', | ||
visibility: 'share_everything', | ||
}, | ||
{ | ||
id: '6cbf78c7-fdff-438f-9132-7d5f216dfc4d', | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
deletedAt: null, | ||
isContactAutoCreationEnabled: true, | ||
type: 'email', | ||
connectedAccountId: 'f2a8cf93-cafc-4323-908d-e5b42ad69fdf', | ||
handle: 'incoming', | ||
visibility: 'share_everything', | ||
}, | ||
]) | ||
.execute(); | ||
}; |
60 changes: 60 additions & 0 deletions
60
...es/twenty-server/src/database/typeorm-seeds/workspace/messageChannelMessageAssociation.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,60 @@ | ||
import { DataSource } from 'typeorm'; | ||
|
||
const tableName = 'messageChannelMessageAssociation'; | ||
|
||
export const seedMessageChannelMessageAssociation = async ( | ||
workspaceDataSource: DataSource, | ||
schemaName: string, | ||
) => { | ||
await workspaceDataSource | ||
.createQueryBuilder() | ||
.insert() | ||
.into(`${schemaName}.${tableName}`, [ | ||
'id', | ||
'createdAt', | ||
'updatedAt', | ||
'deletedAt', | ||
'messageThreadExternalId', | ||
'messageThreadId', | ||
'messageExternalId', | ||
'messageId', | ||
'messageChannelId', | ||
]) | ||
.orIgnore() | ||
.values([ | ||
{ | ||
id: '067fb2c8-cc69-44ef-a82c-600c0dbf39ba', | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
deletedAt: null, | ||
messageThreadExternalId: null, | ||
messageThreadId: 'f66b3db3-8bfa-453b-b99b-bc435a7d4da8', | ||
messageExternalId: null, | ||
messageId: '99ef24a8-2b8a-405d-8f42-e820ca921421', | ||
messageChannelId: '815e647f-9b80-4c2c-a597-383db48de1d6', | ||
}, | ||
{ | ||
id: '736e9516-d80e-4a13-b10b-72ba09082668', | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
deletedAt: null, | ||
messageThreadExternalId: null, | ||
messageThreadId: 'a05c4e4c-634a-4fde-aa7c-28a0eaf203ca', | ||
messageExternalId: null, | ||
messageId: '8f804a9a-04c8-4f24-93f2-764948e95014', | ||
messageChannelId: '815e647f-9b80-4c2c-a597-383db48de1d6', | ||
}, | ||
{ | ||
id: 'bb9a3fb8-e6ec-4c8a-b431-0901eaf395a9', | ||
createdAt: new Date(), | ||
updatedAt: new Date(), | ||
deletedAt: null, | ||
messageThreadExternalId: null, | ||
messageThreadId: 'f66b3db3-8bfa-453b-b99b-bc435a7d4da8', | ||
messageExternalId: null, | ||
messageId: '3939d68a-ac6b-4f86-87a2-5f5f9d1b6481', | ||
messageChannelId: '815e647f-9b80-4c2c-a597-383db48de1d6', | ||
}, | ||
]) | ||
.execute(); | ||
}; |
Oops, something went wrong.