feat: expose foreign key (#2505)

* fix: typo

* feat: expose foreign key

* fix: foreign key exposition

* fix: be able to filter by foreign key

* feat: add `isSystem` on field metadata

* feat: update all seeds

* fix: seed issues

* fix: sync metadata generated files

* fix: squash metadata migrations

* Fix conflicts

---------

Co-authored-by: Charles Bochet <charles@twenty.com>
This commit is contained in:
Jérémy M
2023-11-16 12:30:40 +01:00
committed by GitHub
parent e5caa7a5df
commit e026b2b6e9
45 changed files with 786 additions and 327 deletions

View File

@ -19,7 +19,7 @@ const documents = {
"\n mutation UpdateOneObjectMetadataItem(\n $idToUpdate: ID!\n $updatePayload: UpdateObjectInput!\n ) {\n updateOneObject(input: { id: $idToUpdate, update: $updatePayload }) {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n createdAt\n updatedAt\n }\n }\n": types.UpdateOneObjectMetadataItemDocument, "\n mutation UpdateOneObjectMetadataItem(\n $idToUpdate: ID!\n $updatePayload: UpdateObjectInput!\n ) {\n updateOneObject(input: { id: $idToUpdate, update: $updatePayload }) {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n createdAt\n updatedAt\n }\n }\n": types.UpdateOneObjectMetadataItemDocument,
"\n mutation DeleteOneObjectMetadataItem($idToDelete: ID!) {\n deleteOneObject(input: { id: $idToDelete }) {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n createdAt\n updatedAt\n }\n }\n": types.DeleteOneObjectMetadataItemDocument, "\n mutation DeleteOneObjectMetadataItem($idToDelete: ID!) {\n deleteOneObject(input: { id: $idToDelete }) {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n createdAt\n updatedAt\n }\n }\n": types.DeleteOneObjectMetadataItemDocument,
"\n mutation DeleteOneFieldMetadataItem($idToDelete: ID!) {\n deleteOneField(input: { id: $idToDelete }) {\n id\n type\n name\n label\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n": types.DeleteOneFieldMetadataItemDocument, "\n mutation DeleteOneFieldMetadataItem($idToDelete: ID!) {\n deleteOneField(input: { id: $idToDelete }) {\n id\n type\n name\n label\n description\n icon\n placeholder\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n }\n }\n": types.DeleteOneFieldMetadataItemDocument,
"\n query ObjectMetadataItems($filter: objectFilter) {\n objects(paging: { first: 1000 }, filter: $filter) {\n edges {\n node {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n isSystem\n createdAt\n updatedAt\n fields(paging: { first: 1000 }) {\n edges {\n node {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n fromRelationMetadata {\n id\n relationType\n toObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n fromObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n }\n toRelationMetadata {\n id\n relationType\n toObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n fromObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n": types.ObjectMetadataItemsDocument, "\n query ObjectMetadataItems(\n $objectFilter: objectFilter\n $fieldFilter: fieldFilter\n ) {\n objects(paging: { first: 1000 }, filter: $objectFilter) {\n edges {\n node {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n isSystem\n createdAt\n updatedAt\n fields(paging: { first: 1000 }, filter: $fieldFilter) {\n edges {\n node {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isSystem\n isNullable\n createdAt\n updatedAt\n fromRelationMetadata {\n id\n relationType\n toObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n fromObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n }\n toRelationMetadata {\n id\n relationType\n toObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n fromObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n": types.ObjectMetadataItemsDocument,
}; };
/** /**
@ -63,7 +63,7 @@ export function graphql(source: "\n mutation DeleteOneFieldMetadataItem($idToDe
/** /**
* The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients. * The graphql function is used to parse GraphQL queries into a document that can be used by GraphQL clients.
*/ */
export function graphql(source: "\n query ObjectMetadataItems($filter: objectFilter) {\n objects(paging: { first: 1000 }, filter: $filter) {\n edges {\n node {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n isSystem\n createdAt\n updatedAt\n fields(paging: { first: 1000 }) {\n edges {\n node {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n fromRelationMetadata {\n id\n relationType\n toObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n fromObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n }\n toRelationMetadata {\n id\n relationType\n toObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n fromObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n"): (typeof documents)["\n query ObjectMetadataItems($filter: objectFilter) {\n objects(paging: { first: 1000 }, filter: $filter) {\n edges {\n node {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n isSystem\n createdAt\n updatedAt\n fields(paging: { first: 1000 }) {\n edges {\n node {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isNullable\n createdAt\n updatedAt\n fromRelationMetadata {\n id\n relationType\n toObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n fromObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n }\n toRelationMetadata {\n id\n relationType\n toObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n fromObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n"]; export function graphql(source: "\n query ObjectMetadataItems(\n $objectFilter: objectFilter\n $fieldFilter: fieldFilter\n ) {\n objects(paging: { first: 1000 }, filter: $objectFilter) {\n edges {\n node {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n isSystem\n createdAt\n updatedAt\n fields(paging: { first: 1000 }, filter: $fieldFilter) {\n edges {\n node {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isSystem\n isNullable\n createdAt\n updatedAt\n fromRelationMetadata {\n id\n relationType\n toObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n fromObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n }\n toRelationMetadata {\n id\n relationType\n toObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n fromObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n"): (typeof documents)["\n query ObjectMetadataItems(\n $objectFilter: objectFilter\n $fieldFilter: fieldFilter\n ) {\n objects(paging: { first: 1000 }, filter: $objectFilter) {\n edges {\n node {\n id\n dataSourceId\n nameSingular\n namePlural\n labelSingular\n labelPlural\n description\n icon\n isCustom\n isActive\n isSystem\n createdAt\n updatedAt\n fields(paging: { first: 1000 }, filter: $fieldFilter) {\n edges {\n node {\n id\n type\n name\n label\n description\n icon\n isCustom\n isActive\n isSystem\n isNullable\n createdAt\n updatedAt\n fromRelationMetadata {\n id\n relationType\n toObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n fromObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n }\n toRelationMetadata {\n id\n relationType\n toObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n fromObjectMetadata {\n id\n dataSourceId\n nameSingular\n namePlural\n }\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n }\n pageInfo {\n hasNextPage\n hasPreviousPage\n startCursor\n endCursor\n }\n totalCount\n }\n }\n"];
export function graphql(source: string) { export function graphql(source: string) {
return (documents as any)[source] ?? {}; return (documents as any)[source] ?? {};

File diff suppressed because one or more lines are too long

View File

@ -8,7 +8,10 @@ import { useFindManyObjectMetadataItems } from '../hooks/useFindManyObjectMetada
export const ObjectMetadataNavItems = () => { export const ObjectMetadataNavItems = () => {
const { objectMetadataItems } = useFindManyObjectMetadataItems({ const { objectMetadataItems } = useFindManyObjectMetadataItems({
filter: { objectFilter: {
isSystem: { is: false },
},
fieldFilter: {
isSystem: { is: false }, isSystem: { is: false },
}, },
}); });

View File

@ -1,8 +1,11 @@
import { gql } from '@apollo/client'; import { gql } from '@apollo/client';
export const FIND_MANY_METADATA_OBJECTS = gql` export const FIND_MANY_METADATA_OBJECTS = gql`
query ObjectMetadataItems($filter: objectFilter) { query ObjectMetadataItems(
objects(paging: { first: 1000 }, filter: $filter) { $objectFilter: objectFilter
$fieldFilter: fieldFilter
) {
objects(paging: { first: 1000 }, filter: $objectFilter) {
edges { edges {
node { node {
id id
@ -18,7 +21,7 @@ export const FIND_MANY_METADATA_OBJECTS = gql`
isSystem isSystem
createdAt createdAt
updatedAt updatedAt
fields(paging: { first: 1000 }) { fields(paging: { first: 1000 }, filter: $fieldFilter) {
edges { edges {
node { node {
id id
@ -29,6 +32,7 @@ export const FIND_MANY_METADATA_OBJECTS = gql`
icon icon
isCustom isCustom
isActive isActive
isSystem
isNullable isNullable
createdAt createdAt
updatedAt updatedAt

View File

@ -1,5 +1,6 @@
import { MetadataFieldDataType } from '@/settings/data-model/types/ObjectFieldDataType'; import { FieldType } from '@/ui/object/field/types/FieldType';
import { Field } from '~/generated/graphql'; import { Field } from '~/generated/graphql';
import { FieldMetadataType } from '~/generated-metadata/graphql';
import { FieldMetadataItem } from '../types/FieldMetadataItem'; import { FieldMetadataItem } from '../types/FieldMetadataItem';
import { formatFieldMetadataItemInput } from '../utils/formatFieldMetadataItemInput'; import { formatFieldMetadataItemInput } from '../utils/formatFieldMetadataItemInput';
@ -16,13 +17,13 @@ export const useFieldMetadataItem = () => {
const createMetadataField = ( const createMetadataField = (
input: Pick<Field, 'label' | 'icon' | 'description'> & { input: Pick<Field, 'label' | 'icon' | 'description'> & {
objectMetadataId: string; objectMetadataId: string;
type: MetadataFieldDataType; type: FieldMetadataType;
}, },
) => ) =>
createOneFieldMetadataItem({ createOneFieldMetadataItem({
...formatFieldMetadataItemInput(input), ...formatFieldMetadataItemInput(input),
objectMetadataId: input.objectMetadataId, objectMetadataId: input.objectMetadataId,
type: input.type, type: input.type as FieldType,
}); });
const editMetadataField = ( const editMetadataField = (

View File

@ -3,6 +3,7 @@ import { useQuery } from '@apollo/client';
import { useSnackBar } from '@/ui/feedback/snack-bar/hooks/useSnackBar'; import { useSnackBar } from '@/ui/feedback/snack-bar/hooks/useSnackBar';
import { import {
FieldFilter,
ObjectFilter, ObjectFilter,
ObjectMetadataItemsQuery, ObjectMetadataItemsQuery,
ObjectMetadataItemsQueryVariables, ObjectMetadataItemsQueryVariables,
@ -17,8 +18,13 @@ import { useApolloMetadataClient } from './useApolloMetadataClient';
// TODO: test fetchMore // TODO: test fetchMore
export const useFindManyObjectMetadataItems = ({ export const useFindManyObjectMetadataItems = ({
skip, skip,
filter, objectFilter,
}: { skip?: boolean; filter?: ObjectFilter } = {}) => { fieldFilter,
}: {
skip?: boolean;
objectFilter?: ObjectFilter;
fieldFilter?: FieldFilter;
} = {}) => {
const apolloMetadataClient = useApolloMetadataClient(); const apolloMetadataClient = useApolloMetadataClient();
const { enqueueSnackBar } = useSnackBar(); const { enqueueSnackBar } = useSnackBar();
@ -32,7 +38,8 @@ export const useFindManyObjectMetadataItems = ({
FIND_MANY_METADATA_OBJECTS, FIND_MANY_METADATA_OBJECTS,
{ {
variables: { variables: {
filter, objectFilter,
fieldFilter,
}, },
client: apolloMetadataClient ?? undefined, client: apolloMetadataClient ?? undefined,
skip: skip || !apolloMetadataClient, skip: skip || !apolloMetadataClient,

View File

@ -32,7 +32,7 @@ export const useFindManyObjectMetadataItems = ({
FIND_MANY_METADATA_OBJECTS, FIND_MANY_METADATA_OBJECTS,
{ {
variables: { variables: {
filter, objectFilter: filter,
}, },
client: apolloMetadataClient ?? undefined, client: apolloMetadataClient ?? undefined,
skip: skip || !apolloMetadataClient, skip: skip || !apolloMetadataClient,

View File

@ -9,7 +9,10 @@ import { useUpdateOneObjectMetadataItem } from './useUpdateOneObjectMetadataItem
export const useObjectMetadataItemForSettings = () => { export const useObjectMetadataItemForSettings = () => {
const { objectMetadataItems, loading } = useFindManyObjectMetadataItems({ const { objectMetadataItems, loading } = useFindManyObjectMetadataItems({
filter: { objectFilter: {
isSystem: { is: false },
},
fieldFilter: {
isSystem: { is: false }, isSystem: { is: false },
}, },
}); });

View File

@ -15,13 +15,12 @@ import { FieldMetadataType } from '~/generated/graphql';
import { assertNotNull } from '~/utils/assert'; import { assertNotNull } from '~/utils/assert';
import { dataTypes } from '../constants/dataTypes'; import { dataTypes } from '../constants/dataTypes';
import { MetadataFieldDataType } from '../types/ObjectFieldDataType';
export type SettingsObjectFieldPreviewProps = { export type SettingsObjectFieldPreviewProps = {
fieldIconKey?: string | null; fieldIconKey?: string | null;
fieldLabel: string; fieldLabel: string;
fieldName?: string; fieldName?: string;
fieldType: MetadataFieldDataType; fieldType: FieldMetadataType;
isObjectCustom: boolean; isObjectCustom: boolean;
objectIconKey?: string | null; objectIconKey?: string | null;
objectLabelPlural: string; objectLabelPlural: string;

View File

@ -3,9 +3,9 @@ import styled from '@emotion/styled';
import { H2Title } from '@/ui/display/typography/components/H2Title'; import { H2Title } from '@/ui/display/typography/components/H2Title';
import { Select } from '@/ui/input/components/Select'; import { Select } from '@/ui/input/components/Select';
import { Section } from '@/ui/layout/section/components/Section'; import { Section } from '@/ui/layout/section/components/Section';
import { FieldMetadataType } from '~/generated-metadata/graphql';
import { dataTypes } from '../constants/dataTypes'; import { dataTypes } from '../constants/dataTypes';
import { MetadataFieldDataType } from '../types/ObjectFieldDataType';
import { import {
SettingsObjectFieldPreview, SettingsObjectFieldPreview,
@ -15,7 +15,7 @@ import { SettingsObjectFieldTypeCard } from './SettingsObjectFieldTypeCard';
type SettingsObjectFieldTypeSelectSectionProps = { type SettingsObjectFieldTypeSelectSectionProps = {
disabled?: boolean; disabled?: boolean;
onChange?: (value: MetadataFieldDataType) => void; onChange?: (value: FieldMetadataType) => void;
} & Pick< } & Pick<
SettingsObjectFieldPreviewProps, SettingsObjectFieldPreviewProps,
| 'fieldIconKey' | 'fieldIconKey'
@ -59,7 +59,7 @@ export const SettingsObjectFieldTypeSelectSection = ({
onChange={onChange} onChange={onChange}
options={Object.entries(dataTypesWithoutRelation).map( options={Object.entries(dataTypesWithoutRelation).map(
([key, dataType]) => ({ ([key, dataType]) => ({
value: key as MetadataFieldDataType, value: key as FieldMetadataType,
...dataType, ...dataType,
}), }),
)} )}

View File

@ -1,6 +1,7 @@
import { MemoryRouter } from 'react-router-dom'; import { MemoryRouter } from 'react-router-dom';
import { Meta, StoryObj } from '@storybook/react'; import { Meta, StoryObj } from '@storybook/react';
import { FieldMetadataType } from '~/generated-metadata/graphql';
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator'; import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
import { SettingsObjectFieldPreview } from '../SettingsObjectFieldPreview'; import { SettingsObjectFieldPreview } from '../SettingsObjectFieldPreview';
@ -12,7 +13,7 @@ const meta: Meta<typeof SettingsObjectFieldPreview> = {
args: { args: {
fieldIconKey: 'IconNotes', fieldIconKey: 'IconNotes',
fieldLabel: 'Description', fieldLabel: 'Description',
fieldType: 'TEXT', fieldType: FieldMetadataType.Text,
isObjectCustom: false, isObjectCustom: false,
objectIconKey: 'IconBuildingSkyscraper', objectIconKey: 'IconBuildingSkyscraper',
objectLabelPlural: 'Companies', objectLabelPlural: 'Companies',
@ -29,7 +30,7 @@ export const Boolean: Story = {
args: { args: {
fieldIconKey: 'IconHeadphones', fieldIconKey: 'IconHeadphones',
fieldLabel: 'Priority Support', fieldLabel: 'Priority Support',
fieldType: 'BOOLEAN', fieldType: FieldMetadataType.Boolean,
}, },
}; };
@ -37,7 +38,7 @@ export const Currency: Story = {
args: { args: {
fieldIconKey: 'IconCurrencyDollar', fieldIconKey: 'IconCurrencyDollar',
fieldLabel: 'Amount', fieldLabel: 'Amount',
fieldType: 'MONEY', fieldType: FieldMetadataType.Money,
}, },
}; };
@ -45,7 +46,7 @@ export const Date: Story = {
args: { args: {
fieldIconKey: 'IconCalendarEvent', fieldIconKey: 'IconCalendarEvent',
fieldLabel: 'Registration Date', fieldLabel: 'Registration Date',
fieldType: 'DATE', fieldType: FieldMetadataType.Date,
}, },
}; };
@ -60,7 +61,7 @@ export const Link: Story = {
args: { args: {
fieldIconKey: 'IconWorldWww', fieldIconKey: 'IconWorldWww',
fieldLabel: 'Website', fieldLabel: 'Website',
fieldType: 'URL', fieldType: FieldMetadataType.Url,
}, },
}; };
@ -68,7 +69,7 @@ export const Number: Story = {
args: { args: {
fieldIconKey: 'IconUsers', fieldIconKey: 'IconUsers',
fieldLabel: 'Employees', fieldLabel: 'Employees',
fieldType: 'NUMBER', fieldType: FieldMetadataType.Number,
}, },
}; };

View File

@ -1,6 +1,7 @@
import { Meta, StoryObj } from '@storybook/react'; import { Meta, StoryObj } from '@storybook/react';
import { TextInput } from '@/ui/input/components/TextInput'; import { TextInput } from '@/ui/input/components/TextInput';
import { FieldMetadataType } from '~/generated/graphql';
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator'; import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
import { SettingsObjectFieldPreview } from '../SettingsObjectFieldPreview'; import { SettingsObjectFieldPreview } from '../SettingsObjectFieldPreview';
@ -15,7 +16,7 @@ const meta: Meta<typeof SettingsObjectFieldTypeCard> = {
<SettingsObjectFieldPreview <SettingsObjectFieldPreview
fieldIconKey="IconNotes" fieldIconKey="IconNotes"
fieldLabel="Description" fieldLabel="Description"
fieldType="TEXT" fieldType={FieldMetadataType.Text}
isObjectCustom={false} isObjectCustom={false}
objectIconKey="IconUser" objectIconKey="IconUser"
objectLabelPlural="People" objectLabelPlural="People"

View File

@ -1,6 +1,7 @@
import { Meta, StoryObj } from '@storybook/react'; import { Meta, StoryObj } from '@storybook/react';
import { userEvent, within } from '@storybook/testing-library'; import { userEvent, within } from '@storybook/testing-library';
import { FieldMetadataType } from '~/generated-metadata/graphql';
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator'; import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
import { SettingsObjectFieldTypeSelectSection } from '../SettingsObjectFieldTypeSelectSection'; import { SettingsObjectFieldTypeSelectSection } from '../SettingsObjectFieldTypeSelectSection';
@ -10,7 +11,7 @@ const meta: Meta<typeof SettingsObjectFieldTypeSelectSection> = {
component: SettingsObjectFieldTypeSelectSection, component: SettingsObjectFieldTypeSelectSection,
decorators: [ComponentDecorator], decorators: [ComponentDecorator],
args: { args: {
fieldType: 'NUMBER', fieldType: FieldMetadataType.Number,
fieldIconKey: 'IconUsers', fieldIconKey: 'IconUsers',
fieldLabel: 'Employees', fieldLabel: 'Employees',
fieldName: 'employees', fieldName: 'employees',

View File

@ -2,45 +2,67 @@ import {
IconCalendarEvent, IconCalendarEvent,
IconCheck, IconCheck,
IconCoins, IconCoins,
IconKey,
IconLink, IconLink,
IconMail,
IconNumbers, IconNumbers,
IconPhone,
IconPlug, IconPlug,
IconTextSize, IconTextSize,
} from '@/ui/display/icon'; } from '@/ui/display/icon';
import { IconComponent } from '@/ui/display/icon/types/IconComponent'; import { IconComponent } from '@/ui/display/icon/types/IconComponent';
import { Currency } from '~/generated-metadata/graphql'; import { Currency, FieldMetadataType } from '~/generated-metadata/graphql';
import { MetadataFieldDataType } from '../types/ObjectFieldDataType';
const defaultDateValue = new Date(); const defaultDateValue = new Date();
defaultDateValue.setFullYear(defaultDateValue.getFullYear() + 2); defaultDateValue.setFullYear(defaultDateValue.getFullYear() + 2);
export const dataTypes: Record< export const dataTypes: Record<
MetadataFieldDataType, FieldMetadataType,
{ label: string; Icon: IconComponent; defaultValue?: unknown } { label: string; Icon: IconComponent; defaultValue?: unknown }
> = { > = {
TEXT: { [FieldMetadataType.Uuid]: {
label: 'Unique ID',
Icon: IconKey,
defaultValue: '00000000-0000-0000-0000-000000000000',
},
[FieldMetadataType.Text]: {
label: 'Text', label: 'Text',
Icon: IconTextSize, Icon: IconTextSize,
defaultValue: defaultValue:
'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum magna enim, dapibus non enim in, lacinia faucibus nunc. Sed interdum ante sed felis facilisis, eget ultricies neque molestie. Mauris auctor, justo eu volutpat cursus, libero erat tempus nulla, non sodales lorem lacus a est.', 'Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vestibulum magna enim, dapibus non enim in, lacinia faucibus nunc. Sed interdum ante sed felis facilisis, eget ultricies neque molestie. Mauris auctor, justo eu volutpat cursus, libero erat tempus nulla, non sodales lorem lacus a est.',
}, },
NUMBER: { label: 'Number', Icon: IconNumbers, defaultValue: 2000 }, [FieldMetadataType.Number]: {
URL: { label: 'Number',
Icon: IconNumbers,
defaultValue: 2000,
},
[FieldMetadataType.Url]: {
label: 'Link', label: 'Link',
Icon: IconLink, Icon: IconLink,
defaultValue: { link: 'www.twenty.com', text: '' }, defaultValue: { link: 'www.twenty.com', text: '' },
}, },
BOOLEAN: { label: 'True/False', Icon: IconCheck, defaultValue: true }, [FieldMetadataType.Boolean]: {
DATE: { label: 'True/False',
Icon: IconCheck,
defaultValue: true,
},
[FieldMetadataType.Date]: {
label: 'Date', label: 'Date',
Icon: IconCalendarEvent, Icon: IconCalendarEvent,
defaultValue: defaultDateValue.toISOString(), defaultValue: defaultDateValue.toISOString(),
}, },
MONEY: { [FieldMetadataType.Money]: {
label: 'Currency', label: 'Currency',
Icon: IconCoins, Icon: IconCoins,
defaultValue: { amount: 2000, currency: Currency.Usd }, defaultValue: { amount: 2000, currency: Currency.Usd },
}, },
RELATION: { label: 'Relation', Icon: IconPlug }, [FieldMetadataType.Relation]: { label: 'Relation', Icon: IconPlug },
[FieldMetadataType.Email]: { label: 'Email', Icon: IconMail },
[FieldMetadataType.Phone]: { label: 'Phone', Icon: IconPhone },
[FieldMetadataType.Probability]: {
label: 'Probability',
Icon: IconNumbers,
defaultValue: 50,
},
[FieldMetadataType.Enum]: { label: 'Enum', Icon: IconPlug },
}; };

View File

@ -1,10 +1,11 @@
import { css, useTheme } from '@emotion/react'; import { css, useTheme } from '@emotion/react';
import styled from '@emotion/styled'; import styled from '@emotion/styled';
import { dataTypes } from '../../constants/dataTypes'; import { FieldMetadataType } from '~/generated-metadata/graphql';
import { MetadataFieldDataType } from '../../types/ObjectFieldDataType';
const StyledDataType = styled.div<{ value: MetadataFieldDataType }>` import { dataTypes } from '../../constants/dataTypes';
const StyledDataType = styled.div<{ value: FieldMetadataType }>`
align-items: center; align-items: center;
border: 1px solid transparent; border: 1px solid transparent;
border-radius: ${({ theme }) => theme.border.radius.sm}; border-radius: ${({ theme }) => theme.border.radius.sm};
@ -24,7 +25,7 @@ const StyledDataType = styled.div<{ value: MetadataFieldDataType }>`
`; `;
type SettingsObjectFieldDataTypeProps = { type SettingsObjectFieldDataTypeProps = {
value: MetadataFieldDataType; value: FieldMetadataType;
}; };
export const SettingsObjectFieldDataType = ({ export const SettingsObjectFieldDataType = ({

View File

@ -6,9 +6,9 @@ import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
import { useLazyLoadIcon } from '@/ui/input/hooks/useLazyLoadIcon'; import { useLazyLoadIcon } from '@/ui/input/hooks/useLazyLoadIcon';
import { TableCell } from '@/ui/layout/table/components/TableCell'; import { TableCell } from '@/ui/layout/table/components/TableCell';
import { TableRow } from '@/ui/layout/table/components/TableRow'; import { TableRow } from '@/ui/layout/table/components/TableRow';
import { FieldMetadataType } from '~/generated-metadata/graphql';
import { dataTypes } from '../../constants/dataTypes'; import { dataTypes } from '../../constants/dataTypes';
import { MetadataFieldDataType } from '../../types/ObjectFieldDataType';
import { SettingsObjectFieldDataType } from './SettingsObjectFieldDataType'; import { SettingsObjectFieldDataType } from './SettingsObjectFieldDataType';
@ -59,7 +59,7 @@ export const SettingsObjectFieldItemTableRow = ({
<TableCell>{fieldItem.isCustom ? 'Custom' : 'Standard'}</TableCell> <TableCell>{fieldItem.isCustom ? 'Custom' : 'Standard'}</TableCell>
<TableCell> <TableCell>
<SettingsObjectFieldDataType <SettingsObjectFieldDataType
value={fieldItem.type as MetadataFieldDataType} value={fieldItem.type as FieldMetadataType}
/> />
</TableCell> </TableCell>
<StyledIconTableCell>{ActionIcon}</StyledIconTableCell> <StyledIconTableCell>{ActionIcon}</StyledIconTableCell>

View File

@ -47,6 +47,7 @@ export {
IconHeartOff, IconHeartOff,
IconHelpCircle, IconHelpCircle,
IconHierarchy2, IconHierarchy2,
IconKey,
IconLanguage, IconLanguage,
IconLayoutKanban, IconLayoutKanban,
IconLayoutSidebarLeftCollapse, IconLayoutSidebarLeftCollapse,

View File

@ -9,7 +9,6 @@ import { SettingsHeaderContainer } from '@/settings/components/SettingsHeaderCon
import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer'; import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';
import { SettingsObjectFieldFormSection } from '@/settings/data-model/components/SettingsObjectFieldFormSection'; import { SettingsObjectFieldFormSection } from '@/settings/data-model/components/SettingsObjectFieldFormSection';
import { SettingsObjectFieldTypeSelectSection } from '@/settings/data-model/components/SettingsObjectFieldTypeSelectSection'; import { SettingsObjectFieldTypeSelectSection } from '@/settings/data-model/components/SettingsObjectFieldTypeSelectSection';
import { MetadataFieldDataType } from '@/settings/data-model/types/ObjectFieldDataType';
import { AppPath } from '@/types/AppPath'; import { AppPath } from '@/types/AppPath';
import { IconArchive, IconSettings } from '@/ui/display/icon'; import { IconArchive, IconSettings } from '@/ui/display/icon';
import { H2Title } from '@/ui/display/typography/components/H2Title'; import { H2Title } from '@/ui/display/typography/components/H2Title';
@ -17,6 +16,7 @@ import { Button } from '@/ui/input/button/components/Button';
import { SubMenuTopBarContainer } from '@/ui/layout/page/SubMenuTopBarContainer'; import { SubMenuTopBarContainer } from '@/ui/layout/page/SubMenuTopBarContainer';
import { Section } from '@/ui/layout/section/components/Section'; import { Section } from '@/ui/layout/section/components/Section';
import { Breadcrumb } from '@/ui/navigation/bread-crumb/components/Breadcrumb'; import { Breadcrumb } from '@/ui/navigation/bread-crumb/components/Breadcrumb';
import { FieldMetadataType } from '~/generated-metadata/graphql';
export const SettingsObjectFieldEdit = () => { export const SettingsObjectFieldEdit = () => {
const navigate = useNavigate(); const navigate = useNavigate();
@ -128,7 +128,7 @@ export const SettingsObjectFieldEdit = () => {
fieldIconKey={formValues.icon} fieldIconKey={formValues.icon}
fieldLabel={formValues.label || 'Employees'} fieldLabel={formValues.label || 'Employees'}
fieldName={activeMetadataField.name} fieldName={activeMetadataField.name}
fieldType={activeMetadataField.type as MetadataFieldDataType} fieldType={activeMetadataField.type as FieldMetadataType}
isObjectCustom={activeObjectMetadataItem.isCustom} isObjectCustom={activeObjectMetadataItem.isCustom}
objectIconKey={activeObjectMetadataItem.icon} objectIconKey={activeObjectMetadataItem.icon}
objectLabelPlural={activeObjectMetadataItem.labelPlural} objectLabelPlural={activeObjectMetadataItem.labelPlural}

View File

@ -11,13 +11,13 @@ import { SettingsHeaderContainer } from '@/settings/components/SettingsHeaderCon
import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer'; import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';
import { SettingsObjectFieldFormSection } from '@/settings/data-model/components/SettingsObjectFieldFormSection'; import { SettingsObjectFieldFormSection } from '@/settings/data-model/components/SettingsObjectFieldFormSection';
import { SettingsObjectFieldTypeSelectSection } from '@/settings/data-model/components/SettingsObjectFieldTypeSelectSection'; import { SettingsObjectFieldTypeSelectSection } from '@/settings/data-model/components/SettingsObjectFieldTypeSelectSection';
import { MetadataFieldDataType } from '@/settings/data-model/types/ObjectFieldDataType';
import { AppPath } from '@/types/AppPath'; import { AppPath } from '@/types/AppPath';
import { IconSettings } from '@/ui/display/icon'; import { IconSettings } from '@/ui/display/icon';
import { SubMenuTopBarContainer } from '@/ui/layout/page/SubMenuTopBarContainer'; import { SubMenuTopBarContainer } from '@/ui/layout/page/SubMenuTopBarContainer';
import { Breadcrumb } from '@/ui/navigation/bread-crumb/components/Breadcrumb'; import { Breadcrumb } from '@/ui/navigation/bread-crumb/components/Breadcrumb';
import { View } from '@/views/types/View'; import { View } from '@/views/types/View';
import { ViewType } from '@/views/types/ViewType'; import { ViewType } from '@/views/types/ViewType';
import { FieldMetadataType } from '~/generated-metadata/graphql';
export const SettingsObjectNewFieldStep2 = () => { export const SettingsObjectNewFieldStep2 = () => {
const navigate = useNavigate(); const navigate = useNavigate();
@ -39,8 +39,8 @@ export const SettingsObjectNewFieldStep2 = () => {
description?: string; description?: string;
icon: string; icon: string;
label: string; label: string;
type: MetadataFieldDataType; type: FieldMetadataType;
}>({ icon: 'IconUsers', label: '', type: 'NUMBER' }); }>({ icon: 'IconUsers', label: '', type: FieldMetadataType.Number });
const [objectViews, setObjectViews] = useState<View[]>([]); const [objectViews, setObjectViews] = useState<View[]>([]);

View File

@ -12,8 +12,11 @@ export enum SeedActivityTargetFieldMetadataIds {
UpdatedAt = '20202020-4cf0-4478-8c68-62a855622a99', UpdatedAt = '20202020-4cf0-4478-8c68-62a855622a99',
Activity = '20202020-cb21-42c9-bba8-347f7cb02b84', Activity = '20202020-cb21-42c9-bba8-347f7cb02b84',
ActivityForeignKey = '20202020-2b1a-4c6a-9c0a-1b9f5b7c9b1a',
Person = '20202020-e56c-43e6-8fce-5619d8c2293a', Person = '20202020-e56c-43e6-8fce-5619d8c2293a',
PersonForeignKey = '20202020-4c5d-4b5e-8d6e-3b2a4d5f6a7b',
Company = '20202020-9408-4cc0-9fe1-51467edb530b', Company = '20202020-9408-4cc0-9fe1-51467edb530b',
CompanyForeignKey = '20202020-9408-4cc0-9fe1-51467edb530c',
} }
export const seedActivityTargetFieldMetadata = async ( export const seedActivityTargetFieldMetadata = async (
@ -36,6 +39,7 @@ export const seedActivityTargetFieldMetadata = async (
'description', 'description',
'icon', 'icon',
'isNullable', 'isNullable',
'isSystem',
]) ])
.orIgnore() .orIgnore()
.values([ .values([
@ -55,7 +59,7 @@ export const seedActivityTargetFieldMetadata = async (
description: undefined, description: undefined,
icon: undefined, icon: undefined,
isNullable: true, isNullable: true,
// isSystem: true, isSystem: true,
}, },
{ {
id: SeedActivityTargetFieldMetadataIds.CreatedAt, id: SeedActivityTargetFieldMetadataIds.CreatedAt,
@ -72,6 +76,7 @@ export const seedActivityTargetFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedActivityTargetFieldMetadataIds.UpdatedAt, id: SeedActivityTargetFieldMetadataIds.UpdatedAt,
@ -88,6 +93,7 @@ export const seedActivityTargetFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
// Relationships // Relationships
{ {
@ -96,31 +102,29 @@ export const seedActivityTargetFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'activity', name: 'activity',
label: 'Activity', label: 'Activity',
targetColumnMap: { targetColumnMap: {},
value: 'activityId',
},
description: 'ActivityTarget activity', description: 'ActivityTarget activity',
icon: 'IconNotes', icon: 'IconNotes',
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedActivityTargetFieldMetadataIds.Activity, id: SeedActivityTargetFieldMetadataIds.ActivityForeignKey,
objectMetadataId: SeedObjectMetadataIds.ActivityTarget, objectMetadataId: SeedObjectMetadataIds.ActivityTarget,
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.UUID,
name: 'activity', name: 'activityId',
label: 'Activity', label: 'Activity id (foreign key)',
targetColumnMap: { targetColumnMap: {},
value: 'activityId', description: 'ActivityTarget activity id foreign key',
}, icon: undefined,
description: 'ActivityTarget activity',
icon: 'IconNotes',
isNullable: false, isNullable: false,
isSystem: true,
}, },
{ {
id: SeedActivityTargetFieldMetadataIds.Person, id: SeedActivityTargetFieldMetadataIds.Person,
@ -128,15 +132,29 @@ export const seedActivityTargetFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'person', name: 'person',
label: 'Person', label: 'Person',
targetColumnMap: { targetColumnMap: {},
value: 'personId',
},
description: 'ActivityTarget person', description: 'ActivityTarget person',
icon: 'IconUser', icon: 'IconUser',
isNullable: true, isNullable: true,
isSystem: false,
},
{
id: SeedActivityTargetFieldMetadataIds.PersonForeignKey,
objectMetadataId: SeedObjectMetadataIds.ActivityTarget,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.UUID,
name: 'personId',
label: 'Person id (foreign key)',
targetColumnMap: {},
description: 'ActivityTarget person id foreign key',
icon: undefined,
isNullable: true,
isSystem: true,
}, },
{ {
id: SeedActivityTargetFieldMetadataIds.Company, id: SeedActivityTargetFieldMetadataIds.Company,
@ -144,15 +162,29 @@ export const seedActivityTargetFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'company', name: 'company',
label: 'Company', label: 'Company',
targetColumnMap: { targetColumnMap: {},
value: 'companyId',
},
description: 'ActivityTarget company', description: 'ActivityTarget company',
icon: 'IconBuildingSkyscraper', icon: 'IconBuildingSkyscraper',
isNullable: true, isNullable: true,
isSystem: false,
},
{
id: SeedActivityTargetFieldMetadataIds.CompanyForeignKey,
objectMetadataId: SeedObjectMetadataIds.ActivityTarget,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.UUID,
name: 'companyId',
label: 'Company id (foreign key)',
targetColumnMap: {},
description: 'ActivityTarget company id foreign key',
icon: undefined,
isNullable: true,
isSystem: true,
}, },
]) ])
.execute(); .execute();

View File

@ -22,7 +22,9 @@ export enum SeedActivityFieldMetadataIds {
Comments = '20202020-c85c-47f2-bbe4-6b36c26f9247', Comments = '20202020-c85c-47f2-bbe4-6b36c26f9247',
Attachments = '20202020-9755-43a8-b621-f94df0f6b839', Attachments = '20202020-9755-43a8-b621-f94df0f6b839',
Author = '20202020-3acb-46bb-b993-0dc49fa2a48c', Author = '20202020-3acb-46bb-b993-0dc49fa2a48c',
AuthorForeignKey = '20202020-3acb-46bb-b993-0dc49fa2a48d',
Assignee = '20202020-4694-4ec6-9084-8d932ebb3065', Assignee = '20202020-4694-4ec6-9084-8d932ebb3065',
AssigneeForeignKey = '20202020-4694-4ec6-9084-8d932ebb3066',
} }
export const seedActivityFieldMetadata = async ( export const seedActivityFieldMetadata = async (
@ -45,6 +47,7 @@ export const seedActivityFieldMetadata = async (
'description', 'description',
'icon', 'icon',
'isNullable', 'isNullable',
'isSystem',
]) ])
.orIgnore() .orIgnore()
.values([ .values([
@ -64,7 +67,7 @@ export const seedActivityFieldMetadata = async (
description: undefined, description: undefined,
icon: undefined, icon: undefined,
isNullable: true, isNullable: true,
// isSystem: true, isSystem: true,
}, },
{ {
id: SeedActivityFieldMetadataIds.CreatedAt, id: SeedActivityFieldMetadataIds.CreatedAt,
@ -81,6 +84,7 @@ export const seedActivityFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedActivityFieldMetadataIds.UpdatedAt, id: SeedActivityFieldMetadataIds.UpdatedAt,
@ -97,6 +101,7 @@ export const seedActivityFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
// Primary identifier // Primary identifier
{ {
@ -105,7 +110,7 @@ export const seedActivityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'title', name: 'title',
label: 'Title', label: 'Title',
targetColumnMap: { targetColumnMap: {
@ -114,6 +119,7 @@ export const seedActivityFieldMetadata = async (
description: 'Activity title', description: 'Activity title',
icon: 'IconNotes', icon: 'IconNotes',
isNullable: true, isNullable: true,
isSystem: false,
}, },
// Scalar fields // Scalar fields
@ -123,7 +129,7 @@ export const seedActivityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'body', name: 'body',
label: 'Body', label: 'Body',
targetColumnMap: { targetColumnMap: {
@ -132,6 +138,7 @@ export const seedActivityFieldMetadata = async (
description: 'Activity body', description: 'Activity body',
icon: 'IconList', icon: 'IconList',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedActivityFieldMetadataIds.Type, id: SeedActivityFieldMetadataIds.Type,
@ -139,7 +146,7 @@ export const seedActivityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'type', name: 'type',
label: 'Type', label: 'Type',
targetColumnMap: { targetColumnMap: {
@ -148,6 +155,7 @@ export const seedActivityFieldMetadata = async (
description: 'Activity type', description: 'Activity type',
icon: 'IconCheckbox', icon: 'IconCheckbox',
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedActivityFieldMetadataIds.ReminderAt, id: SeedActivityFieldMetadataIds.ReminderAt,
@ -155,7 +163,7 @@ export const seedActivityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'DATE', type: FieldMetadataType.DATE,
name: 'reminderAt', name: 'reminderAt',
label: 'Reminder Date', label: 'Reminder Date',
targetColumnMap: { targetColumnMap: {
@ -164,6 +172,7 @@ export const seedActivityFieldMetadata = async (
description: 'Activity reminder date', description: 'Activity reminder date',
icon: 'IconCalendarEvent', icon: 'IconCalendarEvent',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedActivityFieldMetadataIds.DueAt, id: SeedActivityFieldMetadataIds.DueAt,
@ -171,7 +180,7 @@ export const seedActivityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'DATE', type: FieldMetadataType.DATE,
name: 'dueAt', name: 'dueAt',
label: 'Due Date', label: 'Due Date',
targetColumnMap: { targetColumnMap: {
@ -180,6 +189,7 @@ export const seedActivityFieldMetadata = async (
description: 'Activity due date', description: 'Activity due date',
icon: 'IconCalendarEvent', icon: 'IconCalendarEvent',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedActivityFieldMetadataIds.CompletedAt, id: SeedActivityFieldMetadataIds.CompletedAt,
@ -187,7 +197,7 @@ export const seedActivityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'DATE', type: FieldMetadataType.DATE,
name: 'completedAt', name: 'completedAt',
label: 'Completion Date', label: 'Completion Date',
targetColumnMap: { targetColumnMap: {
@ -196,6 +206,7 @@ export const seedActivityFieldMetadata = async (
description: 'Activity completion date', description: 'Activity completion date',
icon: 'IconCheck', icon: 'IconCheck',
isNullable: true, isNullable: true,
isSystem: false,
}, },
// Relationships // Relationships
@ -205,13 +216,14 @@ export const seedActivityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'activityTargets', name: 'activityTargets',
label: 'Targets', label: 'Targets',
targetColumnMap: {}, targetColumnMap: {},
description: 'Activity targets', description: 'Activity targets',
icon: 'IconCheckbox', icon: 'IconCheckbox',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedActivityFieldMetadataIds.Attachments, id: SeedActivityFieldMetadataIds.Attachments,
@ -219,13 +231,14 @@ export const seedActivityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'attachments', name: 'attachments',
label: 'Attachments', label: 'Attachments',
targetColumnMap: {}, targetColumnMap: {},
description: 'Activity attachments', description: 'Activity attachments',
icon: 'IconFileImport', icon: 'IconFileImport',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedActivityFieldMetadataIds.Comments, id: SeedActivityFieldMetadataIds.Comments,
@ -233,13 +246,14 @@ export const seedActivityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'Comments', name: 'Comments',
label: 'Comments', label: 'Comments',
targetColumnMap: {}, targetColumnMap: {},
description: 'Activity comments', description: 'Activity comments',
icon: 'IconComment', icon: 'IconComment',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedActivityFieldMetadataIds.Author, id: SeedActivityFieldMetadataIds.Author,
@ -247,7 +261,7 @@ export const seedActivityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'author', name: 'author',
label: 'Author', label: 'Author',
targetColumnMap: { targetColumnMap: {
@ -257,6 +271,22 @@ export const seedActivityFieldMetadata = async (
'Activity author. This is the person who created the activity', 'Activity author. This is the person who created the activity',
icon: 'IconUserCircle', icon: 'IconUserCircle',
isNullable: false, isNullable: false,
isSystem: false,
},
{
id: SeedActivityFieldMetadataIds.AuthorForeignKey,
objectMetadataId: SeedObjectMetadataIds.Activity,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.UUID,
name: 'authorId',
label: 'Author id (foreign key)',
targetColumnMap: {},
description: 'Activity author id foreign key',
icon: undefined,
isNullable: false,
isSystem: true,
}, },
{ {
id: SeedActivityFieldMetadataIds.Assignee, id: SeedActivityFieldMetadataIds.Assignee,
@ -264,16 +294,30 @@ export const seedActivityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'assignee', name: 'assignee',
label: 'Assignee', label: 'Assignee',
targetColumnMap: { targetColumnMap: {},
value: 'assigneeId',
},
description: description:
'Acitivity assignee. This is the workspace member assigned to the activity ', 'Acitivity assignee. This is the workspace member assigned to the activity ',
icon: 'IconUserCircle', icon: 'IconUserCircle',
isNullable: true, isNullable: true,
isSystem: false,
},
{
id: SeedActivityFieldMetadataIds.AssigneeForeignKey,
objectMetadataId: SeedObjectMetadataIds.Activity,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.UUID,
name: 'assigneeId',
label: 'Assignee id (foreign key)',
targetColumnMap: {},
description: 'Acitivity assignee id foreign key',
icon: undefined,
isNullable: true,
isSystem: true,
}, },
]) ])
.execute(); .execute();

View File

@ -36,6 +36,7 @@ export const seedApiKeyFieldMetadata = async (
'description', 'description',
'icon', 'icon',
'isNullable', 'isNullable',
'isSystem',
]) ])
.orIgnore() .orIgnore()
.values([ .values([
@ -55,7 +56,7 @@ export const seedApiKeyFieldMetadata = async (
description: undefined, description: undefined,
icon: undefined, icon: undefined,
isNullable: false, isNullable: false,
// isSystem: true, isSystem: true,
}, },
{ {
id: SeedApiKeyFieldMetadataIds.CreatedAt, id: SeedApiKeyFieldMetadataIds.CreatedAt,
@ -72,6 +73,7 @@ export const seedApiKeyFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedApiKeyFieldMetadataIds.UpdatedAt, id: SeedApiKeyFieldMetadataIds.UpdatedAt,
@ -88,6 +90,7 @@ export const seedApiKeyFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
// Scalar fields // Scalar fields
{ {
@ -96,7 +99,7 @@ export const seedApiKeyFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'name', name: 'name',
label: 'Name', label: 'Name',
targetColumnMap: { targetColumnMap: {
@ -105,6 +108,7 @@ export const seedApiKeyFieldMetadata = async (
description: 'ApiKey name', description: 'ApiKey name',
icon: 'IconLink', icon: 'IconLink',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedApiKeyFieldMetadataIds.ExpiresAt, id: SeedApiKeyFieldMetadataIds.ExpiresAt,
@ -112,7 +116,7 @@ export const seedApiKeyFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'DATE', type: FieldMetadataType.DATE,
name: 'expiresAt', name: 'expiresAt',
label: 'Expiration date', label: 'Expiration date',
targetColumnMap: { targetColumnMap: {
@ -121,6 +125,7 @@ export const seedApiKeyFieldMetadata = async (
description: 'ApiKey expiration date', description: 'ApiKey expiration date',
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedApiKeyFieldMetadataIds.RevokedAt, id: SeedApiKeyFieldMetadataIds.RevokedAt,
@ -128,7 +133,7 @@ export const seedApiKeyFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'DATE', type: FieldMetadataType.DATE,
name: 'revokedAt', name: 'revokedAt',
label: 'Revocation date', label: 'Revocation date',
targetColumnMap: { targetColumnMap: {
@ -137,6 +142,7 @@ export const seedApiKeyFieldMetadata = async (
description: 'ApiKey revocation date', description: 'ApiKey revocation date',
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
]) ])
.execute(); .execute();

View File

@ -16,9 +16,13 @@ export enum SeedAttachmentFieldMetadataIds {
Type = '20202020-8dfa-492f-92d1-56d5fb18cbb7', Type = '20202020-8dfa-492f-92d1-56d5fb18cbb7',
Author = '20202020-7831-43c2-827f-bc78289b7398', Author = '20202020-7831-43c2-827f-bc78289b7398',
AuthorForeignKey = '20202020-7831-43c2-827f-bc78289b7399',
Activity = '20202020-f5a9-46ec-b39a-eda906f00804', Activity = '20202020-f5a9-46ec-b39a-eda906f00804',
ActivityForeignKey = '20202020-f5a9-46ec-b39a-eda906f00805',
Person = '20202020-f67c-4cc5-893c-c6b615527473', Person = '20202020-f67c-4cc5-893c-c6b615527473',
PersonForeignKey = '20202020-f67c-4cc5-893c-c6b615527474',
Company = '20202020-5463-4d03-9124-1775b9b7f955', Company = '20202020-5463-4d03-9124-1775b9b7f955',
CompanyForeignKey = '20202020-5463-4d03-9124-1775b9b7f956',
} }
export const seedAttachmentFieldMetadata = async ( export const seedAttachmentFieldMetadata = async (
@ -41,6 +45,7 @@ export const seedAttachmentFieldMetadata = async (
'description', 'description',
'icon', 'icon',
'isNullable', 'isNullable',
'isSystem',
]) ])
.orIgnore() .orIgnore()
.values([ .values([
@ -60,7 +65,7 @@ export const seedAttachmentFieldMetadata = async (
description: undefined, description: undefined,
icon: undefined, icon: undefined,
isNullable: true, isNullable: true,
// isSystem: true, isSystem: true,
}, },
{ {
id: SeedAttachmentFieldMetadataIds.CreatedAt, id: SeedAttachmentFieldMetadataIds.CreatedAt,
@ -77,6 +82,7 @@ export const seedAttachmentFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedAttachmentFieldMetadataIds.UpdatedAt, id: SeedAttachmentFieldMetadataIds.UpdatedAt,
@ -93,6 +99,7 @@ export const seedAttachmentFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
// Primary Identifier // Primary Identifier
{ {
@ -101,7 +108,7 @@ export const seedAttachmentFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'name', name: 'name',
label: 'Name', label: 'Name',
targetColumnMap: { targetColumnMap: {
@ -110,6 +117,7 @@ export const seedAttachmentFieldMetadata = async (
description: 'Attachment name', description: 'Attachment name',
icon: 'IconFileUpload', icon: 'IconFileUpload',
isNullable: false, isNullable: false,
isSystem: false,
}, },
// Scalar fields // Scalar fields
{ {
@ -118,7 +126,7 @@ export const seedAttachmentFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'fullPath', name: 'fullPath',
label: 'Full path', label: 'Full path',
targetColumnMap: { targetColumnMap: {
@ -127,6 +135,7 @@ export const seedAttachmentFieldMetadata = async (
description: 'Attachment full path', description: 'Attachment full path',
icon: 'IconLink', icon: 'IconLink',
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedAttachmentFieldMetadataIds.Type, id: SeedAttachmentFieldMetadataIds.Type,
@ -134,7 +143,7 @@ export const seedAttachmentFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'type', name: 'type',
label: 'Type', label: 'Type',
targetColumnMap: { targetColumnMap: {
@ -143,6 +152,7 @@ export const seedAttachmentFieldMetadata = async (
description: 'Attachment type', description: 'Attachment type',
icon: 'IconList', icon: 'IconList',
isNullable: false, isNullable: false,
isSystem: false,
}, },
// Relationships // Relationships
@ -152,15 +162,29 @@ export const seedAttachmentFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'author', name: 'author',
label: 'Author', label: 'Author',
targetColumnMap: { targetColumnMap: {},
value: 'authorId',
},
description: 'Attachment author', description: 'Attachment author',
icon: 'IconCircleUser', icon: 'IconCircleUser',
isNullable: false, isNullable: false,
isSystem: false,
},
{
id: SeedAttachmentFieldMetadataIds.AuthorForeignKey,
objectMetadataId: SeedObjectMetadataIds.Attachment,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.UUID,
name: 'authorId',
label: 'Author id (foreign key)',
targetColumnMap: {},
description: 'Attachment author id foreign key',
icon: undefined,
isNullable: false,
isSystem: true,
}, },
{ {
id: SeedAttachmentFieldMetadataIds.Activity, id: SeedAttachmentFieldMetadataIds.Activity,
@ -168,15 +192,29 @@ export const seedAttachmentFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'activity', name: 'activity',
label: 'Activity', label: 'Activity',
targetColumnMap: { targetColumnMap: {},
value: 'activityId',
},
description: 'Attachment activity', description: 'Attachment activity',
icon: 'IconNotes', icon: 'IconNotes',
isNullable: false, isNullable: false,
isSystem: false,
},
{
id: SeedAttachmentFieldMetadataIds.ActivityForeignKey,
objectMetadataId: SeedObjectMetadataIds.Attachment,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.UUID,
name: 'activityId',
label: 'Activity id (foreign key)',
targetColumnMap: {},
description: 'Attachment activity id foreign key',
icon: undefined,
isNullable: false,
isSystem: true,
}, },
{ {
id: SeedAttachmentFieldMetadataIds.Person, id: SeedAttachmentFieldMetadataIds.Person,
@ -184,15 +222,29 @@ export const seedAttachmentFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'person', name: 'person',
label: 'Person', label: 'Person',
targetColumnMap: { targetColumnMap: {},
value: 'personId',
},
description: 'Attachment person', description: 'Attachment person',
icon: 'IconUser', icon: 'IconUser',
isNullable: false, isNullable: false,
isSystem: false,
},
{
id: SeedAttachmentFieldMetadataIds.PersonForeignKey,
objectMetadataId: SeedObjectMetadataIds.Attachment,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.UUID,
name: 'personId',
label: 'Person id (foreign key)',
targetColumnMap: {},
description: 'Attachment person id foreign key',
icon: undefined,
isNullable: false,
isSystem: true,
}, },
{ {
id: SeedAttachmentFieldMetadataIds.Company, id: SeedAttachmentFieldMetadataIds.Company,
@ -200,15 +252,29 @@ export const seedAttachmentFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'company', name: 'company',
label: 'Company', label: 'Company',
targetColumnMap: { targetColumnMap: {},
value: 'companyId',
},
description: 'Attachment company', description: 'Attachment company',
icon: 'IconBuildingSkyscraper', icon: 'IconBuildingSkyscraper',
isNullable: false, isNullable: false,
isSystem: false,
},
{
id: SeedAttachmentFieldMetadataIds.CompanyForeignKey,
objectMetadataId: SeedObjectMetadataIds.Attachment,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.UUID,
name: 'companyId',
label: 'Company id (foreign key)',
targetColumnMap: {},
description: 'Attachment company id foreign key',
icon: undefined,
isNullable: false,
isSystem: true,
}, },
]) ])
.execute(); .execute();

View File

@ -12,9 +12,10 @@ export enum SeedCommentFieldMetadataIds {
UpdatedAt = '20202020-63dd-4426-abad-9973fece49ed', UpdatedAt = '20202020-63dd-4426-abad-9973fece49ed',
Body = '20202020-354b-4f10-9425-fa3eb8fddc51', Body = '20202020-354b-4f10-9425-fa3eb8fddc51',
Author = '20202020-2c70-40c2-bba6-893780b25d41', Author = '20202020-2c70-40c2-bba6-893780b25d41',
AuthorForeignKey = '20202021-2c70-40c2-bba6-893780b25d42',
Activity = '20202020-a9ac-4294-9462-db0f690da906', Activity = '20202020-a9ac-4294-9462-db0f690da906',
ActivityForeignKey = '20202021-a9ac-4294-9462-db0f690da907',
} }
export const seedCommentFieldMetadata = async ( export const seedCommentFieldMetadata = async (
@ -37,6 +38,7 @@ export const seedCommentFieldMetadata = async (
'description', 'description',
'icon', 'icon',
'isNullable', 'isNullable',
'isSystem',
]) ])
.orIgnore() .orIgnore()
.values([ .values([
@ -56,7 +58,7 @@ export const seedCommentFieldMetadata = async (
description: undefined, description: undefined,
icon: undefined, icon: undefined,
isNullable: true, isNullable: true,
// isSystem: true, isSystem: true,
}, },
{ {
id: SeedCommentFieldMetadataIds.CreatedAt, id: SeedCommentFieldMetadataIds.CreatedAt,
@ -73,6 +75,7 @@ export const seedCommentFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedCommentFieldMetadataIds.UpdatedAt, id: SeedCommentFieldMetadataIds.UpdatedAt,
@ -89,6 +92,7 @@ export const seedCommentFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
// Scalar fields // Scalar fields
{ {
@ -97,7 +101,7 @@ export const seedCommentFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'body', name: 'body',
label: 'Body', label: 'Body',
targetColumnMap: { targetColumnMap: {
@ -106,6 +110,7 @@ export const seedCommentFieldMetadata = async (
description: 'Comment body', description: 'Comment body',
icon: 'IconLink', icon: 'IconLink',
isNullable: false, isNullable: false,
isSystem: false,
}, },
// Relationships // Relationships
{ {
@ -114,15 +119,29 @@ export const seedCommentFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'author', name: 'author',
label: 'Author', label: 'Author',
targetColumnMap: { targetColumnMap: {},
value: 'authorId',
},
description: 'Comment author', description: 'Comment author',
icon: 'IconCircleUser', icon: 'IconCircleUser',
isNullable: false, isNullable: false,
isSystem: false,
},
{
id: SeedCommentFieldMetadataIds.AuthorForeignKey,
objectMetadataId: SeedObjectMetadataIds.Comment,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.UUID,
name: 'authorId',
label: 'Author id (foreign key)',
targetColumnMap: {},
description: 'Comment author id foreign key',
icon: undefined,
isNullable: false,
isSystem: true,
}, },
{ {
id: SeedCommentFieldMetadataIds.Activity, id: SeedCommentFieldMetadataIds.Activity,
@ -130,15 +149,29 @@ export const seedCommentFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'activity', name: 'activity',
label: 'Activity', label: 'Activity',
targetColumnMap: { targetColumnMap: {},
value: 'activityId',
},
description: 'Comment activity', description: 'Comment activity',
icon: 'IconNotes', icon: 'IconNotes',
isNullable: false, isNullable: false,
isSystem: false,
},
{
id: SeedCommentFieldMetadataIds.ActivityForeignKey,
objectMetadataId: SeedObjectMetadataIds.Comment,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.UUID,
name: 'activityId',
label: 'Activity id (foreign key)',
targetColumnMap: {},
description: 'Activity id foreign key',
icon: undefined,
isNullable: false,
isSystem: true,
}, },
]) ])
.execute(); .execute();

View File

@ -23,6 +23,7 @@ export enum SeedCompanyFieldMetadataIds {
People = '20202020-68b4-4c8e-af19-738eba2a42a5', People = '20202020-68b4-4c8e-af19-738eba2a42a5',
AccountOwner = '20202020-0739-495d-8e70-c0807f6b2268', AccountOwner = '20202020-0739-495d-8e70-c0807f6b2268',
AccountOwnerForeignKey = '20202020-0b9e-4b9e-8b0a-5b0b5b0b5b0b',
ActivityTargets = '20202020-4a2e-4b41-8562-279963e8947e', ActivityTargets = '20202020-4a2e-4b41-8562-279963e8947e',
Opportunities = '20202020-e3fc-46ff-b552-3e757843f06e', Opportunities = '20202020-e3fc-46ff-b552-3e757843f06e',
Favorites = '20202020-e7c8-4771-8cc4-ce0e8c36a3c0', Favorites = '20202020-e7c8-4771-8cc4-ce0e8c36a3c0',
@ -49,6 +50,7 @@ export const seedCompanyFieldMetadata = async (
'description', 'description',
'icon', 'icon',
'isNullable', 'isNullable',
'isSystem',
]) ])
.orIgnore() .orIgnore()
.values([ .values([
@ -68,7 +70,7 @@ export const seedCompanyFieldMetadata = async (
description: undefined, description: undefined,
icon: undefined, icon: undefined,
isNullable: true, isNullable: true,
// isSystem: true, isSystem: true,
}, },
{ {
id: SeedCompanyFieldMetadataIds.CreatedAt, id: SeedCompanyFieldMetadataIds.CreatedAt,
@ -85,6 +87,7 @@ export const seedCompanyFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedCompanyFieldMetadataIds.UpdatedAt, id: SeedCompanyFieldMetadataIds.UpdatedAt,
@ -101,6 +104,7 @@ export const seedCompanyFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
// Main Identifier // Main Identifier
{ {
@ -109,7 +113,7 @@ export const seedCompanyFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'name', name: 'name',
label: 'Name', label: 'Name',
targetColumnMap: { targetColumnMap: {
@ -118,6 +122,7 @@ export const seedCompanyFieldMetadata = async (
description: 'The company name', description: 'The company name',
icon: 'IconBuildingSkyscraper', icon: 'IconBuildingSkyscraper',
isNullable: false, isNullable: false,
isSystem: false,
}, },
// Scalar Fields // Scalar Fields
@ -127,7 +132,7 @@ export const seedCompanyFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'domainName', name: 'domainName',
label: 'Domain Name', label: 'Domain Name',
targetColumnMap: { targetColumnMap: {
@ -137,6 +142,7 @@ export const seedCompanyFieldMetadata = async (
'The company website URL. We use this url to fetch the company icon', 'The company website URL. We use this url to fetch the company icon',
icon: 'IconLink', icon: 'IconLink',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedCompanyFieldMetadataIds.Address, id: SeedCompanyFieldMetadataIds.Address,
@ -144,7 +150,7 @@ export const seedCompanyFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'address', name: 'address',
label: 'Address', label: 'Address',
targetColumnMap: { targetColumnMap: {
@ -153,6 +159,7 @@ export const seedCompanyFieldMetadata = async (
description: 'The company address', description: 'The company address',
icon: 'IconMap', icon: 'IconMap',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedCompanyFieldMetadataIds.Employees, id: SeedCompanyFieldMetadataIds.Employees,
@ -160,7 +167,7 @@ export const seedCompanyFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'NUMBER', type: FieldMetadataType.NUMBER,
name: 'employees', name: 'employees',
label: 'Employees', label: 'Employees',
targetColumnMap: { targetColumnMap: {
@ -169,6 +176,7 @@ export const seedCompanyFieldMetadata = async (
description: 'Number of employees in the company', description: 'Number of employees in the company',
icon: 'IconUsers', icon: 'IconUsers',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedCompanyFieldMetadataIds.LinkedinUrl, id: SeedCompanyFieldMetadataIds.LinkedinUrl,
@ -176,7 +184,7 @@ export const seedCompanyFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'linkedinUrl', name: 'linkedinUrl',
label: 'Linkedin', label: 'Linkedin',
targetColumnMap: { targetColumnMap: {
@ -185,6 +193,7 @@ export const seedCompanyFieldMetadata = async (
description: 'The company Linkedin account', description: 'The company Linkedin account',
icon: 'IconBrandLinkedin', icon: 'IconBrandLinkedin',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedCompanyFieldMetadataIds.XUrl, id: SeedCompanyFieldMetadataIds.XUrl,
@ -192,7 +201,7 @@ export const seedCompanyFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'xUrl', name: 'xUrl',
label: 'X', label: 'X',
targetColumnMap: { targetColumnMap: {
@ -201,6 +210,7 @@ export const seedCompanyFieldMetadata = async (
description: 'The company Twitter/X account', description: 'The company Twitter/X account',
icon: 'IconBrandX', icon: 'IconBrandX',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedCompanyFieldMetadataIds.AnnualRecurringRevenue, id: SeedCompanyFieldMetadataIds.AnnualRecurringRevenue,
@ -208,7 +218,7 @@ export const seedCompanyFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'NUMBER', type: FieldMetadataType.NUMBER,
name: 'annualRecurringRevenue', name: 'annualRecurringRevenue',
label: 'ARR', label: 'ARR',
targetColumnMap: { targetColumnMap: {
@ -218,6 +228,7 @@ export const seedCompanyFieldMetadata = async (
'Annual Recurring Revenue: The actual or estimated annual revenue of the company', 'Annual Recurring Revenue: The actual or estimated annual revenue of the company',
icon: 'IconMoneybag', icon: 'IconMoneybag',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedCompanyFieldMetadataIds.IdealCustomerProfile, id: SeedCompanyFieldMetadataIds.IdealCustomerProfile,
@ -225,7 +236,7 @@ export const seedCompanyFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'BOOLEAN', type: FieldMetadataType.BOOLEAN,
name: 'idealCustomerProfile', name: 'idealCustomerProfile',
label: 'ICP', label: 'ICP',
targetColumnMap: { targetColumnMap: {
@ -235,6 +246,7 @@ export const seedCompanyFieldMetadata = async (
'Ideal Customer Profile: Indicates whether the company is the most suitable and valuable customer for you', 'Ideal Customer Profile: Indicates whether the company is the most suitable and valuable customer for you',
icon: 'IconTarget', icon: 'IconTarget',
isNullable: true, isNullable: true,
isSystem: false,
}, },
// Relationships // Relationships
@ -244,13 +256,14 @@ export const seedCompanyFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'people', name: 'people',
label: 'People', label: 'People',
targetColumnMap: {}, targetColumnMap: {},
description: 'People linked to the company.', description: 'People linked to the company.',
icon: 'IconUsers', icon: 'IconUsers',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedCompanyFieldMetadataIds.AccountOwner, id: SeedCompanyFieldMetadataIds.AccountOwner,
@ -258,16 +271,30 @@ export const seedCompanyFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'accountOwner', name: 'accountOwner',
label: 'Account Owner', label: 'Account Owner',
targetColumnMap: { targetColumnMap: {},
value: 'accountOwnerId',
},
description: description:
'Your team member responsible for managing the company account', 'Your team member responsible for managing the company account',
icon: 'IconUserCircle', icon: 'IconUserCircle',
isNullable: true, isNullable: true,
isSystem: false,
},
{
id: SeedCompanyFieldMetadataIds.AccountOwnerForeignKey,
objectMetadataId: SeedObjectMetadataIds.Company,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.UUID,
name: 'accountOwnerId',
label: 'Account Owner ID (foreign key)',
targetColumnMap: {},
description: 'Foreign key for account owner',
icon: undefined,
isNullable: true,
isSystem: true,
}, },
{ {
id: SeedCompanyFieldMetadataIds.ActivityTargets, id: SeedCompanyFieldMetadataIds.ActivityTargets,
@ -275,13 +302,14 @@ export const seedCompanyFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'activityTargets', name: 'activityTargets',
label: 'Activities', label: 'Activities',
targetColumnMap: {}, targetColumnMap: {},
description: 'Activities tied to the company', description: 'Activities tied to the company',
icon: 'IconCheckbox', icon: 'IconCheckbox',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedCompanyFieldMetadataIds.Opportunities, id: SeedCompanyFieldMetadataIds.Opportunities,
@ -289,13 +317,14 @@ export const seedCompanyFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'opportunities', name: 'opportunities',
label: 'Opportunities', label: 'Opportunities',
targetColumnMap: {}, targetColumnMap: {},
description: 'Opportunities linked to the company.', description: 'Opportunities linked to the company.',
icon: 'IconTargetArrow', icon: 'IconTargetArrow',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedCompanyFieldMetadataIds.Favorites, id: SeedCompanyFieldMetadataIds.Favorites,
@ -303,13 +332,14 @@ export const seedCompanyFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'favorites', name: 'favorites',
label: 'Favorites', label: 'Favorites',
targetColumnMap: {}, targetColumnMap: {},
description: 'Favorites linked to the company', description: 'Favorites linked to the company',
icon: 'IconHeart', icon: 'IconHeart',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedCompanyFieldMetadataIds.Attachments, id: SeedCompanyFieldMetadataIds.Attachments,
@ -317,13 +347,14 @@ export const seedCompanyFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'attachments', name: 'attachments',
label: 'Attachments', label: 'Attachments',
targetColumnMap: {}, targetColumnMap: {},
description: 'Attachments linked to the company.', description: 'Attachments linked to the company.',
icon: 'IconFileImport', icon: 'IconFileImport',
isNullable: true, isNullable: true,
isSystem: false,
}, },
]) ])
.execute(); .execute();

View File

@ -14,9 +14,12 @@ export enum SeedFavoriteFieldMetadataIds {
Position = '20202020-dd6d-4f67-94aa-22cc83eb0a2e', Position = '20202020-dd6d-4f67-94aa-22cc83eb0a2e',
WorkspaceMember = '20202020-1138-4e93-bbff-917a68161abf', WorkspaceMember = '20202020-1138-4e93-bbff-917a68161abf',
WorkspaceMemberForeignKey = '20202020-0f4c-4b9a-9b9a-917a68161a4f',
Person = '20202020-0876-4735-8974-ff4d51aafa07', Person = '20202020-0876-4735-8974-ff4d51aafa07',
PersonForeignKey = '20202020-0876-4735-9473-ff4d51aa4e7b',
Company = '20202020-09e1-4384-ae3e-39e7956396fe', Company = '20202020-09e1-4384-ae3e-39e7956396fe',
CompanyV2 = '20202020-09e1-4384-ae3e-39e7956396ff', CompanyV2 = '20202020-09e1-4384-ae3e-39e7956396ff',
CompanyForeignKey = '20202020-09e1-4384-ae3e-45e79563d528',
} }
export const seedFavoriteFieldMetadata = async ( export const seedFavoriteFieldMetadata = async (
@ -39,6 +42,7 @@ export const seedFavoriteFieldMetadata = async (
'description', 'description',
'icon', 'icon',
'isNullable', 'isNullable',
'isSystem',
]) ])
.orIgnore() .orIgnore()
.values([ .values([
@ -58,7 +62,7 @@ export const seedFavoriteFieldMetadata = async (
description: undefined, description: undefined,
icon: undefined, icon: undefined,
isNullable: true, isNullable: true,
// isSystem: true, isSystem: true,
}, },
{ {
id: SeedFavoriteFieldMetadataIds.CreatedAt, id: SeedFavoriteFieldMetadataIds.CreatedAt,
@ -75,6 +79,7 @@ export const seedFavoriteFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedFavoriteFieldMetadataIds.UpdatedAt, id: SeedFavoriteFieldMetadataIds.UpdatedAt,
@ -91,6 +96,7 @@ export const seedFavoriteFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
// Scalar fields // Scalar fields
{ {
@ -99,7 +105,7 @@ export const seedFavoriteFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'NUMBER', type: FieldMetadataType.NUMBER,
name: 'position', name: 'position',
label: 'Position', label: 'Position',
targetColumnMap: { targetColumnMap: {
@ -108,6 +114,7 @@ export const seedFavoriteFieldMetadata = async (
description: 'Favorite position', description: 'Favorite position',
icon: 'IconList', icon: 'IconList',
isNullable: false, isNullable: false,
isSystem: false,
}, },
// Relationships // Relationships
@ -117,15 +124,29 @@ export const seedFavoriteFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'workspaceMember', name: 'workspaceMember',
label: 'Workspace Member', label: 'Workspace Member',
targetColumnMap: { targetColumnMap: {},
value: 'workspaceMemberId',
},
description: 'Favorite workspace member', description: 'Favorite workspace member',
icon: 'IconCircleUser', icon: 'IconCircleUser',
isNullable: false, isNullable: false,
isSystem: false,
},
{
id: SeedFavoriteFieldMetadataIds.WorkspaceMemberForeignKey,
objectMetadataId: SeedObjectMetadataIds.Favorite,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.UUID,
name: 'workspaceMemberId',
label: 'Workspace Member ID (foreign key)',
targetColumnMap: {},
description: 'Foreign key for workspace member',
icon: undefined,
isNullable: false,
isSystem: true,
}, },
{ {
id: SeedFavoriteFieldMetadataIds.Person, id: SeedFavoriteFieldMetadataIds.Person,
@ -133,7 +154,7 @@ export const seedFavoriteFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'person', name: 'person',
label: 'Person', label: 'Person',
targetColumnMap: { targetColumnMap: {
@ -142,6 +163,22 @@ export const seedFavoriteFieldMetadata = async (
description: 'Favorite person', description: 'Favorite person',
icon: 'IconUser', icon: 'IconUser',
isNullable: true, isNullable: true,
isSystem: false,
},
{
id: SeedFavoriteFieldMetadataIds.PersonForeignKey,
objectMetadataId: SeedObjectMetadataIds.Favorite,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.UUID,
name: 'personId',
label: 'Person ID (foreign key)',
targetColumnMap: {},
description: 'Foreign key for person',
icon: undefined,
isNullable: false,
isSystem: true,
}, },
{ {
id: SeedFavoriteFieldMetadataIds.Company, id: SeedFavoriteFieldMetadataIds.Company,
@ -149,15 +186,29 @@ export const seedFavoriteFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'company', name: 'company',
label: 'Company', label: 'Company',
targetColumnMap: { targetColumnMap: {},
value: 'companyId',
},
description: 'Favorite company', description: 'Favorite company',
icon: 'IconBuildingSkyscraper', icon: 'IconBuildingSkyscraper',
isNullable: true, isNullable: true,
isSystem: false,
},
{
id: SeedFavoriteFieldMetadataIds.CompanyForeignKey,
objectMetadataId: SeedObjectMetadataIds.Favorite,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.UUID,
name: 'companyId',
label: 'Company ID (foreign key)',
targetColumnMap: {},
description: 'Foreign key for company',
icon: undefined,
isNullable: false,
isSystem: true,
}, },
]) ])
.execute(); .execute();

View File

@ -16,9 +16,13 @@ export enum SeedOpportunityFieldMetadataIds {
Probability = '20202020-3b9c-4e58-a3d2-c617d3b596b1', Probability = '20202020-3b9c-4e58-a3d2-c617d3b596b1',
PipelineStep = '20202020-0a2e-4676-8011-3fdb2c30c258', PipelineStep = '20202020-0a2e-4676-8011-3fdb2c30c258',
PipelineStepForeignKey = '20202020-0a2e-4676-8011-3fdb2c30d7f8',
PointOfContact = '20202020-618e-42da-b3c3-bcd7af76e355', PointOfContact = '20202020-618e-42da-b3c3-bcd7af76e355',
PointOfContactForeignKey = '20202020-618e-42da-b3c3-bcd7af76e4c2',
Company = '20202020-31d5-4af5-b016-c61c1c265706', Company = '20202020-31d5-4af5-b016-c61c1c265706',
CompanyForeignKey = '20202020-31d5-4af5-b016-c61c1c2657b9',
Person = '20202020-0655-41df-b938-15d71e589307', Person = '20202020-0655-41df-b938-15d71e589307',
PersonForeignKey = '20202020-0655-41df-b938-15d71e589d3e',
} }
export const seedOpportunityFieldMetadata = async ( export const seedOpportunityFieldMetadata = async (
@ -41,6 +45,7 @@ export const seedOpportunityFieldMetadata = async (
'description', 'description',
'icon', 'icon',
'isNullable', 'isNullable',
'isSystem',
]) ])
.orIgnore() .orIgnore()
.values([ .values([
@ -60,7 +65,7 @@ export const seedOpportunityFieldMetadata = async (
description: undefined, description: undefined,
icon: undefined, icon: undefined,
isNullable: true, isNullable: true,
// isSystem: true, isSystem: true,
}, },
{ {
id: SeedOpportunityFieldMetadataIds.CreatedAt, id: SeedOpportunityFieldMetadataIds.CreatedAt,
@ -77,6 +82,7 @@ export const seedOpportunityFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedOpportunityFieldMetadataIds.UpdatedAt, id: SeedOpportunityFieldMetadataIds.UpdatedAt,
@ -93,6 +99,7 @@ export const seedOpportunityFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
// Scalar fields // Scalar fields
{ {
@ -101,7 +108,7 @@ export const seedOpportunityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'NUMBER', type: FieldMetadataType.NUMBER,
name: 'amount', name: 'amount',
label: 'Amount', label: 'Amount',
targetColumnMap: { targetColumnMap: {
@ -110,6 +117,7 @@ export const seedOpportunityFieldMetadata = async (
description: 'Opportunity amount', description: 'Opportunity amount',
icon: 'IconCurrencyDollar', icon: 'IconCurrencyDollar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedOpportunityFieldMetadataIds.CloseDate, id: SeedOpportunityFieldMetadataIds.CloseDate,
@ -117,7 +125,7 @@ export const seedOpportunityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'DATE', type: FieldMetadataType.DATE,
name: 'closeDate', name: 'closeDate',
label: 'Close date', label: 'Close date',
targetColumnMap: { targetColumnMap: {
@ -126,6 +134,7 @@ export const seedOpportunityFieldMetadata = async (
description: 'Opportunity close date', description: 'Opportunity close date',
icon: 'IconCalendarEvent', icon: 'IconCalendarEvent',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedOpportunityFieldMetadataIds.Probability, id: SeedOpportunityFieldMetadataIds.Probability,
@ -133,7 +142,7 @@ export const seedOpportunityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'probability', name: 'probability',
label: 'Probability', label: 'Probability',
targetColumnMap: { targetColumnMap: {
@ -142,22 +151,38 @@ export const seedOpportunityFieldMetadata = async (
description: 'Opportunity amount', description: 'Opportunity amount',
icon: 'IconProgressCheck', icon: 'IconProgressCheck',
isNullable: true, isNullable: true,
isSystem: false,
}, },
// Relationships
{ {
id: SeedOpportunityFieldMetadataIds.PipelineStep, id: SeedOpportunityFieldMetadataIds.PipelineStep,
objectMetadataId: SeedObjectMetadataIds.Opportunity, objectMetadataId: SeedObjectMetadataIds.Opportunity,
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'pipelineStep', name: 'pipelineStep',
label: 'Pipeline Step', label: 'Pipeline Step',
targetColumnMap: { targetColumnMap: {},
value: 'pipelineStepId',
},
description: 'Opportunity pipeline step', description: 'Opportunity pipeline step',
icon: 'IconKanban', icon: 'IconKanban',
isNullable: true, isNullable: true,
isSystem: false,
},
{
id: SeedOpportunityFieldMetadataIds.PipelineStepForeignKey,
objectMetadataId: SeedObjectMetadataIds.Opportunity,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.UUID,
name: 'pipelineStepId',
label: 'Pipeline Step ID (foreign key)',
targetColumnMap: {},
description: 'Foreign key for pipeline step',
icon: undefined,
isNullable: true,
isSystem: true,
}, },
{ {
id: SeedOpportunityFieldMetadataIds.PointOfContact, id: SeedOpportunityFieldMetadataIds.PointOfContact,
@ -165,15 +190,29 @@ export const seedOpportunityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'pointOfContact', name: 'pointOfContact',
label: 'Point of Contact', label: 'Point of Contact',
targetColumnMap: { targetColumnMap: {},
value: 'pointOfContactId',
},
description: 'Opportunity point of contact', description: 'Opportunity point of contact',
icon: 'IconUser', icon: 'IconUser',
isNullable: true, isNullable: true,
isSystem: false,
},
{
id: SeedOpportunityFieldMetadataIds.PointOfContactForeignKey,
objectMetadataId: SeedObjectMetadataIds.Opportunity,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.UUID,
name: 'pointOfContactId',
label: 'Point of Contact ID (foreign key)',
targetColumnMap: {},
description: 'Foreign key for point of contact',
icon: undefined,
isNullable: true,
isSystem: true,
}, },
{ {
id: SeedOpportunityFieldMetadataIds.Person, id: SeedOpportunityFieldMetadataIds.Person,
@ -181,15 +220,29 @@ export const seedOpportunityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'person', name: 'person',
label: 'Person', label: 'Person',
targetColumnMap: { targetColumnMap: {},
value: 'personId',
},
description: 'Opportunity person', description: 'Opportunity person',
icon: 'IconUser', icon: 'IconUser',
isNullable: true, isNullable: true,
isSystem: false,
},
{
id: SeedOpportunityFieldMetadataIds.PersonForeignKey,
objectMetadataId: SeedObjectMetadataIds.Opportunity,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.UUID,
name: 'personId',
label: 'Person ID (foreign key)',
targetColumnMap: {},
description: 'Foreign key for person',
icon: undefined,
isNullable: true,
isSystem: true,
}, },
{ {
id: SeedOpportunityFieldMetadataIds.Company, id: SeedOpportunityFieldMetadataIds.Company,
@ -197,15 +250,29 @@ export const seedOpportunityFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'company', name: 'company',
label: 'Company', label: 'Company',
targetColumnMap: { targetColumnMap: {},
value: 'companyId',
},
description: 'Opportunity company', description: 'Opportunity company',
icon: 'IconBuildingSkyscraper', icon: 'IconBuildingSkyscraper',
isNullable: true, isNullable: true,
isSystem: false,
},
{
id: SeedOpportunityFieldMetadataIds.CompanyForeignKey,
objectMetadataId: SeedObjectMetadataIds.Opportunity,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.UUID,
name: 'companyId',
label: 'Company ID (foreign key)',
targetColumnMap: {},
description: 'Foreign key for company',
icon: undefined,
isNullable: true,
isSystem: true,
}, },
]) ])
.execute(); .execute();

View File

@ -23,6 +23,7 @@ export enum SeedPersonFieldMetadataIds {
AvatarUrl = '20202020-bb05-45cb-aa2a-71b58d49dd23', AvatarUrl = '20202020-bb05-45cb-aa2a-71b58d49dd23',
Company = '20202020-64e1-4080-b6ad-db03c3809885', Company = '20202020-64e1-4080-b6ad-db03c3809885',
CompanyForeignKey = '20202020-64e1-4080-b6ad-db03c3809f8b',
ContactForOpportunities = '20202020-2c2e-418e-ba2d-d28434ff02a6', ContactForOpportunities = '20202020-2c2e-418e-ba2d-d28434ff02a6',
Opportunities = '20202020-6bc4-4905-a9d3-4f8d616a19e1', Opportunities = '20202020-6bc4-4905-a9d3-4f8d616a19e1',
ActivityTargets = '20202020-f285-4115-a46c-116522986b29', ActivityTargets = '20202020-f285-4115-a46c-116522986b29',
@ -50,6 +51,7 @@ export const seedPersonFieldMetadata = async (
'description', 'description',
'icon', 'icon',
'isNullable', 'isNullable',
'isSystem',
]) ])
.orIgnore() .orIgnore()
.values([ .values([
@ -69,7 +71,7 @@ export const seedPersonFieldMetadata = async (
description: undefined, description: undefined,
icon: undefined, icon: undefined,
isNullable: true, isNullable: true,
// isSystem: true, isSystem: true,
}, },
{ {
id: SeedPersonFieldMetadataIds.CreatedAt, id: SeedPersonFieldMetadataIds.CreatedAt,
@ -86,6 +88,7 @@ export const seedPersonFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedPersonFieldMetadataIds.UpdatedAt, id: SeedPersonFieldMetadataIds.UpdatedAt,
@ -102,6 +105,7 @@ export const seedPersonFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
// Main Identifier // Main Identifier
{ {
@ -110,7 +114,7 @@ export const seedPersonFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'firstName', name: 'firstName',
label: 'First name', label: 'First name',
targetColumnMap: { targetColumnMap: {
@ -119,6 +123,7 @@ export const seedPersonFieldMetadata = async (
description: 'Contacts first name', description: 'Contacts first name',
icon: 'IconUser', icon: 'IconUser',
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedPersonFieldMetadataIds.LastName, id: SeedPersonFieldMetadataIds.LastName,
@ -126,7 +131,7 @@ export const seedPersonFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'lastName', name: 'lastName',
label: 'Last name', label: 'Last name',
targetColumnMap: { targetColumnMap: {
@ -135,6 +140,7 @@ export const seedPersonFieldMetadata = async (
description: 'Contacts last name', description: 'Contacts last name',
icon: 'IconUser', icon: 'IconUser',
isNullable: false, isNullable: false,
isSystem: false,
}, },
// Scalar Fields // Scalar Fields
@ -144,7 +150,7 @@ export const seedPersonFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'EMAIL', type: FieldMetadataType.EMAIL,
name: 'email', name: 'email',
label: 'Email', label: 'Email',
targetColumnMap: { targetColumnMap: {
@ -153,6 +159,7 @@ export const seedPersonFieldMetadata = async (
description: 'Contacts Email', description: 'Contacts Email',
icon: 'IconMail', icon: 'IconMail',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedPersonFieldMetadataIds.LinkedinUrl, id: SeedPersonFieldMetadataIds.LinkedinUrl,
@ -160,7 +167,7 @@ export const seedPersonFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'linkedinUrl', name: 'linkedinUrl',
label: 'Linkedin', label: 'Linkedin',
targetColumnMap: { targetColumnMap: {
@ -169,6 +176,7 @@ export const seedPersonFieldMetadata = async (
description: 'Contacts Linkedin account', description: 'Contacts Linkedin account',
icon: 'IconBrandLinkedin', icon: 'IconBrandLinkedin',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedPersonFieldMetadataIds.XUrl, id: SeedPersonFieldMetadataIds.XUrl,
@ -176,7 +184,7 @@ export const seedPersonFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'xUrl', name: 'xUrl',
label: 'X', label: 'X',
targetColumnMap: { targetColumnMap: {
@ -185,6 +193,7 @@ export const seedPersonFieldMetadata = async (
description: 'Contacts X/Twitter account', description: 'Contacts X/Twitter account',
icon: 'IconUser', icon: 'IconUser',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedPersonFieldMetadataIds.JobTitle, id: SeedPersonFieldMetadataIds.JobTitle,
@ -192,7 +201,7 @@ export const seedPersonFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'jobTitle', name: 'jobTitle',
label: 'Job Title', label: 'Job Title',
targetColumnMap: { targetColumnMap: {
@ -201,6 +210,7 @@ export const seedPersonFieldMetadata = async (
description: 'Contacts job title', description: 'Contacts job title',
icon: 'IconBriefcase', icon: 'IconBriefcase',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedPersonFieldMetadataIds.Phone, id: SeedPersonFieldMetadataIds.Phone,
@ -208,7 +218,7 @@ export const seedPersonFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'phone', name: 'phone',
label: 'Phone', label: 'Phone',
targetColumnMap: { targetColumnMap: {
@ -217,6 +227,7 @@ export const seedPersonFieldMetadata = async (
description: 'Contacts phone number', description: 'Contacts phone number',
icon: 'IconPhone', icon: 'IconPhone',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedPersonFieldMetadataIds.City, id: SeedPersonFieldMetadataIds.City,
@ -224,7 +235,7 @@ export const seedPersonFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'city', name: 'city',
label: 'City', label: 'City',
targetColumnMap: { targetColumnMap: {
@ -233,6 +244,7 @@ export const seedPersonFieldMetadata = async (
description: 'Contacts city', description: 'Contacts city',
icon: 'IconMap', icon: 'IconMap',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedPersonFieldMetadataIds.AvatarUrl, id: SeedPersonFieldMetadataIds.AvatarUrl,
@ -240,7 +252,7 @@ export const seedPersonFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'avatarUrl', name: 'avatarUrl',
label: 'Avatar', label: 'Avatar',
targetColumnMap: { targetColumnMap: {
@ -249,6 +261,7 @@ export const seedPersonFieldMetadata = async (
description: 'Contacts avatar', description: 'Contacts avatar',
icon: 'IconFileUpload', icon: 'IconFileUpload',
isNullable: true, isNullable: true,
isSystem: false,
}, },
// Relationships // Relationships
@ -258,15 +271,29 @@ export const seedPersonFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'company', name: 'company',
label: 'Company', label: 'Company',
targetColumnMap: { targetColumnMap: {},
value: 'companyId',
},
description: 'Contacts company', description: 'Contacts company',
icon: 'IconBuildingSkyscraper', icon: 'IconBuildingSkyscraper',
isNullable: false, isNullable: false,
isSystem: false,
},
{
id: SeedPersonFieldMetadataIds.CompanyForeignKey,
objectMetadataId: SeedObjectMetadataIds.Person,
isCustom: false,
workspaceId: SeedWorkspaceId,
isActive: true,
type: FieldMetadataType.UUID,
name: 'companyId',
label: 'Company ID (foreign key)',
targetColumnMap: {},
description: 'Foreign key for company',
icon: undefined,
isNullable: false,
isSystem: true,
}, },
{ {
id: SeedPersonFieldMetadataIds.ContactForOpportunities, id: SeedPersonFieldMetadataIds.ContactForOpportunities,
@ -274,13 +301,14 @@ export const seedPersonFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'pointOfContactForOpporunities', name: 'pointOfContactForOpporunities',
label: 'POC for Opportunities', label: 'POC for Opportunities',
targetColumnMap: {}, targetColumnMap: {},
description: 'Point of Contact for Opportuniites', description: 'Point of Contact for Opportuniites',
icon: 'IconArrowTarget', icon: 'IconArrowTarget',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedPersonFieldMetadataIds.ActivityTargets, id: SeedPersonFieldMetadataIds.ActivityTargets,
@ -288,13 +316,14 @@ export const seedPersonFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'activityTargets', name: 'activityTargets',
label: 'Activities', label: 'Activities',
targetColumnMap: {}, targetColumnMap: {},
description: 'Activities tied to the contact', description: 'Activities tied to the contact',
icon: 'IconCheckbox', icon: 'IconCheckbox',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedPersonFieldMetadataIds.Opportunities, id: SeedPersonFieldMetadataIds.Opportunities,
@ -302,13 +331,14 @@ export const seedPersonFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'opportunities', name: 'opportunities',
label: 'Opportunities', label: 'Opportunities',
targetColumnMap: {}, targetColumnMap: {},
description: 'Opportunities linked to the contact.', description: 'Opportunities linked to the contact.',
icon: 'IconTargetArrow', icon: 'IconTargetArrow',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedPersonFieldMetadataIds.Favorites, id: SeedPersonFieldMetadataIds.Favorites,
@ -316,13 +346,14 @@ export const seedPersonFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'favorites', name: 'favorites',
label: 'Favorites', label: 'Favorites',
targetColumnMap: {}, targetColumnMap: {},
description: 'Favorites linked to the contact', description: 'Favorites linked to the contact',
icon: 'IconHeart', icon: 'IconHeart',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedPersonFieldMetadataIds.Attachments, id: SeedPersonFieldMetadataIds.Attachments,
@ -330,13 +361,14 @@ export const seedPersonFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'attachments', name: 'attachments',
label: 'Attachments', label: 'Attachments',
targetColumnMap: {}, targetColumnMap: {},
description: 'Attachments linked to the contact.', description: 'Attachments linked to the contact.',
icon: 'IconFileImport', icon: 'IconFileImport',
isNullable: true, isNullable: true,
isSystem: false,
}, },
]) ])
.execute(); .execute();

View File

@ -37,6 +37,7 @@ export const seedPipelineStepFieldMetadata = async (
'description', 'description',
'icon', 'icon',
'isNullable', 'isNullable',
'isSystem',
]) ])
.orIgnore() .orIgnore()
.values([ .values([
@ -56,7 +57,7 @@ export const seedPipelineStepFieldMetadata = async (
description: undefined, description: undefined,
icon: undefined, icon: undefined,
isNullable: true, isNullable: true,
// isSystem: true, isSystem: true,
}, },
{ {
id: SeedPipelineStepFieldMetadataIds.CreatedAt, id: SeedPipelineStepFieldMetadataIds.CreatedAt,
@ -73,6 +74,7 @@ export const seedPipelineStepFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedPipelineStepFieldMetadataIds.UpdatedAt, id: SeedPipelineStepFieldMetadataIds.UpdatedAt,
@ -89,6 +91,7 @@ export const seedPipelineStepFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
// Main Identifier // Main Identifier
{ {
@ -97,7 +100,7 @@ export const seedPipelineStepFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'name', name: 'name',
label: 'Name', label: 'Name',
targetColumnMap: { targetColumnMap: {
@ -106,6 +109,7 @@ export const seedPipelineStepFieldMetadata = async (
description: 'Pipeline Step name', description: 'Pipeline Step name',
icon: 'IconCurrencyDollar', icon: 'IconCurrencyDollar',
isNullable: false, isNullable: false,
isSystem: false,
}, },
// Scalar Fields // Scalar Fields
@ -115,7 +119,7 @@ export const seedPipelineStepFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'color', name: 'color',
label: 'Color', label: 'Color',
targetColumnMap: { targetColumnMap: {
@ -124,6 +128,7 @@ export const seedPipelineStepFieldMetadata = async (
description: 'Pipeline Step color', description: 'Pipeline Step color',
icon: 'IconColorSwatch', icon: 'IconColorSwatch',
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedPipelineStepFieldMetadataIds.Position, id: SeedPipelineStepFieldMetadataIds.Position,
@ -131,7 +136,7 @@ export const seedPipelineStepFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'NUMBER', type: FieldMetadataType.NUMBER,
name: 'position', name: 'position',
label: 'Position', label: 'Position',
targetColumnMap: { targetColumnMap: {
@ -140,6 +145,7 @@ export const seedPipelineStepFieldMetadata = async (
description: 'Pipeline Step position', description: 'Pipeline Step position',
icon: 'IconHierarchy2', icon: 'IconHierarchy2',
isNullable: false, isNullable: false,
isSystem: false,
}, },
// Relationships // Relationships
@ -149,13 +155,14 @@ export const seedPipelineStepFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'opportunities', name: 'opportunities',
label: 'Opportunities', label: 'Opportunities',
targetColumnMap: {}, targetColumnMap: {},
description: 'Opportunities linked to the step.', description: 'Opportunities linked to the step.',
icon: 'IconTargetArrow', icon: 'IconTargetArrow',
isNullable: true, isNullable: true,
isSystem: false,
}, },
]) ])
.execute(); .execute();

View File

@ -38,6 +38,7 @@ export const seedViewFieldFieldMetadata = async (
'description', 'description',
'icon', 'icon',
'isNullable', 'isNullable',
'isSystem',
]) ])
.orIgnore() .orIgnore()
.values([ .values([
@ -57,7 +58,7 @@ export const seedViewFieldFieldMetadata = async (
description: undefined, description: undefined,
icon: undefined, icon: undefined,
isNullable: true, isNullable: true,
// isSystem: true, isSystem: true,
}, },
{ {
id: SeedViewFieldFieldMetadataIds.CreatedAt, id: SeedViewFieldFieldMetadataIds.CreatedAt,
@ -74,6 +75,7 @@ export const seedViewFieldFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedViewFieldFieldMetadataIds.UpdatedAt, id: SeedViewFieldFieldMetadataIds.UpdatedAt,
@ -90,6 +92,7 @@ export const seedViewFieldFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
// Fields // Fields
{ {
@ -98,7 +101,7 @@ export const seedViewFieldFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'fieldMetadataId', name: 'fieldMetadataId',
label: 'Field Metadata Id', label: 'Field Metadata Id',
targetColumnMap: { targetColumnMap: {
@ -107,6 +110,7 @@ export const seedViewFieldFieldMetadata = async (
description: 'View Field target field', description: 'View Field target field',
icon: 'IconTag', icon: 'IconTag',
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedViewFieldFieldMetadataIds.View, id: SeedViewFieldFieldMetadataIds.View,
@ -114,13 +118,14 @@ export const seedViewFieldFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'view', name: 'view',
label: 'View Id', label: 'View Id',
targetColumnMap: { value: 'viewId' }, targetColumnMap: { value: 'viewId' },
description: 'View Field related view', description: 'View Field related view',
icon: 'IconLayoutCollage', icon: 'IconLayoutCollage',
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedViewFieldFieldMetadataIds.IsVisible, id: SeedViewFieldFieldMetadataIds.IsVisible,
@ -128,7 +133,7 @@ export const seedViewFieldFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'BOOLEAN', type: FieldMetadataType.BOOLEAN,
name: 'isVisible', name: 'isVisible',
label: 'Visible', label: 'Visible',
targetColumnMap: { targetColumnMap: {
@ -137,6 +142,7 @@ export const seedViewFieldFieldMetadata = async (
description: 'View Field visibility', description: 'View Field visibility',
icon: 'IconEye', icon: 'IconEye',
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedViewFieldFieldMetadataIds.Size, id: SeedViewFieldFieldMetadataIds.Size,
@ -144,7 +150,7 @@ export const seedViewFieldFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'NUMBER', type: FieldMetadataType.NUMBER,
name: 'size', name: 'size',
label: 'Size', label: 'Size',
targetColumnMap: { targetColumnMap: {
@ -153,6 +159,7 @@ export const seedViewFieldFieldMetadata = async (
description: 'View Field size', description: 'View Field size',
icon: 'IconEye', icon: 'IconEye',
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedViewFieldFieldMetadataIds.Position, id: SeedViewFieldFieldMetadataIds.Position,
@ -160,7 +167,7 @@ export const seedViewFieldFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'NUMBER', type: FieldMetadataType.NUMBER,
name: 'position', name: 'position',
label: 'Position', label: 'Position',
targetColumnMap: { targetColumnMap: {
@ -169,6 +176,7 @@ export const seedViewFieldFieldMetadata = async (
description: 'View Field position', description: 'View Field position',
icon: 'IconList', icon: 'IconList',
isNullable: false, isNullable: false,
isSystem: false,
}, },
]) ])
.execute(); .execute();

View File

@ -38,6 +38,7 @@ export const seedViewFilterFieldMetadata = async (
'description', 'description',
'icon', 'icon',
'isNullable', 'isNullable',
'isSystem',
]) ])
.orIgnore() .orIgnore()
.values([ .values([
@ -57,7 +58,7 @@ export const seedViewFilterFieldMetadata = async (
description: undefined, description: undefined,
icon: undefined, icon: undefined,
isNullable: true, isNullable: true,
// isSystem: true, isSystem: true,
}, },
{ {
id: SeedViewFilterFieldMetadataIds.CreatedAt, id: SeedViewFilterFieldMetadataIds.CreatedAt,
@ -74,6 +75,7 @@ export const seedViewFilterFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedViewFilterFieldMetadataIds.UpdatedAt, id: SeedViewFilterFieldMetadataIds.UpdatedAt,
@ -90,6 +92,7 @@ export const seedViewFilterFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
// Fields // Fields
{ {
@ -98,7 +101,7 @@ export const seedViewFilterFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'fieldMetadataId', name: 'fieldMetadataId',
label: 'Field Metadata Id', label: 'Field Metadata Id',
targetColumnMap: { targetColumnMap: {
@ -107,6 +110,7 @@ export const seedViewFilterFieldMetadata = async (
description: 'View Filter target field', description: 'View Filter target field',
icon: null, icon: null,
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedViewFilterFieldMetadataIds.View, id: SeedViewFilterFieldMetadataIds.View,
@ -114,7 +118,7 @@ export const seedViewFilterFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'viewId', name: 'viewId',
label: 'View Id', label: 'View Id',
targetColumnMap: { targetColumnMap: {
@ -123,6 +127,7 @@ export const seedViewFilterFieldMetadata = async (
description: 'View Filter related view', description: 'View Filter related view',
icon: 'IconLayoutCollage', icon: 'IconLayoutCollage',
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedViewFilterFieldMetadataIds.Operand, id: SeedViewFilterFieldMetadataIds.Operand,
@ -130,7 +135,7 @@ export const seedViewFilterFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'operand', name: 'operand',
label: 'Operand', label: 'Operand',
targetColumnMap: { targetColumnMap: {
@ -139,6 +144,7 @@ export const seedViewFilterFieldMetadata = async (
description: 'View Filter operand', description: 'View Filter operand',
icon: null, icon: null,
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedViewFilterFieldMetadataIds.Value, id: SeedViewFilterFieldMetadataIds.Value,
@ -146,7 +152,7 @@ export const seedViewFilterFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'value', name: 'value',
label: 'Value', label: 'Value',
targetColumnMap: { targetColumnMap: {
@ -155,6 +161,7 @@ export const seedViewFilterFieldMetadata = async (
description: 'View Filter value', description: 'View Filter value',
icon: null, icon: null,
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedViewFilterFieldMetadataIds.DisplayValue, id: SeedViewFilterFieldMetadataIds.DisplayValue,
@ -162,7 +169,7 @@ export const seedViewFilterFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'displayValue', name: 'displayValue',
label: 'Display Value', label: 'Display Value',
targetColumnMap: { targetColumnMap: {
@ -171,6 +178,7 @@ export const seedViewFilterFieldMetadata = async (
description: 'View Filter Display Value', description: 'View Filter Display Value',
icon: null, icon: null,
isNullable: false, isNullable: false,
isSystem: false,
}, },
]) ])
.execute(); .execute();

View File

@ -36,6 +36,7 @@ export const seedViewSortFieldMetadata = async (
'description', 'description',
'icon', 'icon',
'isNullable', 'isNullable',
'isSystem',
]) ])
.orIgnore() .orIgnore()
.values([ .values([
@ -55,7 +56,7 @@ export const seedViewSortFieldMetadata = async (
description: undefined, description: undefined,
icon: undefined, icon: undefined,
isNullable: true, isNullable: true,
// isSystem: true, isSystem: true,
}, },
{ {
id: SeedViewSortFieldMetadataIds.CreatedAt, id: SeedViewSortFieldMetadataIds.CreatedAt,
@ -72,6 +73,7 @@ export const seedViewSortFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedViewSortFieldMetadataIds.UpdatedAt, id: SeedViewSortFieldMetadataIds.UpdatedAt,
@ -88,6 +90,7 @@ export const seedViewSortFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
// Fields // Fields
{ {
@ -96,7 +99,7 @@ export const seedViewSortFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'fieldMetadataId', name: 'fieldMetadataId',
label: 'Field Metadata Id', label: 'Field Metadata Id',
targetColumnMap: { targetColumnMap: {
@ -105,6 +108,7 @@ export const seedViewSortFieldMetadata = async (
description: 'View Sort target field', description: 'View Sort target field',
icon: null, icon: null,
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedViewSortFieldMetadataIds.View, id: SeedViewSortFieldMetadataIds.View,
@ -112,7 +116,7 @@ export const seedViewSortFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'viewId', name: 'viewId',
label: 'View Id', label: 'View Id',
targetColumnMap: { targetColumnMap: {
@ -121,6 +125,7 @@ export const seedViewSortFieldMetadata = async (
description: 'View Sort related view', description: 'View Sort related view',
icon: 'IconLayoutCollage', icon: 'IconLayoutCollage',
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedViewSortFieldMetadataIds.Direction, id: SeedViewSortFieldMetadataIds.Direction,
@ -128,7 +133,7 @@ export const seedViewSortFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'direction', name: 'direction',
label: 'Direction', label: 'Direction',
targetColumnMap: { targetColumnMap: {
@ -137,6 +142,7 @@ export const seedViewSortFieldMetadata = async (
description: 'View Sort direction', description: 'View Sort direction',
icon: null, icon: null,
isNullable: false, isNullable: false,
isSystem: false,
}, },
]) ])
.execute(); .execute();

View File

@ -39,6 +39,7 @@ export const seedViewFieldMetadata = async (
'description', 'description',
'icon', 'icon',
'isNullable', 'isNullable',
'isSystem',
]) ])
.orIgnore() .orIgnore()
.values([ .values([
@ -58,7 +59,7 @@ export const seedViewFieldMetadata = async (
description: undefined, description: undefined,
icon: undefined, icon: undefined,
isNullable: true, isNullable: true,
// isSystem: true, isSystem: true,
}, },
{ {
id: SeedViewFieldMetadataIds.CreatedAt, id: SeedViewFieldMetadataIds.CreatedAt,
@ -75,6 +76,7 @@ export const seedViewFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedViewFieldMetadataIds.UpdatedAt, id: SeedViewFieldMetadataIds.UpdatedAt,
@ -91,6 +93,7 @@ export const seedViewFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
// Fields // Fields
{ {
@ -99,7 +102,7 @@ export const seedViewFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'name', name: 'name',
label: 'Name', label: 'Name',
targetColumnMap: { targetColumnMap: {
@ -108,6 +111,7 @@ export const seedViewFieldMetadata = async (
description: 'View name', description: 'View name',
icon: null, icon: null,
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedViewFieldMetadataIds.ObjectMetadataId, id: SeedViewFieldMetadataIds.ObjectMetadataId,
@ -115,7 +119,7 @@ export const seedViewFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'objectMetadataId', name: 'objectMetadataId',
label: 'Object Metadata Id', label: 'Object Metadata Id',
targetColumnMap: { targetColumnMap: {
@ -124,6 +128,7 @@ export const seedViewFieldMetadata = async (
description: 'View target object', description: 'View target object',
icon: null, icon: null,
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedViewFieldMetadataIds.Type, id: SeedViewFieldMetadataIds.Type,
@ -131,7 +136,7 @@ export const seedViewFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'type', name: 'type',
label: 'Type', label: 'Type',
targetColumnMap: { targetColumnMap: {
@ -140,6 +145,7 @@ export const seedViewFieldMetadata = async (
description: 'View type', description: 'View type',
icon: null, icon: null,
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedViewFieldMetadataIds.ViewFields, id: SeedViewFieldMetadataIds.ViewFields,
@ -147,13 +153,14 @@ export const seedViewFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'viewFields', name: 'viewFields',
label: 'View Fields', label: 'View Fields',
targetColumnMap: {}, targetColumnMap: {},
description: 'View Fields', description: 'View Fields',
icon: 'IconTag', icon: 'IconTag',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedViewFieldMetadataIds.ViewSorts, id: SeedViewFieldMetadataIds.ViewSorts,
@ -161,13 +168,14 @@ export const seedViewFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'viewSorts', name: 'viewSorts',
label: 'View Sorts', label: 'View Sorts',
targetColumnMap: {}, targetColumnMap: {},
description: 'View Sorts', description: 'View Sorts',
icon: 'IconArrowsSort', icon: 'IconArrowsSort',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedViewFieldMetadataIds.ViewFilters, id: SeedViewFieldMetadataIds.ViewFilters,
@ -175,13 +183,14 @@ export const seedViewFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'viewFilters', name: 'viewFilters',
label: 'View Filters', label: 'View Filters',
targetColumnMap: {}, targetColumnMap: {},
description: 'View Filters', description: 'View Filters',
icon: 'IconFilterBolt', icon: 'IconFilterBolt',
isNullable: true, isNullable: true,
isSystem: false,
}, },
]) ])
.execute(); .execute();

View File

@ -35,6 +35,7 @@ export const seedWebhookFieldMetadata = async (
'description', 'description',
'icon', 'icon',
'isNullable', 'isNullable',
'isSystem',
]) ])
.orIgnore() .orIgnore()
.values([ .values([
@ -54,7 +55,7 @@ export const seedWebhookFieldMetadata = async (
description: undefined, description: undefined,
icon: undefined, icon: undefined,
isNullable: true, isNullable: true,
// isSystem: true, isSystem: true,
}, },
{ {
id: SeedWebhookFieldMetadataIds.CreatedAt, id: SeedWebhookFieldMetadataIds.CreatedAt,
@ -71,6 +72,7 @@ export const seedWebhookFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedWebhookFieldMetadataIds.UpdatedAt, id: SeedWebhookFieldMetadataIds.UpdatedAt,
@ -87,6 +89,7 @@ export const seedWebhookFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
// Scalar fields // Scalar fields
{ {
@ -95,7 +98,7 @@ export const seedWebhookFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'targetUrl', name: 'targetUrl',
label: 'Target Url', label: 'Target Url',
targetColumnMap: { targetColumnMap: {
@ -104,6 +107,7 @@ export const seedWebhookFieldMetadata = async (
description: 'Webhook target url', description: 'Webhook target url',
icon: 'IconLink', icon: 'IconLink',
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedWebhookFieldMetadataIds.Operation, id: SeedWebhookFieldMetadataIds.Operation,
@ -111,7 +115,7 @@ export const seedWebhookFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'operation', name: 'operation',
label: 'Operation', label: 'Operation',
targetColumnMap: { targetColumnMap: {
@ -120,6 +124,7 @@ export const seedWebhookFieldMetadata = async (
description: 'Webhook operation', description: 'Webhook operation',
icon: 'IconCheckbox', icon: 'IconCheckbox',
isNullable: false, isNullable: false,
isSystem: false,
}, },
]) ])
.execute(); .execute();

View File

@ -47,6 +47,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
'description', 'description',
'icon', 'icon',
'isNullable', 'isNullable',
'isSystem',
]) ])
.orIgnore() .orIgnore()
.values([ .values([
@ -66,7 +67,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
description: undefined, description: undefined,
icon: undefined, icon: undefined,
isNullable: true, isNullable: true,
// isSystem: true, isSystem: true,
}, },
{ {
id: SeedWorkspaceMemberFieldMetadataIds.CreatedAt, id: SeedWorkspaceMemberFieldMetadataIds.CreatedAt,
@ -83,6 +84,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedWorkspaceMemberFieldMetadataIds.UpdatedAt, id: SeedWorkspaceMemberFieldMetadataIds.UpdatedAt,
@ -99,6 +101,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
description: undefined, description: undefined,
icon: 'IconCalendar', icon: 'IconCalendar',
isNullable: true, isNullable: true,
isSystem: false,
}, },
// Scalar fields // Scalar fields
{ {
@ -107,7 +110,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'firstName', name: 'firstName',
label: 'First name', label: 'First name',
targetColumnMap: { targetColumnMap: {
@ -116,6 +119,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
description: 'Workspace member first name', description: 'Workspace member first name',
icon: 'IconCircleUser', icon: 'IconCircleUser',
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedWorkspaceMemberFieldMetadataIds.LastName, id: SeedWorkspaceMemberFieldMetadataIds.LastName,
@ -123,7 +127,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'lastName', name: 'lastName',
label: 'Last name', label: 'Last name',
targetColumnMap: { targetColumnMap: {
@ -132,6 +136,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
description: 'Workspace member last name', description: 'Workspace member last name',
icon: 'IconCircleUser', icon: 'IconCircleUser',
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedWorkspaceMemberFieldMetadataIds.AvatarUrl, id: SeedWorkspaceMemberFieldMetadataIds.AvatarUrl,
@ -148,6 +153,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
description: 'Workspace member avatar', description: 'Workspace member avatar',
icon: 'IconFileUpload', icon: 'IconFileUpload',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedWorkspaceMemberFieldMetadataIds.UserId, id: SeedWorkspaceMemberFieldMetadataIds.UserId,
@ -155,7 +161,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'UUID', type: FieldMetadataType.UUID,
name: 'userId', name: 'userId',
label: 'User Id', label: 'User Id',
targetColumnMap: { targetColumnMap: {
@ -164,6 +170,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
description: 'Associated User Id', description: 'Associated User Id',
icon: 'IconCircleUsers', icon: 'IconCircleUsers',
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedWorkspaceMemberFieldMetadataIds.AllowImpersonation, id: SeedWorkspaceMemberFieldMetadataIds.AllowImpersonation,
@ -171,7 +178,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'BOOLEAN', type: FieldMetadataType.BOOLEAN,
name: 'allowImpersonation', name: 'allowImpersonation',
label: 'Admin Access', label: 'Admin Access',
targetColumnMap: { targetColumnMap: {
@ -180,6 +187,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
description: 'Allow Admin Access', description: 'Allow Admin Access',
icon: 'IconEye', icon: 'IconEye',
isNullable: false, isNullable: false,
isSystem: false,
}, },
{ {
id: SeedWorkspaceMemberFieldMetadataIds.ColorScheme, id: SeedWorkspaceMemberFieldMetadataIds.ColorScheme,
@ -187,7 +195,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'colorScheme', name: 'colorScheme',
label: 'Color Scheme', label: 'Color Scheme',
targetColumnMap: { targetColumnMap: {
@ -196,6 +204,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
description: 'Preferred color scheme', description: 'Preferred color scheme',
icon: 'IconColorSwatch', icon: 'IconColorSwatch',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedWorkspaceMemberFieldMetadataIds.Locale, id: SeedWorkspaceMemberFieldMetadataIds.Locale,
@ -203,7 +212,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'TEXT', type: FieldMetadataType.TEXT,
name: 'locale', name: 'locale',
label: 'Language', label: 'Language',
targetColumnMap: { targetColumnMap: {
@ -212,6 +221,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
description: 'Preferred language', description: 'Preferred language',
icon: 'IconLanguage', icon: 'IconLanguage',
isNullable: false, isNullable: false,
isSystem: false,
}, },
// Relationships // Relationships
@ -221,13 +231,14 @@ export const seedWorkspaceMemberFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'authoredActivities', name: 'authoredActivities',
label: 'Authored activities', label: 'Authored activities',
targetColumnMap: {}, targetColumnMap: {},
description: 'Activities created by the workspace member', description: 'Activities created by the workspace member',
icon: 'IconCheckbox', icon: 'IconCheckbox',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedWorkspaceMemberFieldMetadataIds.AssignedActivities, id: SeedWorkspaceMemberFieldMetadataIds.AssignedActivities,
@ -235,13 +246,14 @@ export const seedWorkspaceMemberFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'assignedActivities', name: 'assignedActivities',
label: 'Assigned activities', label: 'Assigned activities',
targetColumnMap: {}, targetColumnMap: {},
description: 'Activities assigned to the workspace member', description: 'Activities assigned to the workspace member',
icon: 'IconCheckbox', icon: 'IconCheckbox',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedWorkspaceMemberFieldMetadataIds.Favorites, id: SeedWorkspaceMemberFieldMetadataIds.Favorites,
@ -249,13 +261,14 @@ export const seedWorkspaceMemberFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'favorites', name: 'favorites',
label: 'Favorites', label: 'Favorites',
targetColumnMap: {}, targetColumnMap: {},
description: 'Favorites linked to the workspace member', description: 'Favorites linked to the workspace member',
icon: 'IconHeart', icon: 'IconHeart',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedWorkspaceMemberFieldMetadataIds.AccountOwnerForCompanies, id: SeedWorkspaceMemberFieldMetadataIds.AccountOwnerForCompanies,
@ -263,13 +276,14 @@ export const seedWorkspaceMemberFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'accountOwnerForCompanies', name: 'accountOwnerForCompanies',
label: 'Account Owner For Companies', label: 'Account Owner For Companies',
targetColumnMap: {}, targetColumnMap: {},
description: 'Account owner for companies', description: 'Account owner for companies',
icon: 'IconBriefcase', icon: 'IconBriefcase',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedWorkspaceMemberFieldMetadataIds.AuthoredAttachments, id: SeedWorkspaceMemberFieldMetadataIds.AuthoredAttachments,
@ -277,13 +291,14 @@ export const seedWorkspaceMemberFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'authoredAttachments', name: 'authoredAttachments',
label: 'Authored attachments', label: 'Authored attachments',
targetColumnMap: {}, targetColumnMap: {},
description: 'Attachments created by the workspace member', description: 'Attachments created by the workspace member',
icon: 'IconFileImport', icon: 'IconFileImport',
isNullable: true, isNullable: true,
isSystem: false,
}, },
{ {
id: SeedWorkspaceMemberFieldMetadataIds.AuthoredComments, id: SeedWorkspaceMemberFieldMetadataIds.AuthoredComments,
@ -291,13 +306,14 @@ export const seedWorkspaceMemberFieldMetadata = async (
isCustom: false, isCustom: false,
workspaceId: SeedWorkspaceId, workspaceId: SeedWorkspaceId,
isActive: true, isActive: true,
type: 'RELATION', type: FieldMetadataType.RELATION,
name: 'authoredComments', name: 'authoredComments',
label: 'Authored comments', label: 'Authored comments',
targetColumnMap: {}, targetColumnMap: {},
description: 'Authored comments', description: 'Authored comments',
icon: 'IconComment', icon: 'IconComment',
isNullable: true, isNullable: true,
isSystem: false,
}, },
]) ])
.execute(); .execute();

View File

@ -1,71 +0,0 @@
import { MigrationInterface, QueryRunner } from 'typeorm';
export class SetupMetadataTables1699890270187 implements MigrationInterface {
name = 'SetupMetadataTables1699890270187';
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`CREATE TABLE "metadata"."relationMetadata" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "relationType" character varying NOT NULL, "fromObjectMetadataId" uuid NOT NULL, "toObjectMetadataId" uuid NOT NULL, "fromFieldMetadataId" uuid NOT NULL, "toFieldMetadataId" uuid NOT NULL, "workspaceId" character varying NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "REL_3deb257254145a3bdde9575e7d" UNIQUE ("fromFieldMetadataId"), CONSTRAINT "REL_9dea8f90d04edbbf9c541a95c3" UNIQUE ("toFieldMetadataId"), CONSTRAINT "PK_2724f60cb4f17a89481a7e8d7d3" PRIMARY KEY ("id"))`,
);
await queryRunner.query(
`CREATE TYPE "metadata"."dataSource_type_enum" AS ENUM('postgres')`,
);
await queryRunner.query(
`CREATE TABLE "metadata"."dataSource" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "url" character varying, "schema" character varying, "type" "metadata"."dataSource_type_enum" NOT NULL DEFAULT 'postgres', "label" character varying, "isRemote" boolean NOT NULL DEFAULT false, "workspaceId" character varying NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_6d01ae6c0f47baf4f8e37342268" PRIMARY KEY ("id"))`,
);
await queryRunner.query(
`CREATE TABLE "metadata"."objectMetadata" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "dataSourceId" uuid NOT NULL, "nameSingular" character varying NOT NULL, "namePlural" character varying NOT NULL, "labelSingular" character varying NOT NULL, "labelPlural" character varying NOT NULL, "description" text, "icon" character varying, "targetTableName" character varying NOT NULL, "isCustom" boolean NOT NULL DEFAULT false, "isActive" boolean NOT NULL DEFAULT false, "isSystem" boolean NOT NULL DEFAULT false, "workspaceId" character varying NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "IndexOnNamePluralAndWorkspaceIdUnique" UNIQUE ("namePlural", "workspaceId"), CONSTRAINT "IndexOnNameSingularAndWorkspaceIdUnique" UNIQUE ("nameSingular", "workspaceId"), CONSTRAINT "PK_81fb7f4f4244211cfbd188af1e8" PRIMARY KEY ("id"))`,
);
await queryRunner.query(
`CREATE TABLE "metadata"."fieldMetadata" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "objectMetadataId" uuid NOT NULL, "type" character varying NOT NULL, "name" character varying NOT NULL, "label" character varying NOT NULL, "targetColumnMap" jsonb NOT NULL, "description" text, "icon" character varying, "enums" text array, "isCustom" boolean NOT NULL DEFAULT false, "isActive" boolean NOT NULL DEFAULT false, "isNullable" boolean DEFAULT true, "workspaceId" character varying NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "IndexOnNameObjectMetadataIdAndWorkspaceIdUnique" UNIQUE ("name", "objectMetadataId", "workspaceId"), CONSTRAINT "PK_d046b1c7cea325ebc4cdc25e7a9" PRIMARY KEY ("id"))`,
);
await queryRunner.query(
`CREATE TABLE "metadata"."tenantMigration" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "migrations" jsonb, "name" character varying, "isCustom" boolean NOT NULL DEFAULT false, "appliedAt" TIMESTAMP, "workspaceId" character varying NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_f9b06eb42494795f73acb5c2350" PRIMARY KEY ("id"))`,
);
await queryRunner.query(
`ALTER TABLE "metadata"."relationMetadata" ADD CONSTRAINT "FK_f2a0acd3a548ee446a1a35df44d" FOREIGN KEY ("fromObjectMetadataId") REFERENCES "metadata"."objectMetadata"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "metadata"."relationMetadata" ADD CONSTRAINT "FK_0f781f589e5a527b8f3d3a4b824" FOREIGN KEY ("toObjectMetadataId") REFERENCES "metadata"."objectMetadata"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "metadata"."relationMetadata" ADD CONSTRAINT "FK_3deb257254145a3bdde9575e7d6" FOREIGN KEY ("fromFieldMetadataId") REFERENCES "metadata"."fieldMetadata"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "metadata"."relationMetadata" ADD CONSTRAINT "FK_9dea8f90d04edbbf9c541a95c3b" FOREIGN KEY ("toFieldMetadataId") REFERENCES "metadata"."fieldMetadata"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "metadata"."objectMetadata" ADD CONSTRAINT "FK_0b19dd17369574578bc18c405b2" FOREIGN KEY ("dataSourceId") REFERENCES "metadata"."dataSource"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
await queryRunner.query(
`ALTER TABLE "metadata"."fieldMetadata" ADD CONSTRAINT "FK_de2a09b9e3e690440480d2dee26" FOREIGN KEY ("objectMetadataId") REFERENCES "metadata"."objectMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`,
);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(
`ALTER TABLE "metadata"."fieldMetadata" DROP CONSTRAINT "FK_de2a09b9e3e690440480d2dee26"`,
);
await queryRunner.query(
`ALTER TABLE "metadata"."objectMetadata" DROP CONSTRAINT "FK_0b19dd17369574578bc18c405b2"`,
);
await queryRunner.query(
`ALTER TABLE "metadata"."relationMetadata" DROP CONSTRAINT "FK_9dea8f90d04edbbf9c541a95c3b"`,
);
await queryRunner.query(
`ALTER TABLE "metadata"."relationMetadata" DROP CONSTRAINT "FK_3deb257254145a3bdde9575e7d6"`,
);
await queryRunner.query(
`ALTER TABLE "metadata"."relationMetadata" DROP CONSTRAINT "FK_0f781f589e5a527b8f3d3a4b824"`,
);
await queryRunner.query(
`ALTER TABLE "metadata"."relationMetadata" DROP CONSTRAINT "FK_f2a0acd3a548ee446a1a35df44d"`,
);
await queryRunner.query(`DROP TABLE "metadata"."tenantMigration"`);
await queryRunner.query(`DROP TABLE "metadata"."fieldMetadata"`);
await queryRunner.query(`DROP TABLE "metadata"."objectMetadata"`);
await queryRunner.query(`DROP TABLE "metadata"."dataSource"`);
await queryRunner.query(`DROP TYPE "metadata"."dataSource_type_enum"`);
await queryRunner.query(`DROP TABLE "metadata"."relationMetadata"`);
}
}

View File

@ -0,0 +1,36 @@
import { MigrationInterface, QueryRunner } from "typeorm";
export class SetupMetadataTables1700133603735 implements MigrationInterface {
name = 'SetupMetadataTables1700133603735'
public async up(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`CREATE TABLE "metadata"."relationMetadata" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "relationType" character varying NOT NULL, "fromObjectMetadataId" uuid NOT NULL, "toObjectMetadataId" uuid NOT NULL, "fromFieldMetadataId" uuid NOT NULL, "toFieldMetadataId" uuid NOT NULL, "workspaceId" character varying NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "REL_3deb257254145a3bdde9575e7d" UNIQUE ("fromFieldMetadataId"), CONSTRAINT "REL_9dea8f90d04edbbf9c541a95c3" UNIQUE ("toFieldMetadataId"), CONSTRAINT "PK_2724f60cb4f17a89481a7e8d7d3" PRIMARY KEY ("id"))`);
await queryRunner.query(`CREATE TYPE "metadata"."dataSource_type_enum" AS ENUM('postgres')`);
await queryRunner.query(`CREATE TABLE "metadata"."dataSource" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "url" character varying, "schema" character varying, "type" "metadata"."dataSource_type_enum" NOT NULL DEFAULT 'postgres', "label" character varying, "isRemote" boolean NOT NULL DEFAULT false, "workspaceId" character varying NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_6d01ae6c0f47baf4f8e37342268" PRIMARY KEY ("id"))`);
await queryRunner.query(`CREATE TABLE "metadata"."objectMetadata" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "dataSourceId" uuid NOT NULL, "nameSingular" character varying NOT NULL, "namePlural" character varying NOT NULL, "labelSingular" character varying NOT NULL, "labelPlural" character varying NOT NULL, "description" text, "icon" character varying, "targetTableName" character varying NOT NULL, "isCustom" boolean NOT NULL DEFAULT false, "isActive" boolean NOT NULL DEFAULT false, "isSystem" boolean NOT NULL DEFAULT false, "workspaceId" character varying NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "IndexOnNamePluralAndWorkspaceIdUnique" UNIQUE ("namePlural", "workspaceId"), CONSTRAINT "IndexOnNameSingularAndWorkspaceIdUnique" UNIQUE ("nameSingular", "workspaceId"), CONSTRAINT "PK_81fb7f4f4244211cfbd188af1e8" PRIMARY KEY ("id"))`);
await queryRunner.query(`CREATE TABLE "metadata"."fieldMetadata" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "objectMetadataId" uuid NOT NULL, "type" character varying NOT NULL, "name" character varying NOT NULL, "label" character varying NOT NULL, "targetColumnMap" jsonb NOT NULL, "description" text, "icon" character varying, "enums" text array, "isCustom" boolean NOT NULL DEFAULT false, "isActive" boolean NOT NULL DEFAULT false, "isSystem" boolean NOT NULL DEFAULT false, "isNullable" boolean DEFAULT true, "workspaceId" character varying NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), "updatedAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "IndexOnNameObjectMetadataIdAndWorkspaceIdUnique" UNIQUE ("name", "objectMetadataId", "workspaceId"), CONSTRAINT "PK_d046b1c7cea325ebc4cdc25e7a9" PRIMARY KEY ("id"))`);
await queryRunner.query(`CREATE TABLE "metadata"."tenantMigration" ("id" uuid NOT NULL DEFAULT uuid_generate_v4(), "migrations" jsonb, "name" character varying, "isCustom" boolean NOT NULL DEFAULT false, "appliedAt" TIMESTAMP, "workspaceId" character varying NOT NULL, "createdAt" TIMESTAMP NOT NULL DEFAULT now(), CONSTRAINT "PK_f9b06eb42494795f73acb5c2350" PRIMARY KEY ("id"))`);
await queryRunner.query(`ALTER TABLE "metadata"."relationMetadata" ADD CONSTRAINT "FK_f2a0acd3a548ee446a1a35df44d" FOREIGN KEY ("fromObjectMetadataId") REFERENCES "metadata"."objectMetadata"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE "metadata"."relationMetadata" ADD CONSTRAINT "FK_0f781f589e5a527b8f3d3a4b824" FOREIGN KEY ("toObjectMetadataId") REFERENCES "metadata"."objectMetadata"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE "metadata"."relationMetadata" ADD CONSTRAINT "FK_3deb257254145a3bdde9575e7d6" FOREIGN KEY ("fromFieldMetadataId") REFERENCES "metadata"."fieldMetadata"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE "metadata"."relationMetadata" ADD CONSTRAINT "FK_9dea8f90d04edbbf9c541a95c3b" FOREIGN KEY ("toFieldMetadataId") REFERENCES "metadata"."fieldMetadata"("id") ON DELETE NO ACTION ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE "metadata"."objectMetadata" ADD CONSTRAINT "FK_0b19dd17369574578bc18c405b2" FOREIGN KEY ("dataSourceId") REFERENCES "metadata"."dataSource"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
await queryRunner.query(`ALTER TABLE "metadata"."fieldMetadata" ADD CONSTRAINT "FK_de2a09b9e3e690440480d2dee26" FOREIGN KEY ("objectMetadataId") REFERENCES "metadata"."objectMetadata"("id") ON DELETE CASCADE ON UPDATE NO ACTION`);
}
public async down(queryRunner: QueryRunner): Promise<void> {
await queryRunner.query(`ALTER TABLE "metadata"."fieldMetadata" DROP CONSTRAINT "FK_de2a09b9e3e690440480d2dee26"`);
await queryRunner.query(`ALTER TABLE "metadata"."objectMetadata" DROP CONSTRAINT "FK_0b19dd17369574578bc18c405b2"`);
await queryRunner.query(`ALTER TABLE "metadata"."relationMetadata" DROP CONSTRAINT "FK_9dea8f90d04edbbf9c541a95c3b"`);
await queryRunner.query(`ALTER TABLE "metadata"."relationMetadata" DROP CONSTRAINT "FK_3deb257254145a3bdde9575e7d6"`);
await queryRunner.query(`ALTER TABLE "metadata"."relationMetadata" DROP CONSTRAINT "FK_0f781f589e5a527b8f3d3a4b824"`);
await queryRunner.query(`ALTER TABLE "metadata"."relationMetadata" DROP CONSTRAINT "FK_f2a0acd3a548ee446a1a35df44d"`);
await queryRunner.query(`DROP TABLE "metadata"."tenantMigration"`);
await queryRunner.query(`DROP TABLE "metadata"."fieldMetadata"`);
await queryRunner.query(`DROP TABLE "metadata"."objectMetadata"`);
await queryRunner.query(`DROP TABLE "metadata"."dataSource"`);
await queryRunner.query(`DROP TYPE "metadata"."dataSource_type_enum"`);
await queryRunner.query(`DROP TABLE "metadata"."relationMetadata"`);
}
}

View File

@ -8,6 +8,7 @@ import {
import { import {
Authorize, Authorize,
FilterableField,
IDField, IDField,
QueryOptions, QueryOptions,
Relation, Relation,
@ -29,7 +30,6 @@ registerEnumType(FieldMetadataType, {
}) })
@QueryOptions({ @QueryOptions({
defaultResultSize: 10, defaultResultSize: 10,
disableFilter: true,
disableSort: true, disableSort: true,
maxResultsSize: 1000, maxResultsSize: 1000,
}) })
@ -61,12 +61,15 @@ export class FieldMetadataDTO {
@Field({ nullable: true, deprecationReason: 'Use label name instead' }) @Field({ nullable: true, deprecationReason: 'Use label name instead' })
placeholder?: string; placeholder?: string;
@Field() @FilterableField()
isCustom: boolean; isCustom: boolean;
@Field() @FilterableField()
isActive: boolean; isActive: boolean;
@FilterableField()
isSystem: boolean;
@Field() @Field()
isNullable: boolean; isNullable: boolean;

View File

@ -77,6 +77,9 @@ export class FieldMetadataEntity implements FieldMetadataInterface {
@Column({ default: false }) @Column({ default: false })
isActive: boolean; isActive: boolean;
@Column({ default: false })
isSystem: boolean;
@Column({ nullable: true, default: true }) @Column({ nullable: true, default: true })
isNullable: boolean; isNullable: boolean;

View File

@ -100,18 +100,33 @@ export class RelationMetadataService extends TypeOrmQueryService<RelationMetadat
description: undefined, description: undefined,
icon: record.toIcon, icon: record.toIcon,
isCustom: true, isCustom: true,
targetColumnMap: { targetColumnMap: {},
value: foreignKeyColumnName,
},
isActive: true, isActive: true,
type: FieldMetadataType.RELATION, type: FieldMetadataType.RELATION,
objectMetadataId: record.toObjectMetadataId, objectMetadataId: record.toObjectMetadataId,
workspaceId: record.workspaceId, workspaceId: record.workspaceId,
}, },
// FOREIGN KEY
{
name: foreignKeyColumnName,
label: `${record.toLabel} Foreign Key`,
description: undefined,
icon: undefined,
isCustom: true,
targetColumnMap: {},
isActive: true,
// Should not be visible on the front side
isSystem: true,
type: FieldMetadataType.UUID,
objectMetadataId: record.toObjectMetadataId,
workspaceId: record.workspaceId,
},
]); ]);
const createdFieldMap = createdFields.reduce((acc, curr) => { const createdFieldMap = createdFields.reduce((acc, fieldMetadata) => {
acc[curr.objectMetadataId] = curr; if (fieldMetadata.type === FieldMetadataType.RELATION) {
acc[fieldMetadata.objectMetadataId] = fieldMetadata;
}
return acc; return acc;
}, {}); }, {});

View File

@ -57,9 +57,7 @@ export class ArgsAliasFactory {
// Otherwise we just need to map the value // Otherwise we just need to map the value
const mappedKey = fieldMetadata.targetColumnMap.value; const mappedKey = fieldMetadata.targetColumnMap.value;
if (mappedKey) { newArgs[mappedKey ?? key] = value;
newArgs[mappedKey] = value;
}
} else { } else {
// Recurse if value is a nested object, otherwise append field or alias // Recurse if value is a nested object, otherwise append field or alias
newArgs[key] = this.createArgsObjectRecursive(value, fieldMetadataMap); newArgs[key] = this.createArgsObjectRecursive(value, fieldMetadataMap);

View File

@ -68,7 +68,7 @@ export class FilterTypeDefinitionFactory {
const fields: GraphQLInputFieldConfigMap = {}; const fields: GraphQLInputFieldConfigMap = {};
for (const fieldMetadata of objectMetadata.fields) { for (const fieldMetadata of objectMetadata.fields) {
// Composite field types are generated during extensin of object type definition // Composite field types are generated during extension of object type definition
if (isCompositeFieldMetadataType(fieldMetadata.type)) { if (isCompositeFieldMetadataType(fieldMetadata.type)) {
//continue; //continue;
} }

View File

@ -53,7 +53,7 @@ export class InputTypeDefinitionFactory {
const fields: GraphQLInputFieldConfigMap = {}; const fields: GraphQLInputFieldConfigMap = {};
for (const fieldMetadata of objectMetadata.fields) { for (const fieldMetadata of objectMetadata.fields) {
// Composite field types are generated during extensin of object type definition // Composite field types are generated during extension of object type definition
if (isCompositeFieldMetadataType(fieldMetadata.type)) { if (isCompositeFieldMetadataType(fieldMetadata.type)) {
//continue; //continue;
} }

View File

@ -50,7 +50,7 @@ export class ObjectTypeDefinitionFactory {
const fields: GraphQLFieldConfigMap<any, any> = {}; const fields: GraphQLFieldConfigMap<any, any> = {};
for (const fieldMetadata of objectMetadata.fields) { for (const fieldMetadata of objectMetadata.fields) {
// Composite field types are generated during extensin of object type definition // Composite field types are generated during extension of object type definition
if (isCompositeFieldMetadataType(fieldMetadata.type)) { if (isCompositeFieldMetadataType(fieldMetadata.type)) {
continue; continue;
} }

View File

@ -44,7 +44,7 @@ export class OrderByTypeDefinitionFactory {
const fields: GraphQLInputFieldConfigMap = {}; const fields: GraphQLInputFieldConfigMap = {};
for (const fieldMetadata of objectMetadata.fields) { for (const fieldMetadata of objectMetadata.fields) {
// Composite field types are generated during extensin of object type definition // Composite field types are generated during extension of object type definition
if (isCompositeFieldMetadataType(fieldMetadata.type)) { if (isCompositeFieldMetadataType(fieldMetadata.type)) {
continue; continue;
} }