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:
@ -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 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 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.
|
||||
*/
|
||||
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) {
|
||||
return (documents as any)[source] ?? {};
|
||||
|
||||
File diff suppressed because one or more lines are too long
@ -8,7 +8,10 @@ import { useFindManyObjectMetadataItems } from '../hooks/useFindManyObjectMetada
|
||||
|
||||
export const ObjectMetadataNavItems = () => {
|
||||
const { objectMetadataItems } = useFindManyObjectMetadataItems({
|
||||
filter: {
|
||||
objectFilter: {
|
||||
isSystem: { is: false },
|
||||
},
|
||||
fieldFilter: {
|
||||
isSystem: { is: false },
|
||||
},
|
||||
});
|
||||
|
||||
@ -1,8 +1,11 @@
|
||||
import { gql } from '@apollo/client';
|
||||
|
||||
export const FIND_MANY_METADATA_OBJECTS = gql`
|
||||
query ObjectMetadataItems($filter: objectFilter) {
|
||||
objects(paging: { first: 1000 }, filter: $filter) {
|
||||
query ObjectMetadataItems(
|
||||
$objectFilter: objectFilter
|
||||
$fieldFilter: fieldFilter
|
||||
) {
|
||||
objects(paging: { first: 1000 }, filter: $objectFilter) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
@ -18,7 +21,7 @@ export const FIND_MANY_METADATA_OBJECTS = gql`
|
||||
isSystem
|
||||
createdAt
|
||||
updatedAt
|
||||
fields(paging: { first: 1000 }) {
|
||||
fields(paging: { first: 1000 }, filter: $fieldFilter) {
|
||||
edges {
|
||||
node {
|
||||
id
|
||||
@ -29,6 +32,7 @@ export const FIND_MANY_METADATA_OBJECTS = gql`
|
||||
icon
|
||||
isCustom
|
||||
isActive
|
||||
isSystem
|
||||
isNullable
|
||||
createdAt
|
||||
updatedAt
|
||||
|
||||
@ -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 { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
|
||||
import { FieldMetadataItem } from '../types/FieldMetadataItem';
|
||||
import { formatFieldMetadataItemInput } from '../utils/formatFieldMetadataItemInput';
|
||||
@ -16,13 +17,13 @@ export const useFieldMetadataItem = () => {
|
||||
const createMetadataField = (
|
||||
input: Pick<Field, 'label' | 'icon' | 'description'> & {
|
||||
objectMetadataId: string;
|
||||
type: MetadataFieldDataType;
|
||||
type: FieldMetadataType;
|
||||
},
|
||||
) =>
|
||||
createOneFieldMetadataItem({
|
||||
...formatFieldMetadataItemInput(input),
|
||||
objectMetadataId: input.objectMetadataId,
|
||||
type: input.type,
|
||||
type: input.type as FieldType,
|
||||
});
|
||||
|
||||
const editMetadataField = (
|
||||
|
||||
@ -3,6 +3,7 @@ import { useQuery } from '@apollo/client';
|
||||
|
||||
import { useSnackBar } from '@/ui/feedback/snack-bar/hooks/useSnackBar';
|
||||
import {
|
||||
FieldFilter,
|
||||
ObjectFilter,
|
||||
ObjectMetadataItemsQuery,
|
||||
ObjectMetadataItemsQueryVariables,
|
||||
@ -17,8 +18,13 @@ import { useApolloMetadataClient } from './useApolloMetadataClient';
|
||||
// TODO: test fetchMore
|
||||
export const useFindManyObjectMetadataItems = ({
|
||||
skip,
|
||||
filter,
|
||||
}: { skip?: boolean; filter?: ObjectFilter } = {}) => {
|
||||
objectFilter,
|
||||
fieldFilter,
|
||||
}: {
|
||||
skip?: boolean;
|
||||
objectFilter?: ObjectFilter;
|
||||
fieldFilter?: FieldFilter;
|
||||
} = {}) => {
|
||||
const apolloMetadataClient = useApolloMetadataClient();
|
||||
|
||||
const { enqueueSnackBar } = useSnackBar();
|
||||
@ -32,7 +38,8 @@ export const useFindManyObjectMetadataItems = ({
|
||||
FIND_MANY_METADATA_OBJECTS,
|
||||
{
|
||||
variables: {
|
||||
filter,
|
||||
objectFilter,
|
||||
fieldFilter,
|
||||
},
|
||||
client: apolloMetadataClient ?? undefined,
|
||||
skip: skip || !apolloMetadataClient,
|
||||
|
||||
@ -32,7 +32,7 @@ export const useFindManyObjectMetadataItems = ({
|
||||
FIND_MANY_METADATA_OBJECTS,
|
||||
{
|
||||
variables: {
|
||||
filter,
|
||||
objectFilter: filter,
|
||||
},
|
||||
client: apolloMetadataClient ?? undefined,
|
||||
skip: skip || !apolloMetadataClient,
|
||||
|
||||
@ -9,7 +9,10 @@ import { useUpdateOneObjectMetadataItem } from './useUpdateOneObjectMetadataItem
|
||||
|
||||
export const useObjectMetadataItemForSettings = () => {
|
||||
const { objectMetadataItems, loading } = useFindManyObjectMetadataItems({
|
||||
filter: {
|
||||
objectFilter: {
|
||||
isSystem: { is: false },
|
||||
},
|
||||
fieldFilter: {
|
||||
isSystem: { is: false },
|
||||
},
|
||||
});
|
||||
|
||||
@ -15,13 +15,12 @@ import { FieldMetadataType } from '~/generated/graphql';
|
||||
import { assertNotNull } from '~/utils/assert';
|
||||
|
||||
import { dataTypes } from '../constants/dataTypes';
|
||||
import { MetadataFieldDataType } from '../types/ObjectFieldDataType';
|
||||
|
||||
export type SettingsObjectFieldPreviewProps = {
|
||||
fieldIconKey?: string | null;
|
||||
fieldLabel: string;
|
||||
fieldName?: string;
|
||||
fieldType: MetadataFieldDataType;
|
||||
fieldType: FieldMetadataType;
|
||||
isObjectCustom: boolean;
|
||||
objectIconKey?: string | null;
|
||||
objectLabelPlural: string;
|
||||
|
||||
@ -3,9 +3,9 @@ import styled from '@emotion/styled';
|
||||
import { H2Title } from '@/ui/display/typography/components/H2Title';
|
||||
import { Select } from '@/ui/input/components/Select';
|
||||
import { Section } from '@/ui/layout/section/components/Section';
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
|
||||
import { dataTypes } from '../constants/dataTypes';
|
||||
import { MetadataFieldDataType } from '../types/ObjectFieldDataType';
|
||||
|
||||
import {
|
||||
SettingsObjectFieldPreview,
|
||||
@ -15,7 +15,7 @@ import { SettingsObjectFieldTypeCard } from './SettingsObjectFieldTypeCard';
|
||||
|
||||
type SettingsObjectFieldTypeSelectSectionProps = {
|
||||
disabled?: boolean;
|
||||
onChange?: (value: MetadataFieldDataType) => void;
|
||||
onChange?: (value: FieldMetadataType) => void;
|
||||
} & Pick<
|
||||
SettingsObjectFieldPreviewProps,
|
||||
| 'fieldIconKey'
|
||||
@ -59,7 +59,7 @@ export const SettingsObjectFieldTypeSelectSection = ({
|
||||
onChange={onChange}
|
||||
options={Object.entries(dataTypesWithoutRelation).map(
|
||||
([key, dataType]) => ({
|
||||
value: key as MetadataFieldDataType,
|
||||
value: key as FieldMetadataType,
|
||||
...dataType,
|
||||
}),
|
||||
)}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { MemoryRouter } from 'react-router-dom';
|
||||
import { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
|
||||
|
||||
import { SettingsObjectFieldPreview } from '../SettingsObjectFieldPreview';
|
||||
@ -12,7 +13,7 @@ const meta: Meta<typeof SettingsObjectFieldPreview> = {
|
||||
args: {
|
||||
fieldIconKey: 'IconNotes',
|
||||
fieldLabel: 'Description',
|
||||
fieldType: 'TEXT',
|
||||
fieldType: FieldMetadataType.Text,
|
||||
isObjectCustom: false,
|
||||
objectIconKey: 'IconBuildingSkyscraper',
|
||||
objectLabelPlural: 'Companies',
|
||||
@ -29,7 +30,7 @@ export const Boolean: Story = {
|
||||
args: {
|
||||
fieldIconKey: 'IconHeadphones',
|
||||
fieldLabel: 'Priority Support',
|
||||
fieldType: 'BOOLEAN',
|
||||
fieldType: FieldMetadataType.Boolean,
|
||||
},
|
||||
};
|
||||
|
||||
@ -37,7 +38,7 @@ export const Currency: Story = {
|
||||
args: {
|
||||
fieldIconKey: 'IconCurrencyDollar',
|
||||
fieldLabel: 'Amount',
|
||||
fieldType: 'MONEY',
|
||||
fieldType: FieldMetadataType.Money,
|
||||
},
|
||||
};
|
||||
|
||||
@ -45,7 +46,7 @@ export const Date: Story = {
|
||||
args: {
|
||||
fieldIconKey: 'IconCalendarEvent',
|
||||
fieldLabel: 'Registration Date',
|
||||
fieldType: 'DATE',
|
||||
fieldType: FieldMetadataType.Date,
|
||||
},
|
||||
};
|
||||
|
||||
@ -60,7 +61,7 @@ export const Link: Story = {
|
||||
args: {
|
||||
fieldIconKey: 'IconWorldWww',
|
||||
fieldLabel: 'Website',
|
||||
fieldType: 'URL',
|
||||
fieldType: FieldMetadataType.Url,
|
||||
},
|
||||
};
|
||||
|
||||
@ -68,7 +69,7 @@ export const Number: Story = {
|
||||
args: {
|
||||
fieldIconKey: 'IconUsers',
|
||||
fieldLabel: 'Employees',
|
||||
fieldType: 'NUMBER',
|
||||
fieldType: FieldMetadataType.Number,
|
||||
},
|
||||
};
|
||||
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { Meta, StoryObj } from '@storybook/react';
|
||||
|
||||
import { TextInput } from '@/ui/input/components/TextInput';
|
||||
import { FieldMetadataType } from '~/generated/graphql';
|
||||
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
|
||||
|
||||
import { SettingsObjectFieldPreview } from '../SettingsObjectFieldPreview';
|
||||
@ -15,7 +16,7 @@ const meta: Meta<typeof SettingsObjectFieldTypeCard> = {
|
||||
<SettingsObjectFieldPreview
|
||||
fieldIconKey="IconNotes"
|
||||
fieldLabel="Description"
|
||||
fieldType="TEXT"
|
||||
fieldType={FieldMetadataType.Text}
|
||||
isObjectCustom={false}
|
||||
objectIconKey="IconUser"
|
||||
objectLabelPlural="People"
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
import { Meta, StoryObj } from '@storybook/react';
|
||||
import { userEvent, within } from '@storybook/testing-library';
|
||||
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
import { ComponentDecorator } from '~/testing/decorators/ComponentDecorator';
|
||||
|
||||
import { SettingsObjectFieldTypeSelectSection } from '../SettingsObjectFieldTypeSelectSection';
|
||||
@ -10,7 +11,7 @@ const meta: Meta<typeof SettingsObjectFieldTypeSelectSection> = {
|
||||
component: SettingsObjectFieldTypeSelectSection,
|
||||
decorators: [ComponentDecorator],
|
||||
args: {
|
||||
fieldType: 'NUMBER',
|
||||
fieldType: FieldMetadataType.Number,
|
||||
fieldIconKey: 'IconUsers',
|
||||
fieldLabel: 'Employees',
|
||||
fieldName: 'employees',
|
||||
|
||||
@ -2,45 +2,67 @@ import {
|
||||
IconCalendarEvent,
|
||||
IconCheck,
|
||||
IconCoins,
|
||||
IconKey,
|
||||
IconLink,
|
||||
IconMail,
|
||||
IconNumbers,
|
||||
IconPhone,
|
||||
IconPlug,
|
||||
IconTextSize,
|
||||
} from '@/ui/display/icon';
|
||||
import { IconComponent } from '@/ui/display/icon/types/IconComponent';
|
||||
import { Currency } from '~/generated-metadata/graphql';
|
||||
|
||||
import { MetadataFieldDataType } from '../types/ObjectFieldDataType';
|
||||
import { Currency, FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
|
||||
const defaultDateValue = new Date();
|
||||
defaultDateValue.setFullYear(defaultDateValue.getFullYear() + 2);
|
||||
|
||||
export const dataTypes: Record<
|
||||
MetadataFieldDataType,
|
||||
FieldMetadataType,
|
||||
{ label: string; Icon: IconComponent; defaultValue?: unknown }
|
||||
> = {
|
||||
TEXT: {
|
||||
[FieldMetadataType.Uuid]: {
|
||||
label: 'Unique ID',
|
||||
Icon: IconKey,
|
||||
defaultValue: '00000000-0000-0000-0000-000000000000',
|
||||
},
|
||||
[FieldMetadataType.Text]: {
|
||||
label: 'Text',
|
||||
Icon: IconTextSize,
|
||||
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.',
|
||||
},
|
||||
NUMBER: { label: 'Number', Icon: IconNumbers, defaultValue: 2000 },
|
||||
URL: {
|
||||
[FieldMetadataType.Number]: {
|
||||
label: 'Number',
|
||||
Icon: IconNumbers,
|
||||
defaultValue: 2000,
|
||||
},
|
||||
[FieldMetadataType.Url]: {
|
||||
label: 'Link',
|
||||
Icon: IconLink,
|
||||
defaultValue: { link: 'www.twenty.com', text: '' },
|
||||
},
|
||||
BOOLEAN: { label: 'True/False', Icon: IconCheck, defaultValue: true },
|
||||
DATE: {
|
||||
[FieldMetadataType.Boolean]: {
|
||||
label: 'True/False',
|
||||
Icon: IconCheck,
|
||||
defaultValue: true,
|
||||
},
|
||||
[FieldMetadataType.Date]: {
|
||||
label: 'Date',
|
||||
Icon: IconCalendarEvent,
|
||||
defaultValue: defaultDateValue.toISOString(),
|
||||
},
|
||||
MONEY: {
|
||||
[FieldMetadataType.Money]: {
|
||||
label: 'Currency',
|
||||
Icon: IconCoins,
|
||||
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 },
|
||||
};
|
||||
|
||||
@ -1,10 +1,11 @@
|
||||
import { css, useTheme } from '@emotion/react';
|
||||
import styled from '@emotion/styled';
|
||||
|
||||
import { dataTypes } from '../../constants/dataTypes';
|
||||
import { MetadataFieldDataType } from '../../types/ObjectFieldDataType';
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
|
||||
const StyledDataType = styled.div<{ value: MetadataFieldDataType }>`
|
||||
import { dataTypes } from '../../constants/dataTypes';
|
||||
|
||||
const StyledDataType = styled.div<{ value: FieldMetadataType }>`
|
||||
align-items: center;
|
||||
border: 1px solid transparent;
|
||||
border-radius: ${({ theme }) => theme.border.radius.sm};
|
||||
@ -24,7 +25,7 @@ const StyledDataType = styled.div<{ value: MetadataFieldDataType }>`
|
||||
`;
|
||||
|
||||
type SettingsObjectFieldDataTypeProps = {
|
||||
value: MetadataFieldDataType;
|
||||
value: FieldMetadataType;
|
||||
};
|
||||
|
||||
export const SettingsObjectFieldDataType = ({
|
||||
|
||||
@ -6,9 +6,9 @@ import { FieldMetadataItem } from '@/object-metadata/types/FieldMetadataItem';
|
||||
import { useLazyLoadIcon } from '@/ui/input/hooks/useLazyLoadIcon';
|
||||
import { TableCell } from '@/ui/layout/table/components/TableCell';
|
||||
import { TableRow } from '@/ui/layout/table/components/TableRow';
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
|
||||
import { dataTypes } from '../../constants/dataTypes';
|
||||
import { MetadataFieldDataType } from '../../types/ObjectFieldDataType';
|
||||
|
||||
import { SettingsObjectFieldDataType } from './SettingsObjectFieldDataType';
|
||||
|
||||
@ -59,7 +59,7 @@ export const SettingsObjectFieldItemTableRow = ({
|
||||
<TableCell>{fieldItem.isCustom ? 'Custom' : 'Standard'}</TableCell>
|
||||
<TableCell>
|
||||
<SettingsObjectFieldDataType
|
||||
value={fieldItem.type as MetadataFieldDataType}
|
||||
value={fieldItem.type as FieldMetadataType}
|
||||
/>
|
||||
</TableCell>
|
||||
<StyledIconTableCell>{ActionIcon}</StyledIconTableCell>
|
||||
|
||||
@ -47,6 +47,7 @@ export {
|
||||
IconHeartOff,
|
||||
IconHelpCircle,
|
||||
IconHierarchy2,
|
||||
IconKey,
|
||||
IconLanguage,
|
||||
IconLayoutKanban,
|
||||
IconLayoutSidebarLeftCollapse,
|
||||
|
||||
@ -9,7 +9,6 @@ import { SettingsHeaderContainer } from '@/settings/components/SettingsHeaderCon
|
||||
import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';
|
||||
import { SettingsObjectFieldFormSection } from '@/settings/data-model/components/SettingsObjectFieldFormSection';
|
||||
import { SettingsObjectFieldTypeSelectSection } from '@/settings/data-model/components/SettingsObjectFieldTypeSelectSection';
|
||||
import { MetadataFieldDataType } from '@/settings/data-model/types/ObjectFieldDataType';
|
||||
import { AppPath } from '@/types/AppPath';
|
||||
import { IconArchive, IconSettings } from '@/ui/display/icon';
|
||||
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 { Section } from '@/ui/layout/section/components/Section';
|
||||
import { Breadcrumb } from '@/ui/navigation/bread-crumb/components/Breadcrumb';
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
|
||||
export const SettingsObjectFieldEdit = () => {
|
||||
const navigate = useNavigate();
|
||||
@ -128,7 +128,7 @@ export const SettingsObjectFieldEdit = () => {
|
||||
fieldIconKey={formValues.icon}
|
||||
fieldLabel={formValues.label || 'Employees'}
|
||||
fieldName={activeMetadataField.name}
|
||||
fieldType={activeMetadataField.type as MetadataFieldDataType}
|
||||
fieldType={activeMetadataField.type as FieldMetadataType}
|
||||
isObjectCustom={activeObjectMetadataItem.isCustom}
|
||||
objectIconKey={activeObjectMetadataItem.icon}
|
||||
objectLabelPlural={activeObjectMetadataItem.labelPlural}
|
||||
|
||||
@ -11,13 +11,13 @@ import { SettingsHeaderContainer } from '@/settings/components/SettingsHeaderCon
|
||||
import { SettingsPageContainer } from '@/settings/components/SettingsPageContainer';
|
||||
import { SettingsObjectFieldFormSection } from '@/settings/data-model/components/SettingsObjectFieldFormSection';
|
||||
import { SettingsObjectFieldTypeSelectSection } from '@/settings/data-model/components/SettingsObjectFieldTypeSelectSection';
|
||||
import { MetadataFieldDataType } from '@/settings/data-model/types/ObjectFieldDataType';
|
||||
import { AppPath } from '@/types/AppPath';
|
||||
import { IconSettings } from '@/ui/display/icon';
|
||||
import { SubMenuTopBarContainer } from '@/ui/layout/page/SubMenuTopBarContainer';
|
||||
import { Breadcrumb } from '@/ui/navigation/bread-crumb/components/Breadcrumb';
|
||||
import { View } from '@/views/types/View';
|
||||
import { ViewType } from '@/views/types/ViewType';
|
||||
import { FieldMetadataType } from '~/generated-metadata/graphql';
|
||||
|
||||
export const SettingsObjectNewFieldStep2 = () => {
|
||||
const navigate = useNavigate();
|
||||
@ -39,8 +39,8 @@ export const SettingsObjectNewFieldStep2 = () => {
|
||||
description?: string;
|
||||
icon: string;
|
||||
label: string;
|
||||
type: MetadataFieldDataType;
|
||||
}>({ icon: 'IconUsers', label: '', type: 'NUMBER' });
|
||||
type: FieldMetadataType;
|
||||
}>({ icon: 'IconUsers', label: '', type: FieldMetadataType.Number });
|
||||
|
||||
const [objectViews, setObjectViews] = useState<View[]>([]);
|
||||
|
||||
|
||||
@ -12,8 +12,11 @@ export enum SeedActivityTargetFieldMetadataIds {
|
||||
UpdatedAt = '20202020-4cf0-4478-8c68-62a855622a99',
|
||||
|
||||
Activity = '20202020-cb21-42c9-bba8-347f7cb02b84',
|
||||
ActivityForeignKey = '20202020-2b1a-4c6a-9c0a-1b9f5b7c9b1a',
|
||||
Person = '20202020-e56c-43e6-8fce-5619d8c2293a',
|
||||
PersonForeignKey = '20202020-4c5d-4b5e-8d6e-3b2a4d5f6a7b',
|
||||
Company = '20202020-9408-4cc0-9fe1-51467edb530b',
|
||||
CompanyForeignKey = '20202020-9408-4cc0-9fe1-51467edb530c',
|
||||
}
|
||||
|
||||
export const seedActivityTargetFieldMetadata = async (
|
||||
@ -36,6 +39,7 @@ export const seedActivityTargetFieldMetadata = async (
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
'isSystem',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
@ -55,7 +59,7 @@ export const seedActivityTargetFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: undefined,
|
||||
isNullable: true,
|
||||
// isSystem: true,
|
||||
isSystem: true,
|
||||
},
|
||||
{
|
||||
id: SeedActivityTargetFieldMetadataIds.CreatedAt,
|
||||
@ -72,6 +76,7 @@ export const seedActivityTargetFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedActivityTargetFieldMetadataIds.UpdatedAt,
|
||||
@ -88,6 +93,7 @@ export const seedActivityTargetFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
// Relationships
|
||||
{
|
||||
@ -96,31 +102,29 @@ export const seedActivityTargetFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'activity',
|
||||
label: 'Activity',
|
||||
targetColumnMap: {
|
||||
value: 'activityId',
|
||||
},
|
||||
targetColumnMap: {},
|
||||
description: 'ActivityTarget activity',
|
||||
icon: 'IconNotes',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedActivityTargetFieldMetadataIds.Activity,
|
||||
id: SeedActivityTargetFieldMetadataIds.ActivityForeignKey,
|
||||
objectMetadataId: SeedObjectMetadataIds.ActivityTarget,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
name: 'activity',
|
||||
label: 'Activity',
|
||||
targetColumnMap: {
|
||||
value: 'activityId',
|
||||
},
|
||||
description: 'ActivityTarget activity',
|
||||
icon: 'IconNotes',
|
||||
type: FieldMetadataType.UUID,
|
||||
name: 'activityId',
|
||||
label: 'Activity id (foreign key)',
|
||||
targetColumnMap: {},
|
||||
description: 'ActivityTarget activity id foreign key',
|
||||
icon: undefined,
|
||||
isNullable: false,
|
||||
isSystem: true,
|
||||
},
|
||||
{
|
||||
id: SeedActivityTargetFieldMetadataIds.Person,
|
||||
@ -128,15 +132,29 @@ export const seedActivityTargetFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'person',
|
||||
label: 'Person',
|
||||
targetColumnMap: {
|
||||
value: 'personId',
|
||||
},
|
||||
targetColumnMap: {},
|
||||
description: 'ActivityTarget person',
|
||||
icon: 'IconUser',
|
||||
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,
|
||||
@ -144,15 +162,29 @@ export const seedActivityTargetFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'company',
|
||||
label: 'Company',
|
||||
targetColumnMap: {
|
||||
value: 'companyId',
|
||||
},
|
||||
targetColumnMap: {},
|
||||
description: 'ActivityTarget company',
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
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();
|
||||
|
||||
@ -22,7 +22,9 @@ export enum SeedActivityFieldMetadataIds {
|
||||
Comments = '20202020-c85c-47f2-bbe4-6b36c26f9247',
|
||||
Attachments = '20202020-9755-43a8-b621-f94df0f6b839',
|
||||
Author = '20202020-3acb-46bb-b993-0dc49fa2a48c',
|
||||
AuthorForeignKey = '20202020-3acb-46bb-b993-0dc49fa2a48d',
|
||||
Assignee = '20202020-4694-4ec6-9084-8d932ebb3065',
|
||||
AssigneeForeignKey = '20202020-4694-4ec6-9084-8d932ebb3066',
|
||||
}
|
||||
|
||||
export const seedActivityFieldMetadata = async (
|
||||
@ -45,6 +47,7 @@ export const seedActivityFieldMetadata = async (
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
'isSystem',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
@ -64,7 +67,7 @@ export const seedActivityFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: undefined,
|
||||
isNullable: true,
|
||||
// isSystem: true,
|
||||
isSystem: true,
|
||||
},
|
||||
{
|
||||
id: SeedActivityFieldMetadataIds.CreatedAt,
|
||||
@ -81,6 +84,7 @@ export const seedActivityFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedActivityFieldMetadataIds.UpdatedAt,
|
||||
@ -97,6 +101,7 @@ export const seedActivityFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
// Primary identifier
|
||||
{
|
||||
@ -105,7 +110,7 @@ export const seedActivityFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'title',
|
||||
label: 'Title',
|
||||
targetColumnMap: {
|
||||
@ -114,6 +119,7 @@ export const seedActivityFieldMetadata = async (
|
||||
description: 'Activity title',
|
||||
icon: 'IconNotes',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
|
||||
// Scalar fields
|
||||
@ -123,7 +129,7 @@ export const seedActivityFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'body',
|
||||
label: 'Body',
|
||||
targetColumnMap: {
|
||||
@ -132,6 +138,7 @@ export const seedActivityFieldMetadata = async (
|
||||
description: 'Activity body',
|
||||
icon: 'IconList',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedActivityFieldMetadataIds.Type,
|
||||
@ -139,7 +146,7 @@ export const seedActivityFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'type',
|
||||
label: 'Type',
|
||||
targetColumnMap: {
|
||||
@ -148,6 +155,7 @@ export const seedActivityFieldMetadata = async (
|
||||
description: 'Activity type',
|
||||
icon: 'IconCheckbox',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedActivityFieldMetadataIds.ReminderAt,
|
||||
@ -155,7 +163,7 @@ export const seedActivityFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'DATE',
|
||||
type: FieldMetadataType.DATE,
|
||||
name: 'reminderAt',
|
||||
label: 'Reminder Date',
|
||||
targetColumnMap: {
|
||||
@ -164,6 +172,7 @@ export const seedActivityFieldMetadata = async (
|
||||
description: 'Activity reminder date',
|
||||
icon: 'IconCalendarEvent',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedActivityFieldMetadataIds.DueAt,
|
||||
@ -171,7 +180,7 @@ export const seedActivityFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'DATE',
|
||||
type: FieldMetadataType.DATE,
|
||||
name: 'dueAt',
|
||||
label: 'Due Date',
|
||||
targetColumnMap: {
|
||||
@ -180,6 +189,7 @@ export const seedActivityFieldMetadata = async (
|
||||
description: 'Activity due date',
|
||||
icon: 'IconCalendarEvent',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedActivityFieldMetadataIds.CompletedAt,
|
||||
@ -187,7 +197,7 @@ export const seedActivityFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'DATE',
|
||||
type: FieldMetadataType.DATE,
|
||||
name: 'completedAt',
|
||||
label: 'Completion Date',
|
||||
targetColumnMap: {
|
||||
@ -196,6 +206,7 @@ export const seedActivityFieldMetadata = async (
|
||||
description: 'Activity completion date',
|
||||
icon: 'IconCheck',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
|
||||
// Relationships
|
||||
@ -205,13 +216,14 @@ export const seedActivityFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'activityTargets',
|
||||
label: 'Targets',
|
||||
targetColumnMap: {},
|
||||
description: 'Activity targets',
|
||||
icon: 'IconCheckbox',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedActivityFieldMetadataIds.Attachments,
|
||||
@ -219,13 +231,14 @@ export const seedActivityFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'attachments',
|
||||
label: 'Attachments',
|
||||
targetColumnMap: {},
|
||||
description: 'Activity attachments',
|
||||
icon: 'IconFileImport',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedActivityFieldMetadataIds.Comments,
|
||||
@ -233,13 +246,14 @@ export const seedActivityFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'Comments',
|
||||
label: 'Comments',
|
||||
targetColumnMap: {},
|
||||
description: 'Activity comments',
|
||||
icon: 'IconComment',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedActivityFieldMetadataIds.Author,
|
||||
@ -247,7 +261,7 @@ export const seedActivityFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'author',
|
||||
label: 'Author',
|
||||
targetColumnMap: {
|
||||
@ -257,6 +271,22 @@ export const seedActivityFieldMetadata = async (
|
||||
'Activity author. This is the person who created the activity',
|
||||
icon: 'IconUserCircle',
|
||||
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,
|
||||
@ -264,16 +294,30 @@ export const seedActivityFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'assignee',
|
||||
label: 'Assignee',
|
||||
targetColumnMap: {
|
||||
value: 'assigneeId',
|
||||
},
|
||||
targetColumnMap: {},
|
||||
description:
|
||||
'Acitivity assignee. This is the workspace member assigned to the activity ',
|
||||
icon: 'IconUserCircle',
|
||||
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();
|
||||
|
||||
@ -36,6 +36,7 @@ export const seedApiKeyFieldMetadata = async (
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
'isSystem',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
@ -55,7 +56,7 @@ export const seedApiKeyFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: undefined,
|
||||
isNullable: false,
|
||||
// isSystem: true,
|
||||
isSystem: true,
|
||||
},
|
||||
{
|
||||
id: SeedApiKeyFieldMetadataIds.CreatedAt,
|
||||
@ -72,6 +73,7 @@ export const seedApiKeyFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedApiKeyFieldMetadataIds.UpdatedAt,
|
||||
@ -88,6 +90,7 @@ export const seedApiKeyFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
// Scalar fields
|
||||
{
|
||||
@ -96,7 +99,7 @@ export const seedApiKeyFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'name',
|
||||
label: 'Name',
|
||||
targetColumnMap: {
|
||||
@ -105,6 +108,7 @@ export const seedApiKeyFieldMetadata = async (
|
||||
description: 'ApiKey name',
|
||||
icon: 'IconLink',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedApiKeyFieldMetadataIds.ExpiresAt,
|
||||
@ -112,7 +116,7 @@ export const seedApiKeyFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'DATE',
|
||||
type: FieldMetadataType.DATE,
|
||||
name: 'expiresAt',
|
||||
label: 'Expiration date',
|
||||
targetColumnMap: {
|
||||
@ -121,6 +125,7 @@ export const seedApiKeyFieldMetadata = async (
|
||||
description: 'ApiKey expiration date',
|
||||
icon: 'IconCalendar',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedApiKeyFieldMetadataIds.RevokedAt,
|
||||
@ -128,7 +133,7 @@ export const seedApiKeyFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'DATE',
|
||||
type: FieldMetadataType.DATE,
|
||||
name: 'revokedAt',
|
||||
label: 'Revocation date',
|
||||
targetColumnMap: {
|
||||
@ -137,6 +142,7 @@ export const seedApiKeyFieldMetadata = async (
|
||||
description: 'ApiKey revocation date',
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
|
||||
@ -16,9 +16,13 @@ export enum SeedAttachmentFieldMetadataIds {
|
||||
Type = '20202020-8dfa-492f-92d1-56d5fb18cbb7',
|
||||
|
||||
Author = '20202020-7831-43c2-827f-bc78289b7398',
|
||||
AuthorForeignKey = '20202020-7831-43c2-827f-bc78289b7399',
|
||||
Activity = '20202020-f5a9-46ec-b39a-eda906f00804',
|
||||
ActivityForeignKey = '20202020-f5a9-46ec-b39a-eda906f00805',
|
||||
Person = '20202020-f67c-4cc5-893c-c6b615527473',
|
||||
PersonForeignKey = '20202020-f67c-4cc5-893c-c6b615527474',
|
||||
Company = '20202020-5463-4d03-9124-1775b9b7f955',
|
||||
CompanyForeignKey = '20202020-5463-4d03-9124-1775b9b7f956',
|
||||
}
|
||||
|
||||
export const seedAttachmentFieldMetadata = async (
|
||||
@ -41,6 +45,7 @@ export const seedAttachmentFieldMetadata = async (
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
'isSystem',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
@ -60,7 +65,7 @@ export const seedAttachmentFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: undefined,
|
||||
isNullable: true,
|
||||
// isSystem: true,
|
||||
isSystem: true,
|
||||
},
|
||||
{
|
||||
id: SeedAttachmentFieldMetadataIds.CreatedAt,
|
||||
@ -77,6 +82,7 @@ export const seedAttachmentFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedAttachmentFieldMetadataIds.UpdatedAt,
|
||||
@ -93,6 +99,7 @@ export const seedAttachmentFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
// Primary Identifier
|
||||
{
|
||||
@ -101,7 +108,7 @@ export const seedAttachmentFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'name',
|
||||
label: 'Name',
|
||||
targetColumnMap: {
|
||||
@ -110,6 +117,7 @@ export const seedAttachmentFieldMetadata = async (
|
||||
description: 'Attachment name',
|
||||
icon: 'IconFileUpload',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
// Scalar fields
|
||||
{
|
||||
@ -118,7 +126,7 @@ export const seedAttachmentFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'fullPath',
|
||||
label: 'Full path',
|
||||
targetColumnMap: {
|
||||
@ -127,6 +135,7 @@ export const seedAttachmentFieldMetadata = async (
|
||||
description: 'Attachment full path',
|
||||
icon: 'IconLink',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedAttachmentFieldMetadataIds.Type,
|
||||
@ -134,7 +143,7 @@ export const seedAttachmentFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'type',
|
||||
label: 'Type',
|
||||
targetColumnMap: {
|
||||
@ -143,6 +152,7 @@ export const seedAttachmentFieldMetadata = async (
|
||||
description: 'Attachment type',
|
||||
icon: 'IconList',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
|
||||
// Relationships
|
||||
@ -152,15 +162,29 @@ export const seedAttachmentFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'author',
|
||||
label: 'Author',
|
||||
targetColumnMap: {
|
||||
value: 'authorId',
|
||||
},
|
||||
targetColumnMap: {},
|
||||
description: 'Attachment author',
|
||||
icon: 'IconCircleUser',
|
||||
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,
|
||||
@ -168,15 +192,29 @@ export const seedAttachmentFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'activity',
|
||||
label: 'Activity',
|
||||
targetColumnMap: {
|
||||
value: 'activityId',
|
||||
},
|
||||
targetColumnMap: {},
|
||||
description: 'Attachment activity',
|
||||
icon: 'IconNotes',
|
||||
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,
|
||||
@ -184,15 +222,29 @@ export const seedAttachmentFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'person',
|
||||
label: 'Person',
|
||||
targetColumnMap: {
|
||||
value: 'personId',
|
||||
},
|
||||
targetColumnMap: {},
|
||||
description: 'Attachment person',
|
||||
icon: 'IconUser',
|
||||
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,
|
||||
@ -200,15 +252,29 @@ export const seedAttachmentFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'company',
|
||||
label: 'Company',
|
||||
targetColumnMap: {
|
||||
value: 'companyId',
|
||||
},
|
||||
targetColumnMap: {},
|
||||
description: 'Attachment company',
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
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();
|
||||
|
||||
@ -12,9 +12,10 @@ export enum SeedCommentFieldMetadataIds {
|
||||
UpdatedAt = '20202020-63dd-4426-abad-9973fece49ed',
|
||||
|
||||
Body = '20202020-354b-4f10-9425-fa3eb8fddc51',
|
||||
|
||||
Author = '20202020-2c70-40c2-bba6-893780b25d41',
|
||||
AuthorForeignKey = '20202021-2c70-40c2-bba6-893780b25d42',
|
||||
Activity = '20202020-a9ac-4294-9462-db0f690da906',
|
||||
ActivityForeignKey = '20202021-a9ac-4294-9462-db0f690da907',
|
||||
}
|
||||
|
||||
export const seedCommentFieldMetadata = async (
|
||||
@ -37,6 +38,7 @@ export const seedCommentFieldMetadata = async (
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
'isSystem',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
@ -56,7 +58,7 @@ export const seedCommentFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: undefined,
|
||||
isNullable: true,
|
||||
// isSystem: true,
|
||||
isSystem: true,
|
||||
},
|
||||
{
|
||||
id: SeedCommentFieldMetadataIds.CreatedAt,
|
||||
@ -73,6 +75,7 @@ export const seedCommentFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedCommentFieldMetadataIds.UpdatedAt,
|
||||
@ -89,6 +92,7 @@ export const seedCommentFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
// Scalar fields
|
||||
{
|
||||
@ -97,7 +101,7 @@ export const seedCommentFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'body',
|
||||
label: 'Body',
|
||||
targetColumnMap: {
|
||||
@ -106,6 +110,7 @@ export const seedCommentFieldMetadata = async (
|
||||
description: 'Comment body',
|
||||
icon: 'IconLink',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
// Relationships
|
||||
{
|
||||
@ -114,15 +119,29 @@ export const seedCommentFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'author',
|
||||
label: 'Author',
|
||||
targetColumnMap: {
|
||||
value: 'authorId',
|
||||
},
|
||||
targetColumnMap: {},
|
||||
description: 'Comment author',
|
||||
icon: 'IconCircleUser',
|
||||
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,
|
||||
@ -130,15 +149,29 @@ export const seedCommentFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'activity',
|
||||
label: 'Activity',
|
||||
targetColumnMap: {
|
||||
value: 'activityId',
|
||||
},
|
||||
targetColumnMap: {},
|
||||
description: 'Comment activity',
|
||||
icon: 'IconNotes',
|
||||
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();
|
||||
|
||||
@ -23,6 +23,7 @@ export enum SeedCompanyFieldMetadataIds {
|
||||
|
||||
People = '20202020-68b4-4c8e-af19-738eba2a42a5',
|
||||
AccountOwner = '20202020-0739-495d-8e70-c0807f6b2268',
|
||||
AccountOwnerForeignKey = '20202020-0b9e-4b9e-8b0a-5b0b5b0b5b0b',
|
||||
ActivityTargets = '20202020-4a2e-4b41-8562-279963e8947e',
|
||||
Opportunities = '20202020-e3fc-46ff-b552-3e757843f06e',
|
||||
Favorites = '20202020-e7c8-4771-8cc4-ce0e8c36a3c0',
|
||||
@ -49,6 +50,7 @@ export const seedCompanyFieldMetadata = async (
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
'isSystem',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
@ -68,7 +70,7 @@ export const seedCompanyFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: undefined,
|
||||
isNullable: true,
|
||||
// isSystem: true,
|
||||
isSystem: true,
|
||||
},
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.CreatedAt,
|
||||
@ -85,6 +87,7 @@ export const seedCompanyFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.UpdatedAt,
|
||||
@ -101,6 +104,7 @@ export const seedCompanyFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
// Main Identifier
|
||||
{
|
||||
@ -109,7 +113,7 @@ export const seedCompanyFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'name',
|
||||
label: 'Name',
|
||||
targetColumnMap: {
|
||||
@ -118,6 +122,7 @@ export const seedCompanyFieldMetadata = async (
|
||||
description: 'The company name',
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
|
||||
// Scalar Fields
|
||||
@ -127,7 +132,7 @@ export const seedCompanyFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'domainName',
|
||||
label: 'Domain Name',
|
||||
targetColumnMap: {
|
||||
@ -137,6 +142,7 @@ export const seedCompanyFieldMetadata = async (
|
||||
'The company website URL. We use this url to fetch the company icon',
|
||||
icon: 'IconLink',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.Address,
|
||||
@ -144,7 +150,7 @@ export const seedCompanyFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'address',
|
||||
label: 'Address',
|
||||
targetColumnMap: {
|
||||
@ -153,6 +159,7 @@ export const seedCompanyFieldMetadata = async (
|
||||
description: 'The company address',
|
||||
icon: 'IconMap',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.Employees,
|
||||
@ -160,7 +167,7 @@ export const seedCompanyFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'NUMBER',
|
||||
type: FieldMetadataType.NUMBER,
|
||||
name: 'employees',
|
||||
label: 'Employees',
|
||||
targetColumnMap: {
|
||||
@ -169,6 +176,7 @@ export const seedCompanyFieldMetadata = async (
|
||||
description: 'Number of employees in the company',
|
||||
icon: 'IconUsers',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.LinkedinUrl,
|
||||
@ -176,7 +184,7 @@ export const seedCompanyFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'linkedinUrl',
|
||||
label: 'Linkedin',
|
||||
targetColumnMap: {
|
||||
@ -185,6 +193,7 @@ export const seedCompanyFieldMetadata = async (
|
||||
description: 'The company Linkedin account',
|
||||
icon: 'IconBrandLinkedin',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.XUrl,
|
||||
@ -192,7 +201,7 @@ export const seedCompanyFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'xUrl',
|
||||
label: 'X',
|
||||
targetColumnMap: {
|
||||
@ -201,6 +210,7 @@ export const seedCompanyFieldMetadata = async (
|
||||
description: 'The company Twitter/X account',
|
||||
icon: 'IconBrandX',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.AnnualRecurringRevenue,
|
||||
@ -208,7 +218,7 @@ export const seedCompanyFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'NUMBER',
|
||||
type: FieldMetadataType.NUMBER,
|
||||
name: 'annualRecurringRevenue',
|
||||
label: 'ARR',
|
||||
targetColumnMap: {
|
||||
@ -218,6 +228,7 @@ export const seedCompanyFieldMetadata = async (
|
||||
'Annual Recurring Revenue: The actual or estimated annual revenue of the company',
|
||||
icon: 'IconMoneybag',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.IdealCustomerProfile,
|
||||
@ -225,7 +236,7 @@ export const seedCompanyFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'BOOLEAN',
|
||||
type: FieldMetadataType.BOOLEAN,
|
||||
name: 'idealCustomerProfile',
|
||||
label: 'ICP',
|
||||
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',
|
||||
icon: 'IconTarget',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
|
||||
// Relationships
|
||||
@ -244,13 +256,14 @@ export const seedCompanyFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'people',
|
||||
label: 'People',
|
||||
targetColumnMap: {},
|
||||
description: 'People linked to the company.',
|
||||
icon: 'IconUsers',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.AccountOwner,
|
||||
@ -258,16 +271,30 @@ export const seedCompanyFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'accountOwner',
|
||||
label: 'Account Owner',
|
||||
targetColumnMap: {
|
||||
value: 'accountOwnerId',
|
||||
},
|
||||
targetColumnMap: {},
|
||||
description:
|
||||
'Your team member responsible for managing the company account',
|
||||
icon: 'IconUserCircle',
|
||||
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,
|
||||
@ -275,13 +302,14 @@ export const seedCompanyFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'activityTargets',
|
||||
label: 'Activities',
|
||||
targetColumnMap: {},
|
||||
description: 'Activities tied to the company',
|
||||
icon: 'IconCheckbox',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.Opportunities,
|
||||
@ -289,13 +317,14 @@ export const seedCompanyFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'opportunities',
|
||||
label: 'Opportunities',
|
||||
targetColumnMap: {},
|
||||
description: 'Opportunities linked to the company.',
|
||||
icon: 'IconTargetArrow',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.Favorites,
|
||||
@ -303,13 +332,14 @@ export const seedCompanyFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'favorites',
|
||||
label: 'Favorites',
|
||||
targetColumnMap: {},
|
||||
description: 'Favorites linked to the company',
|
||||
icon: 'IconHeart',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedCompanyFieldMetadataIds.Attachments,
|
||||
@ -317,13 +347,14 @@ export const seedCompanyFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'attachments',
|
||||
label: 'Attachments',
|
||||
targetColumnMap: {},
|
||||
description: 'Attachments linked to the company.',
|
||||
icon: 'IconFileImport',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
|
||||
@ -14,9 +14,12 @@ export enum SeedFavoriteFieldMetadataIds {
|
||||
Position = '20202020-dd6d-4f67-94aa-22cc83eb0a2e',
|
||||
|
||||
WorkspaceMember = '20202020-1138-4e93-bbff-917a68161abf',
|
||||
WorkspaceMemberForeignKey = '20202020-0f4c-4b9a-9b9a-917a68161a4f',
|
||||
Person = '20202020-0876-4735-8974-ff4d51aafa07',
|
||||
PersonForeignKey = '20202020-0876-4735-9473-ff4d51aa4e7b',
|
||||
Company = '20202020-09e1-4384-ae3e-39e7956396fe',
|
||||
CompanyV2 = '20202020-09e1-4384-ae3e-39e7956396ff',
|
||||
CompanyForeignKey = '20202020-09e1-4384-ae3e-45e79563d528',
|
||||
}
|
||||
|
||||
export const seedFavoriteFieldMetadata = async (
|
||||
@ -39,6 +42,7 @@ export const seedFavoriteFieldMetadata = async (
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
'isSystem',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
@ -58,7 +62,7 @@ export const seedFavoriteFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: undefined,
|
||||
isNullable: true,
|
||||
// isSystem: true,
|
||||
isSystem: true,
|
||||
},
|
||||
{
|
||||
id: SeedFavoriteFieldMetadataIds.CreatedAt,
|
||||
@ -75,6 +79,7 @@ export const seedFavoriteFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedFavoriteFieldMetadataIds.UpdatedAt,
|
||||
@ -91,6 +96,7 @@ export const seedFavoriteFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
// Scalar fields
|
||||
{
|
||||
@ -99,7 +105,7 @@ export const seedFavoriteFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'NUMBER',
|
||||
type: FieldMetadataType.NUMBER,
|
||||
name: 'position',
|
||||
label: 'Position',
|
||||
targetColumnMap: {
|
||||
@ -108,6 +114,7 @@ export const seedFavoriteFieldMetadata = async (
|
||||
description: 'Favorite position',
|
||||
icon: 'IconList',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
|
||||
// Relationships
|
||||
@ -117,15 +124,29 @@ export const seedFavoriteFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'workspaceMember',
|
||||
label: 'Workspace Member',
|
||||
targetColumnMap: {
|
||||
value: 'workspaceMemberId',
|
||||
},
|
||||
targetColumnMap: {},
|
||||
description: 'Favorite workspace member',
|
||||
icon: 'IconCircleUser',
|
||||
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,
|
||||
@ -133,7 +154,7 @@ export const seedFavoriteFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'person',
|
||||
label: 'Person',
|
||||
targetColumnMap: {
|
||||
@ -142,6 +163,22 @@ export const seedFavoriteFieldMetadata = async (
|
||||
description: 'Favorite person',
|
||||
icon: 'IconUser',
|
||||
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,
|
||||
@ -149,15 +186,29 @@ export const seedFavoriteFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'company',
|
||||
label: 'Company',
|
||||
targetColumnMap: {
|
||||
value: 'companyId',
|
||||
},
|
||||
targetColumnMap: {},
|
||||
description: 'Favorite company',
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
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();
|
||||
|
||||
@ -16,9 +16,13 @@ export enum SeedOpportunityFieldMetadataIds {
|
||||
Probability = '20202020-3b9c-4e58-a3d2-c617d3b596b1',
|
||||
|
||||
PipelineStep = '20202020-0a2e-4676-8011-3fdb2c30c258',
|
||||
PipelineStepForeignKey = '20202020-0a2e-4676-8011-3fdb2c30d7f8',
|
||||
PointOfContact = '20202020-618e-42da-b3c3-bcd7af76e355',
|
||||
PointOfContactForeignKey = '20202020-618e-42da-b3c3-bcd7af76e4c2',
|
||||
Company = '20202020-31d5-4af5-b016-c61c1c265706',
|
||||
CompanyForeignKey = '20202020-31d5-4af5-b016-c61c1c2657b9',
|
||||
Person = '20202020-0655-41df-b938-15d71e589307',
|
||||
PersonForeignKey = '20202020-0655-41df-b938-15d71e589d3e',
|
||||
}
|
||||
|
||||
export const seedOpportunityFieldMetadata = async (
|
||||
@ -41,6 +45,7 @@ export const seedOpportunityFieldMetadata = async (
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
'isSystem',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
@ -60,7 +65,7 @@ export const seedOpportunityFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: undefined,
|
||||
isNullable: true,
|
||||
// isSystem: true,
|
||||
isSystem: true,
|
||||
},
|
||||
{
|
||||
id: SeedOpportunityFieldMetadataIds.CreatedAt,
|
||||
@ -77,6 +82,7 @@ export const seedOpportunityFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedOpportunityFieldMetadataIds.UpdatedAt,
|
||||
@ -93,6 +99,7 @@ export const seedOpportunityFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
// Scalar fields
|
||||
{
|
||||
@ -101,7 +108,7 @@ export const seedOpportunityFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'NUMBER',
|
||||
type: FieldMetadataType.NUMBER,
|
||||
name: 'amount',
|
||||
label: 'Amount',
|
||||
targetColumnMap: {
|
||||
@ -110,6 +117,7 @@ export const seedOpportunityFieldMetadata = async (
|
||||
description: 'Opportunity amount',
|
||||
icon: 'IconCurrencyDollar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedOpportunityFieldMetadataIds.CloseDate,
|
||||
@ -117,7 +125,7 @@ export const seedOpportunityFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'DATE',
|
||||
type: FieldMetadataType.DATE,
|
||||
name: 'closeDate',
|
||||
label: 'Close date',
|
||||
targetColumnMap: {
|
||||
@ -126,6 +134,7 @@ export const seedOpportunityFieldMetadata = async (
|
||||
description: 'Opportunity close date',
|
||||
icon: 'IconCalendarEvent',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedOpportunityFieldMetadataIds.Probability,
|
||||
@ -133,7 +142,7 @@ export const seedOpportunityFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'probability',
|
||||
label: 'Probability',
|
||||
targetColumnMap: {
|
||||
@ -142,22 +151,38 @@ export const seedOpportunityFieldMetadata = async (
|
||||
description: 'Opportunity amount',
|
||||
icon: 'IconProgressCheck',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
// Relationships
|
||||
{
|
||||
id: SeedOpportunityFieldMetadataIds.PipelineStep,
|
||||
objectMetadataId: SeedObjectMetadataIds.Opportunity,
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'pipelineStep',
|
||||
label: 'Pipeline Step',
|
||||
targetColumnMap: {
|
||||
value: 'pipelineStepId',
|
||||
},
|
||||
targetColumnMap: {},
|
||||
description: 'Opportunity pipeline step',
|
||||
icon: 'IconKanban',
|
||||
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,
|
||||
@ -165,15 +190,29 @@ export const seedOpportunityFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'pointOfContact',
|
||||
label: 'Point of Contact',
|
||||
targetColumnMap: {
|
||||
value: 'pointOfContactId',
|
||||
},
|
||||
targetColumnMap: {},
|
||||
description: 'Opportunity point of contact',
|
||||
icon: 'IconUser',
|
||||
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,
|
||||
@ -181,15 +220,29 @@ export const seedOpportunityFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'person',
|
||||
label: 'Person',
|
||||
targetColumnMap: {
|
||||
value: 'personId',
|
||||
},
|
||||
targetColumnMap: {},
|
||||
description: 'Opportunity person',
|
||||
icon: 'IconUser',
|
||||
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,
|
||||
@ -197,15 +250,29 @@ export const seedOpportunityFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'company',
|
||||
label: 'Company',
|
||||
targetColumnMap: {
|
||||
value: 'companyId',
|
||||
},
|
||||
targetColumnMap: {},
|
||||
description: 'Opportunity company',
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
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();
|
||||
|
||||
@ -23,6 +23,7 @@ export enum SeedPersonFieldMetadataIds {
|
||||
AvatarUrl = '20202020-bb05-45cb-aa2a-71b58d49dd23',
|
||||
|
||||
Company = '20202020-64e1-4080-b6ad-db03c3809885',
|
||||
CompanyForeignKey = '20202020-64e1-4080-b6ad-db03c3809f8b',
|
||||
ContactForOpportunities = '20202020-2c2e-418e-ba2d-d28434ff02a6',
|
||||
Opportunities = '20202020-6bc4-4905-a9d3-4f8d616a19e1',
|
||||
ActivityTargets = '20202020-f285-4115-a46c-116522986b29',
|
||||
@ -50,6 +51,7 @@ export const seedPersonFieldMetadata = async (
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
'isSystem',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
@ -69,7 +71,7 @@ export const seedPersonFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: undefined,
|
||||
isNullable: true,
|
||||
// isSystem: true,
|
||||
isSystem: true,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.CreatedAt,
|
||||
@ -86,6 +88,7 @@ export const seedPersonFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.UpdatedAt,
|
||||
@ -102,6 +105,7 @@ export const seedPersonFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
// Main Identifier
|
||||
{
|
||||
@ -110,7 +114,7 @@ export const seedPersonFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'firstName',
|
||||
label: 'First name',
|
||||
targetColumnMap: {
|
||||
@ -119,6 +123,7 @@ export const seedPersonFieldMetadata = async (
|
||||
description: 'Contact’s first name',
|
||||
icon: 'IconUser',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.LastName,
|
||||
@ -126,7 +131,7 @@ export const seedPersonFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'lastName',
|
||||
label: 'Last name',
|
||||
targetColumnMap: {
|
||||
@ -135,6 +140,7 @@ export const seedPersonFieldMetadata = async (
|
||||
description: 'Contact’s last name',
|
||||
icon: 'IconUser',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
|
||||
// Scalar Fields
|
||||
@ -144,7 +150,7 @@ export const seedPersonFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'EMAIL',
|
||||
type: FieldMetadataType.EMAIL,
|
||||
name: 'email',
|
||||
label: 'Email',
|
||||
targetColumnMap: {
|
||||
@ -153,6 +159,7 @@ export const seedPersonFieldMetadata = async (
|
||||
description: 'Contact’s Email',
|
||||
icon: 'IconMail',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.LinkedinUrl,
|
||||
@ -160,7 +167,7 @@ export const seedPersonFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'linkedinUrl',
|
||||
label: 'Linkedin',
|
||||
targetColumnMap: {
|
||||
@ -169,6 +176,7 @@ export const seedPersonFieldMetadata = async (
|
||||
description: 'Contact’s Linkedin account',
|
||||
icon: 'IconBrandLinkedin',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.XUrl,
|
||||
@ -176,7 +184,7 @@ export const seedPersonFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'xUrl',
|
||||
label: 'X',
|
||||
targetColumnMap: {
|
||||
@ -185,6 +193,7 @@ export const seedPersonFieldMetadata = async (
|
||||
description: 'Contact’s X/Twitter account',
|
||||
icon: 'IconUser',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.JobTitle,
|
||||
@ -192,7 +201,7 @@ export const seedPersonFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'jobTitle',
|
||||
label: 'Job Title',
|
||||
targetColumnMap: {
|
||||
@ -201,6 +210,7 @@ export const seedPersonFieldMetadata = async (
|
||||
description: 'Contact’s job title',
|
||||
icon: 'IconBriefcase',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.Phone,
|
||||
@ -208,7 +218,7 @@ export const seedPersonFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'phone',
|
||||
label: 'Phone',
|
||||
targetColumnMap: {
|
||||
@ -217,6 +227,7 @@ export const seedPersonFieldMetadata = async (
|
||||
description: 'Contact’s phone number',
|
||||
icon: 'IconPhone',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.City,
|
||||
@ -224,7 +235,7 @@ export const seedPersonFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'city',
|
||||
label: 'City',
|
||||
targetColumnMap: {
|
||||
@ -233,6 +244,7 @@ export const seedPersonFieldMetadata = async (
|
||||
description: 'Contact’s city',
|
||||
icon: 'IconMap',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.AvatarUrl,
|
||||
@ -240,7 +252,7 @@ export const seedPersonFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'avatarUrl',
|
||||
label: 'Avatar',
|
||||
targetColumnMap: {
|
||||
@ -249,6 +261,7 @@ export const seedPersonFieldMetadata = async (
|
||||
description: 'Contact’s avatar',
|
||||
icon: 'IconFileUpload',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
|
||||
// Relationships
|
||||
@ -258,15 +271,29 @@ export const seedPersonFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'company',
|
||||
label: 'Company',
|
||||
targetColumnMap: {
|
||||
value: 'companyId',
|
||||
},
|
||||
targetColumnMap: {},
|
||||
description: 'Contact’s company',
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
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,
|
||||
@ -274,13 +301,14 @@ export const seedPersonFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'pointOfContactForOpporunities',
|
||||
label: 'POC for Opportunities',
|
||||
targetColumnMap: {},
|
||||
description: 'Point of Contact for Opportuniites',
|
||||
icon: 'IconArrowTarget',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.ActivityTargets,
|
||||
@ -288,13 +316,14 @@ export const seedPersonFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'activityTargets',
|
||||
label: 'Activities',
|
||||
targetColumnMap: {},
|
||||
description: 'Activities tied to the contact',
|
||||
icon: 'IconCheckbox',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.Opportunities,
|
||||
@ -302,13 +331,14 @@ export const seedPersonFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'opportunities',
|
||||
label: 'Opportunities',
|
||||
targetColumnMap: {},
|
||||
description: 'Opportunities linked to the contact.',
|
||||
icon: 'IconTargetArrow',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.Favorites,
|
||||
@ -316,13 +346,14 @@ export const seedPersonFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'favorites',
|
||||
label: 'Favorites',
|
||||
targetColumnMap: {},
|
||||
description: 'Favorites linked to the contact',
|
||||
icon: 'IconHeart',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedPersonFieldMetadataIds.Attachments,
|
||||
@ -330,13 +361,14 @@ export const seedPersonFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'attachments',
|
||||
label: 'Attachments',
|
||||
targetColumnMap: {},
|
||||
description: 'Attachments linked to the contact.',
|
||||
icon: 'IconFileImport',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
|
||||
@ -37,6 +37,7 @@ export const seedPipelineStepFieldMetadata = async (
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
'isSystem',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
@ -56,7 +57,7 @@ export const seedPipelineStepFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: undefined,
|
||||
isNullable: true,
|
||||
// isSystem: true,
|
||||
isSystem: true,
|
||||
},
|
||||
{
|
||||
id: SeedPipelineStepFieldMetadataIds.CreatedAt,
|
||||
@ -73,6 +74,7 @@ export const seedPipelineStepFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedPipelineStepFieldMetadataIds.UpdatedAt,
|
||||
@ -89,6 +91,7 @@ export const seedPipelineStepFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
// Main Identifier
|
||||
{
|
||||
@ -97,7 +100,7 @@ export const seedPipelineStepFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'name',
|
||||
label: 'Name',
|
||||
targetColumnMap: {
|
||||
@ -106,6 +109,7 @@ export const seedPipelineStepFieldMetadata = async (
|
||||
description: 'Pipeline Step name',
|
||||
icon: 'IconCurrencyDollar',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
|
||||
// Scalar Fields
|
||||
@ -115,7 +119,7 @@ export const seedPipelineStepFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'color',
|
||||
label: 'Color',
|
||||
targetColumnMap: {
|
||||
@ -124,6 +128,7 @@ export const seedPipelineStepFieldMetadata = async (
|
||||
description: 'Pipeline Step color',
|
||||
icon: 'IconColorSwatch',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedPipelineStepFieldMetadataIds.Position,
|
||||
@ -131,7 +136,7 @@ export const seedPipelineStepFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'NUMBER',
|
||||
type: FieldMetadataType.NUMBER,
|
||||
name: 'position',
|
||||
label: 'Position',
|
||||
targetColumnMap: {
|
||||
@ -140,6 +145,7 @@ export const seedPipelineStepFieldMetadata = async (
|
||||
description: 'Pipeline Step position',
|
||||
icon: 'IconHierarchy2',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
|
||||
// Relationships
|
||||
@ -149,13 +155,14 @@ export const seedPipelineStepFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'opportunities',
|
||||
label: 'Opportunities',
|
||||
targetColumnMap: {},
|
||||
description: 'Opportunities linked to the step.',
|
||||
icon: 'IconTargetArrow',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
|
||||
@ -38,6 +38,7 @@ export const seedViewFieldFieldMetadata = async (
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
'isSystem',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
@ -57,7 +58,7 @@ export const seedViewFieldFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: undefined,
|
||||
isNullable: true,
|
||||
// isSystem: true,
|
||||
isSystem: true,
|
||||
},
|
||||
{
|
||||
id: SeedViewFieldFieldMetadataIds.CreatedAt,
|
||||
@ -74,6 +75,7 @@ export const seedViewFieldFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedViewFieldFieldMetadataIds.UpdatedAt,
|
||||
@ -90,6 +92,7 @@ export const seedViewFieldFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
// Fields
|
||||
{
|
||||
@ -98,7 +101,7 @@ export const seedViewFieldFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'fieldMetadataId',
|
||||
label: 'Field Metadata Id',
|
||||
targetColumnMap: {
|
||||
@ -107,6 +110,7 @@ export const seedViewFieldFieldMetadata = async (
|
||||
description: 'View Field target field',
|
||||
icon: 'IconTag',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedViewFieldFieldMetadataIds.View,
|
||||
@ -114,13 +118,14 @@ export const seedViewFieldFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'view',
|
||||
label: 'View Id',
|
||||
targetColumnMap: { value: 'viewId' },
|
||||
description: 'View Field related view',
|
||||
icon: 'IconLayoutCollage',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedViewFieldFieldMetadataIds.IsVisible,
|
||||
@ -128,7 +133,7 @@ export const seedViewFieldFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'BOOLEAN',
|
||||
type: FieldMetadataType.BOOLEAN,
|
||||
name: 'isVisible',
|
||||
label: 'Visible',
|
||||
targetColumnMap: {
|
||||
@ -137,6 +142,7 @@ export const seedViewFieldFieldMetadata = async (
|
||||
description: 'View Field visibility',
|
||||
icon: 'IconEye',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedViewFieldFieldMetadataIds.Size,
|
||||
@ -144,7 +150,7 @@ export const seedViewFieldFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'NUMBER',
|
||||
type: FieldMetadataType.NUMBER,
|
||||
name: 'size',
|
||||
label: 'Size',
|
||||
targetColumnMap: {
|
||||
@ -153,6 +159,7 @@ export const seedViewFieldFieldMetadata = async (
|
||||
description: 'View Field size',
|
||||
icon: 'IconEye',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedViewFieldFieldMetadataIds.Position,
|
||||
@ -160,7 +167,7 @@ export const seedViewFieldFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'NUMBER',
|
||||
type: FieldMetadataType.NUMBER,
|
||||
name: 'position',
|
||||
label: 'Position',
|
||||
targetColumnMap: {
|
||||
@ -169,6 +176,7 @@ export const seedViewFieldFieldMetadata = async (
|
||||
description: 'View Field position',
|
||||
icon: 'IconList',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
|
||||
@ -38,6 +38,7 @@ export const seedViewFilterFieldMetadata = async (
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
'isSystem',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
@ -57,7 +58,7 @@ export const seedViewFilterFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: undefined,
|
||||
isNullable: true,
|
||||
// isSystem: true,
|
||||
isSystem: true,
|
||||
},
|
||||
{
|
||||
id: SeedViewFilterFieldMetadataIds.CreatedAt,
|
||||
@ -74,6 +75,7 @@ export const seedViewFilterFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedViewFilterFieldMetadataIds.UpdatedAt,
|
||||
@ -90,6 +92,7 @@ export const seedViewFilterFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
// Fields
|
||||
{
|
||||
@ -98,7 +101,7 @@ export const seedViewFilterFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'fieldMetadataId',
|
||||
label: 'Field Metadata Id',
|
||||
targetColumnMap: {
|
||||
@ -107,6 +110,7 @@ export const seedViewFilterFieldMetadata = async (
|
||||
description: 'View Filter target field',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedViewFilterFieldMetadataIds.View,
|
||||
@ -114,7 +118,7 @@ export const seedViewFilterFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'viewId',
|
||||
label: 'View Id',
|
||||
targetColumnMap: {
|
||||
@ -123,6 +127,7 @@ export const seedViewFilterFieldMetadata = async (
|
||||
description: 'View Filter related view',
|
||||
icon: 'IconLayoutCollage',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedViewFilterFieldMetadataIds.Operand,
|
||||
@ -130,7 +135,7 @@ export const seedViewFilterFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'operand',
|
||||
label: 'Operand',
|
||||
targetColumnMap: {
|
||||
@ -139,6 +144,7 @@ export const seedViewFilterFieldMetadata = async (
|
||||
description: 'View Filter operand',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedViewFilterFieldMetadataIds.Value,
|
||||
@ -146,7 +152,7 @@ export const seedViewFilterFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'value',
|
||||
label: 'Value',
|
||||
targetColumnMap: {
|
||||
@ -155,6 +161,7 @@ export const seedViewFilterFieldMetadata = async (
|
||||
description: 'View Filter value',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedViewFilterFieldMetadataIds.DisplayValue,
|
||||
@ -162,7 +169,7 @@ export const seedViewFilterFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'displayValue',
|
||||
label: 'Display Value',
|
||||
targetColumnMap: {
|
||||
@ -171,6 +178,7 @@ export const seedViewFilterFieldMetadata = async (
|
||||
description: 'View Filter Display Value',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
|
||||
@ -36,6 +36,7 @@ export const seedViewSortFieldMetadata = async (
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
'isSystem',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
@ -55,7 +56,7 @@ export const seedViewSortFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: undefined,
|
||||
isNullable: true,
|
||||
// isSystem: true,
|
||||
isSystem: true,
|
||||
},
|
||||
{
|
||||
id: SeedViewSortFieldMetadataIds.CreatedAt,
|
||||
@ -72,6 +73,7 @@ export const seedViewSortFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedViewSortFieldMetadataIds.UpdatedAt,
|
||||
@ -88,6 +90,7 @@ export const seedViewSortFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
// Fields
|
||||
{
|
||||
@ -96,7 +99,7 @@ export const seedViewSortFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'fieldMetadataId',
|
||||
label: 'Field Metadata Id',
|
||||
targetColumnMap: {
|
||||
@ -105,6 +108,7 @@ export const seedViewSortFieldMetadata = async (
|
||||
description: 'View Sort target field',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedViewSortFieldMetadataIds.View,
|
||||
@ -112,7 +116,7 @@ export const seedViewSortFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'viewId',
|
||||
label: 'View Id',
|
||||
targetColumnMap: {
|
||||
@ -121,6 +125,7 @@ export const seedViewSortFieldMetadata = async (
|
||||
description: 'View Sort related view',
|
||||
icon: 'IconLayoutCollage',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedViewSortFieldMetadataIds.Direction,
|
||||
@ -128,7 +133,7 @@ export const seedViewSortFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'direction',
|
||||
label: 'Direction',
|
||||
targetColumnMap: {
|
||||
@ -137,6 +142,7 @@ export const seedViewSortFieldMetadata = async (
|
||||
description: 'View Sort direction',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
|
||||
@ -39,6 +39,7 @@ export const seedViewFieldMetadata = async (
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
'isSystem',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
@ -58,7 +59,7 @@ export const seedViewFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: undefined,
|
||||
isNullable: true,
|
||||
// isSystem: true,
|
||||
isSystem: true,
|
||||
},
|
||||
{
|
||||
id: SeedViewFieldMetadataIds.CreatedAt,
|
||||
@ -75,6 +76,7 @@ export const seedViewFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedViewFieldMetadataIds.UpdatedAt,
|
||||
@ -91,6 +93,7 @@ export const seedViewFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
// Fields
|
||||
{
|
||||
@ -99,7 +102,7 @@ export const seedViewFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'name',
|
||||
label: 'Name',
|
||||
targetColumnMap: {
|
||||
@ -108,6 +111,7 @@ export const seedViewFieldMetadata = async (
|
||||
description: 'View name',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedViewFieldMetadataIds.ObjectMetadataId,
|
||||
@ -115,7 +119,7 @@ export const seedViewFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'objectMetadataId',
|
||||
label: 'Object Metadata Id',
|
||||
targetColumnMap: {
|
||||
@ -124,6 +128,7 @@ export const seedViewFieldMetadata = async (
|
||||
description: 'View target object',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedViewFieldMetadataIds.Type,
|
||||
@ -131,7 +136,7 @@ export const seedViewFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'type',
|
||||
label: 'Type',
|
||||
targetColumnMap: {
|
||||
@ -140,6 +145,7 @@ export const seedViewFieldMetadata = async (
|
||||
description: 'View type',
|
||||
icon: null,
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedViewFieldMetadataIds.ViewFields,
|
||||
@ -147,13 +153,14 @@ export const seedViewFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'viewFields',
|
||||
label: 'View Fields',
|
||||
targetColumnMap: {},
|
||||
description: 'View Fields',
|
||||
icon: 'IconTag',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedViewFieldMetadataIds.ViewSorts,
|
||||
@ -161,13 +168,14 @@ export const seedViewFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'viewSorts',
|
||||
label: 'View Sorts',
|
||||
targetColumnMap: {},
|
||||
description: 'View Sorts',
|
||||
icon: 'IconArrowsSort',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedViewFieldMetadataIds.ViewFilters,
|
||||
@ -175,13 +183,14 @@ export const seedViewFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'viewFilters',
|
||||
label: 'View Filters',
|
||||
targetColumnMap: {},
|
||||
description: 'View Filters',
|
||||
icon: 'IconFilterBolt',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
|
||||
@ -35,6 +35,7 @@ export const seedWebhookFieldMetadata = async (
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
'isSystem',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
@ -54,7 +55,7 @@ export const seedWebhookFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: undefined,
|
||||
isNullable: true,
|
||||
// isSystem: true,
|
||||
isSystem: true,
|
||||
},
|
||||
{
|
||||
id: SeedWebhookFieldMetadataIds.CreatedAt,
|
||||
@ -71,6 +72,7 @@ export const seedWebhookFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedWebhookFieldMetadataIds.UpdatedAt,
|
||||
@ -87,6 +89,7 @@ export const seedWebhookFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
// Scalar fields
|
||||
{
|
||||
@ -95,7 +98,7 @@ export const seedWebhookFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'targetUrl',
|
||||
label: 'Target Url',
|
||||
targetColumnMap: {
|
||||
@ -104,6 +107,7 @@ export const seedWebhookFieldMetadata = async (
|
||||
description: 'Webhook target url',
|
||||
icon: 'IconLink',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedWebhookFieldMetadataIds.Operation,
|
||||
@ -111,7 +115,7 @@ export const seedWebhookFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'operation',
|
||||
label: 'Operation',
|
||||
targetColumnMap: {
|
||||
@ -120,6 +124,7 @@ export const seedWebhookFieldMetadata = async (
|
||||
description: 'Webhook operation',
|
||||
icon: 'IconCheckbox',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
|
||||
@ -47,6 +47,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
'description',
|
||||
'icon',
|
||||
'isNullable',
|
||||
'isSystem',
|
||||
])
|
||||
.orIgnore()
|
||||
.values([
|
||||
@ -66,7 +67,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: undefined,
|
||||
isNullable: true,
|
||||
// isSystem: true,
|
||||
isSystem: true,
|
||||
},
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.CreatedAt,
|
||||
@ -83,6 +84,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.UpdatedAt,
|
||||
@ -99,6 +101,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
description: undefined,
|
||||
icon: 'IconCalendar',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
// Scalar fields
|
||||
{
|
||||
@ -107,7 +110,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'firstName',
|
||||
label: 'First name',
|
||||
targetColumnMap: {
|
||||
@ -116,6 +119,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
description: 'Workspace member first name',
|
||||
icon: 'IconCircleUser',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.LastName,
|
||||
@ -123,7 +127,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'lastName',
|
||||
label: 'Last name',
|
||||
targetColumnMap: {
|
||||
@ -132,6 +136,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
description: 'Workspace member last name',
|
||||
icon: 'IconCircleUser',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.AvatarUrl,
|
||||
@ -148,6 +153,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
description: 'Workspace member avatar',
|
||||
icon: 'IconFileUpload',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.UserId,
|
||||
@ -155,7 +161,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'UUID',
|
||||
type: FieldMetadataType.UUID,
|
||||
name: 'userId',
|
||||
label: 'User Id',
|
||||
targetColumnMap: {
|
||||
@ -164,6 +170,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
description: 'Associated User Id',
|
||||
icon: 'IconCircleUsers',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.AllowImpersonation,
|
||||
@ -171,7 +178,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'BOOLEAN',
|
||||
type: FieldMetadataType.BOOLEAN,
|
||||
name: 'allowImpersonation',
|
||||
label: 'Admin Access',
|
||||
targetColumnMap: {
|
||||
@ -180,6 +187,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
description: 'Allow Admin Access',
|
||||
icon: 'IconEye',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.ColorScheme,
|
||||
@ -187,7 +195,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'colorScheme',
|
||||
label: 'Color Scheme',
|
||||
targetColumnMap: {
|
||||
@ -196,6 +204,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
description: 'Preferred color scheme',
|
||||
icon: 'IconColorSwatch',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.Locale,
|
||||
@ -203,7 +212,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'TEXT',
|
||||
type: FieldMetadataType.TEXT,
|
||||
name: 'locale',
|
||||
label: 'Language',
|
||||
targetColumnMap: {
|
||||
@ -212,6 +221,7 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
description: 'Preferred language',
|
||||
icon: 'IconLanguage',
|
||||
isNullable: false,
|
||||
isSystem: false,
|
||||
},
|
||||
|
||||
// Relationships
|
||||
@ -221,13 +231,14 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'authoredActivities',
|
||||
label: 'Authored activities',
|
||||
targetColumnMap: {},
|
||||
description: 'Activities created by the workspace member',
|
||||
icon: 'IconCheckbox',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.AssignedActivities,
|
||||
@ -235,13 +246,14 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'assignedActivities',
|
||||
label: 'Assigned activities',
|
||||
targetColumnMap: {},
|
||||
description: 'Activities assigned to the workspace member',
|
||||
icon: 'IconCheckbox',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.Favorites,
|
||||
@ -249,13 +261,14 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'favorites',
|
||||
label: 'Favorites',
|
||||
targetColumnMap: {},
|
||||
description: 'Favorites linked to the workspace member',
|
||||
icon: 'IconHeart',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.AccountOwnerForCompanies,
|
||||
@ -263,13 +276,14 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'accountOwnerForCompanies',
|
||||
label: 'Account Owner For Companies',
|
||||
targetColumnMap: {},
|
||||
description: 'Account owner for companies',
|
||||
icon: 'IconBriefcase',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.AuthoredAttachments,
|
||||
@ -277,13 +291,14 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'authoredAttachments',
|
||||
label: 'Authored attachments',
|
||||
targetColumnMap: {},
|
||||
description: 'Attachments created by the workspace member',
|
||||
icon: 'IconFileImport',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
{
|
||||
id: SeedWorkspaceMemberFieldMetadataIds.AuthoredComments,
|
||||
@ -291,13 +306,14 @@ export const seedWorkspaceMemberFieldMetadata = async (
|
||||
isCustom: false,
|
||||
workspaceId: SeedWorkspaceId,
|
||||
isActive: true,
|
||||
type: 'RELATION',
|
||||
type: FieldMetadataType.RELATION,
|
||||
name: 'authoredComments',
|
||||
label: 'Authored comments',
|
||||
targetColumnMap: {},
|
||||
description: 'Authored comments',
|
||||
icon: 'IconComment',
|
||||
isNullable: true,
|
||||
isSystem: false,
|
||||
},
|
||||
])
|
||||
.execute();
|
||||
|
||||
@ -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"`);
|
||||
}
|
||||
}
|
||||
@ -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"`);
|
||||
}
|
||||
|
||||
}
|
||||
@ -8,6 +8,7 @@ import {
|
||||
|
||||
import {
|
||||
Authorize,
|
||||
FilterableField,
|
||||
IDField,
|
||||
QueryOptions,
|
||||
Relation,
|
||||
@ -29,7 +30,6 @@ registerEnumType(FieldMetadataType, {
|
||||
})
|
||||
@QueryOptions({
|
||||
defaultResultSize: 10,
|
||||
disableFilter: true,
|
||||
disableSort: true,
|
||||
maxResultsSize: 1000,
|
||||
})
|
||||
@ -61,12 +61,15 @@ export class FieldMetadataDTO {
|
||||
@Field({ nullable: true, deprecationReason: 'Use label name instead' })
|
||||
placeholder?: string;
|
||||
|
||||
@Field()
|
||||
@FilterableField()
|
||||
isCustom: boolean;
|
||||
|
||||
@Field()
|
||||
@FilterableField()
|
||||
isActive: boolean;
|
||||
|
||||
@FilterableField()
|
||||
isSystem: boolean;
|
||||
|
||||
@Field()
|
||||
isNullable: boolean;
|
||||
|
||||
|
||||
@ -77,6 +77,9 @@ export class FieldMetadataEntity implements FieldMetadataInterface {
|
||||
@Column({ default: false })
|
||||
isActive: boolean;
|
||||
|
||||
@Column({ default: false })
|
||||
isSystem: boolean;
|
||||
|
||||
@Column({ nullable: true, default: true })
|
||||
isNullable: boolean;
|
||||
|
||||
|
||||
@ -100,18 +100,33 @@ export class RelationMetadataService extends TypeOrmQueryService<RelationMetadat
|
||||
description: undefined,
|
||||
icon: record.toIcon,
|
||||
isCustom: true,
|
||||
targetColumnMap: {
|
||||
value: foreignKeyColumnName,
|
||||
},
|
||||
targetColumnMap: {},
|
||||
isActive: true,
|
||||
type: FieldMetadataType.RELATION,
|
||||
objectMetadataId: record.toObjectMetadataId,
|
||||
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) => {
|
||||
acc[curr.objectMetadataId] = curr;
|
||||
const createdFieldMap = createdFields.reduce((acc, fieldMetadata) => {
|
||||
if (fieldMetadata.type === FieldMetadataType.RELATION) {
|
||||
acc[fieldMetadata.objectMetadataId] = fieldMetadata;
|
||||
}
|
||||
return acc;
|
||||
}, {});
|
||||
|
||||
|
||||
@ -57,9 +57,7 @@ export class ArgsAliasFactory {
|
||||
// Otherwise we just need to map the value
|
||||
const mappedKey = fieldMetadata.targetColumnMap.value;
|
||||
|
||||
if (mappedKey) {
|
||||
newArgs[mappedKey] = value;
|
||||
}
|
||||
newArgs[mappedKey ?? key] = value;
|
||||
} else {
|
||||
// Recurse if value is a nested object, otherwise append field or alias
|
||||
newArgs[key] = this.createArgsObjectRecursive(value, fieldMetadataMap);
|
||||
|
||||
@ -68,7 +68,7 @@ export class FilterTypeDefinitionFactory {
|
||||
const fields: GraphQLInputFieldConfigMap = {};
|
||||
|
||||
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)) {
|
||||
//continue;
|
||||
}
|
||||
|
||||
@ -53,7 +53,7 @@ export class InputTypeDefinitionFactory {
|
||||
const fields: GraphQLInputFieldConfigMap = {};
|
||||
|
||||
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)) {
|
||||
//continue;
|
||||
}
|
||||
|
||||
@ -50,7 +50,7 @@ export class ObjectTypeDefinitionFactory {
|
||||
const fields: GraphQLFieldConfigMap<any, any> = {};
|
||||
|
||||
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)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
@ -44,7 +44,7 @@ export class OrderByTypeDefinitionFactory {
|
||||
const fields: GraphQLInputFieldConfigMap = {};
|
||||
|
||||
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)) {
|
||||
continue;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user