Sync metadata generate migrations (#2864)
* Sync Metadata generates migrations * add execute migrations * fix relations + add isActive on creation * fix composite fields migration * remove dependency * use new metadata setup for seed-dev * fix rebase * remove unused code * fix viewField dev seeds * fix isSystem
This commit is contained in:
@ -0,0 +1,164 @@
|
||||
import { FieldMetadataType } from 'src/metadata/field-metadata/field-metadata.entity';
|
||||
import { RelationMetadataType } from 'src/metadata/relation-metadata/relation-metadata.entity';
|
||||
import {
|
||||
ObjectMetadata,
|
||||
FieldMetadata,
|
||||
IsNullable,
|
||||
RelationMetadata,
|
||||
} from 'src/workspace/workspace-sync-metadata/decorators/metadata.decorator';
|
||||
import { BaseObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/base.object-metadata';
|
||||
|
||||
@ObjectMetadata({
|
||||
namePlural: 'companies',
|
||||
labelSingular: 'Company',
|
||||
labelPlural: 'Companies',
|
||||
description: 'A company',
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
})
|
||||
export class CompanyObjectMetadata extends BaseObjectMetadata {
|
||||
@FieldMetadata({
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: 'Name',
|
||||
description: 'The company name',
|
||||
icon: 'IconBuildingSkyscraper',
|
||||
})
|
||||
name: string;
|
||||
|
||||
@FieldMetadata({
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: 'Domain Name',
|
||||
description:
|
||||
'The company website URL. We use this url to fetch the company icon',
|
||||
icon: 'IconLink',
|
||||
})
|
||||
@IsNullable()
|
||||
domainName?: string;
|
||||
|
||||
@FieldMetadata({
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: 'Address',
|
||||
description: 'The company address',
|
||||
icon: 'IconMap',
|
||||
})
|
||||
@IsNullable()
|
||||
address: string;
|
||||
|
||||
@FieldMetadata({
|
||||
type: FieldMetadataType.NUMBER,
|
||||
label: 'Employees',
|
||||
description: 'Number of employees in the company',
|
||||
icon: 'IconUsers',
|
||||
})
|
||||
@IsNullable()
|
||||
employees: number;
|
||||
|
||||
@FieldMetadata({
|
||||
type: FieldMetadataType.LINK,
|
||||
label: 'Linkedin',
|
||||
description: 'The company Linkedin account',
|
||||
icon: 'IconBrandLinkedin',
|
||||
})
|
||||
@IsNullable()
|
||||
linkedinLink: string;
|
||||
|
||||
@FieldMetadata({
|
||||
type: FieldMetadataType.LINK,
|
||||
label: 'X',
|
||||
description: 'The company Twitter/X account',
|
||||
icon: 'IconBrandX',
|
||||
})
|
||||
@IsNullable()
|
||||
xLink: string;
|
||||
|
||||
@FieldMetadata({
|
||||
type: FieldMetadataType.CURRENCY,
|
||||
label: 'ARR',
|
||||
description:
|
||||
'Annual Recurring Revenue: The actual or estimated annual revenue of the company',
|
||||
icon: 'IconMoneybag',
|
||||
})
|
||||
@IsNullable()
|
||||
annualRecurringRevenue: number;
|
||||
|
||||
@FieldMetadata({
|
||||
type: FieldMetadataType.BOOLEAN,
|
||||
label: 'ICP',
|
||||
description:
|
||||
'Ideal Customer Profile: Indicates whether the company is the most suitable and valuable customer for you',
|
||||
icon: 'IconTarget',
|
||||
})
|
||||
@IsNullable()
|
||||
idealCustomerProfile: boolean;
|
||||
|
||||
// Relations
|
||||
@FieldMetadata({
|
||||
type: FieldMetadataType.RELATION,
|
||||
label: 'People',
|
||||
description: 'People linked to the company.',
|
||||
icon: 'IconUsers',
|
||||
})
|
||||
@RelationMetadata({
|
||||
type: RelationMetadataType.ONE_TO_MANY,
|
||||
objectName: 'person',
|
||||
})
|
||||
people: object[];
|
||||
|
||||
@FieldMetadata({
|
||||
type: FieldMetadataType.RELATION,
|
||||
label: 'Account Owner',
|
||||
description:
|
||||
'Your team member responsible for managing the company account',
|
||||
icon: 'IconUserCircle',
|
||||
joinColumn: 'accountOwnerId',
|
||||
})
|
||||
@IsNullable()
|
||||
accountOwner: string;
|
||||
|
||||
@FieldMetadata({
|
||||
type: FieldMetadataType.RELATION,
|
||||
label: 'Activities',
|
||||
description: 'Activities tied to the company',
|
||||
icon: 'IconCheckbox',
|
||||
})
|
||||
@RelationMetadata({
|
||||
type: RelationMetadataType.ONE_TO_MANY,
|
||||
objectName: 'activityTarget',
|
||||
})
|
||||
activityTargets: object[];
|
||||
|
||||
@FieldMetadata({
|
||||
type: FieldMetadataType.RELATION,
|
||||
label: 'Opportunities',
|
||||
description: 'Opportunities linked to the company.',
|
||||
icon: 'IconTargetArrow',
|
||||
})
|
||||
@RelationMetadata({
|
||||
type: RelationMetadataType.ONE_TO_MANY,
|
||||
objectName: 'opportunity',
|
||||
})
|
||||
opportunities: object[];
|
||||
|
||||
@FieldMetadata({
|
||||
type: FieldMetadataType.RELATION,
|
||||
label: 'Favorites',
|
||||
description: 'Favorites linked to the company',
|
||||
icon: 'IconHeart',
|
||||
})
|
||||
@RelationMetadata({
|
||||
type: RelationMetadataType.ONE_TO_MANY,
|
||||
objectName: 'favorite',
|
||||
})
|
||||
favorites: object[];
|
||||
|
||||
@FieldMetadata({
|
||||
type: FieldMetadataType.RELATION,
|
||||
label: 'Attachments',
|
||||
description: 'Attachments linked to the company.',
|
||||
icon: 'IconFileImport',
|
||||
})
|
||||
@RelationMetadata({
|
||||
type: RelationMetadataType.ONE_TO_MANY,
|
||||
objectName: 'attachment',
|
||||
})
|
||||
attachments: object[];
|
||||
}
|
||||
Reference in New Issue
Block a user