mirror of
https://github.com/twentyhq/twenty.git
synced 2024-11-22 11:43:34 +03:00
Migrate standard objects (#2439)
* Migrate standard objects * Add migrations * fix relation * fix: register RelationMetadataType enum * fix: correctly fix null relation --------- Co-authored-by: corentin <corentin@twenty.com> Co-authored-by: Jérémy Magrin <jeremy.magrin@gmail.com>
This commit is contained in:
parent
c7568ff28b
commit
9a109758c8
1
.vscode/settings.json
vendored
1
.vscode/settings.json
vendored
@ -42,4 +42,5 @@
|
||||
"cSpell.words": [
|
||||
"twentyhq"
|
||||
],
|
||||
"typescript.preferences.importModuleSpecifier": "non-relative"
|
||||
}
|
@ -449,6 +449,7 @@ export enum FieldMetadataType {
|
||||
Date = 'DATE',
|
||||
Email = 'EMAIL',
|
||||
Enum = 'ENUM',
|
||||
Probability = 'PROBABILITY',
|
||||
Money = 'MONEY',
|
||||
Number = 'NUMBER',
|
||||
Phone = 'PHONE',
|
||||
|
@ -180,37 +180,3 @@ export const companiesAvailableFieldDefinitions: ColumnDefinition<FieldMetadata>
|
||||
infoTooltipContent: 'The company Twitter account.',
|
||||
} satisfies ColumnDefinition<FieldURLMetadata>,
|
||||
];
|
||||
|
||||
export const suppliersAvailableColumnDefinitions: ColumnDefinition<FieldMetadata>[] =
|
||||
[
|
||||
{
|
||||
fieldMetadataId: 'name',
|
||||
label: 'Name',
|
||||
Icon: IconBuildingSkyscraper,
|
||||
size: 180,
|
||||
position: 0,
|
||||
type: 'TEXT',
|
||||
metadata: {
|
||||
fieldName: 'name',
|
||||
placeHolder: 'Company Name',
|
||||
},
|
||||
isVisible: true,
|
||||
infoTooltipContent: 'The company name.',
|
||||
basePathToShowPage: '/companies/',
|
||||
} satisfies ColumnDefinition<FieldTextMetadata>,
|
||||
{
|
||||
fieldMetadataId: 'city',
|
||||
label: 'City',
|
||||
Icon: IconBuildingSkyscraper,
|
||||
size: 180,
|
||||
position: 0,
|
||||
type: 'TEXT',
|
||||
metadata: {
|
||||
fieldName: 'city',
|
||||
placeHolder: 'Company Name',
|
||||
},
|
||||
isVisible: true,
|
||||
infoTooltipContent: 'The company name.',
|
||||
basePathToShowPage: '/companies/',
|
||||
} satisfies ColumnDefinition<FieldTextMetadata>,
|
||||
];
|
||||
|
@ -14,29 +14,21 @@ export const ObjectMetadataNavItems = () => {
|
||||
|
||||
return (
|
||||
<>
|
||||
{objectMetadataItems
|
||||
.filter(
|
||||
(objectMetadataItem) =>
|
||||
objectMetadataItem.isActive &&
|
||||
!objectMetadataItem.namePlural.endsWith('V2'),
|
||||
)
|
||||
.map((objectMetadataItem) => {
|
||||
return (
|
||||
<NavItem
|
||||
key={objectMetadataItem.id}
|
||||
label={objectMetadataItem.labelPlural}
|
||||
to={`/objects/${objectMetadataItem.namePlural}`}
|
||||
Icon={
|
||||
objectMetadataItem.icon
|
||||
? icons[objectMetadataItem.icon]
|
||||
: Icon123
|
||||
}
|
||||
onClick={() => {
|
||||
navigate(`/objects/${objectMetadataItem.namePlural}`);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
{objectMetadataItems.map((objectMetadataItem) => {
|
||||
return (
|
||||
<NavItem
|
||||
key={objectMetadataItem.id}
|
||||
label={objectMetadataItem.labelPlural}
|
||||
to={`/objects/${objectMetadataItem.namePlural}`}
|
||||
Icon={
|
||||
objectMetadataItem.icon ? icons[objectMetadataItem.icon] : Icon123
|
||||
}
|
||||
onClick={() => {
|
||||
navigate(`/objects/${objectMetadataItem.namePlural}`);
|
||||
}}
|
||||
/>
|
||||
);
|
||||
})}
|
||||
</>
|
||||
);
|
||||
};
|
||||
|
@ -13,6 +13,7 @@ const defaultFieldValues: Record<FieldMetadataType, unknown> = {
|
||||
[FieldMetadataType.Email]: '',
|
||||
[FieldMetadataType.Enum]: null,
|
||||
[FieldMetadataType.Number]: null,
|
||||
[FieldMetadataType.Probability]: null,
|
||||
[FieldMetadataType.Relation]: null,
|
||||
[FieldMetadataType.Phone]: '',
|
||||
[FieldMetadataType.Text]: '',
|
||||
|
@ -47,6 +47,7 @@ export {
|
||||
IconHeartOff,
|
||||
IconHelpCircle,
|
||||
IconHierarchy2,
|
||||
IconLanguage,
|
||||
IconLayoutKanban,
|
||||
IconLayoutSidebarLeftCollapse,
|
||||
IconLayoutSidebarRightCollapse,
|
||||
|
4
server/.vscode/settings.json
vendored
Normal file
4
server/.vscode/settings.json
vendored
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"javascript.preferences.importModuleSpecifier": "non-relative",
|
||||
"typescript.preferences.importModuleSpecifier": "non-relative"
|
||||
}
|
@ -9,14 +9,8 @@ import { TenantMigrationRunnerService } from 'src/tenant-migration-runner/tenant
|
||||
import { seedCompanies } from 'src/database/typeorm-seeds/tenant/companies';
|
||||
import { seedViewFields } from 'src/database/typeorm-seeds/tenant/view-fields';
|
||||
import { seedViews } from 'src/database/typeorm-seeds/tenant/views';
|
||||
import { seedObjectMetadata } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { TypeORMService } from 'src/database/typeorm/typeorm.service';
|
||||
import { seedCompanyFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/company';
|
||||
import { seedViewFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/view';
|
||||
import { seedViewFieldFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/viewField';
|
||||
import { seedViewFilterFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/viewFilter';
|
||||
import { seedViewSortFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/viewSort';
|
||||
import { seedViewRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/view';
|
||||
import { seedMetadataSchema } from 'src/database/typeorm-seeds/metadata';
|
||||
|
||||
// TODO: implement dry-run
|
||||
@Command({
|
||||
@ -25,7 +19,7 @@ import { seedViewRelationMetadata } from 'src/database/typeorm-seeds/metadata/re
|
||||
'Seed tenant with initial data. This command is intended for development only.',
|
||||
})
|
||||
export class DataSeedTenantCommand extends CommandRunner {
|
||||
workspaceId = 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419';
|
||||
workspaceId = '20202020-1c25-4d02-bf25-6aeccf7ea419';
|
||||
|
||||
constructor(
|
||||
@InjectDataSource('metadata')
|
||||
@ -53,15 +47,7 @@ export class DataSeedTenantCommand extends CommandRunner {
|
||||
}
|
||||
|
||||
try {
|
||||
await seedObjectMetadata(this.metadataDataSource, 'metadata');
|
||||
|
||||
await seedCompanyFieldMetadata(this.metadataDataSource, 'metadata');
|
||||
await seedViewFieldMetadata(this.metadataDataSource, 'metadata');
|
||||
await seedViewFieldFieldMetadata(this.metadataDataSource, 'metadata');
|
||||
await seedViewSortFieldMetadata(this.metadataDataSource, 'metadata');
|
||||
await seedViewFilterFieldMetadata(this.metadataDataSource, 'metadata');
|
||||
|
||||
await seedViewRelationMetadata(this.metadataDataSource, 'metadata');
|
||||
await seedMetadataSchema(workspaceDataSource, 'metadata');
|
||||
|
||||
await this.tenantMigrationService.insertStandardMigrations(
|
||||
this.workspaceId,
|
||||
|
@ -5,7 +5,7 @@ export const seedComments = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb400',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
title: 'Performance update',
|
||||
type: 'Note',
|
||||
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":[]}]',
|
||||
@ -21,7 +21,7 @@ export const seedComments = async (prisma: PrismaClient) => {
|
||||
personId: null,
|
||||
companyId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
|
||||
activityId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb400',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
});
|
||||
|
||||
@ -30,7 +30,7 @@ export const seedComments = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb200',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
body: 'Hi Félix ! How do you like your Twenty workspace?',
|
||||
activityId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb400',
|
||||
commentThreadId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb400',
|
||||
@ -43,7 +43,7 @@ export const seedComments = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-fe256b40-3ec3-4fe3-8997-b76aa0bfb200',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
body: 'I love it!',
|
||||
activityId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb400',
|
||||
commentThreadId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb400',
|
||||
@ -56,7 +56,7 @@ export const seedComments = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfc408',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
title: 'Buyout Proposal',
|
||||
type: 'Task',
|
||||
assigneeId: 'twenty-ge256b39-3ec3-4fe3-8997-b76aa0bfa408',
|
||||
@ -74,7 +74,7 @@ export const seedComments = async (prisma: PrismaClient) => {
|
||||
personId: 'twenty-755035db-623d-41fe-92e7-dd45b7c568e1',
|
||||
companyId: null,
|
||||
activityId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfc408',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
});
|
||||
|
||||
@ -83,7 +83,7 @@ export const seedComments = async (prisma: PrismaClient) => {
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfb100',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
body: 'I really like this comment thread feature!',
|
||||
activityId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfc408',
|
||||
commentThreadId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfc408',
|
||||
|
@ -7,7 +7,7 @@ export const seedCompanies = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
|
||||
name: 'Linkedin',
|
||||
domainName: 'linkedin.com',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
@ -18,7 +18,7 @@ export const seedCompanies = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-118995f3-5d81-46d6-bf83-f7fd33ea6102',
|
||||
name: 'Facebook',
|
||||
domainName: 'facebook.com',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
@ -29,7 +29,7 @@ export const seedCompanies = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-04b2e9f5-0713-40a5-8216-82802401d33e',
|
||||
name: 'Qonto',
|
||||
domainName: 'qonto.com',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
@ -40,7 +40,7 @@ export const seedCompanies = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-460b6fb1-ed89-413a-b31a-962986e67bb4',
|
||||
name: 'Microsoft',
|
||||
domainName: 'microsoft.com',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
@ -51,7 +51,7 @@ export const seedCompanies = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-89bb825c-171e-4bcc-9cf7-43448d6fb278',
|
||||
name: 'Airbnb',
|
||||
domainName: 'airbnb.com',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
@ -62,7 +62,7 @@ export const seedCompanies = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-0d940997-c21e-4ec2-873b-de4264d89025',
|
||||
name: 'Google',
|
||||
domainName: 'google.com',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
@ -73,7 +73,7 @@ export const seedCompanies = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-1d3a1c6e-707e-44dc-a1d2-30030bf1a944',
|
||||
name: 'Netflix',
|
||||
domainName: 'netflix.com',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
@ -84,7 +84,7 @@ export const seedCompanies = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-7a93d1e5-3f74-492d-a101-2a70f50a1645',
|
||||
name: 'Libeo',
|
||||
domainName: 'libeo.io',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
@ -96,7 +96,7 @@ export const seedCompanies = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-9d162de6-cfbf-4156-a790-e39854dcd4eb',
|
||||
name: 'Claap',
|
||||
domainName: 'claap.io',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
@ -108,7 +108,7 @@ export const seedCompanies = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-aaffcfbd-f86b-419f-b794-02319abe8637',
|
||||
name: 'Hasura',
|
||||
domainName: 'hasura.io',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
@ -120,7 +120,7 @@ export const seedCompanies = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-f33dc242-5518-4553-9433-42d8eb82834b',
|
||||
name: 'Wework',
|
||||
domainName: 'wework.com',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
@ -132,7 +132,7 @@ export const seedCompanies = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-a7bc68d5-f79e-40dd-bd06-c36e6abb4678',
|
||||
name: 'Samsung',
|
||||
domainName: 'samsung.com',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
@ -143,7 +143,7 @@ export const seedCompanies = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-a674fa6c-1455-4c57-afaf-dd5dc086361d',
|
||||
name: 'Algolia',
|
||||
domainName: 'algolia.com',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
address: '',
|
||||
},
|
||||
});
|
||||
|
@ -1,15 +1,19 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
|
||||
export const SeedDataSourceId = '20202020-7f63-47a9-b1b3-6c7290ca9fb1';
|
||||
export const SeedWorkspaceId = '20202020-1c25-4d02-bf25-6aeccf7ea419';
|
||||
export const SeedWorkspaceSchemaName = 'workspace_1wgvd1injqtife6y4rvfbu3h5';
|
||||
|
||||
export const seedMetadata = async (prisma: PrismaClient) => {
|
||||
await prisma.$queryRawUnsafe(
|
||||
'CREATE SCHEMA IF NOT EXISTS workspace_twenty_7icsva0r6s00mpcp6cwg4w4rd',
|
||||
`CREATE SCHEMA IF NOT EXISTS ${SeedWorkspaceSchemaName}`,
|
||||
);
|
||||
await prisma.$queryRawUnsafe(
|
||||
`INSERT INTO metadata."dataSource"(
|
||||
id, schema, type, "workspaceId"
|
||||
)
|
||||
VALUES (
|
||||
'b37b2163-7f63-47a9-b1b3-6c7290ca9fb1', 'workspace_twenty_7icsva0r6s00mpcp6cwg4w4rd', 'postgres', 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419'
|
||||
'${SeedDataSourceId}', '${SeedWorkspaceSchemaName}', 'postgres', '${SeedWorkspaceId}'
|
||||
) ON CONFLICT DO NOTHING`,
|
||||
);
|
||||
};
|
||||
|
@ -7,7 +7,7 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-86083141-1c0e-494c-a1b6-85b1c6fefaa5',
|
||||
firstName: 'Christoph',
|
||||
lastName: 'Callisto',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33789012345',
|
||||
city: 'Seattle',
|
||||
companyId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
|
||||
@ -22,7 +22,7 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-0aa00beb-ac73-4797-824e-87a1f5aea9e0',
|
||||
firstName: 'Sylvie',
|
||||
lastName: 'Palmer',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33780123456',
|
||||
city: 'Los Angeles',
|
||||
companyId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
|
||||
@ -37,7 +37,7 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-93c72d2e-f517-42fd-80ae-14173b3b70ae',
|
||||
firstName: 'Christopher',
|
||||
lastName: 'Gonzalez',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33789012345',
|
||||
city: 'Seattle',
|
||||
companyId: 'twenty-04b2e9f5-0713-40a5-8216-82802401d33e',
|
||||
@ -52,7 +52,7 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-eeeacacf-eee1-4690-ad2c-8619e5b56a2e',
|
||||
firstName: 'Ashley',
|
||||
lastName: 'Parker',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33780123456',
|
||||
city: 'Los Angeles',
|
||||
companyId: 'twenty-04b2e9f5-0713-40a5-8216-82802401d33e',
|
||||
@ -67,7 +67,7 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-9b324a88-6784-4449-afdf-dc62cb8702f2',
|
||||
firstName: 'Nicholas',
|
||||
lastName: 'Wright',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33781234567',
|
||||
city: 'Seattle',
|
||||
companyId: 'twenty-460b6fb1-ed89-413a-b31a-962986e67bb4',
|
||||
@ -82,7 +82,7 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-1d151852-490f-4466-8391-733cfd66a0c8',
|
||||
firstName: 'Isabella',
|
||||
lastName: 'Scott',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33782345678',
|
||||
city: 'New York',
|
||||
companyId: 'twenty-460b6fb1-ed89-413a-b31a-962986e67bb4',
|
||||
@ -97,7 +97,7 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-98406e26-80f1-4dff-b570-a74942528de3',
|
||||
firstName: 'Matthew',
|
||||
lastName: 'Green',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33783456789',
|
||||
city: 'Seattle',
|
||||
companyId: 'twenty-460b6fb1-ed89-413a-b31a-962986e67bb4',
|
||||
@ -112,7 +112,7 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-a2e78a5f-338b-46df-8811-fa08c7d19d35',
|
||||
firstName: 'Elizabeth',
|
||||
lastName: 'Baker',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33784567890',
|
||||
city: 'New York',
|
||||
companyId: 'twenty-89bb825c-171e-4bcc-9cf7-43448d6fb278',
|
||||
@ -127,7 +127,7 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-ca1f5bf3-64ad-4b0e-bbfd-e9fd795b7016',
|
||||
firstName: 'Christopher',
|
||||
lastName: 'Nelson',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33785678901',
|
||||
city: 'San Francisco',
|
||||
companyId: 'twenty-89bb825c-171e-4bcc-9cf7-43448d6fb278',
|
||||
@ -142,7 +142,7 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-56955422-5d54-41b7-ba36-f0d20e1417ae',
|
||||
firstName: 'Avery',
|
||||
lastName: 'Carter',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33786789012',
|
||||
city: 'New York',
|
||||
companyId: 'twenty-89bb825c-171e-4bcc-9cf7-43448d6fb278',
|
||||
@ -157,7 +157,7 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-755035db-623d-41fe-92e7-dd45b7c568e1',
|
||||
firstName: 'Ethan',
|
||||
lastName: 'Mitchell',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33787890123',
|
||||
city: 'Los Angeles',
|
||||
companyId: 'twenty-0d940997-c21e-4ec2-873b-de4264d89025',
|
||||
@ -172,7 +172,7 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-240da2ec-2d40-4e49-8df4-9c6a049190ef',
|
||||
firstName: 'Madison',
|
||||
lastName: 'Perez',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33788901234',
|
||||
city: 'Seattle',
|
||||
companyId: 'twenty-0d940997-c21e-4ec2-873b-de4264d89025',
|
||||
@ -187,7 +187,7 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-240da2ec-2d40-4e49-8df4-9c6a049190df',
|
||||
firstName: 'Bertrand',
|
||||
lastName: 'Voulzy',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33788901234',
|
||||
city: 'Seattle',
|
||||
companyId: 'twenty-0d940997-c21e-4ec2-873b-de4264d89025',
|
||||
@ -202,7 +202,7 @@ export const seedPeople = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-240da2ec-2d40-4e49-8df4-9c6a049190dg',
|
||||
firstName: 'Louis',
|
||||
lastName: 'Duss',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
phone: '+33788901234',
|
||||
city: 'Seattle',
|
||||
companyId: 'twenty-0d940997-c21e-4ec2-873b-de4264d89025',
|
||||
|
@ -7,7 +7,7 @@ export const seedPipelines = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
name: 'Sales pipeline',
|
||||
icon: '💰',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
pipelineProgressableType: 'Company',
|
||||
},
|
||||
});
|
||||
@ -22,7 +22,7 @@ export const seedPipelines = async (prisma: PrismaClient) => {
|
||||
position: 0,
|
||||
type: 'open',
|
||||
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
});
|
||||
|
||||
@ -36,7 +36,7 @@ export const seedPipelines = async (prisma: PrismaClient) => {
|
||||
position: 1,
|
||||
type: 'ongoing',
|
||||
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
});
|
||||
|
||||
@ -50,7 +50,7 @@ export const seedPipelines = async (prisma: PrismaClient) => {
|
||||
position: 2,
|
||||
type: 'ongoing',
|
||||
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
});
|
||||
|
||||
@ -64,7 +64,7 @@ export const seedPipelines = async (prisma: PrismaClient) => {
|
||||
position: 3,
|
||||
type: 'ongoing',
|
||||
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
});
|
||||
|
||||
@ -78,7 +78,7 @@ export const seedPipelines = async (prisma: PrismaClient) => {
|
||||
position: 4,
|
||||
type: 'won',
|
||||
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
});
|
||||
|
||||
@ -90,7 +90,7 @@ export const seedPipelines = async (prisma: PrismaClient) => {
|
||||
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
pipelineStageId: 'twenty-fe256b39-3ec3-4fe3-8998-b76aa0bfb600',
|
||||
companyId: 'twenty-fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
});
|
||||
|
||||
@ -102,7 +102,7 @@ export const seedPipelines = async (prisma: PrismaClient) => {
|
||||
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
pipelineStageId: 'twenty-fe256b39-3ec3-4fe4-8998-b76aa0bfb600',
|
||||
companyId: 'twenty-118995f3-5d81-46d6-bf83-f7fd33ea6102',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
});
|
||||
|
||||
@ -114,7 +114,7 @@ export const seedPipelines = async (prisma: PrismaClient) => {
|
||||
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
pipelineStageId: 'twenty-fe256b39-3ec3-4fe5-8998-b76aa0bfb600',
|
||||
companyId: 'twenty-04b2e9f5-0713-40a5-8216-82802401d33e',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
});
|
||||
|
||||
@ -126,7 +126,7 @@ export const seedPipelines = async (prisma: PrismaClient) => {
|
||||
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b75aa0bfb400',
|
||||
pipelineStageId: 'twenty-fe256b39-3ec3-4fe5-8998-b76aa0bfb600',
|
||||
companyId: 'twenty-460b6fb1-ed89-413a-b31a-962986e67bb4',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
});
|
||||
|
||||
@ -137,7 +137,7 @@ export const seedPipelines = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-fe256b39-3ec3-4fe3-8997-b74aa0bfb400',
|
||||
name: 'Customer support pipeline',
|
||||
icon: '📔',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
pipelineProgressableType: 'Person',
|
||||
},
|
||||
});
|
||||
@ -152,7 +152,7 @@ export const seedPipelines = async (prisma: PrismaClient) => {
|
||||
position: 1,
|
||||
type: 'open',
|
||||
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b74aa0bfb400',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
});
|
||||
|
||||
@ -164,7 +164,7 @@ export const seedPipelines = async (prisma: PrismaClient) => {
|
||||
pipelineId: 'twenty-fe256b39-3ec3-4fe3-8997-b74aa0bfb400',
|
||||
pipelineStageId: 'twenty-fe256b39-3ec3-4fe3-8998-a76aa0bfb600',
|
||||
personId: 'twenty-755035db-623d-41fe-92e7-dd45b7c568e1',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -27,7 +27,7 @@ export const seedUsers = async (prisma: PrismaClient) => {
|
||||
id: 'twenty-7ef9d213-1c25-4d02-bf35-6aeccf7ea419',
|
||||
},
|
||||
create: {
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
settingsId: 'twenty-ge256b39-3ec3-4fe3-8997-9dcb1084c109',
|
||||
},
|
||||
},
|
||||
@ -57,7 +57,7 @@ export const seedUsers = async (prisma: PrismaClient) => {
|
||||
workspaceMember: {
|
||||
create: {
|
||||
id: 'twenty-7ef9d213-1c25-4d02-bf35-6aeccf7ea419',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
settingsId: 'twenty-ge256b39-3ec3-4fe3-8997-2c4a2035a215',
|
||||
},
|
||||
},
|
||||
@ -86,7 +86,7 @@ export const seedUsers = async (prisma: PrismaClient) => {
|
||||
workspaceMember: {
|
||||
create: {
|
||||
id: 'twenty-7ed9d213-1c25-4d02-bf35-6aeccf7ea419',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
settingsId: 'twenty-ge256b39-3ec3-4fe3-8997-8e1f2097b328',
|
||||
},
|
||||
},
|
||||
|
@ -1,10 +1,10 @@
|
||||
import { PrismaClient } from '@prisma/client';
|
||||
export const seedWorkspaces = async (prisma: PrismaClient) => {
|
||||
await prisma.workspace.upsert({
|
||||
where: { id: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419' },
|
||||
where: { id: '20202020-1c25-4d02-bf25-6aeccf7ea419' },
|
||||
update: {},
|
||||
create: {
|
||||
id: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
id: '20202020-1c25-4d02-bf25-6aeccf7ea419',
|
||||
displayName: 'Apple',
|
||||
domainName: 'apple.dev',
|
||||
inviteHash: 'apple.dev-invite-hash',
|
||||
|
@ -0,0 +1,88 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
|
||||
const fieldMetadataTableName = 'fieldMetadata';
|
||||
|
||||
export enum SeedActivityTargetFieldMetadataIds {
|
||||
Activity = '20202020-cb21-42c9-bba8-347f7cb02b84',
|
||||
Person = '20202020-e56c-43e6-8fce-5619d8c2293a',
|
||||
Company = '20202020-9408-4cc0-9fe1-51467edb530b',
|
||||
}
|
||||
|
||||
export const seedActivityTargetFieldMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${fieldMetadataTableName}`, [
|
||||
'id',
|
||||
'objectMetadataId',
|
||||
'isCustom',
|
||||
'workspaceId',
|
||||
'isActive',
|
||||
'type',
|
||||
'name',
|
||||
'label',
|
||||
'targetColumnMap',
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
// Relationships
|
||||
{
|
||||
id: SeedActivityTargetFieldMetadataIds.Activity,
|
||||
objectMetadataId: SeedObjectMetadataIds.ActivityTarget,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'activity',
|
||||
label: 'Activity',
|
||||
targetColumnMap: {
|
||||
value: 'activityId',
|
||||
},
|
||||
description: 'ActivityTarget activity',
|
||||
icon: 'IconNotes',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
id: SeedActivityTargetFieldMetadataIds.Person,
|
||||
objectMetadataId: SeedObjectMetadataIds.ActivityTarget,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'person',
|
||||
label: 'Person',
|
||||
targetColumnMap: {
|
||||
value: 'personId',
|
||||
},
|
||||
description: 'ActivityTarget person',
|
||||
icon: 'IconUser',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedActivityTargetFieldMetadataIds.Company,
|
||||
objectMetadataId: SeedObjectMetadataIds.ActivityTarget,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'company',
|
||||
label: 'Company',
|
||||
targetColumnMap: {
|
||||
value: 'companyId',
|
||||
},
|
||||
description: 'ActivityTarget company',
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
isNullable: true,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
@ -0,0 +1,225 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
|
||||
const fieldMetadataTableName = 'fieldMetadata';
|
||||
|
||||
export enum SeedActivityFieldMetadataIds {
|
||||
Title = '20202020-2584-4797-95a8-5cc90d48c040',
|
||||
Body = '20202020-aff0-4961-be8a-0e5c2598b9a6',
|
||||
Type = '20202020-a243-4b94-a4b4-25705af86be2',
|
||||
ReminderAt = '20202020-cd46-44f4-bf22-b0aa20d009da',
|
||||
DueAt = '20202020-20e1-4366-b386-750bdca2dfe3',
|
||||
CompletedAt = '20202020-0924-48f0-a8c2-d2dd4e2098e2',
|
||||
|
||||
ActivityTargets = '20202020-ec1d-4ffe-8bd2-a85c23ae0037',
|
||||
Comments = '20202020-c85c-47f2-bbe4-6b36c26f9247',
|
||||
Attachments = '20202020-9755-43a8-b621-f94df0f6b839',
|
||||
Author = '20202020-3acb-46bb-b993-0dc49fa2a48c',
|
||||
Assignee = '20202020-4694-4ec6-9084-8d932ebb3065',
|
||||
}
|
||||
|
||||
export const seedActivityFieldMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${fieldMetadataTableName}`, [
|
||||
'id',
|
||||
'objectMetadataId',
|
||||
'isCustom',
|
||||
'workspaceId',
|
||||
'isActive',
|
||||
'type',
|
||||
'name',
|
||||
'label',
|
||||
'targetColumnMap',
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
// Primary identifier
|
||||
{
|
||||
id: SeedActivityFieldMetadataIds.Title,
|
||||
objectMetadataId: SeedObjectMetadataIds.Activity,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'title',
|
||||
label: 'Title',
|
||||
targetColumnMap: {
|
||||
value: 'title',
|
||||
},
|
||||
description: 'Activity title',
|
||||
icon: 'IconNotes',
|
||||
isNullable: true,
|
||||
},
|
||||
|
||||
// Scalar fields
|
||||
{
|
||||
id: SeedActivityFieldMetadataIds.Body,
|
||||
objectMetadataId: SeedObjectMetadataIds.Activity,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'body',
|
||||
label: 'Body',
|
||||
targetColumnMap: {
|
||||
value: 'body',
|
||||
},
|
||||
description: 'Activity body',
|
||||
icon: 'IconList',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedActivityFieldMetadataIds.Type,
|
||||
objectMetadataId: SeedObjectMetadataIds.Activity,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'type',
|
||||
label: 'Type',
|
||||
targetColumnMap: {
|
||||
value: 'type',
|
||||
},
|
||||
description: 'Activity type',
|
||||
icon: 'IconCheckbox',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
id: SeedActivityFieldMetadataIds.ReminderAt,
|
||||
objectMetadataId: SeedObjectMetadataIds.Activity,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'reminderAt',
|
||||
label: 'Reminder Date',
|
||||
targetColumnMap: {
|
||||
value: 'reminderAt',
|
||||
},
|
||||
description: 'Activity reminder date',
|
||||
icon: 'IconCalendarEvent',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedActivityFieldMetadataIds.DueAt,
|
||||
objectMetadataId: SeedObjectMetadataIds.Activity,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'dueAt',
|
||||
label: 'Due Date',
|
||||
targetColumnMap: {
|
||||
value: 'dueAt',
|
||||
},
|
||||
description: 'Activity due date',
|
||||
icon: 'IconCalendarEvent',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedActivityFieldMetadataIds.CompletedAt,
|
||||
objectMetadataId: SeedObjectMetadataIds.Activity,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'completedAt',
|
||||
label: 'Completion Date',
|
||||
targetColumnMap: {
|
||||
value: 'completedAt',
|
||||
},
|
||||
description: 'Activity completion date',
|
||||
icon: 'IconCheck',
|
||||
isNullable: true,
|
||||
},
|
||||
|
||||
// Relationships
|
||||
{
|
||||
id: SeedActivityFieldMetadataIds.ActivityTargets,
|
||||
objectMetadataId: SeedObjectMetadataIds.Activity,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'activityTargets',
|
||||
label: 'Targets',
|
||||
targetColumnMap: {},
|
||||
description: 'Activity targets',
|
||||
icon: 'IconCheckbox',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedActivityFieldMetadataIds.Attachments,
|
||||
objectMetadataId: SeedObjectMetadataIds.Activity,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'attachments',
|
||||
label: 'Attachments',
|
||||
targetColumnMap: {},
|
||||
description: 'Activity attachments',
|
||||
icon: 'IconFileImport',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedActivityFieldMetadataIds.Comments,
|
||||
objectMetadataId: SeedObjectMetadataIds.Activity,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'Comments',
|
||||
label: 'Comments',
|
||||
targetColumnMap: {},
|
||||
description: 'Activity comments',
|
||||
icon: 'IconComment',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedActivityFieldMetadataIds.Author,
|
||||
objectMetadataId: SeedObjectMetadataIds.Activity,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'author',
|
||||
label: 'Author',
|
||||
targetColumnMap: {
|
||||
value: 'authorId',
|
||||
},
|
||||
description:
|
||||
'Activity author. This is the person who created the activity',
|
||||
icon: 'IconUserCircle',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
id: SeedActivityFieldMetadataIds.Assignee,
|
||||
objectMetadataId: SeedObjectMetadataIds.Activity,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'assignee',
|
||||
label: 'Assignee',
|
||||
targetColumnMap: {
|
||||
value: 'assigneeId',
|
||||
},
|
||||
description:
|
||||
'Acitivity assignee. This is the workspace member assigned to the activity ',
|
||||
icon: 'IconUserCircle',
|
||||
isNullable: true,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
@ -0,0 +1,88 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
|
||||
const fieldMetadataTableName = 'fieldMetadata';
|
||||
|
||||
export enum SeedApiKeyFieldMetadataIds {
|
||||
Name = '20202020-1dfa-4ef3-8d19-51e82c28677a',
|
||||
ExpiresAt = '20202020-a092-41e2-940e-e17cd0403aa7',
|
||||
RevokedAt = '20202020-da41-436e-8498-b1a99c23b275',
|
||||
}
|
||||
|
||||
export const seedApiKeyFieldMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${fieldMetadataTableName}`, [
|
||||
'id',
|
||||
'objectMetadataId',
|
||||
'isCustom',
|
||||
'workspaceId',
|
||||
'isActive',
|
||||
'type',
|
||||
'name',
|
||||
'label',
|
||||
'targetColumnMap',
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
// Scalar fields
|
||||
{
|
||||
id: SeedApiKeyFieldMetadataIds.Name,
|
||||
objectMetadataId: SeedObjectMetadataIds.ApiKey,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'name',
|
||||
label: 'Name',
|
||||
targetColumnMap: {
|
||||
value: 'name',
|
||||
},
|
||||
description: 'ApiKey name',
|
||||
icon: 'IconLink',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
id: SeedApiKeyFieldMetadataIds.ExpiresAt,
|
||||
objectMetadataId: SeedObjectMetadataIds.ApiKey,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'expiresAt',
|
||||
label: 'Expiration date',
|
||||
targetColumnMap: {
|
||||
value: 'expiresAt',
|
||||
},
|
||||
description: 'ApiKey expiration date',
|
||||
icon: 'IconCalendar',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
id: SeedApiKeyFieldMetadataIds.RevokedAt,
|
||||
objectMetadataId: SeedObjectMetadataIds.ApiKey,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'revokedAt',
|
||||
label: 'Revocation date',
|
||||
targetColumnMap: {
|
||||
value: 'revokedAt',
|
||||
},
|
||||
description: 'ApiKey revocation date',
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
@ -0,0 +1,160 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
|
||||
const fieldMetadataTableName = 'fieldMetadata';
|
||||
|
||||
export enum SeedAttachmentFieldMetadataIds {
|
||||
Name = '20202020-5683-4c80-8590-255321ece692',
|
||||
FullPath = '20202020-bb72-4644-b255-afb4ebb83b66',
|
||||
Type = '20202020-8dfa-492f-92d1-56d5fb18cbb7',
|
||||
|
||||
Author = '20202020-7831-43c2-827f-bc78289b7398',
|
||||
Activity = '20202020-f5a9-46ec-b39a-eda906f00804',
|
||||
Person = '20202020-f67c-4cc5-893c-c6b615527473',
|
||||
Company = '20202020-5463-4d03-9124-1775b9b7f955',
|
||||
}
|
||||
|
||||
export const seedAttachmentFieldMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${fieldMetadataTableName}`, [
|
||||
'id',
|
||||
'objectMetadataId',
|
||||
'isCustom',
|
||||
'workspaceId',
|
||||
'isActive',
|
||||
'type',
|
||||
'name',
|
||||
'label',
|
||||
'targetColumnMap',
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
// Primary Identifier
|
||||
{
|
||||
id: SeedAttachmentFieldMetadataIds.Name,
|
||||
objectMetadataId: SeedObjectMetadataIds.Attachment,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'name',
|
||||
label: 'Name',
|
||||
targetColumnMap: {
|
||||
value: 'name',
|
||||
},
|
||||
description: 'Attachment name',
|
||||
icon: 'IconFileUpload',
|
||||
isNullable: false,
|
||||
},
|
||||
// Scalar fields
|
||||
{
|
||||
id: SeedAttachmentFieldMetadataIds.FullPath,
|
||||
objectMetadataId: SeedObjectMetadataIds.Attachment,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'fullPath',
|
||||
label: 'Full path',
|
||||
targetColumnMap: {
|
||||
value: 'fullPath',
|
||||
},
|
||||
description: 'Attachment full path',
|
||||
icon: 'IconLink',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
id: SeedAttachmentFieldMetadataIds.Type,
|
||||
objectMetadataId: SeedObjectMetadataIds.Attachment,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'type',
|
||||
label: 'Type',
|
||||
targetColumnMap: {
|
||||
value: 'type',
|
||||
},
|
||||
description: 'Attachment type',
|
||||
icon: 'IconList',
|
||||
isNullable: false,
|
||||
},
|
||||
|
||||
// Relationships
|
||||
{
|
||||
id: SeedAttachmentFieldMetadataIds.Author,
|
||||
objectMetadataId: SeedObjectMetadataIds.Attachment,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'author',
|
||||
label: 'Author',
|
||||
targetColumnMap: {
|
||||
value: 'authorId',
|
||||
},
|
||||
description: 'Attachment author',
|
||||
icon: 'IconCircleUser',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
id: SeedAttachmentFieldMetadataIds.Activity,
|
||||
objectMetadataId: SeedObjectMetadataIds.Attachment,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'activity',
|
||||
label: 'Activity',
|
||||
targetColumnMap: {
|
||||
value: 'activityId',
|
||||
},
|
||||
description: 'Attachment activity',
|
||||
icon: 'IconNotes',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
id: SeedAttachmentFieldMetadataIds.Person,
|
||||
objectMetadataId: SeedObjectMetadataIds.Attachment,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'person',
|
||||
label: 'Person',
|
||||
targetColumnMap: {
|
||||
value: 'personId',
|
||||
},
|
||||
description: 'Attachment person',
|
||||
icon: 'IconUser',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
id: SeedAttachmentFieldMetadataIds.Company,
|
||||
objectMetadataId: SeedObjectMetadataIds.Attachment,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'company',
|
||||
label: 'Company',
|
||||
targetColumnMap: {
|
||||
value: 'companyId',
|
||||
},
|
||||
description: 'Attachment company',
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
isNullable: false,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
@ -0,0 +1,90 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
|
||||
const fieldMetadataTableName = 'fieldMetadata';
|
||||
|
||||
export enum SeedCommentFieldMetadataIds {
|
||||
Body = '20202020-354b-4f10-9425-fa3eb8fddc51',
|
||||
|
||||
Author = '20202020-2c70-40c2-bba6-893780b25d41',
|
||||
Activity = '20202020-a9ac-4294-9462-db0f690da906',
|
||||
}
|
||||
|
||||
export const seedCommentFieldMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${fieldMetadataTableName}`, [
|
||||
'id',
|
||||
'objectMetadataId',
|
||||
'isCustom',
|
||||
'workspaceId',
|
||||
'isActive',
|
||||
'type',
|
||||
'name',
|
||||
'label',
|
||||
'targetColumnMap',
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
// Scalar fields
|
||||
{
|
||||
id: SeedCommentFieldMetadataIds.Body,
|
||||
objectMetadataId: SeedObjectMetadataIds.Comment,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'body',
|
||||
label: 'Body',
|
||||
targetColumnMap: {
|
||||
value: 'body',
|
||||
},
|
||||
description: 'Comment body',
|
||||
icon: 'IconLink',
|
||||
isNullable: false,
|
||||
},
|
||||
// Relationships
|
||||
{
|
||||
id: SeedCommentFieldMetadataIds.Author,
|
||||
objectMetadataId: SeedObjectMetadataIds.Comment,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'author',
|
||||
label: 'Author',
|
||||
targetColumnMap: {
|
||||
value: 'authorId',
|
||||
},
|
||||
description: 'Comment author',
|
||||
icon: 'IconCircleUser',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
id: SeedCommentFieldMetadataIds.Activity,
|
||||
objectMetadataId: SeedObjectMetadataIds.Comment,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'activity',
|
||||
label: 'Activity',
|
||||
targetColumnMap: {
|
||||
value: 'activityId',
|
||||
},
|
||||
description: 'Comment activity',
|
||||
icon: 'IconNotes',
|
||||
isNullable: false,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
@ -1,6 +1,28 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
const tableName = 'fieldMetadata';
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
|
||||
const fieldMetadataTableName = 'fieldMetadata';
|
||||
|
||||
export enum SeedCompanyFieldMetadataIds {
|
||||
Name = '20202020-6d30-4111-9f40-b4301906fd3c',
|
||||
|
||||
DomainName = '20202020-5e4e-4007-a630-8a2617914889',
|
||||
Address = '20202020-ad10-4117-a039-3f04b7a5f939',
|
||||
Employees = '20202020-7fbd-41ad-b64d-25a15ff62f04',
|
||||
LinkedinUrl = '20202020-a61d-4b78-b998-3fd88b4f73a1',
|
||||
XUrl = '20202020-46e3-479a-b8f4-77137c74daa6',
|
||||
AnnualRecurringRevenue = '20202020-4a5a-466f-92d9-c3870d9502a9',
|
||||
IdealCustomerProfile = '20202020-9e9f-4235-98b2-c76f3e2d281e',
|
||||
|
||||
People = '20202020-68b4-4c8e-af19-738eba2a42a5',
|
||||
AccountOwner = '20202020-0739-495d-8e70-c0807f6b2268',
|
||||
ActivityTargets = '20202020-4a2e-4b41-8562-279963e8947e',
|
||||
Opportunities = '20202020-e3fc-46ff-b552-3e757843f06e',
|
||||
Favorites = '20202020-e7c8-4771-8cc4-ce0e8c36a3c0',
|
||||
Attachments = '20202020-61af-4ffd-b79b-baed6db8ad11',
|
||||
}
|
||||
|
||||
export const seedCompanyFieldMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
@ -9,7 +31,8 @@ export const seedCompanyFieldMetadata = async (
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${tableName}`, [
|
||||
.into(`${schemaName}.${fieldMetadataTableName}`, [
|
||||
'id',
|
||||
'objectMetadataId',
|
||||
'isCustom',
|
||||
'workspaceId',
|
||||
@ -24,10 +47,12 @@ export const seedCompanyFieldMetadata = async (
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
// Main Identifier
|
||||
{
|
||||
objectMetadataId: '1a8487a0-480c-434e-b4c7-e22408b97047',
|
||||
id: SeedCompanyFieldMetadataIds.Name,
|
||||
objectMetadataId: SeedObjectMetadataIds.Company,
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'name',
|
||||
@ -35,14 +60,17 @@ export const seedCompanyFieldMetadata = async (
|
||||
targetColumnMap: {
|
||||
value: 'name',
|
||||
},
|
||||
description: 'Name of the company',
|
||||
description: 'The company name',
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
isNullable: false,
|
||||
},
|
||||
|
||||
// Scalar Fields
|
||||
{
|
||||
objectMetadataId: '1a8487a0-480c-434e-b4c7-e22408b97047',
|
||||
id: SeedCompanyFieldMetadataIds.DomainName,
|
||||
objectMetadataId: SeedObjectMetadataIds.Company,
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'domainName',
|
||||
@ -50,14 +78,16 @@ export const seedCompanyFieldMetadata = async (
|
||||
targetColumnMap: {
|
||||
value: 'domainName',
|
||||
},
|
||||
description: 'Domain name of the company',
|
||||
description:
|
||||
'The company website URL. We use this url to fetch the company icon',
|
||||
icon: 'IconLink',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
objectMetadataId: '1a8487a0-480c-434e-b4c7-e22408b97047',
|
||||
id: SeedCompanyFieldMetadataIds.Address,
|
||||
objectMetadataId: SeedObjectMetadataIds.Company,
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'address',
|
||||
@ -65,25 +95,181 @@ export const seedCompanyFieldMetadata = async (
|
||||
targetColumnMap: {
|
||||
value: 'address',
|
||||
},
|
||||
description: 'Address of the company',
|
||||
description: 'The company address',
|
||||
icon: 'IconMap',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
objectMetadataId: '1a8487a0-480c-434e-b4c7-e22408b97047',
|
||||
id: SeedCompanyFieldMetadataIds.Employees,
|
||||
objectMetadataId: SeedObjectMetadataIds.Company,
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: 'NUMBER',
|
||||
name: 'employees',
|
||||
label: 'Employees',
|
||||
targetColumnMap: {
|
||||
value: 'employees',
|
||||
},
|
||||
description: 'Number of employees',
|
||||
description: 'Number of employees in the company',
|
||||
icon: 'IconUsers',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.LinkedinUrl,
|
||||
objectMetadataId: SeedObjectMetadataIds.Company,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'linkedinUrl',
|
||||
label: 'Linkedin',
|
||||
targetColumnMap: {
|
||||
value: 'linkedinUrl',
|
||||
},
|
||||
description: 'The company Linkedin account',
|
||||
icon: 'IconBrandLinkedin',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.XUrl,
|
||||
objectMetadataId: SeedObjectMetadataIds.Company,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'xUrl',
|
||||
label: 'X',
|
||||
targetColumnMap: {
|
||||
value: 'xUrl',
|
||||
},
|
||||
description: 'The company Twitter/X account',
|
||||
icon: 'IconBrandX',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.AnnualRecurringRevenue,
|
||||
objectMetadataId: SeedObjectMetadataIds.Company,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'NUMBER',
|
||||
name: 'annualRecurringRevenue',
|
||||
label: 'ARR',
|
||||
targetColumnMap: {
|
||||
value: 'annualRecurringRevenue',
|
||||
},
|
||||
description:
|
||||
'Annual Recurring Revenue: The actual or estimated annual revenue of the company',
|
||||
icon: 'IconMoneybag',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.IdealCustomerProfile,
|
||||
objectMetadataId: SeedObjectMetadataIds.Company,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'BOOLEAN',
|
||||
name: 'idealCustomerProfile',
|
||||
label: 'ICP',
|
||||
targetColumnMap: {
|
||||
value: 'idealCustomerProfile',
|
||||
},
|
||||
description:
|
||||
'Ideal Customer Profile: Indicates whether the company is the most suitable and valuable customer for you',
|
||||
icon: 'IconTarget',
|
||||
isNullable: true,
|
||||
},
|
||||
|
||||
// Relationships
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.People,
|
||||
objectMetadataId: SeedObjectMetadataIds.Company,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'people',
|
||||
label: 'People',
|
||||
targetColumnMap: {},
|
||||
description: 'People linked to the company.',
|
||||
icon: 'IconUsers',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.AccountOwner,
|
||||
objectMetadataId: SeedObjectMetadataIds.Company,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'accountOwner',
|
||||
label: 'Account Owner',
|
||||
targetColumnMap: {
|
||||
value: 'accountOwnerId',
|
||||
},
|
||||
description:
|
||||
'Your team member responsible for managing the company account',
|
||||
icon: 'IconUserCircle',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.ActivityTargets,
|
||||
objectMetadataId: SeedObjectMetadataIds.Company,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'activityTargets',
|
||||
label: 'Activities',
|
||||
targetColumnMap: {},
|
||||
description: 'Activities tied to the company',
|
||||
icon: 'IconCheckbox',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.Opportunities,
|
||||
objectMetadataId: SeedObjectMetadataIds.Company,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'opportunities',
|
||||
label: 'Opportunities',
|
||||
targetColumnMap: {},
|
||||
description: 'Opportunities linked to the company.',
|
||||
icon: 'IconTargetArrow',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.Favorites,
|
||||
objectMetadataId: SeedObjectMetadataIds.Company,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'favorites',
|
||||
label: 'Favorites',
|
||||
targetColumnMap: {},
|
||||
description: 'Favorites linked to the company',
|
||||
icon: 'IconHeart',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.Attachments,
|
||||
objectMetadataId: SeedObjectMetadataIds.Company,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'attachments',
|
||||
label: 'Attachments',
|
||||
targetColumnMap: {},
|
||||
description: 'Attachments linked to the company.',
|
||||
icon: 'IconFileImport',
|
||||
isNullable: true,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
||||
|
@ -0,0 +1,109 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
|
||||
const fieldMetadataTableName = 'fieldMetadata';
|
||||
|
||||
export enum SeedFavoriteFieldMetadataIds {
|
||||
Position = '20202020-dd6d-4f67-94aa-22cc83eb0a2e',
|
||||
|
||||
WorkspaceMember = '20202020-1138-4e93-bbff-917a68161abf',
|
||||
Person = '20202020-0876-4735-8974-ff4d51aafa07',
|
||||
Company = '20202020-09e1-4384-ae3e-39e7956396fe',
|
||||
}
|
||||
|
||||
export const seedFavoriteFieldMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${fieldMetadataTableName}`, [
|
||||
'id',
|
||||
'objectMetadataId',
|
||||
'isCustom',
|
||||
'workspaceId',
|
||||
'isActive',
|
||||
'type',
|
||||
'name',
|
||||
'label',
|
||||
'targetColumnMap',
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
// Scalar fields
|
||||
|
||||
{
|
||||
id: SeedFavoriteFieldMetadataIds.Position,
|
||||
objectMetadataId: SeedObjectMetadataIds.Favorite,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'position',
|
||||
label: 'Position',
|
||||
targetColumnMap: {
|
||||
value: 'position',
|
||||
},
|
||||
description: 'Favorite position',
|
||||
icon: 'IconList',
|
||||
isNullable: false,
|
||||
},
|
||||
|
||||
// Relationships
|
||||
{
|
||||
id: SeedFavoriteFieldMetadataIds.WorkspaceMember,
|
||||
objectMetadataId: SeedObjectMetadataIds.Favorite,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'workspaceMember',
|
||||
label: 'Workspace Member',
|
||||
targetColumnMap: {
|
||||
value: 'workspaceMemberId',
|
||||
},
|
||||
description: 'Favorite workspace member',
|
||||
icon: 'IconCircleUser',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
id: SeedFavoriteFieldMetadataIds.Person,
|
||||
objectMetadataId: SeedObjectMetadataIds.Favorite,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'person',
|
||||
label: 'Person',
|
||||
targetColumnMap: {
|
||||
value: 'personId',
|
||||
},
|
||||
description: 'Favorite person',
|
||||
icon: 'IconUser',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
id: SeedFavoriteFieldMetadataIds.Company,
|
||||
objectMetadataId: SeedObjectMetadataIds.Favorite,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'company',
|
||||
label: 'Company',
|
||||
targetColumnMap: {
|
||||
value: 'companyId',
|
||||
},
|
||||
description: 'Favorite company',
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
isNullable: false,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
@ -0,0 +1,157 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
|
||||
const fieldMetadataTableName = 'fieldMetadata';
|
||||
|
||||
export enum SeedOpportunityFieldMetadataIds {
|
||||
Amount = '20202020-8c1f-4c83-9a89-7843e586564d',
|
||||
CloseDate = '20202020-de52-4e7b-a298-db7a7553500f',
|
||||
Probability = '20202020-3b9c-4e58-a3d2-c617d3b596b1',
|
||||
|
||||
PipelineStep = '20202020-0a2e-4676-8011-3fdb2c30c258',
|
||||
PointOfContact = '20202020-618e-42da-b3c3-bcd7af76e355',
|
||||
Company = '20202020-31d5-4af5-b016-c61c1c265706',
|
||||
Person = '20202020-0655-41df-b938-15d71e589307',
|
||||
}
|
||||
|
||||
export const seedOpportunityFieldMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${fieldMetadataTableName}`, [
|
||||
'id',
|
||||
'objectMetadataId',
|
||||
'isCustom',
|
||||
'workspaceId',
|
||||
'isActive',
|
||||
'type',
|
||||
'name',
|
||||
'label',
|
||||
'targetColumnMap',
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
// Scalar fields
|
||||
{
|
||||
id: SeedOpportunityFieldMetadataIds.Amount,
|
||||
objectMetadataId: SeedObjectMetadataIds.Opportunity,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'MONEY',
|
||||
name: 'amount',
|
||||
label: 'Amount',
|
||||
targetColumnMap: {
|
||||
value: 'amount',
|
||||
},
|
||||
description: 'Opportunity amount',
|
||||
icon: 'IconCurrencyDollar',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedOpportunityFieldMetadataIds.CloseDate,
|
||||
objectMetadataId: SeedObjectMetadataIds.Opportunity,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'DATE',
|
||||
name: 'closeDate',
|
||||
label: 'Close date',
|
||||
targetColumnMap: {
|
||||
value: 'closeDate',
|
||||
},
|
||||
description: 'Opportunity close date',
|
||||
icon: 'IconCalendarEvent',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedOpportunityFieldMetadataIds.Probability,
|
||||
objectMetadataId: SeedObjectMetadataIds.Opportunity,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'PROBABILITY',
|
||||
name: 'probability',
|
||||
label: 'Probability',
|
||||
targetColumnMap: {
|
||||
value: 'probability',
|
||||
},
|
||||
description: 'Opportunity amount',
|
||||
icon: 'IconProgressCheck',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedOpportunityFieldMetadataIds.PipelineStep,
|
||||
objectMetadataId: SeedObjectMetadataIds.Opportunity,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'pipelineStep',
|
||||
label: 'Pipeline Step',
|
||||
targetColumnMap: {
|
||||
value: 'pipelineStepId',
|
||||
},
|
||||
description: 'Opportunity pipeline step',
|
||||
icon: 'IconKanban',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedOpportunityFieldMetadataIds.PointOfContact,
|
||||
objectMetadataId: SeedObjectMetadataIds.Opportunity,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'pointOfContact',
|
||||
label: 'Point of Contact',
|
||||
targetColumnMap: {
|
||||
value: 'pointOfContactId',
|
||||
},
|
||||
description: 'Opportunity point of contact',
|
||||
icon: 'IconUser',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedOpportunityFieldMetadataIds.Person,
|
||||
objectMetadataId: SeedObjectMetadataIds.Opportunity,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'person',
|
||||
label: 'Person',
|
||||
targetColumnMap: {
|
||||
value: 'personId',
|
||||
},
|
||||
description: 'Opportunity person',
|
||||
icon: 'IconUser',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedOpportunityFieldMetadataIds.Company,
|
||||
objectMetadataId: SeedObjectMetadataIds.Opportunity,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'company',
|
||||
label: 'Company',
|
||||
targetColumnMap: {
|
||||
value: 'companyId',
|
||||
},
|
||||
description: 'Opportunity company',
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
isNullable: true,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
@ -0,0 +1,288 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
|
||||
const fieldMetadataTableName = 'fieldMetadata';
|
||||
|
||||
export enum SeedPersonFieldMetadataIds {
|
||||
FirstName = '20202020-9b56-4888-bfe3-f6f59aa999e3',
|
||||
LastName = '20202020-b784-458a-869d-6c53fa85483d',
|
||||
|
||||
Email = '20202020-8a96-4e4b-86fd-ea126530e0c1',
|
||||
LinkedinUrl = '20202020-dcf6-445a-b543-37e55de43c25',
|
||||
XUrl = '20202020-a3a7-4f63-9303-10226f6055be',
|
||||
JobTitle = '20202020-3b86-413e-ab56-0ebd1a583ff3',
|
||||
Phone = '20202020-486f-45f9-bbdf-aac18b1831c0',
|
||||
City = '20202020-78f8-4b4c-90ff-86adf77590f5',
|
||||
AvatarUrl = '20202020-bb05-45cb-aa2a-71b58d49dd23',
|
||||
|
||||
Company = '20202020-64e1-4080-b6ad-db03c3809885',
|
||||
ContactForOpportunities = '20202020-2c2e-418e-ba2d-d28434ff02a6',
|
||||
Opportunities = '20202020-6bc4-4905-a9d3-4f8d616a19e1',
|
||||
ActivityTargets = '20202020-f285-4115-a46c-116522986b29',
|
||||
Favorites = '20202020-6268-4165-8774-9aaf45db2b25',
|
||||
Attachments = '20202020-5883-4bb3-a308-65271901a1d4',
|
||||
}
|
||||
|
||||
export const seedPersonFieldMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${fieldMetadataTableName}`, [
|
||||
'id',
|
||||
'objectMetadataId',
|
||||
'isCustom',
|
||||
'workspaceId',
|
||||
'isActive',
|
||||
'type',
|
||||
'name',
|
||||
'label',
|
||||
'targetColumnMap',
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
// Main Identifier
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.FirstName,
|
||||
objectMetadataId: SeedObjectMetadataIds.Person,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'firstName',
|
||||
label: 'First name',
|
||||
targetColumnMap: {
|
||||
value: 'firstName',
|
||||
},
|
||||
description: 'Contact’s first name',
|
||||
icon: 'IconUser',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.LastName,
|
||||
objectMetadataId: SeedObjectMetadataIds.Person,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'lastName',
|
||||
label: 'Last name',
|
||||
targetColumnMap: {
|
||||
value: 'lastName',
|
||||
},
|
||||
description: 'Contact’s last name',
|
||||
icon: 'IconUser',
|
||||
isNullable: false,
|
||||
},
|
||||
|
||||
// Scalar Fields
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.Email,
|
||||
objectMetadataId: SeedObjectMetadataIds.Person,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'EMAIL',
|
||||
name: 'email',
|
||||
label: 'Email',
|
||||
targetColumnMap: {
|
||||
value: 'email',
|
||||
},
|
||||
description: 'Contact’s Email',
|
||||
icon: 'IconMail',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.LinkedinUrl,
|
||||
objectMetadataId: SeedObjectMetadataIds.Person,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'URL',
|
||||
name: 'linkedinUrl',
|
||||
label: 'Linkedin',
|
||||
targetColumnMap: {
|
||||
value: 'linkedinUrl',
|
||||
},
|
||||
description: 'Contact’s Linkedin account',
|
||||
icon: 'IconBrandLinkedin',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.XUrl,
|
||||
objectMetadataId: SeedObjectMetadataIds.Person,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'URL',
|
||||
name: 'xUrl',
|
||||
label: 'X',
|
||||
targetColumnMap: {
|
||||
value: 'xUrl',
|
||||
},
|
||||
description: 'Contact’s X/Twitter account',
|
||||
icon: 'IconUser',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.JobTitle,
|
||||
objectMetadataId: SeedObjectMetadataIds.Person,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'jobTitle',
|
||||
label: 'Job Title',
|
||||
targetColumnMap: {
|
||||
value: 'jobTitle',
|
||||
},
|
||||
description: 'Contact’s job title',
|
||||
icon: 'IconBriefcase',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.Phone,
|
||||
objectMetadataId: SeedObjectMetadataIds.Person,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'phone',
|
||||
label: 'Phone',
|
||||
targetColumnMap: {
|
||||
value: 'phone',
|
||||
},
|
||||
description: 'Contact’s phone number',
|
||||
icon: 'IconPhone',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.City,
|
||||
objectMetadataId: SeedObjectMetadataIds.Person,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'city',
|
||||
label: 'City',
|
||||
targetColumnMap: {
|
||||
value: 'city',
|
||||
},
|
||||
description: 'Contact’s city',
|
||||
icon: 'IconMap',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.AvatarUrl,
|
||||
objectMetadataId: SeedObjectMetadataIds.Person,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'avatarUrl',
|
||||
label: 'Avatar',
|
||||
targetColumnMap: {
|
||||
value: 'avatarUrl',
|
||||
},
|
||||
description: 'Contact’s avatar',
|
||||
icon: 'IconFileUpload',
|
||||
isNullable: false,
|
||||
},
|
||||
|
||||
// Relationships
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.Company,
|
||||
objectMetadataId: SeedObjectMetadataIds.Person,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'company',
|
||||
label: 'Company',
|
||||
targetColumnMap: {
|
||||
value: 'companyId',
|
||||
},
|
||||
description: 'Contact’s company',
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.ContactForOpportunities,
|
||||
objectMetadataId: SeedObjectMetadataIds.Person,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'pointOfContactForOpporunities',
|
||||
label: 'POC for Opportunities',
|
||||
targetColumnMap: {},
|
||||
description: 'Point of Contact for Opportuniites',
|
||||
icon: 'IconArrowTarget',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.ActivityTargets,
|
||||
objectMetadataId: SeedObjectMetadataIds.Person,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'activityTargets',
|
||||
label: 'Activities',
|
||||
targetColumnMap: {},
|
||||
description: 'Activities tied to the contact',
|
||||
icon: 'IconCheckbox',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.Opportunities,
|
||||
objectMetadataId: SeedObjectMetadataIds.Person,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'opportunities',
|
||||
label: 'Opportunities',
|
||||
targetColumnMap: {},
|
||||
description: 'Opportunities linked to the contact.',
|
||||
icon: 'IconTargetArrow',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.Favorites,
|
||||
objectMetadataId: SeedObjectMetadataIds.Person,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'favorites',
|
||||
label: 'Favorites',
|
||||
targetColumnMap: {},
|
||||
description: 'Favorites linked to the contact',
|
||||
icon: 'IconHeart',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.Attachments,
|
||||
objectMetadataId: SeedObjectMetadataIds.Person,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'attachments',
|
||||
label: 'Attachments',
|
||||
targetColumnMap: {},
|
||||
description: 'Attachments linked to the contact.',
|
||||
icon: 'IconFileImport',
|
||||
isNullable: true,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
@ -0,0 +1,107 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
|
||||
const fieldMetadataTableName = 'fieldMetadata';
|
||||
|
||||
export enum SeedPipelineStepFieldMetadataIds {
|
||||
Name = '20202020-f294-430e-b800-3a411fc05ad3',
|
||||
Color = '20202020-5b93-4b28-8c45-7988ea68f91b',
|
||||
Position = '20202020-6296-4cab-aafb-121ef5822b13',
|
||||
Opportunities = '20202020-22c4-443a-b114-43c97dda5867',
|
||||
}
|
||||
|
||||
export const seedPipelineStepFieldMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${fieldMetadataTableName}`, [
|
||||
'id',
|
||||
'objectMetadataId',
|
||||
'isCustom',
|
||||
'workspaceId',
|
||||
'isActive',
|
||||
'type',
|
||||
'name',
|
||||
'label',
|
||||
'targetColumnMap',
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
// Main Identifier
|
||||
{
|
||||
id: SeedPipelineStepFieldMetadataIds.Name,
|
||||
objectMetadataId: SeedObjectMetadataIds.PipelineStep,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'name',
|
||||
label: 'Name',
|
||||
targetColumnMap: {
|
||||
value: 'name',
|
||||
},
|
||||
description: 'Pipeline Step name',
|
||||
icon: 'IconCurrencyDollar',
|
||||
isNullable: false,
|
||||
},
|
||||
|
||||
// Scalar Fields
|
||||
{
|
||||
id: SeedPipelineStepFieldMetadataIds.Color,
|
||||
objectMetadataId: SeedObjectMetadataIds.PipelineStep,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'color',
|
||||
label: 'Color',
|
||||
targetColumnMap: {
|
||||
value: 'color',
|
||||
},
|
||||
description: 'Pipeline Step color',
|
||||
icon: 'IconColorSwatch',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
id: SeedPipelineStepFieldMetadataIds.Position,
|
||||
objectMetadataId: SeedObjectMetadataIds.PipelineStep,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'NUMBER',
|
||||
name: 'position',
|
||||
label: 'Position',
|
||||
targetColumnMap: {
|
||||
value: 'position',
|
||||
},
|
||||
description: 'Pipeline Step position',
|
||||
icon: 'IconHierarchy2',
|
||||
isNullable: false,
|
||||
},
|
||||
|
||||
// Relationships
|
||||
{
|
||||
id: SeedPipelineStepFieldMetadataIds.Opportunities,
|
||||
objectMetadataId: SeedObjectMetadataIds.PipelineStep,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'opportunities',
|
||||
label: 'Opportunities',
|
||||
targetColumnMap: {},
|
||||
description: 'Opportunities linked to the step.',
|
||||
icon: 'IconTargetArrow',
|
||||
isNullable: true,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
@ -1,6 +1,17 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
const tableName = 'fieldMetadata';
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
|
||||
const fieldMetadataTableName = 'fieldMetadata';
|
||||
|
||||
export enum SeedViewFieldFieldMetadataIds {
|
||||
FieldMetadataId = '20202020-1a5e-4ac1-9530-c7fff8481b79',
|
||||
IsVisible = '20202020-3aa9-42db-a74d-0fd6b7cb7c4a',
|
||||
Size = '20202020-b9a1-4c2e-a5af-3a6b4fef4af6',
|
||||
Position = '20202020-a4bb-440a-add2-81dbd9a74517',
|
||||
View = '20202020-8788-4508-b771-719807b60e61',
|
||||
}
|
||||
|
||||
export const seedViewFieldFieldMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
@ -9,7 +20,7 @@ export const seedViewFieldFieldMetadata = async (
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${tableName}`, [
|
||||
.into(`${schemaName}.${fieldMetadataTableName}`, [
|
||||
'id',
|
||||
'objectMetadataId',
|
||||
'isCustom',
|
||||
@ -26,9 +37,10 @@ export const seedViewFieldFieldMetadata = async (
|
||||
.orIgnore()
|
||||
.values([
|
||||
{
|
||||
objectMetadataId: '61d9000b-485c-4c48-a22e-0d9a164f9647',
|
||||
id: SeedViewFieldFieldMetadataIds.FieldMetadataId,
|
||||
objectMetadataId: SeedObjectMetadataIds.ViewField,
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'fieldMetadataId',
|
||||
@ -37,27 +49,28 @@ export const seedViewFieldFieldMetadata = async (
|
||||
value: 'fieldMetadataId',
|
||||
},
|
||||
description: 'View Field target field',
|
||||
icon: null,
|
||||
icon: 'IconTag',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
id: 'a9a56210-a154-4965-9ace-c35f6dc43ee5',
|
||||
objectMetadataId: '61d9000b-485c-4c48-a22e-0d9a164f9647',
|
||||
id: SeedViewFieldFieldMetadataIds.View,
|
||||
objectMetadataId: SeedObjectMetadataIds.ViewField,
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'view',
|
||||
label: 'View Id',
|
||||
targetColumnMap: { value: 'viewId' },
|
||||
description: 'View Field related view',
|
||||
icon: null,
|
||||
icon: 'IconLayoutCollage',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectMetadataId: '61d9000b-485c-4c48-a22e-0d9a164f9647',
|
||||
id: SeedViewFieldFieldMetadataIds.IsVisible,
|
||||
objectMetadataId: SeedObjectMetadataIds.ViewField,
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'BOOLEAN',
|
||||
name: 'isVisible',
|
||||
@ -66,13 +79,14 @@ export const seedViewFieldFieldMetadata = async (
|
||||
value: 'isVisible',
|
||||
},
|
||||
description: 'View Field visibility',
|
||||
icon: null,
|
||||
icon: 'IconEye',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectMetadataId: '61d9000b-485c-4c48-a22e-0d9a164f9647',
|
||||
id: SeedViewFieldFieldMetadataIds.Size,
|
||||
objectMetadataId: SeedObjectMetadataIds.ViewField,
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'NUMBER',
|
||||
name: 'size',
|
||||
@ -81,13 +95,14 @@ export const seedViewFieldFieldMetadata = async (
|
||||
value: 'size',
|
||||
},
|
||||
description: 'View Field size',
|
||||
icon: null,
|
||||
icon: 'IconEye',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectMetadataId: '61d9000b-485c-4c48-a22e-0d9a164f9647',
|
||||
id: SeedViewFieldFieldMetadataIds.Position,
|
||||
objectMetadataId: SeedObjectMetadataIds.ViewField,
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'NUMBER',
|
||||
name: 'position',
|
||||
@ -96,7 +111,7 @@ export const seedViewFieldFieldMetadata = async (
|
||||
value: 'position',
|
||||
},
|
||||
description: 'View Field position',
|
||||
icon: null,
|
||||
icon: 'IconList',
|
||||
isNullable: false,
|
||||
},
|
||||
])
|
@ -1,6 +1,17 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
const tableName = 'fieldMetadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
|
||||
const fieldMetadataTableName = 'fieldMetadata';
|
||||
|
||||
export enum SeedViewFilterFieldMetadataIds {
|
||||
FieldMetadataId = '20202020-78bb-4f2b-a052-260bc8efd694',
|
||||
View = '20202020-65e5-4082-829d-8c634c20e7b5',
|
||||
Operand = '20202020-1d12-465d-ab2c-8af008182730',
|
||||
Value = '20202020-8b37-46ae-86b8-14287ec06802',
|
||||
DisplayValue = '20202020-ed89-4892-83fa-d2b2929c6d52',
|
||||
}
|
||||
|
||||
export const seedViewFilterFieldMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
@ -9,7 +20,8 @@ export const seedViewFilterFieldMetadata = async (
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${tableName}`, [
|
||||
.into(`${schemaName}.${fieldMetadataTableName}`, [
|
||||
'id',
|
||||
'objectMetadataId',
|
||||
'isCustom',
|
||||
'workspaceId',
|
||||
@ -26,9 +38,10 @@ export const seedViewFilterFieldMetadata = async (
|
||||
.values([
|
||||
// View Filters
|
||||
{
|
||||
objectMetadataId: '5d9b1ab9-4461-4e2d-bf9e-9b47e68846d3',
|
||||
id: SeedViewFilterFieldMetadataIds.FieldMetadataId,
|
||||
objectMetadataId: SeedObjectMetadataIds.ViewFilter,
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'fieldMetadataId',
|
||||
@ -41,9 +54,10 @@ export const seedViewFilterFieldMetadata = async (
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectMetadataId: '5d9b1ab9-4461-4e2d-bf9e-9b47e68846d3',
|
||||
id: SeedViewFilterFieldMetadataIds.View,
|
||||
objectMetadataId: SeedObjectMetadataIds.ViewFilter,
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'viewId',
|
||||
@ -52,13 +66,14 @@ export const seedViewFilterFieldMetadata = async (
|
||||
value: 'viewId',
|
||||
},
|
||||
description: 'View Filter related view',
|
||||
icon: null,
|
||||
icon: 'IconLayoutCollage',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectMetadataId: '5d9b1ab9-4461-4e2d-bf9e-9b47e68846d3',
|
||||
id: SeedViewFilterFieldMetadataIds.Operand,
|
||||
objectMetadataId: SeedObjectMetadataIds.ViewFilter,
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'operand',
|
||||
@ -71,9 +86,10 @@ export const seedViewFilterFieldMetadata = async (
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectMetadataId: '5d9b1ab9-4461-4e2d-bf9e-9b47e68846d3',
|
||||
id: SeedViewFilterFieldMetadataIds.Value,
|
||||
objectMetadataId: SeedObjectMetadataIds.ViewFilter,
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'value',
|
||||
@ -86,9 +102,10 @@ export const seedViewFilterFieldMetadata = async (
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectMetadataId: '5d9b1ab9-4461-4e2d-bf9e-9b47e68846d3',
|
||||
id: SeedViewFilterFieldMetadataIds.DisplayValue,
|
||||
objectMetadataId: SeedObjectMetadataIds.ViewFilter,
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'displayValue',
|
@ -1,6 +1,15 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
const tableName = 'fieldMetadata';
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
|
||||
const fieldMetadataTableName = 'fieldMetadata';
|
||||
|
||||
export enum SeedViewSortFieldMetadataIds {
|
||||
FieldMetadataId = '20202020-cb2c-4c8f-a289-c9851b23d064',
|
||||
View = '20202020-f5d0-467f-a3d8-395ba16b8ebf',
|
||||
Direction = '20202020-077e-4451-b1d8-e602c956ebd2',
|
||||
}
|
||||
|
||||
export const seedViewSortFieldMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
@ -9,7 +18,8 @@ export const seedViewSortFieldMetadata = async (
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${tableName}`, [
|
||||
.into(`${schemaName}.${fieldMetadataTableName}`, [
|
||||
'id',
|
||||
'objectMetadataId',
|
||||
'isCustom',
|
||||
'workspaceId',
|
||||
@ -25,9 +35,10 @@ export const seedViewSortFieldMetadata = async (
|
||||
.orIgnore()
|
||||
.values([
|
||||
{
|
||||
objectMetadataId: '6f8dcd4b-cf28-41dd-b98b-d6e1f5b3a251',
|
||||
id: SeedViewSortFieldMetadataIds.FieldMetadataId,
|
||||
objectMetadataId: SeedObjectMetadataIds.ViewSort,
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'fieldMetadataId',
|
||||
@ -40,9 +51,10 @@ export const seedViewSortFieldMetadata = async (
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectMetadataId: '6f8dcd4b-cf28-41dd-b98b-d6e1f5b3a251',
|
||||
id: SeedViewSortFieldMetadataIds.View,
|
||||
objectMetadataId: SeedObjectMetadataIds.ViewSort,
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'viewId',
|
||||
@ -51,13 +63,14 @@ export const seedViewSortFieldMetadata = async (
|
||||
value: 'viewId',
|
||||
},
|
||||
description: 'View Sort related view',
|
||||
icon: null,
|
||||
icon: 'IconLayoutCollage',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectMetadataId: '6f8dcd4b-cf28-41dd-b98b-d6e1f5b3a251',
|
||||
id: SeedViewSortFieldMetadataIds.Direction,
|
||||
objectMetadataId: SeedObjectMetadataIds.ViewSort,
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'direction',
|
@ -1,6 +1,18 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
const tableName = 'fieldMetadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
|
||||
const fieldMetadataTableName = 'fieldMetadata';
|
||||
|
||||
export enum SeedViewFieldMetadataIds {
|
||||
Name = '20202020-e10e-4346-8690-b2e582ebc03c',
|
||||
ObjectMetadataId = '20202020-2c69-46f0-9cf2-1a4f9869d560',
|
||||
Type = '20202020-2c70-46f0-9cf2-1a4f9869d591',
|
||||
ViewFields = '20202020-d288-4df4-9548-7b5c5747f623',
|
||||
ViewSorts = '20202020-3011-4d5c-8133-c01134e733df',
|
||||
ViewFilters = '20202020-afe8-40bc-9a81-9b33e45131d9',
|
||||
}
|
||||
|
||||
export const seedViewFieldMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
@ -9,7 +21,7 @@ export const seedViewFieldMetadata = async (
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${tableName}`, [
|
||||
.into(`${schemaName}.${fieldMetadataTableName}`, [
|
||||
'id',
|
||||
'objectMetadataId',
|
||||
'isCustom',
|
||||
@ -26,9 +38,10 @@ export const seedViewFieldMetadata = async (
|
||||
.orIgnore()
|
||||
.values([
|
||||
{
|
||||
objectMetadataId: '9ab6b3dc-767f-473f-8fd0-6cdbefbf8dbe',
|
||||
id: SeedViewFieldMetadataIds.Name,
|
||||
objectMetadataId: SeedObjectMetadataIds.View,
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'name',
|
||||
@ -41,9 +54,10 @@ export const seedViewFieldMetadata = async (
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectMetadataId: '9ab6b3dc-767f-473f-8fd0-6cdbefbf8dbe',
|
||||
id: SeedViewFieldMetadataIds.ObjectMetadataId,
|
||||
objectMetadataId: SeedObjectMetadataIds.View,
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'objectMetadataId',
|
||||
@ -56,9 +70,10 @@ export const seedViewFieldMetadata = async (
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectMetadataId: '9ab6b3dc-767f-473f-8fd0-6cdbefbf8dbe',
|
||||
id: SeedViewFieldMetadataIds.Type,
|
||||
objectMetadataId: SeedObjectMetadataIds.View,
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'type',
|
||||
@ -71,18 +86,46 @@ export const seedViewFieldMetadata = async (
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
id: '064eb439-fdfa-4246-a13a-989c5bcc4d97',
|
||||
objectMetadataId: '9ab6b3dc-767f-473f-8fd0-6cdbefbf8dbe',
|
||||
id: SeedViewFieldMetadataIds.ViewFields,
|
||||
objectMetadataId: SeedObjectMetadataIds.View,
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'viewFields',
|
||||
label: 'View Fields',
|
||||
targetColumnMap: {},
|
||||
description: 'View Fields',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
icon: 'IconTag',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedViewFieldMetadataIds.ViewSorts,
|
||||
objectMetadataId: SeedObjectMetadataIds.View,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'viewSorts',
|
||||
label: 'View Sorts',
|
||||
targetColumnMap: {},
|
||||
description: 'View Sorts',
|
||||
icon: 'IconArrowsSort',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedViewFieldMetadataIds.ViewFilters,
|
||||
objectMetadataId: SeedObjectMetadataIds.View,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'viewFilters',
|
||||
label: 'View Filters',
|
||||
targetColumnMap: {},
|
||||
description: 'View Filters',
|
||||
icon: 'IconFilterBolt',
|
||||
isNullable: true,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
|
@ -0,0 +1,71 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
|
||||
const fieldMetadataTableName = 'fieldMetadata';
|
||||
|
||||
export enum SeedWebhookFieldMetadataIds {
|
||||
TargetUrl = '20202020-c16e-4ba8-bb24-bbd88e9cdabc',
|
||||
Operation = '20202020-5995-493a-92a8-31376e5c052a',
|
||||
}
|
||||
|
||||
export const seedWebhookFieldMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${fieldMetadataTableName}`, [
|
||||
'id',
|
||||
'objectMetadataId',
|
||||
'isCustom',
|
||||
'workspaceId',
|
||||
'isActive',
|
||||
'type',
|
||||
'name',
|
||||
'label',
|
||||
'targetColumnMap',
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
// Scalar fields
|
||||
{
|
||||
id: SeedWebhookFieldMetadataIds.TargetUrl,
|
||||
objectMetadataId: SeedObjectMetadataIds.Webhook,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'targetUrl',
|
||||
label: 'Target Url',
|
||||
targetColumnMap: {
|
||||
value: 'targetUrl',
|
||||
},
|
||||
description: 'Webhook target url',
|
||||
icon: 'IconLink',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
id: SeedWebhookFieldMetadataIds.Operation,
|
||||
objectMetadataId: SeedObjectMetadataIds.Webhook,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'operation',
|
||||
label: 'Operation',
|
||||
targetColumnMap: {
|
||||
value: 'operation',
|
||||
},
|
||||
description: 'Webhook operation',
|
||||
icon: 'IconCheckbox',
|
||||
isNullable: false,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
@ -0,0 +1,90 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
|
||||
const fieldMetadataTableName = 'fieldMetadata';
|
||||
|
||||
export enum SeedWorkspaceMemberSettingsFieldMetadataIds {
|
||||
ColorScheme = '20202020-d7b7-4f2e-bb52-90d3fd78007a',
|
||||
Locale = '20202020-10f6-4df9-8d6f-a760b65bd800',
|
||||
WorkspaceMember = '20202020-83f2-4c5f-96b0-0c51ecc160e3',
|
||||
}
|
||||
|
||||
export const seedWorkspaceMemberSettingsFieldMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${fieldMetadataTableName}`, [
|
||||
'id',
|
||||
'objectMetadataId',
|
||||
'isCustom',
|
||||
'workspaceId',
|
||||
'isActive',
|
||||
'type',
|
||||
'name',
|
||||
'label',
|
||||
'targetColumnMap',
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
// Scalar fields
|
||||
{
|
||||
id: SeedWorkspaceMemberSettingsFieldMetadataIds.ColorScheme,
|
||||
objectMetadataId: SeedObjectMetadataIds.WorkspaceMemberSettings,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'colorScheme',
|
||||
label: 'Color Scheme',
|
||||
targetColumnMap: {
|
||||
value: 'colorScheme',
|
||||
},
|
||||
description: 'Preferred color scheme',
|
||||
icon: 'IconColorSwatch',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
id: SeedWorkspaceMemberSettingsFieldMetadataIds.Locale,
|
||||
objectMetadataId: SeedObjectMetadataIds.WorkspaceMemberSettings,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
name: 'locale',
|
||||
label: 'Language',
|
||||
targetColumnMap: {
|
||||
value: 'colorScheme',
|
||||
},
|
||||
description: 'Preferred language',
|
||||
icon: 'IconLanguage',
|
||||
isNullable: false,
|
||||
},
|
||||
|
||||
// Relationships
|
||||
{
|
||||
id: SeedWorkspaceMemberSettingsFieldMetadataIds.WorkspaceMember,
|
||||
objectMetadataId: SeedObjectMetadataIds.WorkspaceMemberSettings,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'workspaceMember',
|
||||
label: 'Workspace member',
|
||||
targetColumnMap: {
|
||||
value: 'workspaceMemberId',
|
||||
},
|
||||
description: 'Workspace member associated with these settings',
|
||||
icon: 'IconUserCircle',
|
||||
isNullable: false,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
@ -0,0 +1,180 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
|
||||
const fieldMetadataTableName = 'fieldMetadata';
|
||||
|
||||
export enum SeedWorkspaceMemberFieldMetadataIds {
|
||||
AllowImpersonation = '20202020-bb19-44a1-8156-8866f87a5f42',
|
||||
UserId = '20202020-f2c1-4ca1-9ca5-7b9d5cc87eb0',
|
||||
AuthoredActivities = '20202020-37a0-4db4-9c9f-fd3e3f4e47fc',
|
||||
AssignedActivities = '20202020-ac05-44b9-9526-764dd5ce14e2',
|
||||
AuthoredAttachments = '20202020-7e0c-4dc4-be49-37de4396349e',
|
||||
Favorites = '20202020-5ecb-405b-8712-171bb8916b96',
|
||||
Settings = '20202020-50ed-46ed-8198-65e237b83eb9',
|
||||
AccountOwnerForCompanies = '20202020-41bb-4c17-8979-40fa915df9e1',
|
||||
AuthoredComments = '20202020-7238-4e2a-9ccf-d2c8f604933a',
|
||||
}
|
||||
|
||||
export const seedWorkspaceMemberFieldMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${fieldMetadataTableName}`, [
|
||||
'id',
|
||||
'objectMetadataId',
|
||||
'isCustom',
|
||||
'workspaceId',
|
||||
'isActive',
|
||||
'type',
|
||||
'name',
|
||||
'label',
|
||||
'targetColumnMap',
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
// Scalar fields
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.UserId,
|
||||
objectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'UUID',
|
||||
name: 'userId',
|
||||
label: 'User Id',
|
||||
targetColumnMap: {
|
||||
value: 'userId',
|
||||
},
|
||||
description: 'Associated User Id',
|
||||
icon: 'IconCircleUsers',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.AllowImpersonation,
|
||||
objectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'BOOLEAN',
|
||||
name: 'allowImpersonation',
|
||||
label: 'Admin Access',
|
||||
targetColumnMap: {
|
||||
value: 'allowImpersonation',
|
||||
},
|
||||
description: 'Allow Admin Access',
|
||||
icon: 'IconEye',
|
||||
isNullable: false,
|
||||
},
|
||||
|
||||
// Relationships
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.AuthoredActivities,
|
||||
objectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'authoredActivities',
|
||||
label: 'Authored activities',
|
||||
targetColumnMap: {},
|
||||
description: 'Activities created by the workspace member',
|
||||
icon: 'IconCheckbox',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.AssignedActivities,
|
||||
objectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'assignedActivities',
|
||||
label: 'Assigned activities',
|
||||
targetColumnMap: {},
|
||||
description: 'Activities assigned to the workspace member',
|
||||
icon: 'IconCheckbox',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.Favorites,
|
||||
objectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'favorites',
|
||||
label: 'Favorites',
|
||||
targetColumnMap: {},
|
||||
description: 'Favorites linked to the workspace member',
|
||||
icon: 'IconHeart',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.AccountOwnerForCompanies,
|
||||
objectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'accountOwnerForCompanies',
|
||||
label: 'Account Owner For Companies',
|
||||
targetColumnMap: {},
|
||||
description: 'Account owner for companies',
|
||||
icon: 'IconBriefcase',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.AuthoredAttachments,
|
||||
objectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'authoredAttachments',
|
||||
label: 'Authored attachments',
|
||||
targetColumnMap: {},
|
||||
description: 'Attachments created by the workspace member',
|
||||
icon: 'IconFileImport',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.AuthoredComments,
|
||||
objectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'authoredComments',
|
||||
label: 'Authored comments',
|
||||
targetColumnMap: {},
|
||||
description: 'Authored comments',
|
||||
icon: 'IconComment',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.Settings,
|
||||
objectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'settings',
|
||||
label: 'Settings',
|
||||
targetColumnMap: {
|
||||
value: 'settingsId',
|
||||
},
|
||||
description: 'Workspace member settings',
|
||||
icon: 'IconSettings',
|
||||
isNullable: false,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
60
server/src/database/typeorm-seeds/metadata/index.ts
Normal file
60
server/src/database/typeorm-seeds/metadata/index.ts
Normal file
@ -0,0 +1,60 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { seedCompanyFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/company';
|
||||
import { seedViewFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/view';
|
||||
import { seedViewFieldFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/view-field';
|
||||
import { seedViewFilterFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/view-filter';
|
||||
import { seedViewSortFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/view-sort';
|
||||
import { seedObjectMetadata } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { seedViewRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/view';
|
||||
import { seedActivityTargetFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/activity-target';
|
||||
import { seedActivityFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/activity';
|
||||
import { seedApiKeyFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/api-key';
|
||||
import { seedAttachmentFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/attachment';
|
||||
import { seedCommentFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/comment';
|
||||
import { seedFavoriteFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/favorite';
|
||||
import { seedOpportunityFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/opportunity';
|
||||
import { seedPersonFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/person';
|
||||
import { seedPipelineStepFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/pipeline-step';
|
||||
import { seedWorkspaceMemberFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/workspace-member';
|
||||
import { seedWorkspaceMemberSettingsFieldMetadata } from 'src/database/typeorm-seeds/metadata/field-metadata/workspace-member-settings';
|
||||
import { seedCompanyRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/company';
|
||||
import { seedActivityRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/activity';
|
||||
import { seedPipelineStepRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/pipeline-step';
|
||||
import { seedPersonRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/person';
|
||||
import { seedWorkspaceMemberRelationMetadata } from 'src/database/typeorm-seeds/metadata/relation-metadata/workspace-member';
|
||||
|
||||
export const seedMetadataSchema = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await seedObjectMetadata(workspaceDataSource, schemaName);
|
||||
|
||||
await seedActivityTargetFieldMetadata(workspaceDataSource, schemaName);
|
||||
await seedActivityFieldMetadata(workspaceDataSource, schemaName);
|
||||
await seedApiKeyFieldMetadata(workspaceDataSource, schemaName);
|
||||
await seedAttachmentFieldMetadata(workspaceDataSource, schemaName);
|
||||
await seedCommentFieldMetadata(workspaceDataSource, schemaName);
|
||||
await seedCompanyFieldMetadata(workspaceDataSource, schemaName);
|
||||
await seedFavoriteFieldMetadata(workspaceDataSource, schemaName);
|
||||
await seedOpportunityFieldMetadata(workspaceDataSource, schemaName);
|
||||
await seedPersonFieldMetadata(workspaceDataSource, schemaName);
|
||||
await seedPipelineStepFieldMetadata(workspaceDataSource, schemaName);
|
||||
await seedViewFieldMetadata(workspaceDataSource, schemaName);
|
||||
await seedViewFieldFieldMetadata(workspaceDataSource, schemaName);
|
||||
await seedViewFilterFieldMetadata(workspaceDataSource, schemaName);
|
||||
await seedViewSortFieldMetadata(workspaceDataSource, schemaName);
|
||||
await seedViewRelationMetadata(workspaceDataSource, schemaName);
|
||||
await seedWorkspaceMemberFieldMetadata(workspaceDataSource, schemaName);
|
||||
await seedWorkspaceMemberSettingsFieldMetadata(
|
||||
workspaceDataSource,
|
||||
schemaName,
|
||||
);
|
||||
|
||||
await seedActivityRelationMetadata(workspaceDataSource, schemaName);
|
||||
await seedCompanyRelationMetadata(workspaceDataSource, schemaName);
|
||||
await seedPersonRelationMetadata(workspaceDataSource, schemaName);
|
||||
await seedPipelineStepRelationMetadata(workspaceDataSource, schemaName);
|
||||
await seedViewRelationMetadata(workspaceDataSource, schemaName);
|
||||
await seedWorkspaceMemberRelationMetadata(workspaceDataSource, schemaName);
|
||||
};
|
@ -1,7 +1,29 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { SeedDataSourceId, SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
|
||||
const tableName = 'objectMetadata';
|
||||
|
||||
export enum SeedObjectMetadataIds {
|
||||
Company = '20202020-480c-434e-b4c7-e22408b97047',
|
||||
Person = '20202020-c64b-44bc-bd2c-502c99f49dca',
|
||||
Opportunity = '20202020-cae9-4ff4-9579-f7d9fe44c937',
|
||||
PipelineStep = '20202020-1029-4661-9e91-83bad932bdcd',
|
||||
WorkspaceMember = '20202020-b550-40bb-a96b-9ab54b664753',
|
||||
WorkspaceMemberSettings = '20202020-166d-445c-970f-da1ea43f1dc7',
|
||||
Webhook = '20202020-ddee-40de-9c9b-5f82a3503360',
|
||||
ApiKey = '20202020-d8d0-4c2d-a370-5499b2181d02',
|
||||
Activity = '20202020-8ee3-4f67-84ab-1b7a6eb5a448',
|
||||
ActivityTarget = '20202020-439a-4a41-83a3-3cda03d01d38',
|
||||
Comment = '20202020-4de3-4e65-ac60-b40b8e08d7d6',
|
||||
Attachment = '20202020-5f98-4317-915d-3779bb821be2',
|
||||
Favorite = '20202020-90e4-4701-a350-8ab75e23e3b8',
|
||||
View = '20202020-767f-473f-8fd0-6cdbefbf8dbe',
|
||||
ViewField = '20202020-485c-4c48-a22e-0d9a164f9647',
|
||||
ViewFilter = '20202020-4461-4e2d-bf9e-9b47e68846d3',
|
||||
ViewSort = '20202020-cf28-41dd-b98b-d6e1f5b3a251',
|
||||
}
|
||||
|
||||
export const seedObjectMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
@ -25,7 +47,7 @@ export const seedObjectMetadata = async (
|
||||
.orIgnore()
|
||||
.values([
|
||||
{
|
||||
id: '1a8487a0-480c-434e-b4c7-e22408b97047',
|
||||
id: SeedObjectMetadataIds.Company,
|
||||
nameSingular: 'companyV2',
|
||||
namePlural: 'companiesV2',
|
||||
labelSingular: 'Company',
|
||||
@ -33,12 +55,168 @@ export const seedObjectMetadata = async (
|
||||
targetTableName: 'company',
|
||||
description: 'A company',
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
dataSourceId: 'b37b2163-7f63-47a9-b1b3-6c7290ca9fb1',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
dataSourceId: SeedDataSourceId,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
},
|
||||
{
|
||||
id: '9ab6b3dc-767f-473f-8fd0-6cdbefbf8dbe',
|
||||
id: SeedObjectMetadataIds.Person,
|
||||
nameSingular: 'personV2',
|
||||
namePlural: 'peopleV2',
|
||||
labelSingular: 'Person',
|
||||
labelPlural: 'People',
|
||||
targetTableName: 'person',
|
||||
description: 'A person',
|
||||
icon: 'IconUser',
|
||||
dataSourceId: SeedDataSourceId,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
},
|
||||
{
|
||||
id: SeedObjectMetadataIds.Opportunity,
|
||||
nameSingular: 'opportunityV2',
|
||||
namePlural: 'opportunitiesV2',
|
||||
labelSingular: 'Opportunity',
|
||||
labelPlural: 'Opportunities',
|
||||
targetTableName: 'opportunity',
|
||||
description: 'An opportunity',
|
||||
icon: 'IconTargetArrow',
|
||||
dataSourceId: SeedDataSourceId,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
},
|
||||
{
|
||||
id: SeedObjectMetadataIds.PipelineStep,
|
||||
nameSingular: 'pipelineStepV2',
|
||||
namePlural: 'pipelineStepsV2',
|
||||
labelSingular: 'Pipeline Step',
|
||||
labelPlural: 'Pipeline Steps',
|
||||
targetTableName: 'pipelineStep',
|
||||
description: 'A pipeline step',
|
||||
icon: 'IconLayoutKanban',
|
||||
dataSourceId: SeedDataSourceId,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
},
|
||||
{
|
||||
id: SeedObjectMetadataIds.WorkspaceMember,
|
||||
nameSingular: 'workspaceMemberV2',
|
||||
namePlural: 'workspaceMembersV2',
|
||||
labelSingular: 'Workspace Member',
|
||||
labelPlural: 'Workspace Members',
|
||||
targetTableName: 'workspaceMember',
|
||||
description: 'A workspace member',
|
||||
icon: 'IconUserCircle',
|
||||
dataSourceId: SeedDataSourceId,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
},
|
||||
{
|
||||
id: SeedObjectMetadataIds.WorkspaceMemberSettings,
|
||||
nameSingular: 'workspaceMemberSettingV2',
|
||||
namePlural: 'workspaceMemberSettingsV2',
|
||||
labelSingular: 'WorkspaceMemberSetting',
|
||||
labelPlural: 'Workspace Member Settings',
|
||||
targetTableName: 'workspaceMemberSetting',
|
||||
description: 'A workspace member setting',
|
||||
icon: 'IconSettings',
|
||||
dataSourceId: SeedDataSourceId,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
},
|
||||
{
|
||||
id: SeedObjectMetadataIds.Webhook,
|
||||
nameSingular: 'webhookV2',
|
||||
namePlural: 'webhooksV2',
|
||||
labelSingular: 'Webhook',
|
||||
labelPlural: 'Webhooks',
|
||||
targetTableName: 'webhook',
|
||||
description: 'A webhook',
|
||||
icon: 'IconRobot',
|
||||
dataSourceId: SeedDataSourceId,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
},
|
||||
{
|
||||
id: SeedObjectMetadataIds.ApiKey,
|
||||
nameSingular: 'apiKeyV2',
|
||||
namePlural: 'apiKeysV2',
|
||||
labelSingular: 'Api Key',
|
||||
labelPlural: 'Api Keys',
|
||||
targetTableName: 'apiKey',
|
||||
description: 'An api key',
|
||||
icon: 'IconRobot',
|
||||
dataSourceId: SeedDataSourceId,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
},
|
||||
{
|
||||
id: SeedObjectMetadataIds.Activity,
|
||||
nameSingular: 'activityV2',
|
||||
namePlural: 'activitiesV2',
|
||||
labelSingular: 'Activity',
|
||||
labelPlural: 'Activities',
|
||||
targetTableName: 'activity',
|
||||
description: 'An activity',
|
||||
icon: 'IconCheckbox',
|
||||
dataSourceId: SeedDataSourceId,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
},
|
||||
{
|
||||
id: SeedObjectMetadataIds.ActivityTarget,
|
||||
nameSingular: 'activityTargetV2',
|
||||
namePlural: 'activityTargetsV2',
|
||||
labelSingular: 'Activity Target',
|
||||
labelPlural: 'Activity Targets',
|
||||
targetTableName: 'activityTarget',
|
||||
description: 'An activity target',
|
||||
icon: 'IconCheckbox',
|
||||
dataSourceId: SeedDataSourceId,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
},
|
||||
{
|
||||
id: SeedObjectMetadataIds.Comment,
|
||||
nameSingular: 'commentV2',
|
||||
namePlural: 'commentsV2',
|
||||
labelSingular: 'Comment',
|
||||
labelPlural: 'Comments',
|
||||
targetTableName: 'comment',
|
||||
description: 'A comment',
|
||||
icon: 'IconMessageCircle',
|
||||
dataSourceId: SeedDataSourceId,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
},
|
||||
{
|
||||
id: SeedObjectMetadataIds.Attachment,
|
||||
nameSingular: 'attachmentV2',
|
||||
namePlural: 'attachmentsV2',
|
||||
labelSingular: 'Attachment',
|
||||
labelPlural: 'Attachments',
|
||||
targetTableName: 'attachment',
|
||||
description: 'An attachment',
|
||||
icon: 'IconFileImport',
|
||||
dataSourceId: SeedDataSourceId,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
},
|
||||
{
|
||||
id: SeedObjectMetadataIds.Favorite,
|
||||
nameSingular: 'favoriteV2',
|
||||
namePlural: 'favoritesV2',
|
||||
labelSingular: 'Favorite',
|
||||
labelPlural: 'Favorites',
|
||||
targetTableName: 'favorite',
|
||||
description: 'A favorite',
|
||||
icon: 'IconHeart',
|
||||
dataSourceId: SeedDataSourceId,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
},
|
||||
{
|
||||
id: SeedObjectMetadataIds.View,
|
||||
nameSingular: 'viewV2',
|
||||
namePlural: 'viewsV2',
|
||||
labelSingular: 'View',
|
||||
@ -46,25 +224,25 @@ export const seedObjectMetadata = async (
|
||||
targetTableName: 'view',
|
||||
description: '(System) Views',
|
||||
icon: 'IconLayoutCollage',
|
||||
dataSourceId: 'b37b2163-7f63-47a9-b1b3-6c7290ca9fb1',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
dataSourceId: SeedDataSourceId,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
},
|
||||
{
|
||||
id: '61d9000b-485c-4c48-a22e-0d9a164f9647',
|
||||
id: SeedObjectMetadataIds.ViewField,
|
||||
nameSingular: 'viewFieldV2',
|
||||
namePlural: 'viewFieldsV2',
|
||||
labelSingular: 'View Field',
|
||||
labelPlural: 'View Fields',
|
||||
targetTableName: 'viewField',
|
||||
description: '(System) View Fields',
|
||||
icon: 'IconColumns3',
|
||||
dataSourceId: 'b37b2163-7f63-47a9-b1b3-6c7290ca9fb1',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
icon: 'IconTag',
|
||||
dataSourceId: SeedDataSourceId,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
},
|
||||
{
|
||||
id: '5d9b1ab9-4461-4e2d-bf9e-9b47e68846d3',
|
||||
id: SeedObjectMetadataIds.ViewFilter,
|
||||
nameSingular: 'viewFilterV2',
|
||||
namePlural: 'viewFiltersV2',
|
||||
labelSingular: 'View Filter',
|
||||
@ -72,12 +250,12 @@ export const seedObjectMetadata = async (
|
||||
targetTableName: 'viewFilter',
|
||||
description: '(System) View Filters',
|
||||
icon: 'IconFilterBolt',
|
||||
dataSourceId: 'b37b2163-7f63-47a9-b1b3-6c7290ca9fb1',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
dataSourceId: SeedDataSourceId,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
},
|
||||
{
|
||||
id: '6f8dcd4b-cf28-41dd-b98b-d6e1f5b3a251',
|
||||
id: SeedObjectMetadataIds.ViewSort,
|
||||
nameSingular: 'viewSortV2',
|
||||
namePlural: 'viewSortsV2',
|
||||
labelSingular: 'View Sort',
|
||||
@ -85,8 +263,8 @@ export const seedObjectMetadata = async (
|
||||
targetTableName: 'viewSort',
|
||||
description: '(System) View Sorts',
|
||||
icon: 'IconArrowsSort',
|
||||
dataSourceId: 'b37b2163-7f63-47a9-b1b3-6c7290ca9fb1',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
dataSourceId: SeedDataSourceId,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
},
|
||||
])
|
||||
|
@ -0,0 +1,56 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { RelationMetadataType } from 'src/metadata/relation-metadata/relation-metadata.entity';
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
import { SeedActivityFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/activity';
|
||||
import { SeedActivityTargetFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/activity-target';
|
||||
import { SeedAttachmentFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/attachment';
|
||||
import { SeedCommentFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/comment';
|
||||
|
||||
const tableName = 'relationMetadata';
|
||||
|
||||
export const seedActivityRelationMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${tableName}`, [
|
||||
'relationType',
|
||||
'fromObjectMetadataId',
|
||||
'toObjectMetadataId',
|
||||
'fromFieldMetadataId',
|
||||
'toFieldMetadataId',
|
||||
'workspaceId',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.Activity,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.ActivityTarget,
|
||||
fromFieldMetadataId: SeedActivityFieldMetadataIds.ActivityTargets,
|
||||
toFieldMetadataId: SeedActivityTargetFieldMetadataIds.Activity,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.Activity,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.Attachment,
|
||||
fromFieldMetadataId: SeedActivityFieldMetadataIds.Attachments,
|
||||
toFieldMetadataId: SeedAttachmentFieldMetadataIds.Activity,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.Activity,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.Comment,
|
||||
fromFieldMetadataId: SeedActivityFieldMetadataIds.Comments,
|
||||
toFieldMetadataId: SeedCommentFieldMetadataIds.Activity,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
@ -0,0 +1,74 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { RelationMetadataType } from 'src/metadata/relation-metadata/relation-metadata.entity';
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
import { SeedCompanyFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/company';
|
||||
import { SeedPersonFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/person';
|
||||
import { SeedFavoriteFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/favorite';
|
||||
import { SeedAttachmentFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/attachment';
|
||||
import { SeedOpportunityFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/opportunity';
|
||||
import { SeedActivityTargetFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/activity-target';
|
||||
|
||||
const tableName = 'relationMetadata';
|
||||
|
||||
export const seedCompanyRelationMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${tableName}`, [
|
||||
'relationType',
|
||||
'fromObjectMetadataId',
|
||||
'toObjectMetadataId',
|
||||
'fromFieldMetadataId',
|
||||
'toFieldMetadataId',
|
||||
'workspaceId',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.Company,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.Person,
|
||||
fromFieldMetadataId: SeedCompanyFieldMetadataIds.People,
|
||||
toFieldMetadataId: SeedPersonFieldMetadataIds.Company,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.Company,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.Favorite,
|
||||
fromFieldMetadataId: SeedCompanyFieldMetadataIds.Favorites,
|
||||
toFieldMetadataId: SeedFavoriteFieldMetadataIds.Company,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.Company,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.Attachment,
|
||||
fromFieldMetadataId: SeedCompanyFieldMetadataIds.Attachments,
|
||||
toFieldMetadataId: SeedAttachmentFieldMetadataIds.Company,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.Company,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.Opportunity,
|
||||
fromFieldMetadataId: SeedCompanyFieldMetadataIds.Opportunities,
|
||||
toFieldMetadataId: SeedOpportunityFieldMetadataIds.Company,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.Company,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.ActivityTarget,
|
||||
fromFieldMetadataId: SeedCompanyFieldMetadataIds.ActivityTargets,
|
||||
toFieldMetadataId: SeedActivityTargetFieldMetadataIds.Company,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
@ -0,0 +1,73 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { RelationMetadataType } from 'src/metadata/relation-metadata/relation-metadata.entity';
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
import { SeedFavoriteFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/favorite';
|
||||
import { SeedPersonFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/person';
|
||||
import { SeedActivityTargetFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/activity-target';
|
||||
import { SeedAttachmentFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/attachment';
|
||||
import { SeedOpportunityFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/opportunity';
|
||||
|
||||
const tableName = 'relationMetadata';
|
||||
|
||||
export const seedPersonRelationMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${tableName}`, [
|
||||
'relationType',
|
||||
'fromObjectMetadataId',
|
||||
'toObjectMetadataId',
|
||||
'fromFieldMetadataId',
|
||||
'toFieldMetadataId',
|
||||
'workspaceId',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.Person,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.Favorite,
|
||||
fromFieldMetadataId: SeedPersonFieldMetadataIds.Favorites,
|
||||
toFieldMetadataId: SeedFavoriteFieldMetadataIds.Person,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.Person,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.Attachment,
|
||||
fromFieldMetadataId: SeedPersonFieldMetadataIds.Attachments,
|
||||
toFieldMetadataId: SeedAttachmentFieldMetadataIds.Person,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.Person,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.Opportunity,
|
||||
fromFieldMetadataId: SeedPersonFieldMetadataIds.Opportunities,
|
||||
toFieldMetadataId: SeedOpportunityFieldMetadataIds.Person,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.Person,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.Opportunity,
|
||||
fromFieldMetadataId: SeedPersonFieldMetadataIds.ContactForOpportunities,
|
||||
toFieldMetadataId: SeedOpportunityFieldMetadataIds.PointOfContact,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.Person,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.ActivityTarget,
|
||||
fromFieldMetadataId: SeedPersonFieldMetadataIds.ActivityTargets,
|
||||
toFieldMetadataId: SeedActivityTargetFieldMetadataIds.Person,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
@ -0,0 +1,38 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { RelationMetadataType } from 'src/metadata/relation-metadata/relation-metadata.entity';
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
import { SeedPipelineStepFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/pipeline-step';
|
||||
import { SeedOpportunityFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/opportunity';
|
||||
|
||||
const tableName = 'relationMetadata';
|
||||
|
||||
export const seedPipelineStepRelationMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${tableName}`, [
|
||||
'relationType',
|
||||
'fromObjectMetadataId',
|
||||
'toObjectMetadataId',
|
||||
'fromFieldMetadataId',
|
||||
'toFieldMetadataId',
|
||||
'workspaceId',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.PipelineStep,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.Opportunity,
|
||||
fromFieldMetadataId: SeedPipelineStepFieldMetadataIds.Opportunities,
|
||||
toFieldMetadataId: SeedOpportunityFieldMetadataIds.PipelineStep,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
@ -1,6 +1,12 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { RelationMetadataType } from 'src/metadata/relation-metadata/relation-metadata.entity';
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { SeedViewFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/view';
|
||||
import { SeedViewFieldFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/view-field';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
import { SeedViewFilterFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/view-filter';
|
||||
import { SeedViewSortFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/view-sort';
|
||||
|
||||
const tableName = 'relationMetadata';
|
||||
|
||||
@ -23,11 +29,27 @@ export const seedViewRelationMetadata = async (
|
||||
.values([
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: '9ab6b3dc-767f-473f-8fd0-6cdbefbf8dbe', // View
|
||||
toObjectMetadataId: '61d9000b-485c-4c48-a22e-0d9a164f9647', // ViewField
|
||||
fromFieldMetadataId: '064eb439-fdfa-4246-a13a-989c5bcc4d97', // View > ViewFields
|
||||
toFieldMetadataId: 'a9a56210-a154-4965-9ace-c35f6dc43ee5', // ViewField > View
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.View,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.ViewField,
|
||||
fromFieldMetadataId: SeedViewFieldMetadataIds.ViewFields,
|
||||
toFieldMetadataId: SeedViewFieldFieldMetadataIds.View,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.View,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.ViewFilter,
|
||||
fromFieldMetadataId: SeedViewFieldMetadataIds.ViewFilters,
|
||||
toFieldMetadataId: SeedViewFilterFieldMetadataIds.View,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.View,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.ViewSort,
|
||||
fromFieldMetadataId: SeedViewFieldMetadataIds.ViewSorts,
|
||||
toFieldMetadataId: SeedViewSortFieldMetadataIds.View,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
|
@ -0,0 +1,97 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { RelationMetadataType } from 'src/metadata/relation-metadata/relation-metadata.entity';
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
import { SeedWorkspaceId } from 'src/database/seeds/metadata';
|
||||
import { SeedCompanyFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/company';
|
||||
import { SeedWorkspaceMemberFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/workspace-member';
|
||||
import { SeedWorkspaceMemberSettingsFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/workspace-member-settings';
|
||||
import { SeedFavoriteFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/favorite';
|
||||
import { SeedActivityFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/activity';
|
||||
import { SeedCommentFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/comment';
|
||||
import { SeedAttachmentFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/attachment';
|
||||
|
||||
const tableName = 'relationMetadata';
|
||||
|
||||
export const seedWorkspaceMemberRelationMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${tableName}`, [
|
||||
'relationType',
|
||||
'fromObjectMetadataId',
|
||||
'toObjectMetadataId',
|
||||
'fromFieldMetadataId',
|
||||
'toFieldMetadataId',
|
||||
'workspaceId',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.Company,
|
||||
fromFieldMetadataId:
|
||||
SeedWorkspaceMemberFieldMetadataIds.AccountOwnerForCompanies,
|
||||
toFieldMetadataId: SeedCompanyFieldMetadataIds.AccountOwner,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_ONE,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.WorkspaceMemberSettings,
|
||||
fromFieldMetadataId: SeedWorkspaceMemberFieldMetadataIds.Settings,
|
||||
toFieldMetadataId:
|
||||
SeedWorkspaceMemberSettingsFieldMetadataIds.WorkspaceMember,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.Favorite,
|
||||
fromFieldMetadataId: SeedWorkspaceMemberFieldMetadataIds.Favorites,
|
||||
toFieldMetadataId: SeedFavoriteFieldMetadataIds.WorkspaceMember,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.Activity,
|
||||
fromFieldMetadataId:
|
||||
SeedWorkspaceMemberFieldMetadataIds.AuthoredActivities,
|
||||
toFieldMetadataId: SeedActivityFieldMetadataIds.Author,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.Activity,
|
||||
fromFieldMetadataId:
|
||||
SeedWorkspaceMemberFieldMetadataIds.AssignedActivities,
|
||||
toFieldMetadataId: SeedActivityFieldMetadataIds.Assignee,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.Comment,
|
||||
fromFieldMetadataId:
|
||||
SeedWorkspaceMemberFieldMetadataIds.AuthoredComments,
|
||||
toFieldMetadataId: SeedCommentFieldMetadataIds.Author,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
{
|
||||
relationType: RelationMetadataType.ONE_TO_MANY,
|
||||
fromObjectMetadataId: SeedObjectMetadataIds.WorkspaceMember,
|
||||
toObjectMetadataId: SeedObjectMetadataIds.Attachment,
|
||||
fromFieldMetadataId:
|
||||
SeedWorkspaceMemberFieldMetadataIds.AuthoredAttachments,
|
||||
toFieldMetadataId: SeedAttachmentFieldMetadataIds.Author,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
@ -1,5 +1,8 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { SeedViewIds } from 'src/database/typeorm-seeds/tenant/views';
|
||||
import { SeedCompanyFieldMetadataIds } from 'src/database/typeorm-seeds/metadata/field-metadata/company';
|
||||
|
||||
const tableName = 'viewField';
|
||||
|
||||
export const seedViewFields = async (
|
||||
@ -10,7 +13,6 @@ export const seedViewFields = async (
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${tableName}`, [
|
||||
'id',
|
||||
'fieldMetadataId',
|
||||
'viewId',
|
||||
'position',
|
||||
@ -20,141 +22,132 @@ export const seedViewFields = async (
|
||||
.orIgnore()
|
||||
.values([
|
||||
{
|
||||
id: '46a72a5b-276e-4241-a05f-c054410aebcb',
|
||||
fieldMetadataId: 'name',
|
||||
viewId: '10bec73c-0aea-4cc4-a3b2-8c2186f29b43',
|
||||
viewId: SeedViewIds.PrismaCompany,
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 180,
|
||||
},
|
||||
{
|
||||
id: 'f15b26ff-8f79-49dd-8f53-4286dd1af846',
|
||||
fieldMetadataId: 'name',
|
||||
viewId: '37a8a866-eb17-4e76-9382-03143a2f6a80',
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 180,
|
||||
},
|
||||
{
|
||||
id: '8d1dbb50-c97f-42c4-8575-3d2c9bdeb6e5',
|
||||
fieldMetadataId: 'domainName',
|
||||
viewId: '37a8a866-eb17-4e76-9382-03143a2f6a80',
|
||||
viewId: SeedViewIds.PrismaCompany,
|
||||
position: 1,
|
||||
isVisible: true,
|
||||
size: 100,
|
||||
},
|
||||
{
|
||||
id: '33833b3b-4e02-4f10-91fc-c594422952af',
|
||||
fieldMetadataId: 'accountOwner',
|
||||
viewId: '37a8a866-eb17-4e76-9382-03143a2f6a80',
|
||||
viewId: SeedViewIds.PrismaCompany,
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
id: 'c750a968-832e-4812-a1a2-74f515af55c1',
|
||||
fieldMetadataId: 'createdAt',
|
||||
viewId: '37a8a866-eb17-4e76-9382-03143a2f6a80',
|
||||
viewId: SeedViewIds.PrismaCompany,
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
id: '2fde3187-a0bc-47ca-80bd-457bd826fb4a',
|
||||
fieldMetadataId: 'employees',
|
||||
viewId: '37a8a866-eb17-4e76-9382-03143a2f6a80',
|
||||
viewId: SeedViewIds.PrismaCompany,
|
||||
position: 4,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
id: '2fead26f-3f4f-4a4d-a4c6-3abe7b2f74c9',
|
||||
fieldMetadataId: 'linkedin',
|
||||
viewId: '37a8a866-eb17-4e76-9382-03143a2f6a80',
|
||||
viewId: SeedViewIds.PrismaCompany,
|
||||
position: 5,
|
||||
isVisible: true,
|
||||
size: 170,
|
||||
},
|
||||
{
|
||||
id: '0cffa82a-c851-4e17-b46c-2c4642d78329',
|
||||
fieldMetadataId: 'address',
|
||||
viewId: '37a8a866-eb17-4e76-9382-03143a2f6a80',
|
||||
viewId: SeedViewIds.PrismaCompany,
|
||||
position: 6,
|
||||
isVisible: true,
|
||||
size: 170,
|
||||
},
|
||||
{
|
||||
id: '93a68c4a-8107-409a-9adb-06305ffbd692',
|
||||
fieldMetadataId: 'displayName',
|
||||
viewId: '6095799e-b48f-4e00-b071-10818083593a',
|
||||
viewId: SeedViewIds.PrismaPerson,
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 210,
|
||||
},
|
||||
{
|
||||
id: 'd955ee31-6316-4cb2-af71-9609dede4d7e',
|
||||
fieldMetadataId: 'email',
|
||||
viewId: '6095799e-b48f-4e00-b071-10818083593a',
|
||||
viewId: SeedViewIds.PrismaPerson,
|
||||
position: 1,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
id: 'bceb4d84-8ad1-4a0e-9333-efb870b42eb8',
|
||||
fieldMetadataId: 'company',
|
||||
viewId: '6095799e-b48f-4e00-b071-10818083593a',
|
||||
viewId: SeedViewIds.PrismaPerson,
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
id: 'bef874d4-f349-4cdb-ae28-6e9fc497449b',
|
||||
fieldMetadataId: 'phone',
|
||||
viewId: '6095799e-b48f-4e00-b071-10818083593a',
|
||||
viewId: SeedViewIds.PrismaPerson,
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
id: 'e06f920d-1af9-404d-8b9a-4f97c4009a4a',
|
||||
fieldMetadataId: 'createdAt',
|
||||
viewId: '6095799e-b48f-4e00-b071-10818083593a',
|
||||
viewId: SeedViewIds.PrismaPerson,
|
||||
position: 4,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
id: '92d94ee8-31fc-4025-a427-29291abb2b19',
|
||||
fieldMetadataId: 'city',
|
||||
viewId: '6095799e-b48f-4e00-b071-10818083593a',
|
||||
viewId: SeedViewIds.PrismaPerson,
|
||||
position: 5,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
id: 'b38e4022-1559-40da-bd5e-29d89b6c8330',
|
||||
fieldMetadataId: 'jobTitle',
|
||||
viewId: '6095799e-b48f-4e00-b071-10818083593a',
|
||||
viewId: SeedViewIds.PrismaPerson,
|
||||
position: 6,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
id: '30147fab-9666-4db5-a11b-20af4544c712',
|
||||
fieldMetadataId: 'linkedin',
|
||||
viewId: '6095799e-b48f-4e00-b071-10818083593a',
|
||||
viewId: SeedViewIds.PrismaPerson,
|
||||
position: 7,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
id: 'f0870949-21ac-46a2-b3ec-d1b0107c434c',
|
||||
fieldMetadataId: 'x',
|
||||
viewId: '6095799e-b48f-4e00-b071-10818083593a',
|
||||
viewId: SeedViewIds.PrismaPerson,
|
||||
position: 8,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
|
||||
{
|
||||
fieldMetadataId: SeedCompanyFieldMetadataIds.Name,
|
||||
viewId: SeedViewIds.Company,
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 180,
|
||||
},
|
||||
{
|
||||
fieldMetadataId: SeedCompanyFieldMetadataIds.DomainName,
|
||||
viewId: SeedViewIds.Company,
|
||||
position: 1,
|
||||
isVisible: true,
|
||||
size: 100,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
||||
|
@ -1,7 +1,18 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
import { SeedObjectMetadataIds } from 'src/database/typeorm-seeds/metadata/object-metadata';
|
||||
|
||||
const tableName = 'view';
|
||||
|
||||
export const enum SeedViewIds {
|
||||
PrismaCompany = '20202020-1ad3-4d1b-81f3-d7ecba29f8d3',
|
||||
PrismaPerson = '20202020-9adf-4768-bd9c-27a82fa141f1',
|
||||
PrismaOpportunity = '20202020-ffc7-4c81-bb41-d4baed4ed685',
|
||||
Company = '20202020-2441-4424-8163-4002c523d415',
|
||||
Person = '20202020-1979-447d-8115-593744eb4ead',
|
||||
Opportunity = '20202020-b2b3-48a5-96ce-0936d6af21f7',
|
||||
}
|
||||
|
||||
export const seedViews = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
@ -18,29 +29,41 @@ export const seedViews = async (
|
||||
.orIgnore()
|
||||
.values([
|
||||
{
|
||||
id: '37a8a866-eb17-4e76-9382-03143a2f6a80',
|
||||
id: SeedViewIds.PrismaCompany,
|
||||
name: 'All companies',
|
||||
objectMetadataId: 'company',
|
||||
type: 'table',
|
||||
},
|
||||
{
|
||||
id: '6095799e-b48f-4e00-b071-10818083593a',
|
||||
id: SeedViewIds.PrismaPerson,
|
||||
name: 'All people',
|
||||
objectMetadataId: 'person',
|
||||
type: 'table',
|
||||
},
|
||||
{
|
||||
id: 'e26f66b7-f890-4a5c-b4d2-ec09987b5308',
|
||||
id: SeedViewIds.PrismaOpportunity,
|
||||
name: 'All opportunities',
|
||||
objectMetadataId: 'company',
|
||||
type: 'kanban',
|
||||
},
|
||||
{
|
||||
id: '10bec73c-0aea-4cc4-a3b2-8c2186f29b43',
|
||||
name: 'All Companies (V2)',
|
||||
objectMetadataId: '1a8487a0-480c-434e-b4c7-e22408b97047',
|
||||
id: SeedViewIds.Company,
|
||||
name: 'All Companies',
|
||||
objectMetadataId: SeedObjectMetadataIds.Company,
|
||||
type: 'table',
|
||||
},
|
||||
{
|
||||
id: SeedViewIds.Person,
|
||||
name: 'All People',
|
||||
objectMetadataId: SeedObjectMetadataIds.Company,
|
||||
type: 'table',
|
||||
},
|
||||
{
|
||||
id: SeedViewIds.Opportunity,
|
||||
name: 'All Opportunities',
|
||||
objectMetadataId: SeedObjectMetadataIds.Opportunity,
|
||||
type: 'kanban',
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
||||
|
@ -17,13 +17,14 @@ import { ObjectMetadataEntity } from 'src/metadata/object-metadata/object-metada
|
||||
import { RelationMetadataEntity } from 'src/metadata/relation-metadata/relation-metadata.entity';
|
||||
|
||||
export enum FieldMetadataType {
|
||||
UUID = 'uuid',
|
||||
UUID = 'UUID',
|
||||
TEXT = 'TEXT',
|
||||
PHONE = 'PHONE',
|
||||
EMAIL = 'EMAIL',
|
||||
DATE = 'DATE',
|
||||
BOOLEAN = 'BOOLEAN',
|
||||
NUMBER = 'NUMBER',
|
||||
PROBABILITY = 'PROBABILITY',
|
||||
ENUM = 'ENUM',
|
||||
URL = 'URL',
|
||||
MONEY = 'MONEY',
|
||||
|
@ -28,6 +28,7 @@ export function generateTargetColumnMap(
|
||||
case FieldMetadataType.PHONE:
|
||||
case FieldMetadataType.EMAIL:
|
||||
case FieldMetadataType.NUMBER:
|
||||
case FieldMetadataType.PROBABILITY:
|
||||
case FieldMetadataType.BOOLEAN:
|
||||
case FieldMetadataType.DATE:
|
||||
return {
|
||||
@ -70,11 +71,12 @@ export function convertFieldMetadataToColumnActions(
|
||||
},
|
||||
];
|
||||
case FieldMetadataType.NUMBER:
|
||||
case FieldMetadataType.PROBABILITY:
|
||||
return [
|
||||
{
|
||||
action: TenantMigrationColumnActionType.CREATE,
|
||||
columnName: fieldMetadata.targetColumnMap.value,
|
||||
columnType: 'integer',
|
||||
columnType: 'float',
|
||||
},
|
||||
];
|
||||
case FieldMetadataType.BOOLEAN:
|
||||
|
@ -86,6 +86,7 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
|
||||
'fields.fromRelationMetadata.toObjectMetadata.fields',
|
||||
'fields.toRelationMetadata',
|
||||
'fields.toRelationMetadata.fromObjectMetadata',
|
||||
'fields.toRelationMetadata.fromObjectMetadata.fields',
|
||||
'fields.toRelationMetadata.toObjectMetadata',
|
||||
],
|
||||
});
|
||||
@ -102,6 +103,7 @@ export class ObjectMetadataService extends TypeOrmQueryService<ObjectMetadataEnt
|
||||
'fields.fromRelationMetadata.toObjectMetadata.fields',
|
||||
'fields.toRelationMetadata',
|
||||
'fields.toRelationMetadata.fromObjectMetadata',
|
||||
'fields.toRelationMetadata.fromObjectMetadata.fields',
|
||||
'fields.toRelationMetadata.toObjectMetadata',
|
||||
],
|
||||
});
|
||||
|
@ -17,7 +17,7 @@ import { RelationMetadataType } from 'src/metadata/relation-metadata/relation-me
|
||||
export class CreateRelationInput {
|
||||
@IsEnum(RelationMetadataType)
|
||||
@IsNotEmpty()
|
||||
@Field()
|
||||
@Field(() => RelationMetadataType)
|
||||
relationType: RelationMetadataType;
|
||||
|
||||
@IsUUID()
|
||||
|
@ -29,7 +29,7 @@ export class RelationMetadataDTO {
|
||||
@IDField(() => ID)
|
||||
id: string;
|
||||
|
||||
@Field()
|
||||
@Field(() => RelationMetadataType)
|
||||
relationType: RelationMetadataType;
|
||||
|
||||
@Field()
|
||||
|
@ -1,3 +1,5 @@
|
||||
import { registerEnumType } from '@nestjs/graphql';
|
||||
|
||||
import {
|
||||
Column,
|
||||
CreateDateColumn,
|
||||
@ -20,6 +22,11 @@ export enum RelationMetadataType {
|
||||
MANY_TO_MANY = 'MANY_TO_MANY',
|
||||
}
|
||||
|
||||
registerEnumType(RelationMetadataType, {
|
||||
name: 'RelationMetadataType',
|
||||
description: 'Type of the relation',
|
||||
});
|
||||
|
||||
@Entity('relationMetadata')
|
||||
export class RelationMetadataEntity implements RelationMetadataInterface {
|
||||
@PrimaryGeneratedColumn('uuid')
|
||||
|
@ -32,6 +32,42 @@ export const addCompanyTable: TenantMigrationTableAction[] = [
|
||||
columnType: 'integer',
|
||||
action: TenantMigrationColumnActionType.CREATE,
|
||||
},
|
||||
{
|
||||
columnName: 'linkedinUrl_link',
|
||||
columnType: 'varchar',
|
||||
action: TenantMigrationColumnActionType.CREATE,
|
||||
},
|
||||
{
|
||||
columnName: 'linkedinUrl',
|
||||
columnType: 'varchar',
|
||||
action: TenantMigrationColumnActionType.CREATE,
|
||||
},
|
||||
{
|
||||
columnName: 'xUrl',
|
||||
columnType: 'varchar',
|
||||
action: TenantMigrationColumnActionType.CREATE,
|
||||
},
|
||||
{
|
||||
columnName: 'annualRecurringRevenue',
|
||||
columnType: 'float',
|
||||
action: TenantMigrationColumnActionType.CREATE,
|
||||
},
|
||||
{
|
||||
columnName: 'idealCustomerProfile',
|
||||
columnType: 'boolean',
|
||||
action: TenantMigrationColumnActionType.CREATE,
|
||||
},
|
||||
{
|
||||
columnName: 'accountOwnerId',
|
||||
columnType: 'uuid',
|
||||
action: TenantMigrationColumnActionType.CREATE,
|
||||
},
|
||||
{
|
||||
columnName: 'accountOwnerId',
|
||||
referencedTableName: 'workspaceMember',
|
||||
referencedTableColumnName: 'id',
|
||||
action: TenantMigrationColumnActionType.RELATION,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
@ -17,11 +17,6 @@ export const addViewFilterTable: TenantMigrationTableAction[] = [
|
||||
columnType: 'varchar',
|
||||
action: TenantMigrationColumnActionType.CREATE,
|
||||
},
|
||||
{
|
||||
columnName: 'viewId',
|
||||
columnType: 'varchar',
|
||||
action: TenantMigrationColumnActionType.CREATE,
|
||||
},
|
||||
{
|
||||
columnName: 'operand',
|
||||
columnType: 'varchar',
|
||||
@ -37,6 +32,17 @@ export const addViewFilterTable: TenantMigrationTableAction[] = [
|
||||
columnType: 'varchar',
|
||||
action: TenantMigrationColumnActionType.CREATE,
|
||||
},
|
||||
{
|
||||
columnName: 'viewId',
|
||||
columnType: 'uuid',
|
||||
action: TenantMigrationColumnActionType.CREATE,
|
||||
},
|
||||
{
|
||||
columnName: 'viewId',
|
||||
referencedTableName: 'view',
|
||||
referencedTableColumnName: 'id',
|
||||
action: TenantMigrationColumnActionType.RELATION,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
@ -17,16 +17,22 @@ export const addViewSortTable: TenantMigrationTableAction[] = [
|
||||
columnType: 'varchar',
|
||||
action: TenantMigrationColumnActionType.CREATE,
|
||||
},
|
||||
{
|
||||
columnName: 'viewId',
|
||||
columnType: 'varchar',
|
||||
action: TenantMigrationColumnActionType.CREATE,
|
||||
},
|
||||
{
|
||||
columnName: 'direction',
|
||||
columnType: 'varchar',
|
||||
action: TenantMigrationColumnActionType.CREATE,
|
||||
},
|
||||
{
|
||||
columnName: 'viewId',
|
||||
columnType: 'uuid',
|
||||
action: TenantMigrationColumnActionType.CREATE,
|
||||
},
|
||||
{
|
||||
columnName: 'viewId',
|
||||
referencedTableName: 'view',
|
||||
referencedTableColumnName: 'id',
|
||||
action: TenantMigrationColumnActionType.RELATION,
|
||||
},
|
||||
],
|
||||
},
|
||||
];
|
||||
|
@ -0,0 +1,13 @@
|
||||
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity';
|
||||
|
||||
export const addActivityTargetTable: TenantMigrationTableAction[] = [
|
||||
{
|
||||
name: 'activityTarget',
|
||||
action: 'create',
|
||||
},
|
||||
{
|
||||
name: 'activityTarget',
|
||||
action: 'alter',
|
||||
columns: [],
|
||||
},
|
||||
];
|
@ -0,0 +1,13 @@
|
||||
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity';
|
||||
|
||||
export const addActivityTable: TenantMigrationTableAction[] = [
|
||||
{
|
||||
name: 'activity',
|
||||
action: 'create',
|
||||
},
|
||||
{
|
||||
name: 'activity',
|
||||
action: 'alter',
|
||||
columns: [],
|
||||
},
|
||||
];
|
@ -0,0 +1,13 @@
|
||||
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity';
|
||||
|
||||
export const addApiKeyTable: TenantMigrationTableAction[] = [
|
||||
{
|
||||
name: 'apiKey',
|
||||
action: 'create',
|
||||
},
|
||||
{
|
||||
name: 'apiKey',
|
||||
action: 'alter',
|
||||
columns: [],
|
||||
},
|
||||
];
|
@ -0,0 +1,13 @@
|
||||
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity';
|
||||
|
||||
export const addAttachmentTable: TenantMigrationTableAction[] = [
|
||||
{
|
||||
name: 'attachment',
|
||||
action: 'create',
|
||||
},
|
||||
{
|
||||
name: 'attachment',
|
||||
action: 'alter',
|
||||
columns: [],
|
||||
},
|
||||
];
|
@ -0,0 +1,13 @@
|
||||
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity';
|
||||
|
||||
export const addCommentTable: TenantMigrationTableAction[] = [
|
||||
{
|
||||
name: 'comment',
|
||||
action: 'create',
|
||||
},
|
||||
{
|
||||
name: 'comment',
|
||||
action: 'alter',
|
||||
columns: [],
|
||||
},
|
||||
];
|
@ -0,0 +1,13 @@
|
||||
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity';
|
||||
|
||||
export const addFavoriteTable: TenantMigrationTableAction[] = [
|
||||
{
|
||||
name: 'favorite',
|
||||
action: 'create',
|
||||
},
|
||||
{
|
||||
name: 'favorite',
|
||||
action: 'alter',
|
||||
columns: [],
|
||||
},
|
||||
];
|
@ -0,0 +1,13 @@
|
||||
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity';
|
||||
|
||||
export const addOpportunityTable: TenantMigrationTableAction[] = [
|
||||
{
|
||||
name: 'opportunity',
|
||||
action: 'create',
|
||||
},
|
||||
{
|
||||
name: 'opportunity',
|
||||
action: 'alter',
|
||||
columns: [],
|
||||
},
|
||||
];
|
@ -0,0 +1,13 @@
|
||||
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity';
|
||||
|
||||
export const addPersonTable: TenantMigrationTableAction[] = [
|
||||
{
|
||||
name: 'person',
|
||||
action: 'create',
|
||||
},
|
||||
{
|
||||
name: 'person',
|
||||
action: 'alter',
|
||||
columns: [],
|
||||
},
|
||||
];
|
@ -0,0 +1,13 @@
|
||||
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity';
|
||||
|
||||
export const addPipelineStepTable: TenantMigrationTableAction[] = [
|
||||
{
|
||||
name: 'pipelineStep',
|
||||
action: 'create',
|
||||
},
|
||||
{
|
||||
name: 'pipelineStep',
|
||||
action: 'alter',
|
||||
columns: [],
|
||||
},
|
||||
];
|
@ -0,0 +1,13 @@
|
||||
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity';
|
||||
|
||||
export const addWebhookTable: TenantMigrationTableAction[] = [
|
||||
{
|
||||
name: 'webhook',
|
||||
action: 'create',
|
||||
},
|
||||
{
|
||||
name: 'webhook',
|
||||
action: 'alter',
|
||||
columns: [],
|
||||
},
|
||||
];
|
@ -0,0 +1,13 @@
|
||||
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity';
|
||||
|
||||
export const addWorkspaceMemberSettingTable: TenantMigrationTableAction[] = [
|
||||
{
|
||||
name: 'workspaceMemberSetting',
|
||||
action: 'create',
|
||||
},
|
||||
{
|
||||
name: 'workspaceMemberSetting',
|
||||
action: 'alter',
|
||||
columns: [],
|
||||
},
|
||||
];
|
@ -0,0 +1,13 @@
|
||||
import { TenantMigrationTableAction } from 'src/metadata/tenant-migration/tenant-migration.entity';
|
||||
|
||||
export const addWorkspaceMemberTable: TenantMigrationTableAction[] = [
|
||||
{
|
||||
name: 'workspaceMember',
|
||||
action: 'create',
|
||||
},
|
||||
{
|
||||
name: 'workspaceMember',
|
||||
action: 'alter',
|
||||
columns: [],
|
||||
},
|
||||
];
|
@ -1,3 +1,16 @@
|
||||
import { addActivityTargetTable } from 'src/metadata/tenant-migration/migrations/1697618015-addActivityTargetTable';
|
||||
import { addActivityTable } from 'src/metadata/tenant-migration/migrations/1697618016-addActivityTable';
|
||||
import { addApiKeyTable } from 'src/metadata/tenant-migration/migrations/1697618017-addApiKeyTable';
|
||||
import { addAttachmentTable } from 'src/metadata/tenant-migration/migrations/1697618018-addAttachmentTable';
|
||||
import { addCommentTable } from 'src/metadata/tenant-migration/migrations/1697618019-addCommentTable';
|
||||
import { addFavoriteTable } from 'src/metadata/tenant-migration/migrations/1697618020-addFavoriteTable';
|
||||
import { addOpportunityTable } from 'src/metadata/tenant-migration/migrations/1697618021-addOpportunityTable';
|
||||
import { addPersonTable } from 'src/metadata/tenant-migration/migrations/1697618022-addPersonTable';
|
||||
import { addPipelineStepTable } from 'src/metadata/tenant-migration/migrations/1697618023-addPipelineStepTable';
|
||||
import { addWebhookTable } from 'src/metadata/tenant-migration/migrations/1697618024-addWebhookTable';
|
||||
import { addWorkspaceMemberSettingTable } from 'src/metadata/tenant-migration/migrations/1697618025-addWorkspaceMemberSettingTable';
|
||||
import { addWorkspaceMemberTable } from 'src/metadata/tenant-migration/migrations/1697618026-addWorspaceMemberTable';
|
||||
|
||||
import { addCompanyTable } from './migrations/1697618009-addCompanyTable';
|
||||
import { addViewTable } from './migrations/1697618011-addViewTable';
|
||||
import { addViewFieldTable } from './migrations/1697618012-addViewFieldTable';
|
||||
@ -6,9 +19,22 @@ import { addViewSortTable } from './migrations/1697618014-addViewSortTable';
|
||||
|
||||
// TODO: read the folder and return all migrations
|
||||
export const standardMigrations = {
|
||||
'1697618009-addCompanyTable': addCompanyTable,
|
||||
'1697618011-addViewTable': addViewTable,
|
||||
'1697618012-addViewFieldTable': addViewFieldTable,
|
||||
'1697618013-addViewFilterTable': addViewFilterTable,
|
||||
'1697618014-addViewSortTable': addViewSortTable,
|
||||
|
||||
'1697618015-addActivityTargetTable': addActivityTargetTable,
|
||||
'1697618016-addActivityTable': addActivityTable,
|
||||
'1697618017-addApiKeyTable': addApiKeyTable,
|
||||
'1697618018-addAttachmentTable': addAttachmentTable,
|
||||
'1697618019-addCommentTable': addCommentTable,
|
||||
'1697618020-addFavoriteTable': addFavoriteTable,
|
||||
'1697618021-addOpportunityTable': addOpportunityTable,
|
||||
'1697618022-addPersonTable': addPersonTable,
|
||||
'1697618023-addPipelineStepTable': addPipelineStepTable,
|
||||
'1697618024-addWebhookTable': addWebhookTable,
|
||||
'1697618025-addWorkspaceMemberSettingTable': addWorkspaceMemberSettingTable,
|
||||
'1697618026-addWorkspaceMemberTable': addWorkspaceMemberTable,
|
||||
'1697618009-addCompanyTable': addCompanyTable,
|
||||
};
|
||||
|
@ -68,10 +68,10 @@ export class CompositeFieldAliasFactory {
|
||||
fieldMetadata.objectMetadataId,
|
||||
relationMetadata,
|
||||
);
|
||||
const targetTableName =
|
||||
const referencedObjectMetadata =
|
||||
relationDirection == RelationDirection.TO
|
||||
? relationMetadata.fromObjectMetadata.targetTableName
|
||||
: relationMetadata.toObjectMetadata.targetTableName;
|
||||
? relationMetadata.fromObjectMetadata
|
||||
: relationMetadata.toObjectMetadata;
|
||||
|
||||
// If it's a relation destination is of kind MANY, we need to add the collection suffix and extract the args
|
||||
if (
|
||||
@ -84,7 +84,7 @@ export class CompositeFieldAliasFactory {
|
||||
relationMetadata.toObjectMetadata.fields ?? [],
|
||||
);
|
||||
return `
|
||||
${fieldKey}: ${targetTableName}Collection${
|
||||
${fieldKey}: ${referencedObjectMetadata.targetTableName}Collection${
|
||||
argsString ? `(${argsString})` : ''
|
||||
} {
|
||||
${this.fieldsStringFactory.createFieldsStringRecursive(
|
||||
@ -98,11 +98,11 @@ export class CompositeFieldAliasFactory {
|
||||
|
||||
// Otherwise it means it's a relation destination is of kind ONE
|
||||
return `
|
||||
${fieldKey}: ${targetTableName} {
|
||||
${fieldKey}: ${referencedObjectMetadata.targetTableName} {
|
||||
${this.fieldsStringFactory.createFieldsStringRecursive(
|
||||
info,
|
||||
fieldValue,
|
||||
relationMetadata.toObjectMetadata.fields ?? [],
|
||||
referencedObjectMetadata.fields ?? [],
|
||||
)}
|
||||
}
|
||||
`;
|
||||
|
@ -139,6 +139,9 @@ export class QueryRunnerService {
|
||||
workspaceId,
|
||||
)};
|
||||
`);
|
||||
console.log('ho');
|
||||
console.log(query);
|
||||
console.log('ha');
|
||||
|
||||
return workspaceDataSource?.query<PGGraphQLResult>(`
|
||||
SELECT graphql.resolve($$
|
||||
|
@ -61,6 +61,7 @@ export class TypeMapperService {
|
||||
[FieldMetadataType.DATE, dateScalar],
|
||||
[FieldMetadataType.BOOLEAN, GraphQLBoolean],
|
||||
[FieldMetadataType.NUMBER, numberScalar],
|
||||
[FieldMetadataType.PROBABILITY, GraphQLFloat],
|
||||
[FieldMetadataType.RELATION, GraphQLID],
|
||||
]);
|
||||
|
||||
@ -89,6 +90,7 @@ export class TypeMapperService {
|
||||
[FieldMetadataType.DATE, dateFilter],
|
||||
[FieldMetadataType.BOOLEAN, BooleanFilterType],
|
||||
[FieldMetadataType.NUMBER, numberScalar],
|
||||
[FieldMetadataType.PROBABILITY, FloatFilterType],
|
||||
[FieldMetadataType.RELATION, UUIDFilterType],
|
||||
]);
|
||||
|
||||
@ -107,6 +109,7 @@ export class TypeMapperService {
|
||||
[FieldMetadataType.DATE, OrderByDirectionType],
|
||||
[FieldMetadataType.BOOLEAN, OrderByDirectionType],
|
||||
[FieldMetadataType.NUMBER, OrderByDirectionType],
|
||||
[FieldMetadataType.PROBABILITY, OrderByDirectionType],
|
||||
]);
|
||||
|
||||
return typeOrderByMapping.get(fieldMetadataType);
|
||||
|
@ -1,5 +1,5 @@
|
||||
{
|
||||
"id": "twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419",
|
||||
"id": "20202020-1c25-4d02-bf25-6aeccf7ea419",
|
||||
"displayName": "Apple",
|
||||
"domainName": "apple.dev",
|
||||
"inviteHash": "apple.dev-invite-hash",
|
||||
|
Loading…
Reference in New Issue
Block a user