Fix seeds for local workspace and newly created workspaces (#2333)
* Update metadata/data seeds * fix * fix * move seeding into a transaction * add no-non-null-assertion --------- Co-authored-by: Charles Bochet <charlesBochet@users.noreply.github.com>
This commit is contained in:
334
server/src/database/typeorm-seeds/metadata/field-metadata.ts
Normal file
334
server/src/database/typeorm-seeds/metadata/field-metadata.ts
Normal file
@ -0,0 +1,334 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
const tableName = 'field_metadata';
|
||||
|
||||
export const seedFieldMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${tableName}`, [
|
||||
'objectId',
|
||||
'isCustom',
|
||||
'workspaceId',
|
||||
'isActive',
|
||||
'type',
|
||||
'name',
|
||||
'label',
|
||||
'targetColumnMap',
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
// Companies
|
||||
{
|
||||
objectId: '1a8487a0-480c-434e-b4c7-e22408b97047',
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
isActive: true,
|
||||
type: 'text',
|
||||
name: 'name',
|
||||
label: 'Name',
|
||||
targetColumnMap: {
|
||||
value: 'name',
|
||||
},
|
||||
description: 'Name of the company',
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectId: '1a8487a0-480c-434e-b4c7-e22408b97047',
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
isActive: true,
|
||||
type: 'text',
|
||||
name: 'domainName',
|
||||
label: 'Domain Name',
|
||||
targetColumnMap: {
|
||||
value: 'domainName',
|
||||
},
|
||||
description: 'Domain name of the company',
|
||||
icon: 'IconLink',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
objectId: '1a8487a0-480c-434e-b4c7-e22408b97047',
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
isActive: true,
|
||||
type: 'text',
|
||||
name: 'address',
|
||||
label: 'Address',
|
||||
targetColumnMap: {
|
||||
value: 'address',
|
||||
},
|
||||
description: 'Address of the company',
|
||||
icon: 'IconMap',
|
||||
isNullable: true,
|
||||
},
|
||||
{
|
||||
objectId: '1a8487a0-480c-434e-b4c7-e22408b97047',
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
isActive: true,
|
||||
type: 'text',
|
||||
name: 'employees',
|
||||
label: 'Employees',
|
||||
targetColumnMap: {
|
||||
value: 'employees',
|
||||
},
|
||||
description: 'Number of employees',
|
||||
icon: 'IconUsers',
|
||||
isNullable: true,
|
||||
},
|
||||
// Views
|
||||
{
|
||||
objectId: '9ab6b3dc-767f-473f-8fd0-6cdbefbf8dbe',
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
isActive: true,
|
||||
type: 'text',
|
||||
name: 'name',
|
||||
label: 'Name',
|
||||
targetColumnMap: {
|
||||
value: 'name',
|
||||
},
|
||||
description: 'View name',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectId: '9ab6b3dc-767f-473f-8fd0-6cdbefbf8dbe',
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
isActive: true,
|
||||
type: 'text',
|
||||
name: 'objectId',
|
||||
label: 'Object Id',
|
||||
targetColumnMap: {
|
||||
value: 'objectId',
|
||||
},
|
||||
description: 'View target object',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectId: '9ab6b3dc-767f-473f-8fd0-6cdbefbf8dbe',
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
isActive: true,
|
||||
type: 'text',
|
||||
name: 'type',
|
||||
label: 'Type',
|
||||
targetColumnMap: {
|
||||
value: 'type',
|
||||
},
|
||||
description: 'View type',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
},
|
||||
// View Fields
|
||||
{
|
||||
objectId: '61d9000b-485c-4c48-a22e-0d9a164f9647',
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
isActive: true,
|
||||
type: 'text',
|
||||
name: 'fieldId',
|
||||
label: 'Field Id',
|
||||
targetColumnMap: {
|
||||
value: 'fieldId',
|
||||
},
|
||||
description: 'View Field target field',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectId: '61d9000b-485c-4c48-a22e-0d9a164f9647',
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
isActive: true,
|
||||
type: 'text',
|
||||
name: 'viewId',
|
||||
label: 'View Id',
|
||||
targetColumnMap: {
|
||||
value: 'viewId',
|
||||
},
|
||||
description: 'View Field related view',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectId: '61d9000b-485c-4c48-a22e-0d9a164f9647',
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
isActive: true,
|
||||
type: 'boolean',
|
||||
name: 'isVisible',
|
||||
label: 'Visible',
|
||||
targetColumnMap: {
|
||||
value: 'isVisible',
|
||||
},
|
||||
description: 'View Field visibility',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectId: '61d9000b-485c-4c48-a22e-0d9a164f9647',
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
isActive: true,
|
||||
type: 'number',
|
||||
name: 'size',
|
||||
label: 'Size',
|
||||
targetColumnMap: {
|
||||
value: 'size',
|
||||
},
|
||||
description: 'View Field size',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectId: '61d9000b-485c-4c48-a22e-0d9a164f9647',
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
isActive: true,
|
||||
type: 'number',
|
||||
name: 'position',
|
||||
label: 'Position',
|
||||
targetColumnMap: {
|
||||
value: 'position',
|
||||
},
|
||||
description: 'View Field position',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
},
|
||||
// View Filters
|
||||
{
|
||||
objectId: '5d9b1ab9-4461-4e2d-bf9e-9b47e68846d3',
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
isActive: true,
|
||||
type: 'text',
|
||||
name: 'fieldId',
|
||||
label: 'Field Id',
|
||||
targetColumnMap: {
|
||||
value: 'fieldId',
|
||||
},
|
||||
description: 'View Filter target field',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectId: '5d9b1ab9-4461-4e2d-bf9e-9b47e68846d3',
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
isActive: true,
|
||||
type: 'text',
|
||||
name: 'viewId',
|
||||
label: 'View Id',
|
||||
targetColumnMap: {
|
||||
value: 'viewId',
|
||||
},
|
||||
description: 'View Filter related view',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectId: '5d9b1ab9-4461-4e2d-bf9e-9b47e68846d3',
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
isActive: true,
|
||||
type: 'text',
|
||||
name: 'operand',
|
||||
label: 'Operand',
|
||||
targetColumnMap: {
|
||||
value: 'operand',
|
||||
},
|
||||
description: 'View Filter operand',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectId: '5d9b1ab9-4461-4e2d-bf9e-9b47e68846d3',
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
isActive: true,
|
||||
type: 'text',
|
||||
name: 'value',
|
||||
label: 'Value',
|
||||
targetColumnMap: {
|
||||
value: 'value',
|
||||
},
|
||||
description: 'View Filter value',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectId: '5d9b1ab9-4461-4e2d-bf9e-9b47e68846d3',
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
isActive: true,
|
||||
type: 'text',
|
||||
name: 'displayValue',
|
||||
label: 'Display Value',
|
||||
targetColumnMap: {
|
||||
value: 'displayValue',
|
||||
},
|
||||
description: 'View Filter Display Value',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
},
|
||||
// View Sorts
|
||||
{
|
||||
objectId: '6f8dcd4b-cf28-41dd-b98b-d6e1f5b3a251',
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
isActive: true,
|
||||
type: 'text',
|
||||
name: 'fieldId',
|
||||
label: 'Field Id',
|
||||
targetColumnMap: {
|
||||
value: 'fieldId',
|
||||
},
|
||||
description: 'View Sort target field',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectId: '6f8dcd4b-cf28-41dd-b98b-d6e1f5b3a251',
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
isActive: true,
|
||||
type: 'text',
|
||||
name: 'viewId',
|
||||
label: 'View Id',
|
||||
targetColumnMap: {
|
||||
value: 'viewId',
|
||||
},
|
||||
description: 'View Sort related view',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
},
|
||||
{
|
||||
objectId: '6f8dcd4b-cf28-41dd-b98b-d6e1f5b3a251',
|
||||
isCustom: false,
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
isActive: true,
|
||||
type: 'text',
|
||||
name: 'direction',
|
||||
label: 'Direction',
|
||||
targetColumnMap: {
|
||||
value: 'direction',
|
||||
},
|
||||
description: 'View Sort direction',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
||||
@ -0,0 +1,93 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
const tableName = 'object_metadata';
|
||||
|
||||
export const seedObjectMetadata = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${tableName}`, [
|
||||
'id',
|
||||
'nameSingular',
|
||||
'namePlural',
|
||||
'labelSingular',
|
||||
'labelPlural',
|
||||
'targetTableName',
|
||||
'description',
|
||||
'icon',
|
||||
'dataSourceId',
|
||||
'workspaceId',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
// Companies
|
||||
{
|
||||
id: '1a8487a0-480c-434e-b4c7-e22408b97047',
|
||||
nameSingular: 'companyV2',
|
||||
namePlural: 'companiesV2',
|
||||
labelSingular: 'Company',
|
||||
labelPlural: 'Companies',
|
||||
targetTableName: 'company',
|
||||
description: 'A company',
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
dataSourceId: 'b37b2163-7f63-47a9-b1b3-6c7290ca9fb1',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
// Views
|
||||
{
|
||||
id: '9ab6b3dc-767f-473f-8fd0-6cdbefbf8dbe',
|
||||
nameSingular: 'viewV2',
|
||||
namePlural: 'viewsV2',
|
||||
labelSingular: 'View',
|
||||
labelPlural: 'Views',
|
||||
targetTableName: 'view',
|
||||
description: '(System) Views',
|
||||
icon: 'IconLayoutCollage',
|
||||
dataSourceId: 'b37b2163-7f63-47a9-b1b3-6c7290ca9fb1',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
// ViewFields
|
||||
{
|
||||
id: '61d9000b-485c-4c48-a22e-0d9a164f9647',
|
||||
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',
|
||||
},
|
||||
// ViewFilters
|
||||
{
|
||||
id: '5d9b1ab9-4461-4e2d-bf9e-9b47e68846d3',
|
||||
nameSingular: 'viewFilterV2',
|
||||
namePlural: 'viewFiltersV2',
|
||||
labelSingular: 'View Filter',
|
||||
labelPlural: 'View Filters',
|
||||
targetTableName: 'viewFilter',
|
||||
description: '(System) View Filters',
|
||||
icon: 'IconFilterBolt',
|
||||
dataSourceId: 'b37b2163-7f63-47a9-b1b3-6c7290ca9fb1',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
// ViewSorts
|
||||
{
|
||||
id: '6f8dcd4b-cf28-41dd-b98b-d6e1f5b3a251',
|
||||
nameSingular: 'viewSortV2',
|
||||
namePlural: 'viewSortsV2',
|
||||
labelSingular: 'View Sort',
|
||||
labelPlural: 'View Sorts',
|
||||
targetTableName: 'viewSort',
|
||||
description: '(System) View Sorts',
|
||||
icon: 'IconArrowsSort',
|
||||
dataSourceId: 'b37b2163-7f63-47a9-b1b3-6c7290ca9fb1',
|
||||
workspaceId: 'twenty-7ed9d212-1c25-4d02-bf25-6aeccf7ea419',
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
||||
95
server/src/database/typeorm-seeds/tenant/companies.ts
Normal file
95
server/src/database/typeorm-seeds/tenant/companies.ts
Normal file
@ -0,0 +1,95 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
const tableName = 'company';
|
||||
|
||||
export const seedCompanies = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${tableName}`, ['id', 'name', 'domainName', 'address'])
|
||||
.orIgnore()
|
||||
.values([
|
||||
{
|
||||
id: 'fe256b39-3ec3-4fe3-8997-b76aa0bfa408',
|
||||
name: 'Linkedin',
|
||||
domainName: 'linkedin.com',
|
||||
address: '',
|
||||
},
|
||||
{
|
||||
id: '118995f3-5d81-46d6-bf83-f7fd33ea6102',
|
||||
name: 'Facebook',
|
||||
domainName: 'facebook.com',
|
||||
address: '',
|
||||
},
|
||||
{
|
||||
id: '04b2e9f5-0713-40a5-8216-82802401d33e',
|
||||
name: 'Qonto',
|
||||
domainName: 'qonto.com',
|
||||
address: '',
|
||||
},
|
||||
{
|
||||
id: '460b6fb1-ed89-413a-b31a-962986e67bb4',
|
||||
name: 'Microsoft',
|
||||
domainName: 'microsoft.com',
|
||||
address: '',
|
||||
},
|
||||
{
|
||||
id: '89bb825c-171e-4bcc-9cf7-43448d6fb278',
|
||||
name: 'Airbnb',
|
||||
domainName: 'airbnb.com',
|
||||
address: '',
|
||||
},
|
||||
{
|
||||
id: '0d940997-c21e-4ec2-873b-de4264d89025',
|
||||
name: 'Google',
|
||||
domainName: 'google.com',
|
||||
address: '',
|
||||
},
|
||||
{
|
||||
id: '1d3a1c6e-707e-44dc-a1d2-30030bf1a944',
|
||||
name: 'Netflix',
|
||||
domainName: 'netflix.com',
|
||||
address: '',
|
||||
},
|
||||
{
|
||||
id: '7a93d1e5-3f74-492d-a101-2a70f50a1645',
|
||||
name: 'Libeo',
|
||||
domainName: 'libeo.io',
|
||||
address: '',
|
||||
},
|
||||
{
|
||||
id: '9d162de6-cfbf-4156-a790-e39854dcd4eb',
|
||||
name: 'Claap',
|
||||
domainName: 'claap.io',
|
||||
address: '',
|
||||
},
|
||||
{
|
||||
id: 'aaffcfbd-f86b-419f-b794-02319abe8637',
|
||||
name: 'Hasura',
|
||||
domainName: 'hasura.io',
|
||||
address: '',
|
||||
},
|
||||
{
|
||||
id: 'f33dc242-5518-4553-9433-42d8eb82834b',
|
||||
name: 'Wework',
|
||||
domainName: 'wework.com',
|
||||
address: '',
|
||||
},
|
||||
{
|
||||
id: 'a7bc68d5-f79e-40dd-bd06-c36e6abb4678',
|
||||
name: 'Samsung',
|
||||
domainName: 'samsung.com',
|
||||
address: '',
|
||||
},
|
||||
{
|
||||
id: 'a674fa6c-1455-4c57-afaf-dd5dc086361d',
|
||||
name: 'Algolia',
|
||||
domainName: 'algolia.com',
|
||||
address: '',
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
||||
160
server/src/database/typeorm-seeds/tenant/view-fields.ts
Normal file
160
server/src/database/typeorm-seeds/tenant/view-fields.ts
Normal file
@ -0,0 +1,160 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
const tableName = 'viewField';
|
||||
|
||||
export const seedViewFields = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${tableName}`, [
|
||||
'id',
|
||||
'fieldId',
|
||||
'viewId',
|
||||
'position',
|
||||
'isVisible',
|
||||
'size',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
{
|
||||
id: '46a72a5b-276e-4241-a05f-c054410aebcb',
|
||||
fieldId: 'name',
|
||||
viewId: '10bec73c-0aea-4cc4-a3b2-8c2186f29b43',
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 180,
|
||||
},
|
||||
{
|
||||
id: 'f15b26ff-8f79-49dd-8f53-4286dd1af846',
|
||||
fieldId: 'name',
|
||||
viewId: '37a8a866-eb17-4e76-9382-03143a2f6a80',
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 180,
|
||||
},
|
||||
{
|
||||
id: '8d1dbb50-c97f-42c4-8575-3d2c9bdeb6e5',
|
||||
fieldId: 'domainName',
|
||||
viewId: '37a8a866-eb17-4e76-9382-03143a2f6a80',
|
||||
position: 1,
|
||||
isVisible: true,
|
||||
size: 100,
|
||||
},
|
||||
{
|
||||
id: '33833b3b-4e02-4f10-91fc-c594422952af',
|
||||
fieldId: 'accountOwner',
|
||||
viewId: '37a8a866-eb17-4e76-9382-03143a2f6a80',
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
id: 'c750a968-832e-4812-a1a2-74f515af55c1',
|
||||
fieldId: 'createdAt',
|
||||
viewId: '37a8a866-eb17-4e76-9382-03143a2f6a80',
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
id: '2fde3187-a0bc-47ca-80bd-457bd826fb4a',
|
||||
fieldId: 'employees',
|
||||
viewId: '37a8a866-eb17-4e76-9382-03143a2f6a80',
|
||||
position: 4,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
id: '2fead26f-3f4f-4a4d-a4c6-3abe7b2f74c9',
|
||||
fieldId: 'linkedin',
|
||||
viewId: '37a8a866-eb17-4e76-9382-03143a2f6a80',
|
||||
position: 5,
|
||||
isVisible: true,
|
||||
size: 170,
|
||||
},
|
||||
{
|
||||
id: '0cffa82a-c851-4e17-b46c-2c4642d78329',
|
||||
fieldId: 'address',
|
||||
viewId: '37a8a866-eb17-4e76-9382-03143a2f6a80',
|
||||
position: 6,
|
||||
isVisible: true,
|
||||
size: 170,
|
||||
},
|
||||
{
|
||||
id: '93a68c4a-8107-409a-9adb-06305ffbd692',
|
||||
fieldId: 'displayName',
|
||||
viewId: '6095799e-b48f-4e00-b071-10818083593a',
|
||||
position: 0,
|
||||
isVisible: true,
|
||||
size: 210,
|
||||
},
|
||||
{
|
||||
id: 'd955ee31-6316-4cb2-af71-9609dede4d7e',
|
||||
fieldId: 'email',
|
||||
viewId: '6095799e-b48f-4e00-b071-10818083593a',
|
||||
position: 1,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
id: 'bceb4d84-8ad1-4a0e-9333-efb870b42eb8',
|
||||
fieldId: 'company',
|
||||
viewId: '6095799e-b48f-4e00-b071-10818083593a',
|
||||
position: 2,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
id: 'bef874d4-f349-4cdb-ae28-6e9fc497449b',
|
||||
fieldId: 'phone',
|
||||
viewId: '6095799e-b48f-4e00-b071-10818083593a',
|
||||
position: 3,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
id: 'e06f920d-1af9-404d-8b9a-4f97c4009a4a',
|
||||
fieldId: 'createdAt',
|
||||
viewId: '6095799e-b48f-4e00-b071-10818083593a',
|
||||
position: 4,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
id: '92d94ee8-31fc-4025-a427-29291abb2b19',
|
||||
fieldId: 'city',
|
||||
viewId: '6095799e-b48f-4e00-b071-10818083593a',
|
||||
position: 5,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
id: 'b38e4022-1559-40da-bd5e-29d89b6c8330',
|
||||
fieldId: 'jobTitle',
|
||||
viewId: '6095799e-b48f-4e00-b071-10818083593a',
|
||||
position: 6,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
id: '30147fab-9666-4db5-a11b-20af4544c712',
|
||||
fieldId: 'linkedin',
|
||||
viewId: '6095799e-b48f-4e00-b071-10818083593a',
|
||||
position: 7,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
{
|
||||
id: 'f0870949-21ac-46a2-b3ec-d1b0107c434c',
|
||||
fieldId: 'x',
|
||||
viewId: '6095799e-b48f-4e00-b071-10818083593a',
|
||||
position: 8,
|
||||
isVisible: true,
|
||||
size: 150,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
||||
41
server/src/database/typeorm-seeds/tenant/views.ts
Normal file
41
server/src/database/typeorm-seeds/tenant/views.ts
Normal file
@ -0,0 +1,41 @@
|
||||
import { DataSource } from 'typeorm';
|
||||
|
||||
const tableName = 'view';
|
||||
|
||||
export const seedViews = async (
|
||||
workspaceDataSource: DataSource,
|
||||
schemaName: string,
|
||||
) => {
|
||||
await workspaceDataSource
|
||||
.createQueryBuilder()
|
||||
.insert()
|
||||
.into(`${schemaName}.${tableName}`, ['id', 'name', 'objectId', 'type'])
|
||||
.orIgnore()
|
||||
.values([
|
||||
{
|
||||
id: '37a8a866-eb17-4e76-9382-03143a2f6a80',
|
||||
name: 'All companies',
|
||||
objectId: 'company',
|
||||
type: 'table',
|
||||
},
|
||||
{
|
||||
id: '6095799e-b48f-4e00-b071-10818083593a',
|
||||
name: 'All people',
|
||||
objectId: 'person',
|
||||
type: 'table',
|
||||
},
|
||||
{
|
||||
id: 'e26f66b7-f890-4a5c-b4d2-ec09987b5308',
|
||||
name: 'All opportunities',
|
||||
objectId: 'company',
|
||||
type: 'kanban',
|
||||
},
|
||||
{
|
||||
id: '10bec73c-0aea-4cc4-a3b2-8c2186f29b43',
|
||||
name: 'All Companies (V2)',
|
||||
objectId: '1a8487a0-480c-434e-b4c7-e22408b97047',
|
||||
type: 'table',
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
};
|
||||
Reference in New Issue
Block a user