Refactor seed to use twenty-standard application (#16598)
# Introduction In this pull-request we introduce a service dedicated to the twenty-standard app installation, we will later be able to re-use existing logic to be more generic and allow any app installation. For the moment sticking to this usage https://github.com/twentyhq/core-team-issues/issues/1995 ## Encountered issues - We decided not to migrate deprecated fields ( also they will become custom field for any existing workspace having them in the future ) - duplicate criteria - wrong search index declaration - forgotten isSearchable - Attachement seed - Restored standardId ## Note For the moment we're still searching through standardId for code that run on both existing and new workspaces. For code running on new workspace exclusively we're searching using universalIdentifier We will standardize universalIdentifier usage later when we've migratred all the existing workspaces ## Workspace creation Will handle workspace creation the same way in another PR Related https://github.com/twentyhq/twenty/pull/15065 ## TODO - [ ] Double all frontend hardcoded queries to not refer to deprecated fields especially attachments
This commit is contained in:
+4
-36
@@ -11,10 +11,7 @@ type AttachmentDataSeed = {
|
||||
id: string;
|
||||
name: string;
|
||||
fullPath: string;
|
||||
type: string;
|
||||
fileCategory?: string;
|
||||
// Deprecated: Use createdBy instead
|
||||
authorId: string | null;
|
||||
fileCategory: string;
|
||||
createdBySource: string;
|
||||
createdByWorkspaceMemberId: string;
|
||||
createdByName: string;
|
||||
@@ -29,9 +26,7 @@ export const ATTACHMENT_DATA_SEED_COLUMNS: (keyof AttachmentDataSeed)[] = [
|
||||
'id',
|
||||
'name',
|
||||
'fullPath',
|
||||
'type',
|
||||
'fileCategory',
|
||||
'authorId', // Deprecated: kept for backward compatibility during migration
|
||||
'createdBySource',
|
||||
'createdByWorkspaceMemberId',
|
||||
'createdByName',
|
||||
@@ -71,152 +66,128 @@ const FILE_NAME_VARIATIONS = [
|
||||
// Documents
|
||||
{
|
||||
name: 'Service Agreement.pdf',
|
||||
type: 'TextDocument',
|
||||
fileCategory: 'TEXT_DOCUMENT',
|
||||
pathIndex: 0,
|
||||
},
|
||||
{
|
||||
name: 'NDA Document.pdf',
|
||||
type: 'TextDocument',
|
||||
fileCategory: 'TEXT_DOCUMENT',
|
||||
pathIndex: 0,
|
||||
},
|
||||
{
|
||||
name: 'Project Proposal.pdf',
|
||||
type: 'TextDocument',
|
||||
fileCategory: 'TEXT_DOCUMENT',
|
||||
pathIndex: 0,
|
||||
},
|
||||
{
|
||||
name: 'Invoice Q1 2024.pdf',
|
||||
type: 'TextDocument',
|
||||
fileCategory: 'TEXT_DOCUMENT',
|
||||
pathIndex: 0,
|
||||
},
|
||||
{
|
||||
name: 'Meeting Notes.pdf',
|
||||
type: 'TextDocument',
|
||||
fileCategory: 'TEXT_DOCUMENT',
|
||||
pathIndex: 0,
|
||||
},
|
||||
{
|
||||
name: 'Report Final.pdf',
|
||||
type: 'TextDocument',
|
||||
fileCategory: 'TEXT_DOCUMENT',
|
||||
pathIndex: 0,
|
||||
},
|
||||
{
|
||||
name: 'Contract Signed.pdf',
|
||||
type: 'TextDocument',
|
||||
fileCategory: 'TEXT_DOCUMENT',
|
||||
pathIndex: 0,
|
||||
},
|
||||
// Spreadsheets
|
||||
{
|
||||
name: 'Financial Forecast.xlsx',
|
||||
type: 'Spreadsheet',
|
||||
fileCategory: 'SPREADSHEET',
|
||||
pathIndex: 1,
|
||||
},
|
||||
{
|
||||
name: 'Sales Report Q4.xlsx',
|
||||
type: 'Spreadsheet',
|
||||
fileCategory: 'SPREADSHEET',
|
||||
pathIndex: 1,
|
||||
},
|
||||
{
|
||||
name: 'Team Roster.xlsx',
|
||||
type: 'Spreadsheet',
|
||||
fileCategory: 'SPREADSHEET',
|
||||
pathIndex: 1,
|
||||
},
|
||||
{
|
||||
name: 'Expense Report.xlsx',
|
||||
type: 'Spreadsheet',
|
||||
fileCategory: 'SPREADSHEET',
|
||||
pathIndex: 1,
|
||||
},
|
||||
{
|
||||
name: 'Inventory List.xlsx',
|
||||
type: 'Spreadsheet',
|
||||
fileCategory: 'SPREADSHEET',
|
||||
pathIndex: 1,
|
||||
},
|
||||
{
|
||||
name: 'Data Export.csv',
|
||||
type: 'Spreadsheet',
|
||||
fileCategory: 'SPREADSHEET',
|
||||
pathIndex: 1,
|
||||
},
|
||||
// Presentations
|
||||
{
|
||||
name: 'Pitch Deck.pptx',
|
||||
type: 'Presentation',
|
||||
fileCategory: 'PRESENTATION',
|
||||
pathIndex: 2,
|
||||
},
|
||||
{
|
||||
name: 'Q4 Results.pptx',
|
||||
type: 'Presentation',
|
||||
fileCategory: 'PRESENTATION',
|
||||
pathIndex: 2,
|
||||
},
|
||||
{
|
||||
name: 'Roadmap 2024.pptx',
|
||||
type: 'Presentation',
|
||||
fileCategory: 'PRESENTATION',
|
||||
pathIndex: 2,
|
||||
},
|
||||
{
|
||||
name: 'Company Overview.pptx',
|
||||
type: 'Presentation',
|
||||
fileCategory: 'PRESENTATION',
|
||||
pathIndex: 2,
|
||||
},
|
||||
{
|
||||
name: 'Training Materials.pptx',
|
||||
type: 'Presentation',
|
||||
fileCategory: 'PRESENTATION',
|
||||
pathIndex: 2,
|
||||
},
|
||||
// Images
|
||||
{
|
||||
name: 'Company Logo.png',
|
||||
type: 'Image',
|
||||
fileCategory: 'IMAGE',
|
||||
pathIndex: 3,
|
||||
},
|
||||
{
|
||||
name: 'Product Photo.jpg',
|
||||
type: 'Image',
|
||||
fileCategory: 'IMAGE',
|
||||
pathIndex: 3,
|
||||
},
|
||||
{ name: 'Diagram.png', type: 'Image', fileCategory: 'IMAGE', pathIndex: 3 },
|
||||
{ name: 'Wireframe.png', type: 'Image', fileCategory: 'IMAGE', pathIndex: 3 },
|
||||
{ name: 'Diagram.png', fileCategory: 'IMAGE', pathIndex: 3 },
|
||||
{ name: 'Wireframe.png', fileCategory: 'IMAGE', pathIndex: 3 },
|
||||
{
|
||||
name: 'Mockup Design.png',
|
||||
type: 'Image',
|
||||
fileCategory: 'IMAGE',
|
||||
pathIndex: 3,
|
||||
},
|
||||
{ name: 'Headshot.jpg', type: 'Image', fileCategory: 'IMAGE', pathIndex: 3 },
|
||||
{ name: 'Headshot.jpg', fileCategory: 'IMAGE', pathIndex: 3 },
|
||||
// Archives
|
||||
{
|
||||
name: 'Project Files.zip',
|
||||
type: 'Archive',
|
||||
fileCategory: 'ARCHIVE',
|
||||
pathIndex: 4,
|
||||
},
|
||||
{
|
||||
name: 'Backup Data.zip',
|
||||
type: 'Archive',
|
||||
fileCategory: 'ARCHIVE',
|
||||
pathIndex: 4,
|
||||
},
|
||||
{
|
||||
name: 'Source Code.zip',
|
||||
type: 'Archive',
|
||||
fileCategory: 'ARCHIVE',
|
||||
pathIndex: 4,
|
||||
},
|
||||
@@ -276,10 +247,7 @@ const GENERATE_ATTACHMENT_SEEDS = (): AttachmentDataSeed[] => {
|
||||
id: ATTACHMENT_DATA_SEED_IDS[`ID_${INDEX}`],
|
||||
name: NAME_VARIATION.name,
|
||||
fullPath: FILE_PATH,
|
||||
type: NAME_VARIATION.type,
|
||||
fileCategory: NAME_VARIATION.fileCategory,
|
||||
// Deprecated: Use createdBy fields instead
|
||||
authorId: WORKSPACE_MEMBER_DATA_SEED_IDS.TIM,
|
||||
createdBySource: FieldActorSource.MANUAL,
|
||||
createdByWorkspaceMemberId: WORKSPACE_MEMBER_DATA_SEED_IDS.TIM,
|
||||
createdByName: 'Tim A',
|
||||
|
||||
Reference in New Issue
Block a user