90 lines
2.6 KiB
TypeScript
90 lines
2.6 KiB
TypeScript
import { CurrencyMetadata } from 'src/metadata/field-metadata/composite-types/currency.composite-type';
|
|
import { FieldMetadataType } from 'src/metadata/field-metadata/field-metadata.entity';
|
|
import {
|
|
ObjectMetadata,
|
|
IsSystem,
|
|
FieldMetadata,
|
|
IsNullable,
|
|
} from 'src/workspace/workspace-sync-metadata/decorators/metadata.decorator';
|
|
import { BaseObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
import { CompanyObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/company.object-metadata';
|
|
import { PersonObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/person.object-metadata';
|
|
import { PipelineStepObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/pipeline-step.object-metadata';
|
|
|
|
@ObjectMetadata({
|
|
namePlural: 'opportunities',
|
|
labelSingular: 'Opportunity',
|
|
labelPlural: 'Opportunities',
|
|
description: 'An opportunity',
|
|
icon: 'IconTargetArrow',
|
|
})
|
|
export class OpportunityObjectMetadata extends BaseObjectMetadata {
|
|
@FieldMetadata({
|
|
type: FieldMetadataType.CURRENCY,
|
|
label: 'Amount',
|
|
description: 'Opportunity amount',
|
|
icon: 'IconCurrencyDollar',
|
|
})
|
|
@IsNullable()
|
|
amount: CurrencyMetadata;
|
|
|
|
@FieldMetadata({
|
|
type: FieldMetadataType.DATE_TIME,
|
|
label: 'Close date',
|
|
description: 'Opportunity close date',
|
|
icon: 'IconCalendarEvent',
|
|
})
|
|
@IsNullable()
|
|
closeDate: Date;
|
|
|
|
@FieldMetadata({
|
|
type: FieldMetadataType.TEXT,
|
|
label: 'Probability',
|
|
description: 'Opportunity probability',
|
|
icon: 'IconProgressCheck',
|
|
defaultValue: { value: '0' },
|
|
})
|
|
@IsNullable()
|
|
probability: string;
|
|
|
|
// Relations
|
|
@FieldMetadata({
|
|
type: FieldMetadataType.RELATION,
|
|
label: 'Pipeline Step',
|
|
description: 'Opportunity pipeline step',
|
|
icon: 'IconKanban',
|
|
joinColumn: 'pipelineStepId',
|
|
})
|
|
@IsNullable()
|
|
pipelineStep: PipelineStepObjectMetadata;
|
|
|
|
@FieldMetadata({
|
|
type: FieldMetadataType.RELATION,
|
|
label: 'Point of Contact',
|
|
description: 'Opportunity point of contact',
|
|
icon: 'IconUser',
|
|
joinColumn: 'pointOfContactId',
|
|
})
|
|
@IsNullable()
|
|
pointOfContact: PersonObjectMetadata;
|
|
|
|
@FieldMetadata({
|
|
type: FieldMetadataType.RELATION,
|
|
label: 'Person',
|
|
description: 'Opportunity person',
|
|
icon: 'IconUser',
|
|
joinColumn: 'personId',
|
|
})
|
|
person: PersonObjectMetadata;
|
|
|
|
@FieldMetadata({
|
|
type: FieldMetadataType.RELATION,
|
|
label: 'Company',
|
|
description: 'Opportunity company',
|
|
icon: 'IconBuildingSkyscraper',
|
|
joinColumn: 'companyId',
|
|
})
|
|
@IsNullable()
|
|
company: CompanyObjectMetadata;
|
|
}
|