feat: twenty orm sync (#5266)
This PR is updating all object metadata entities with the new decorators, and deleting the old ones. This way we can use the new TwentyORM with all the standard objects. --------- Co-authored-by: Weiko <corentin@twenty.com>
This commit is contained in:
@ -7,7 +7,6 @@ import {
|
|||||||
import { ConfigModule } from '@nestjs/config';
|
import { ConfigModule } from '@nestjs/config';
|
||||||
import { ServeStaticModule } from '@nestjs/serve-static';
|
import { ServeStaticModule } from '@nestjs/serve-static';
|
||||||
import { GraphQLModule } from '@nestjs/graphql';
|
import { GraphQLModule } from '@nestjs/graphql';
|
||||||
import { DevtoolsModule } from '@nestjs/devtools-integration';
|
|
||||||
|
|
||||||
import { existsSync } from 'fs';
|
import { existsSync } from 'fs';
|
||||||
import { join } from 'path';
|
import { join } from 'path';
|
||||||
@ -20,7 +19,6 @@ import { CoreGraphQLApiModule } from 'src/engine/api/graphql/core-graphql-api.mo
|
|||||||
import { MetadataGraphQLApiModule } from 'src/engine/api/graphql/metadata-graphql-api.module';
|
import { MetadataGraphQLApiModule } from 'src/engine/api/graphql/metadata-graphql-api.module';
|
||||||
import { GraphQLConfigModule } from 'src/engine/api/graphql/graphql-config/graphql-config.module';
|
import { GraphQLConfigModule } from 'src/engine/api/graphql/graphql-config/graphql-config.module';
|
||||||
import { GraphQLConfigService } from 'src/engine/api/graphql/graphql-config/graphql-config.service';
|
import { GraphQLConfigService } from 'src/engine/api/graphql/graphql-config/graphql-config.service';
|
||||||
import { EnvironmentService } from 'src/engine/integrations/environment/environment.service';
|
|
||||||
import { WorkspaceCacheVersionModule } from 'src/engine/metadata-modules/workspace-cache-version/workspace-cache-version.module';
|
import { WorkspaceCacheVersionModule } from 'src/engine/metadata-modules/workspace-cache-version/workspace-cache-version.module';
|
||||||
import { GraphQLHydrateRequestFromTokenMiddleware } from 'src/engine/middlewares/graphql-hydrate-request-from-token.middleware';
|
import { GraphQLHydrateRequestFromTokenMiddleware } from 'src/engine/middlewares/graphql-hydrate-request-from-token.middleware';
|
||||||
|
|
||||||
@ -30,13 +28,13 @@ import { IntegrationsModule } from './engine/integrations/integrations.module';
|
|||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
// Nest.js devtools, use devtools.nestjs.com to debug
|
// Nest.js devtools, use devtools.nestjs.com to debug
|
||||||
DevtoolsModule.registerAsync({
|
// DevtoolsModule.registerAsync({
|
||||||
useFactory: (environmentService: EnvironmentService) => ({
|
// useFactory: (environmentService: EnvironmentService) => ({
|
||||||
http: environmentService.get('DEBUG_MODE'),
|
// http: environmentService.get('DEBUG_MODE'),
|
||||||
port: environmentService.get('DEBUG_PORT'),
|
// port: environmentService.get('DEBUG_PORT'),
|
||||||
}),
|
// }),
|
||||||
inject: [EnvironmentService],
|
// inject: [EnvironmentService],
|
||||||
}),
|
// }),
|
||||||
ConfigModule.forRoot({
|
ConfigModule.forRoot({
|
||||||
isGlobal: true,
|
isGlobal: true,
|
||||||
}),
|
}),
|
||||||
|
|||||||
@ -11,9 +11,9 @@ import { TimelineCalendarEventModule } from 'src/engine/core-modules/calendar/ti
|
|||||||
import { BillingModule } from 'src/engine/core-modules/billing/billing.module';
|
import { BillingModule } from 'src/engine/core-modules/billing/billing.module';
|
||||||
import { HealthModule } from 'src/engine/core-modules/health/health.module';
|
import { HealthModule } from 'src/engine/core-modules/health/health.module';
|
||||||
|
|
||||||
import { ClientConfigModule } from './client-config/client-config.module';
|
|
||||||
import { FileModule } from './file/file.module';
|
|
||||||
import { AnalyticsModule } from './analytics/analytics.module';
|
import { AnalyticsModule } from './analytics/analytics.module';
|
||||||
|
import { FileModule } from './file/file.module';
|
||||||
|
import { ClientConfigModule } from './client-config/client-config.module';
|
||||||
|
|
||||||
@Module({
|
@Module({
|
||||||
imports: [
|
imports: [
|
||||||
|
|||||||
@ -4,7 +4,7 @@ import { WorkspaceIsPimaryField } from 'src/engine/twenty-orm/decorators/workspa
|
|||||||
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
import { BASE_OBJECT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { BASE_OBJECT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
|
|
||||||
export abstract class BaseObjectMetadata {
|
export abstract class BaseWorkspaceEntity {
|
||||||
@WorkspaceField({
|
@WorkspaceField({
|
||||||
standardId: BASE_OBJECT_STANDARD_FIELD_IDS.id,
|
standardId: BASE_OBJECT_STANDARD_FIELD_IDS.id,
|
||||||
type: FieldMetadataType.UUID,
|
type: FieldMetadataType.UUID,
|
||||||
@ -25,7 +25,6 @@ export abstract class BaseObjectMetadata {
|
|||||||
icon: 'IconCalendar',
|
icon: 'IconCalendar',
|
||||||
defaultValue: 'now',
|
defaultValue: 'now',
|
||||||
})
|
})
|
||||||
@WorkspaceIsSystem()
|
|
||||||
createdAt: Date;
|
createdAt: Date;
|
||||||
|
|
||||||
@WorkspaceField({
|
@WorkspaceField({
|
||||||
@ -1,23 +1,23 @@
|
|||||||
import { BaseCustomObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/base-custom-object-metadata.decorator';
|
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import {
|
import {
|
||||||
RelationMetadataType,
|
RelationMetadataType,
|
||||||
RelationOnDeleteAction,
|
RelationOnDeleteAction,
|
||||||
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
import { ActivityTargetObjectMetadata } from 'src/modules/activity/standard-objects/activity-target.object-metadata';
|
import { ActivityTargetObjectMetadata } from 'src/modules/activity/standard-objects/activity-target.object-metadata';
|
||||||
import { RelationMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/relation-metadata.decorator';
|
|
||||||
import { FavoriteObjectMetadata } from 'src/modules/favorite/standard-objects/favorite.object-metadata';
|
import { FavoriteObjectMetadata } from 'src/modules/favorite/standard-objects/favorite.object-metadata';
|
||||||
import { AttachmentObjectMetadata } from 'src/modules/attachment/standard-objects/attachment.object-metadata';
|
import { AttachmentObjectMetadata } from 'src/modules/attachment/standard-objects/attachment.object-metadata';
|
||||||
import { CUSTOM_OBJECT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { CUSTOM_OBJECT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { TimelineActivityObjectMetadata } from 'src/modules/timeline/standard-objects/timeline-activity.object-metadata';
|
import { TimelineActivityObjectMetadata } from 'src/modules/timeline/standard-objects/timeline-activity.object-metadata';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
import { WorkspaceCustomObject } from 'src/engine/twenty-orm/decorators/workspace-custom-object.decorator';
|
||||||
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
|
||||||
@BaseCustomObjectMetadata()
|
@WorkspaceCustomObject()
|
||||||
export class CustomObjectMetadata extends BaseObjectMetadata {
|
export class CustomWorkspaceEntity extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CUSTOM_OBJECT_STANDARD_FIELD_IDS.name,
|
standardId: CUSTOM_OBJECT_STANDARD_FIELD_IDS.name,
|
||||||
label: 'Name',
|
label: 'Name',
|
||||||
description: 'Name',
|
description: 'Name',
|
||||||
@ -27,81 +27,68 @@ export class CustomObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CUSTOM_OBJECT_STANDARD_FIELD_IDS.position,
|
standardId: CUSTOM_OBJECT_STANDARD_FIELD_IDS.position,
|
||||||
label: 'Position',
|
label: 'Position',
|
||||||
description: 'Position',
|
description: 'Position',
|
||||||
type: FieldMetadataType.POSITION,
|
type: FieldMetadataType.POSITION,
|
||||||
icon: 'IconHierarchy2',
|
icon: 'IconHierarchy2',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
position: number;
|
position: number;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: CUSTOM_OBJECT_STANDARD_FIELD_IDS.activityTargets,
|
standardId: CUSTOM_OBJECT_STANDARD_FIELD_IDS.activityTargets,
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Activities',
|
label: 'Activities',
|
||||||
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
description: (objectMetadata) =>
|
description: (objectMetadata) =>
|
||||||
`Activities tied to the ${objectMetadata.labelSingular}`,
|
`Activities tied to the ${objectMetadata.labelSingular}`,
|
||||||
icon: 'IconCheckbox',
|
icon: 'IconCheckbox',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => ActivityTargetObjectMetadata,
|
inverseSideTarget: () => ActivityTargetObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
activityTargets: ActivityTargetObjectMetadata[];
|
activityTargets: ActivityTargetObjectMetadata[];
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: CUSTOM_OBJECT_STANDARD_FIELD_IDS.favorites,
|
standardId: CUSTOM_OBJECT_STANDARD_FIELD_IDS.favorites,
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Favorites',
|
label: 'Favorites',
|
||||||
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
description: (objectMetadata) =>
|
description: (objectMetadata) =>
|
||||||
`Favorites tied to the ${objectMetadata.labelSingular}`,
|
`Favorites tied to the ${objectMetadata.labelSingular}`,
|
||||||
icon: 'IconHeart',
|
icon: 'IconHeart',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => FavoriteObjectMetadata,
|
inverseSideTarget: () => FavoriteObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
favorites: FavoriteObjectMetadata[];
|
favorites: FavoriteObjectMetadata[];
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: CUSTOM_OBJECT_STANDARD_FIELD_IDS.attachments,
|
standardId: CUSTOM_OBJECT_STANDARD_FIELD_IDS.attachments,
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Attachments',
|
label: 'Attachments',
|
||||||
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
description: (objectMetadata) =>
|
description: (objectMetadata) =>
|
||||||
`Attachments tied to the ${objectMetadata.labelSingular}`,
|
`Attachments tied to the ${objectMetadata.labelSingular}`,
|
||||||
icon: 'IconFileImport',
|
icon: 'IconFileImport',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => AttachmentObjectMetadata,
|
inverseSideTarget: () => AttachmentObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
attachments: AttachmentObjectMetadata[];
|
attachments: AttachmentObjectMetadata[];
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: CUSTOM_OBJECT_STANDARD_FIELD_IDS.timelineActivities,
|
standardId: CUSTOM_OBJECT_STANDARD_FIELD_IDS.timelineActivities,
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Timeline Activities',
|
label: 'Timeline Activities',
|
||||||
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
description: (objectMetadata) =>
|
description: (objectMetadata) =>
|
||||||
`Timeline Activities tied to the ${objectMetadata.labelSingular}`,
|
`Timeline Activities tied to the ${objectMetadata.labelSingular}`,
|
||||||
|
|
||||||
icon: 'IconIconTimelineEvent',
|
icon: 'IconIconTimelineEvent',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => TimelineActivityObjectMetadata,
|
inverseSideTarget: () => TimelineActivityObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
timelineActivities: TimelineActivityObjectMetadata[];
|
timelineActivities: TimelineActivityObjectMetadata[];
|
||||||
}
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
import { metadataArgsStorage } from 'src/engine/twenty-orm/storage/metadata-args.storage';
|
||||||
|
import { TypedReflect } from 'src/utils/typed-reflect';
|
||||||
|
|
||||||
|
export function WorkspaceCustomObject(): ClassDecorator {
|
||||||
|
return (target) => {
|
||||||
|
const gate = TypedReflect.getMetadata(
|
||||||
|
'workspace:gate-metadata-args',
|
||||||
|
target,
|
||||||
|
);
|
||||||
|
|
||||||
|
metadataArgsStorage.addExtendedEntities({
|
||||||
|
target,
|
||||||
|
gate,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -0,0 +1,49 @@
|
|||||||
|
import { ObjectType } from 'typeorm';
|
||||||
|
|
||||||
|
import { WorkspaceDynamicRelationMetadataArgsFactory } from 'src/engine/twenty-orm/interfaces/workspace-dynamic-relation-metadata-args.interface';
|
||||||
|
|
||||||
|
import { TypedReflect } from 'src/utils/typed-reflect';
|
||||||
|
import {
|
||||||
|
RelationMetadataType,
|
||||||
|
RelationOnDeleteAction,
|
||||||
|
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
|
import { metadataArgsStorage } from 'src/engine/twenty-orm/storage/metadata-args.storage';
|
||||||
|
|
||||||
|
interface WorkspaceBaseDynamicRelationOptions<TClass> {
|
||||||
|
type: RelationMetadataType;
|
||||||
|
argsFactory: WorkspaceDynamicRelationMetadataArgsFactory;
|
||||||
|
inverseSideTarget: () => ObjectType<TClass>;
|
||||||
|
inverseSideFieldKey?: keyof TClass;
|
||||||
|
onDelete?: RelationOnDeleteAction;
|
||||||
|
}
|
||||||
|
|
||||||
|
export function WorkspaceDynamicRelation<TClass extends object>(
|
||||||
|
args: WorkspaceBaseDynamicRelationOptions<TClass>,
|
||||||
|
): PropertyDecorator {
|
||||||
|
return (target, propertyKey) => {
|
||||||
|
const isSystem =
|
||||||
|
TypedReflect.getMetadata(
|
||||||
|
'workspace:is-system-metadata-args',
|
||||||
|
target,
|
||||||
|
propertyKey.toString(),
|
||||||
|
) ?? false;
|
||||||
|
const gate = TypedReflect.getMetadata(
|
||||||
|
'workspace:gate-metadata-args',
|
||||||
|
target,
|
||||||
|
propertyKey.toString(),
|
||||||
|
);
|
||||||
|
|
||||||
|
metadataArgsStorage.addDynamicRelations({
|
||||||
|
target: target.constructor,
|
||||||
|
argsFactory: args.argsFactory,
|
||||||
|
type: args.type,
|
||||||
|
inverseSideTarget: args.inverseSideTarget,
|
||||||
|
inverseSideFieldKey: args.inverseSideFieldKey as string | undefined,
|
||||||
|
onDelete: args.onDelete,
|
||||||
|
isSystem,
|
||||||
|
isNullable: true,
|
||||||
|
isPrimary: false,
|
||||||
|
gate,
|
||||||
|
});
|
||||||
|
};
|
||||||
|
}
|
||||||
@ -5,6 +5,7 @@ import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/fi
|
|||||||
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||||
import { metadataArgsStorage } from 'src/engine/twenty-orm/storage/metadata-args.storage';
|
import { metadataArgsStorage } from 'src/engine/twenty-orm/storage/metadata-args.storage';
|
||||||
import { TypedReflect } from 'src/utils/typed-reflect';
|
import { TypedReflect } from 'src/utils/typed-reflect';
|
||||||
|
import { generateDefaultValue } from 'src/engine/metadata-modules/field-metadata/utils/generate-default-value';
|
||||||
|
|
||||||
export interface WorkspaceFieldOptions<
|
export interface WorkspaceFieldOptions<
|
||||||
T extends FieldMetadataType | 'default',
|
T extends FieldMetadataType | 'default',
|
||||||
@ -15,7 +16,6 @@ export interface WorkspaceFieldOptions<
|
|||||||
description?: string | ((objectMetadata: ObjectMetadataEntity) => string);
|
description?: string | ((objectMetadata: ObjectMetadataEntity) => string);
|
||||||
icon?: string;
|
icon?: string;
|
||||||
defaultValue?: FieldMetadataDefaultValue<T>;
|
defaultValue?: FieldMetadataDefaultValue<T>;
|
||||||
joinColumn?: string;
|
|
||||||
options?: FieldMetadataOptions<T>;
|
options?: FieldMetadataOptions<T>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -23,28 +23,35 @@ export function WorkspaceField<T extends FieldMetadataType>(
|
|||||||
options: WorkspaceFieldOptions<T>,
|
options: WorkspaceFieldOptions<T>,
|
||||||
): PropertyDecorator {
|
): PropertyDecorator {
|
||||||
return (object, propertyKey) => {
|
return (object, propertyKey) => {
|
||||||
const isPrimary = TypedReflect.getMetadata(
|
const isPrimary =
|
||||||
'workspace:is-primary-field-metadata-args',
|
TypedReflect.getMetadata(
|
||||||
object,
|
'workspace:is-primary-field-metadata-args',
|
||||||
propertyKey.toString(),
|
object,
|
||||||
);
|
propertyKey.toString(),
|
||||||
const isNullable = TypedReflect.getMetadata(
|
) ?? false;
|
||||||
'workspace:is-nullable-metadata-args',
|
const isNullable =
|
||||||
object,
|
TypedReflect.getMetadata(
|
||||||
propertyKey.toString(),
|
'workspace:is-nullable-metadata-args',
|
||||||
);
|
object,
|
||||||
const isSystem = TypedReflect.getMetadata(
|
propertyKey.toString(),
|
||||||
'workspace:is-system-metadata-args',
|
) ?? false;
|
||||||
object,
|
const isSystem =
|
||||||
propertyKey.toString(),
|
TypedReflect.getMetadata(
|
||||||
);
|
'workspace:is-system-metadata-args',
|
||||||
|
object,
|
||||||
|
propertyKey.toString(),
|
||||||
|
) ?? false;
|
||||||
const gate = TypedReflect.getMetadata(
|
const gate = TypedReflect.getMetadata(
|
||||||
'workspace:gate-metadata-args',
|
'workspace:gate-metadata-args',
|
||||||
object,
|
object,
|
||||||
propertyKey.toString(),
|
propertyKey.toString(),
|
||||||
);
|
);
|
||||||
|
const defaultValue = (options.defaultValue ??
|
||||||
|
generateDefaultValue(
|
||||||
|
options.type,
|
||||||
|
)) as FieldMetadataDefaultValue<'default'> | null;
|
||||||
|
|
||||||
metadataArgsStorage.fields.push({
|
metadataArgsStorage.addFields({
|
||||||
target: object.constructor,
|
target: object.constructor,
|
||||||
standardId: options.standardId,
|
standardId: options.standardId,
|
||||||
name: propertyKey.toString(),
|
name: propertyKey.toString(),
|
||||||
@ -52,7 +59,7 @@ export function WorkspaceField<T extends FieldMetadataType>(
|
|||||||
type: options.type,
|
type: options.type,
|
||||||
description: options.description,
|
description: options.description,
|
||||||
icon: options.icon,
|
icon: options.icon,
|
||||||
defaultValue: options.defaultValue,
|
defaultValue,
|
||||||
options: options.options,
|
options: options.options,
|
||||||
isPrimary,
|
isPrimary,
|
||||||
isNullable,
|
isNullable,
|
||||||
|
|||||||
@ -2,7 +2,7 @@ import { metadataArgsStorage } from 'src/engine/twenty-orm/storage/metadata-args
|
|||||||
import { convertClassNameToObjectMetadataName } from 'src/engine/workspace-manager/workspace-sync-metadata/utils/convert-class-to-object-metadata-name.util';
|
import { convertClassNameToObjectMetadataName } from 'src/engine/workspace-manager/workspace-sync-metadata/utils/convert-class-to-object-metadata-name.util';
|
||||||
import { TypedReflect } from 'src/utils/typed-reflect';
|
import { TypedReflect } from 'src/utils/typed-reflect';
|
||||||
|
|
||||||
interface WorkspaceObjectOptions {
|
interface WorkspaceEntityOptions {
|
||||||
standardId: string;
|
standardId: string;
|
||||||
namePlural: string;
|
namePlural: string;
|
||||||
labelSingular: string;
|
labelSingular: string;
|
||||||
@ -11,8 +11,8 @@ interface WorkspaceObjectOptions {
|
|||||||
icon?: string;
|
icon?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
export function WorkspaceObject(
|
export function WorkspaceEntity(
|
||||||
options: WorkspaceObjectOptions,
|
options: WorkspaceEntityOptions,
|
||||||
): ClassDecorator {
|
): ClassDecorator {
|
||||||
return (target) => {
|
return (target) => {
|
||||||
const isAuditLogged =
|
const isAuditLogged =
|
||||||
@ -20,17 +20,16 @@ export function WorkspaceObject(
|
|||||||
'workspace:is-audit-logged-metadata-args',
|
'workspace:is-audit-logged-metadata-args',
|
||||||
target,
|
target,
|
||||||
) ?? true;
|
) ?? true;
|
||||||
const isSystem = TypedReflect.getMetadata(
|
const isSystem =
|
||||||
'workspace:is-system-metadata-args',
|
TypedReflect.getMetadata('workspace:is-system-metadata-args', target) ??
|
||||||
target,
|
false;
|
||||||
);
|
|
||||||
const gate = TypedReflect.getMetadata(
|
const gate = TypedReflect.getMetadata(
|
||||||
'workspace:gate-metadata-args',
|
'workspace:gate-metadata-args',
|
||||||
target,
|
target,
|
||||||
);
|
);
|
||||||
const objectName = convertClassNameToObjectMetadataName(target.name);
|
const objectName = convertClassNameToObjectMetadataName(target.name);
|
||||||
|
|
||||||
metadataArgsStorage.objects.push({
|
metadataArgsStorage.addEntities({
|
||||||
target,
|
target,
|
||||||
standardId: options.standardId,
|
standardId: options.standardId,
|
||||||
nameSingular: objectName,
|
nameSingular: objectName,
|
||||||
|
|||||||
@ -6,11 +6,12 @@ import {
|
|||||||
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
import { metadataArgsStorage } from 'src/engine/twenty-orm/storage/metadata-args.storage';
|
import { metadataArgsStorage } from 'src/engine/twenty-orm/storage/metadata-args.storage';
|
||||||
import { TypedReflect } from 'src/utils/typed-reflect';
|
import { TypedReflect } from 'src/utils/typed-reflect';
|
||||||
|
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||||
|
|
||||||
interface WorkspaceBaseRelationOptions<TType, TClass> {
|
interface WorkspaceBaseRelationOptions<TType, TClass> {
|
||||||
standardId: string;
|
standardId: string;
|
||||||
label: string;
|
label: string | ((objectMetadata: ObjectMetadataEntity) => string);
|
||||||
description?: string;
|
description?: string | ((objectMetadata: ObjectMetadataEntity) => string);
|
||||||
icon?: string;
|
icon?: string;
|
||||||
type: TType;
|
type: TType;
|
||||||
inverseSideTarget: () => ObjectType<TClass>;
|
inverseSideTarget: () => ObjectType<TClass>;
|
||||||
@ -38,21 +39,24 @@ export function WorkspaceRelation<TClass extends object>(
|
|||||||
| WorkspaceOtherRelationOptions<TClass>,
|
| WorkspaceOtherRelationOptions<TClass>,
|
||||||
): PropertyDecorator {
|
): PropertyDecorator {
|
||||||
return (object, propertyKey) => {
|
return (object, propertyKey) => {
|
||||||
const isPrimary = TypedReflect.getMetadata(
|
const isPrimary =
|
||||||
'workspace:is-primary-field-metadata-args',
|
TypedReflect.getMetadata(
|
||||||
object,
|
'workspace:is-primary-field-metadata-args',
|
||||||
propertyKey.toString(),
|
object,
|
||||||
);
|
propertyKey.toString(),
|
||||||
const isNullable = TypedReflect.getMetadata(
|
) ?? false;
|
||||||
'workspace:is-nullable-metadata-args',
|
const isNullable =
|
||||||
object,
|
TypedReflect.getMetadata(
|
||||||
propertyKey.toString(),
|
'workspace:is-nullable-metadata-args',
|
||||||
);
|
object,
|
||||||
const isSystem = TypedReflect.getMetadata(
|
propertyKey.toString(),
|
||||||
'workspace:is-system-metadata-args',
|
) ?? false;
|
||||||
object,
|
const isSystem =
|
||||||
propertyKey.toString(),
|
TypedReflect.getMetadata(
|
||||||
);
|
'workspace:is-system-metadata-args',
|
||||||
|
object,
|
||||||
|
propertyKey.toString(),
|
||||||
|
) ?? false;
|
||||||
const gate = TypedReflect.getMetadata(
|
const gate = TypedReflect.getMetadata(
|
||||||
'workspace:gate-metadata-args',
|
'workspace:gate-metadata-args',
|
||||||
object,
|
object,
|
||||||
@ -67,7 +71,7 @@ export function WorkspaceRelation<TClass extends object>(
|
|||||||
: `${propertyKey.toString()}Id`;
|
: `${propertyKey.toString()}Id`;
|
||||||
}
|
}
|
||||||
|
|
||||||
metadataArgsStorage.relations.push({
|
metadataArgsStorage.addRelations({
|
||||||
target: object.constructor,
|
target: object.constructor,
|
||||||
standardId: options.standardId,
|
standardId: options.standardId,
|
||||||
name: propertyKey.toString(),
|
name: propertyKey.toString(),
|
||||||
|
|||||||
@ -15,10 +15,10 @@ export class EntitySchemaFactory {
|
|||||||
) {}
|
) {}
|
||||||
|
|
||||||
create<T>(target: Type<T>): EntitySchema {
|
create<T>(target: Type<T>): EntitySchema {
|
||||||
const objectMetadataArgs = metadataArgsStorage.filterObjects(target);
|
const entityMetadataArgs = metadataArgsStorage.filterEntities(target);
|
||||||
|
|
||||||
if (!objectMetadataArgs) {
|
if (!entityMetadataArgs) {
|
||||||
throw new Error('Object metadata args are missing on this target');
|
throw new Error('Entity metadata args are missing on this target');
|
||||||
}
|
}
|
||||||
|
|
||||||
const fieldMetadataArgsCollection =
|
const fieldMetadataArgsCollection =
|
||||||
@ -35,8 +35,8 @@ export class EntitySchemaFactory {
|
|||||||
);
|
);
|
||||||
|
|
||||||
const entitySchema = new EntitySchema({
|
const entitySchema = new EntitySchema({
|
||||||
name: objectMetadataArgs.nameSingular,
|
name: entityMetadataArgs.nameSingular,
|
||||||
tableName: objectMetadataArgs.nameSingular,
|
tableName: entityMetadataArgs.nameSingular,
|
||||||
columns,
|
columns,
|
||||||
relations,
|
relations,
|
||||||
});
|
});
|
||||||
|
|||||||
@ -1,9 +0,0 @@
|
|||||||
import { CompositeMetadataTypes } from 'src/engine/metadata-modules/field-metadata/composite-types';
|
|
||||||
|
|
||||||
// TODO: At the time the composite types are generating union of types instead of a single type for their keys
|
|
||||||
// We need to find a way to fix that
|
|
||||||
export type FlattenCompositeTypes<T> = {
|
|
||||||
[P in keyof T as T[P] extends CompositeMetadataTypes
|
|
||||||
? `${string & P}${Capitalize<string & keyof T[P]>}`
|
|
||||||
: P]: T[P] extends CompositeMetadataTypes ? T[P][keyof T[P]] : T[P];
|
|
||||||
};
|
|
||||||
@ -1,9 +1,9 @@
|
|||||||
import { FactoryProvider, ModuleMetadata, Type } from '@nestjs/common';
|
import { FactoryProvider, ModuleMetadata, Type } from '@nestjs/common';
|
||||||
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
|
||||||
export interface TwentyORMOptions {
|
export interface TwentyORMOptions {
|
||||||
objects: Type<BaseObjectMetadata>[];
|
workspaceEntities: Type<BaseWorkspaceEntity>[];
|
||||||
}
|
}
|
||||||
|
|
||||||
export type TwentyORMModuleAsyncOptions = {
|
export type TwentyORMModuleAsyncOptions = {
|
||||||
|
|||||||
@ -0,0 +1,96 @@
|
|||||||
|
import { ObjectType } from 'typeorm';
|
||||||
|
|
||||||
|
import { Gate } from 'src/engine/twenty-orm/interfaces/gate.interface';
|
||||||
|
|
||||||
|
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||||
|
import {
|
||||||
|
RelationMetadataType,
|
||||||
|
RelationOnDeleteAction,
|
||||||
|
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
|
|
||||||
|
export type WorkspaceDynamicRelationMetadataArgsFactory = (
|
||||||
|
oppositeObjectMetadata: ObjectMetadataEntity,
|
||||||
|
) => {
|
||||||
|
/**
|
||||||
|
* Standard id.
|
||||||
|
*/
|
||||||
|
readonly standardId: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relation name.
|
||||||
|
*/
|
||||||
|
readonly name: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relation label.
|
||||||
|
*/
|
||||||
|
readonly label: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relation description.
|
||||||
|
*/
|
||||||
|
readonly description?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relation icon.
|
||||||
|
*/
|
||||||
|
readonly icon?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relation join column.
|
||||||
|
*/
|
||||||
|
readonly joinColumn?: string;
|
||||||
|
};
|
||||||
|
|
||||||
|
export interface WorkspaceDynamicRelationMetadataArgs {
|
||||||
|
/**
|
||||||
|
* Class to which relation is applied.
|
||||||
|
*/
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
|
readonly target: Function;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Factory function
|
||||||
|
*/
|
||||||
|
readonly argsFactory: WorkspaceDynamicRelationMetadataArgsFactory;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relation type.
|
||||||
|
*/
|
||||||
|
readonly type: RelationMetadataType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relation inverse side target.
|
||||||
|
*/
|
||||||
|
readonly inverseSideTarget: () => ObjectType<object>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relation inverse side field key.
|
||||||
|
*/
|
||||||
|
readonly inverseSideFieldKey?: string;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Relation on delete action.
|
||||||
|
*/
|
||||||
|
readonly onDelete?: RelationOnDeleteAction;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is primary field.
|
||||||
|
*/
|
||||||
|
readonly isPrimary: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is system field.
|
||||||
|
*/
|
||||||
|
readonly isSystem: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Is nullable field.
|
||||||
|
*/
|
||||||
|
readonly isNullable: boolean;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Field gate.
|
||||||
|
*/
|
||||||
|
readonly gate?: Gate;
|
||||||
|
}
|
||||||
@ -1,6 +1,6 @@
|
|||||||
import { Gate } from 'src/engine/twenty-orm/interfaces/gate.interface';
|
import { Gate } from 'src/engine/twenty-orm/interfaces/gate.interface';
|
||||||
|
|
||||||
export interface WorkspaceObjectMetadataArgs {
|
export interface WorkspaceEntityMetadataArgs {
|
||||||
/**
|
/**
|
||||||
* Standard id.
|
* Standard id.
|
||||||
*/
|
*/
|
||||||
@ -12,27 +12,27 @@ export interface WorkspaceObjectMetadataArgs {
|
|||||||
* String target is a table defined in a json schema.
|
* String target is a table defined in a json schema.
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
readonly target: Function | string;
|
readonly target: Function;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object name.
|
* Entity name.
|
||||||
*/
|
*/
|
||||||
readonly nameSingular: string;
|
readonly nameSingular: string;
|
||||||
readonly namePlural: string;
|
readonly namePlural: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object label.
|
* Entity label.
|
||||||
*/
|
*/
|
||||||
readonly labelSingular: string;
|
readonly labelSingular: string;
|
||||||
readonly labelPlural: string;
|
readonly labelPlural: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object description.
|
* Entity description.
|
||||||
*/
|
*/
|
||||||
readonly description?: string;
|
readonly description?: string;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object icon.
|
* Entity icon.
|
||||||
*/
|
*/
|
||||||
readonly icon?: string;
|
readonly icon?: string;
|
||||||
|
|
||||||
@ -44,10 +44,10 @@ export interface WorkspaceObjectMetadataArgs {
|
|||||||
/**
|
/**
|
||||||
* Is system object.
|
* Is system object.
|
||||||
*/
|
*/
|
||||||
readonly isSystem?: boolean;
|
readonly isSystem: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Object gate.
|
* Entity gate.
|
||||||
*/
|
*/
|
||||||
readonly gate?: Gate;
|
readonly gate?: Gate;
|
||||||
}
|
}
|
||||||
@ -0,0 +1,16 @@
|
|||||||
|
import { Gate } from 'src/engine/twenty-orm/interfaces/gate.interface';
|
||||||
|
|
||||||
|
export interface WorkspaceExtendedEntityMetadataArgs {
|
||||||
|
/**
|
||||||
|
* Class to which table is applied.
|
||||||
|
* Function target is a table defined in the class.
|
||||||
|
* String target is a table defined in a json schema.
|
||||||
|
*/
|
||||||
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
|
readonly target: Function;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Entity gate.
|
||||||
|
*/
|
||||||
|
readonly gate?: Gate;
|
||||||
|
}
|
||||||
@ -15,7 +15,7 @@ export interface WorkspaceFieldMetadataArgs {
|
|||||||
* Class to which field is applied.
|
* Class to which field is applied.
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
readonly target: Function | string;
|
readonly target: Function;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Field name.
|
* Field name.
|
||||||
@ -57,17 +57,17 @@ export interface WorkspaceFieldMetadataArgs {
|
|||||||
/**
|
/**
|
||||||
* Is primary field.
|
* Is primary field.
|
||||||
*/
|
*/
|
||||||
readonly isPrimary?: boolean;
|
readonly isPrimary: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is system field.
|
* Is system field.
|
||||||
*/
|
*/
|
||||||
readonly isSystem?: boolean;
|
readonly isSystem: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is nullable field.
|
* Is nullable field.
|
||||||
*/
|
*/
|
||||||
readonly isNullable?: boolean;
|
readonly isNullable: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Field gate.
|
* Field gate.
|
||||||
|
|||||||
@ -18,7 +18,7 @@ export interface WorkspaceRelationMetadataArgs {
|
|||||||
* Class to which relation is applied.
|
* Class to which relation is applied.
|
||||||
*/
|
*/
|
||||||
// eslint-disable-next-line @typescript-eslint/ban-types
|
// eslint-disable-next-line @typescript-eslint/ban-types
|
||||||
readonly target: Function | string;
|
readonly target: Function;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Relation name.
|
* Relation name.
|
||||||
@ -70,17 +70,17 @@ export interface WorkspaceRelationMetadataArgs {
|
|||||||
/**
|
/**
|
||||||
* Is primary field.
|
* Is primary field.
|
||||||
*/
|
*/
|
||||||
readonly isPrimary?: boolean;
|
readonly isPrimary: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is system field.
|
* Is system field.
|
||||||
*/
|
*/
|
||||||
readonly isSystem?: boolean;
|
readonly isSystem: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Is nullable field.
|
* Is nullable field.
|
||||||
*/
|
*/
|
||||||
readonly isNullable?: boolean;
|
readonly isNullable: boolean;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Field gate.
|
* Field gate.
|
||||||
|
|||||||
@ -1,24 +1,72 @@
|
|||||||
/* eslint-disable @typescript-eslint/ban-types */
|
/* eslint-disable @typescript-eslint/ban-types */
|
||||||
|
|
||||||
|
import { WorkspaceDynamicRelationMetadataArgs } from 'src/engine/twenty-orm/interfaces/workspace-dynamic-relation-metadata-args.interface';
|
||||||
import { WorkspaceFieldMetadataArgs } from 'src/engine/twenty-orm/interfaces/workspace-field-metadata-args.interface';
|
import { WorkspaceFieldMetadataArgs } from 'src/engine/twenty-orm/interfaces/workspace-field-metadata-args.interface';
|
||||||
import { WorkspaceObjectMetadataArgs } from 'src/engine/twenty-orm/interfaces/workspace-object-metadata-args.interface';
|
import { WorkspaceEntityMetadataArgs } from 'src/engine/twenty-orm/interfaces/workspace-entity-metadata-args.interface';
|
||||||
import { WorkspaceRelationMetadataArgs } from 'src/engine/twenty-orm/interfaces/workspace-relation-metadata-args.interface';
|
import { WorkspaceRelationMetadataArgs } from 'src/engine/twenty-orm/interfaces/workspace-relation-metadata-args.interface';
|
||||||
|
import { WorkspaceExtendedEntityMetadataArgs } from 'src/engine/twenty-orm/interfaces/workspace-extended-entity-metadata-args.interface';
|
||||||
|
|
||||||
export class MetadataArgsStorage {
|
export class MetadataArgsStorage {
|
||||||
readonly objects: WorkspaceObjectMetadataArgs[] = [];
|
private readonly entities: WorkspaceEntityMetadataArgs[] = [];
|
||||||
readonly fields: WorkspaceFieldMetadataArgs[] = [];
|
private readonly extendedEntities: WorkspaceExtendedEntityMetadataArgs[] = [];
|
||||||
readonly relations: WorkspaceRelationMetadataArgs[] = [];
|
private readonly fields: WorkspaceFieldMetadataArgs[] = [];
|
||||||
|
private readonly relations: WorkspaceRelationMetadataArgs[] = [];
|
||||||
|
private readonly dynamicRelations: WorkspaceDynamicRelationMetadataArgs[] =
|
||||||
|
[];
|
||||||
|
|
||||||
filterObjects(
|
addEntities(...entities: WorkspaceEntityMetadataArgs[]): void {
|
||||||
|
this.entities.push(...entities);
|
||||||
|
}
|
||||||
|
|
||||||
|
addExtendedEntities(
|
||||||
|
...extendedEntities: WorkspaceExtendedEntityMetadataArgs[]
|
||||||
|
): void {
|
||||||
|
this.extendedEntities.push(...extendedEntities);
|
||||||
|
}
|
||||||
|
|
||||||
|
addFields(...fields: WorkspaceFieldMetadataArgs[]): void {
|
||||||
|
this.fields.push(...fields);
|
||||||
|
}
|
||||||
|
|
||||||
|
addRelations(...relations: WorkspaceRelationMetadataArgs[]): void {
|
||||||
|
this.relations.push(...relations);
|
||||||
|
}
|
||||||
|
|
||||||
|
addDynamicRelations(
|
||||||
|
...dynamicRelations: WorkspaceDynamicRelationMetadataArgs[]
|
||||||
|
): void {
|
||||||
|
this.dynamicRelations.push(...dynamicRelations);
|
||||||
|
}
|
||||||
|
|
||||||
|
filterEntities(
|
||||||
target: Function | string,
|
target: Function | string,
|
||||||
): WorkspaceObjectMetadataArgs | undefined;
|
): WorkspaceEntityMetadataArgs | undefined;
|
||||||
|
|
||||||
filterObjects(target: (Function | string)[]): WorkspaceObjectMetadataArgs[];
|
filterEntities(target: (Function | string)[]): WorkspaceEntityMetadataArgs[];
|
||||||
|
|
||||||
filterObjects(
|
filterEntities(
|
||||||
target: (Function | string) | (Function | string)[],
|
target: (Function | string) | (Function | string)[],
|
||||||
): WorkspaceObjectMetadataArgs | undefined | WorkspaceObjectMetadataArgs[] {
|
): WorkspaceEntityMetadataArgs | undefined | WorkspaceEntityMetadataArgs[] {
|
||||||
const objects = this.filterByTarget(this.objects, target);
|
const objects = this.filterByTarget(this.entities, target);
|
||||||
|
|
||||||
|
return Array.isArray(objects) ? objects[0] : objects;
|
||||||
|
}
|
||||||
|
|
||||||
|
filterExtendedEntities(
|
||||||
|
target: Function | string,
|
||||||
|
): WorkspaceExtendedEntityMetadataArgs | undefined;
|
||||||
|
|
||||||
|
filterExtendedEntities(
|
||||||
|
target: (Function | string)[],
|
||||||
|
): WorkspaceExtendedEntityMetadataArgs[];
|
||||||
|
|
||||||
|
filterExtendedEntities(
|
||||||
|
target: (Function | string) | (Function | string)[],
|
||||||
|
):
|
||||||
|
| WorkspaceExtendedEntityMetadataArgs
|
||||||
|
| undefined
|
||||||
|
| WorkspaceExtendedEntityMetadataArgs[] {
|
||||||
|
const objects = this.filterByTarget(this.extendedEntities, target);
|
||||||
|
|
||||||
return Array.isArray(objects) ? objects[0] : objects;
|
return Array.isArray(objects) ? objects[0] : objects;
|
||||||
}
|
}
|
||||||
@ -45,6 +93,20 @@ export class MetadataArgsStorage {
|
|||||||
return this.filterByTarget(this.relations, target);
|
return this.filterByTarget(this.relations, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filterDynamicRelations(
|
||||||
|
target: Function | string,
|
||||||
|
): WorkspaceDynamicRelationMetadataArgs[];
|
||||||
|
|
||||||
|
filterDynamicRelations(
|
||||||
|
target: (Function | string)[],
|
||||||
|
): WorkspaceDynamicRelationMetadataArgs[];
|
||||||
|
|
||||||
|
filterDynamicRelations(
|
||||||
|
target: (Function | string) | (Function | string)[],
|
||||||
|
): WorkspaceDynamicRelationMetadataArgs[] {
|
||||||
|
return this.filterByTarget(this.dynamicRelations, target);
|
||||||
|
}
|
||||||
|
|
||||||
protected filterByTarget<T extends { target: Function | string }>(
|
protected filterByTarget<T extends { target: Function | string }>(
|
||||||
array: T[],
|
array: T[],
|
||||||
target: (Function | string) | (Function | string)[],
|
target: (Function | string) | (Function | string)[],
|
||||||
|
|||||||
@ -45,7 +45,7 @@ export class TwentyORMCoreModule
|
|||||||
entitySchemaFactory: EntitySchemaFactory,
|
entitySchemaFactory: EntitySchemaFactory,
|
||||||
scopedWorkspaceDatasourceFactory: ScopedWorkspaceDatasourceFactory,
|
scopedWorkspaceDatasourceFactory: ScopedWorkspaceDatasourceFactory,
|
||||||
) => {
|
) => {
|
||||||
const entities = options.objects.map((entityClass) =>
|
const entities = options.workspaceEntities.map((entityClass) =>
|
||||||
entitySchemaFactory.create(entityClass),
|
entitySchemaFactory.create(entityClass),
|
||||||
);
|
);
|
||||||
|
|
||||||
@ -80,7 +80,7 @@ export class TwentyORMCoreModule
|
|||||||
scopedWorkspaceDatasourceFactory: ScopedWorkspaceDatasourceFactory,
|
scopedWorkspaceDatasourceFactory: ScopedWorkspaceDatasourceFactory,
|
||||||
options: TwentyORMOptions,
|
options: TwentyORMOptions,
|
||||||
) => {
|
) => {
|
||||||
const entities = options.objects.map((entityClass) =>
|
const entities = options.workspaceEntities.map((entityClass) =>
|
||||||
entitySchemaFactory.create(entityClass),
|
entitySchemaFactory.create(entityClass),
|
||||||
);
|
);
|
||||||
|
|
||||||
|
|||||||
@ -1,61 +0,0 @@
|
|||||||
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface';
|
|
||||||
|
|
||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
|
||||||
import { ATTACHMENT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
|
||||||
import { WorkspaceObject } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
|
||||||
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
|
||||||
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
|
||||||
import { RelationMetadataType } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/twenty-orm/workspace-object-tests/base.object-metadata';
|
|
||||||
import { WorkspaceMemberObjectMetadata } from 'src/engine/twenty-orm/workspace-object-tests/workspace-member.object-metadata';
|
|
||||||
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
|
||||||
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
|
||||||
|
|
||||||
@WorkspaceObject({
|
|
||||||
standardId: STANDARD_OBJECT_IDS.attachment,
|
|
||||||
namePlural: 'attachments',
|
|
||||||
labelSingular: 'Attachment',
|
|
||||||
labelPlural: 'Attachments',
|
|
||||||
description: 'An attachment',
|
|
||||||
icon: 'IconFileImport',
|
|
||||||
})
|
|
||||||
@WorkspaceIsSystem()
|
|
||||||
@WorkspaceIsNotAuditLogged()
|
|
||||||
export class AttachmentObjectMetadata extends BaseObjectMetadata {
|
|
||||||
@WorkspaceField({
|
|
||||||
standardId: ATTACHMENT_STANDARD_FIELD_IDS.name,
|
|
||||||
type: FieldMetadataType.TEXT,
|
|
||||||
label: 'Name',
|
|
||||||
description: 'Attachment name',
|
|
||||||
icon: 'IconFileUpload',
|
|
||||||
})
|
|
||||||
name: string;
|
|
||||||
|
|
||||||
@WorkspaceField({
|
|
||||||
standardId: ATTACHMENT_STANDARD_FIELD_IDS.fullPath,
|
|
||||||
type: FieldMetadataType.TEXT,
|
|
||||||
label: 'Full path',
|
|
||||||
description: 'Attachment full path',
|
|
||||||
icon: 'IconLink',
|
|
||||||
})
|
|
||||||
fullPath: string;
|
|
||||||
|
|
||||||
@WorkspaceField({
|
|
||||||
standardId: ATTACHMENT_STANDARD_FIELD_IDS.type,
|
|
||||||
type: FieldMetadataType.TEXT,
|
|
||||||
label: 'Type',
|
|
||||||
description: 'Attachment type',
|
|
||||||
icon: 'IconList',
|
|
||||||
})
|
|
||||||
type: string;
|
|
||||||
|
|
||||||
@WorkspaceRelation({
|
|
||||||
standardId: ATTACHMENT_STANDARD_FIELD_IDS.author,
|
|
||||||
label: 'Author',
|
|
||||||
type: RelationMetadataType.MANY_TO_ONE,
|
|
||||||
inverseSideTarget: () => WorkspaceMemberObjectMetadata,
|
|
||||||
inverseSideFieldKey: 'authoredAttachments',
|
|
||||||
})
|
|
||||||
author: Relation<WorkspaceMemberObjectMetadata>;
|
|
||||||
}
|
|
||||||
@ -1,130 +0,0 @@
|
|||||||
import { CurrencyMetadata } from 'src/engine/metadata-modules/field-metadata/composite-types/currency.composite-type';
|
|
||||||
import { LinkMetadata } from 'src/engine/metadata-modules/field-metadata/composite-types/link.composite-type';
|
|
||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
|
||||||
import {
|
|
||||||
RelationMetadataType,
|
|
||||||
RelationOnDeleteAction,
|
|
||||||
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
|
||||||
import { COMPANY_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
|
||||||
import { WorkspaceObject } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
|
||||||
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
|
||||||
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
|
||||||
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
|
||||||
import { WorkspaceMemberObjectMetadata } from 'src/engine/twenty-orm/workspace-object-tests/workspace-member.object-metadata';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/twenty-orm/workspace-object-tests/base.object-metadata';
|
|
||||||
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
|
||||||
|
|
||||||
@WorkspaceObject({
|
|
||||||
standardId: STANDARD_OBJECT_IDS.company,
|
|
||||||
namePlural: 'companies',
|
|
||||||
labelSingular: 'Company',
|
|
||||||
labelPlural: 'Companies',
|
|
||||||
description: 'A company',
|
|
||||||
icon: 'IconBuildingSkyscraper',
|
|
||||||
})
|
|
||||||
export class CompanyObjectMetadata extends BaseObjectMetadata {
|
|
||||||
@WorkspaceField({
|
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.name,
|
|
||||||
type: FieldMetadataType.TEXT,
|
|
||||||
label: 'Name',
|
|
||||||
description: 'The company name',
|
|
||||||
icon: 'IconBuildingSkyscraper',
|
|
||||||
})
|
|
||||||
name: string;
|
|
||||||
|
|
||||||
@WorkspaceField({
|
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.domainName,
|
|
||||||
type: FieldMetadataType.TEXT,
|
|
||||||
label: 'Domain Name',
|
|
||||||
description:
|
|
||||||
'The company website URL. We use this url to fetch the company icon',
|
|
||||||
icon: 'IconLink',
|
|
||||||
})
|
|
||||||
domainName?: string;
|
|
||||||
|
|
||||||
@WorkspaceField({
|
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.address,
|
|
||||||
type: FieldMetadataType.TEXT,
|
|
||||||
label: 'Address',
|
|
||||||
description: 'The company address',
|
|
||||||
icon: 'IconMap',
|
|
||||||
})
|
|
||||||
address: string;
|
|
||||||
|
|
||||||
@WorkspaceField({
|
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.employees,
|
|
||||||
type: FieldMetadataType.NUMBER,
|
|
||||||
label: 'Employees',
|
|
||||||
description: 'Number of employees in the company',
|
|
||||||
icon: 'IconUsers',
|
|
||||||
})
|
|
||||||
@WorkspaceIsNullable()
|
|
||||||
employees: number;
|
|
||||||
|
|
||||||
@WorkspaceField({
|
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.linkedinLink,
|
|
||||||
type: FieldMetadataType.LINK,
|
|
||||||
label: 'Linkedin',
|
|
||||||
description: 'The company Linkedin account',
|
|
||||||
icon: 'IconBrandLinkedin',
|
|
||||||
})
|
|
||||||
@WorkspaceIsNullable()
|
|
||||||
linkedinLink: LinkMetadata;
|
|
||||||
|
|
||||||
@WorkspaceField({
|
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.xLink,
|
|
||||||
type: FieldMetadataType.LINK,
|
|
||||||
label: 'X',
|
|
||||||
description: 'The company Twitter/X account',
|
|
||||||
icon: 'IconBrandX',
|
|
||||||
})
|
|
||||||
@WorkspaceIsNullable()
|
|
||||||
xLink: LinkMetadata;
|
|
||||||
|
|
||||||
@WorkspaceField({
|
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.annualRecurringRevenue,
|
|
||||||
type: FieldMetadataType.CURRENCY,
|
|
||||||
label: 'ARR',
|
|
||||||
description:
|
|
||||||
'Annual Recurring Revenue: The actual or estimated annual revenue of the company',
|
|
||||||
icon: 'IconMoneybag',
|
|
||||||
})
|
|
||||||
@WorkspaceIsNullable()
|
|
||||||
annualRecurringRevenue: CurrencyMetadata;
|
|
||||||
|
|
||||||
@WorkspaceField({
|
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.idealCustomerProfile,
|
|
||||||
type: FieldMetadataType.BOOLEAN,
|
|
||||||
label: 'ICP',
|
|
||||||
description:
|
|
||||||
'Ideal Customer Profile: Indicates whether the company is the most suitable and valuable customer for you',
|
|
||||||
icon: 'IconTarget',
|
|
||||||
defaultValue: false,
|
|
||||||
})
|
|
||||||
idealCustomerProfile: boolean;
|
|
||||||
|
|
||||||
@WorkspaceField({
|
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.position,
|
|
||||||
type: FieldMetadataType.POSITION,
|
|
||||||
label: 'Position',
|
|
||||||
description: 'Company record position',
|
|
||||||
icon: 'IconHierarchy2',
|
|
||||||
})
|
|
||||||
@WorkspaceIsSystem()
|
|
||||||
@WorkspaceIsNullable()
|
|
||||||
position: number;
|
|
||||||
|
|
||||||
@WorkspaceRelation({
|
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.accountOwner,
|
|
||||||
label: 'Account Owner',
|
|
||||||
description:
|
|
||||||
'Your team member responsible for managing the company account',
|
|
||||||
type: RelationMetadataType.MANY_TO_ONE,
|
|
||||||
inverseSideTarget: () => WorkspaceMemberObjectMetadata,
|
|
||||||
inverseSideFieldKey: 'accountOwnerForCompanies',
|
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
|
||||||
})
|
|
||||||
@WorkspaceIsNullable()
|
|
||||||
accountOwner: WorkspaceMemberObjectMetadata;
|
|
||||||
}
|
|
||||||
@ -1,110 +0,0 @@
|
|||||||
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface';
|
|
||||||
|
|
||||||
import { FullNameMetadata } from 'src/engine/metadata-modules/field-metadata/composite-types/full-name.composite-type';
|
|
||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
|
||||||
import {
|
|
||||||
RelationMetadataType,
|
|
||||||
RelationOnDeleteAction,
|
|
||||||
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
|
||||||
import { WORKSPACE_MEMBER_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
|
||||||
import { AttachmentObjectMetadata } from 'src/modules/attachment/standard-objects/attachment.object-metadata';
|
|
||||||
import { WorkspaceObject } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
|
||||||
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
|
||||||
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/twenty-orm/workspace-object-tests/base.object-metadata';
|
|
||||||
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
|
||||||
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
|
||||||
import { CompanyObjectMetadata } from 'src/engine/twenty-orm/workspace-object-tests/company.object-metadata';
|
|
||||||
|
|
||||||
@WorkspaceObject({
|
|
||||||
standardId: STANDARD_OBJECT_IDS.workspaceMember,
|
|
||||||
namePlural: 'workspaceMembers',
|
|
||||||
labelSingular: 'Workspace Member',
|
|
||||||
labelPlural: 'Workspace Members',
|
|
||||||
description: 'A workspace member',
|
|
||||||
icon: 'IconUserCircle',
|
|
||||||
})
|
|
||||||
@WorkspaceIsSystem()
|
|
||||||
@WorkspaceIsNotAuditLogged()
|
|
||||||
export class WorkspaceMemberObjectMetadata extends BaseObjectMetadata {
|
|
||||||
@WorkspaceField({
|
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.name,
|
|
||||||
type: FieldMetadataType.FULL_NAME,
|
|
||||||
label: 'Name',
|
|
||||||
description: 'Workspace member name',
|
|
||||||
icon: 'IconCircleUser',
|
|
||||||
})
|
|
||||||
name: FullNameMetadata;
|
|
||||||
|
|
||||||
@WorkspaceField({
|
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.colorScheme,
|
|
||||||
type: FieldMetadataType.TEXT,
|
|
||||||
label: 'Color Scheme',
|
|
||||||
description: 'Preferred color scheme',
|
|
||||||
icon: 'IconColorSwatch',
|
|
||||||
defaultValue: "'Light'",
|
|
||||||
})
|
|
||||||
colorScheme: string;
|
|
||||||
|
|
||||||
@WorkspaceField({
|
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.locale,
|
|
||||||
type: FieldMetadataType.TEXT,
|
|
||||||
label: 'Language',
|
|
||||||
description: 'Preferred language',
|
|
||||||
icon: 'IconLanguage',
|
|
||||||
defaultValue: "'en'",
|
|
||||||
})
|
|
||||||
locale: string;
|
|
||||||
|
|
||||||
@WorkspaceField({
|
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.avatarUrl,
|
|
||||||
type: FieldMetadataType.TEXT,
|
|
||||||
label: 'Avatar Url',
|
|
||||||
description: 'Workspace member avatar',
|
|
||||||
icon: 'IconFileUpload',
|
|
||||||
})
|
|
||||||
avatarUrl: string;
|
|
||||||
|
|
||||||
@WorkspaceField({
|
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.userEmail,
|
|
||||||
type: FieldMetadataType.TEXT,
|
|
||||||
label: 'User Email',
|
|
||||||
description: 'Related user email address',
|
|
||||||
icon: 'IconMail',
|
|
||||||
})
|
|
||||||
userEmail: string;
|
|
||||||
|
|
||||||
@WorkspaceField({
|
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.userId,
|
|
||||||
type: FieldMetadataType.UUID,
|
|
||||||
label: 'User Id',
|
|
||||||
description: 'Associated User Id',
|
|
||||||
icon: 'IconCircleUsers',
|
|
||||||
})
|
|
||||||
userId: string;
|
|
||||||
|
|
||||||
@WorkspaceRelation({
|
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.authoredAttachments,
|
|
||||||
label: 'Authored attachments',
|
|
||||||
description: 'Attachments created by the workspace member',
|
|
||||||
icon: 'IconFileImport',
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => AttachmentObjectMetadata,
|
|
||||||
inverseSideFieldKey: 'author',
|
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
|
||||||
})
|
|
||||||
authoredAttachments: Relation<AttachmentObjectMetadata[]>;
|
|
||||||
|
|
||||||
@WorkspaceRelation({
|
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.accountOwnerForCompanies,
|
|
||||||
label: 'Account Owner For Companies',
|
|
||||||
description: 'Account owner for companies',
|
|
||||||
icon: 'IconBriefcase',
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => CompanyObjectMetadata,
|
|
||||||
inverseSideFieldKey: 'accountOwner',
|
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
|
||||||
})
|
|
||||||
accountOwnerForCompanies: Relation<CompanyObjectMetadata[]>;
|
|
||||||
}
|
|
||||||
@ -10,7 +10,7 @@ import { standardObjectMetadataDefinitions } from 'src/engine/workspace-manager/
|
|||||||
import { StandardObjectFactory } from 'src/engine/workspace-manager/workspace-sync-metadata/factories/standard-object.factory';
|
import { StandardObjectFactory } from 'src/engine/workspace-manager/workspace-sync-metadata/factories/standard-object.factory';
|
||||||
import { computeStandardObject } from 'src/engine/workspace-manager/workspace-sync-metadata/utils/compute-standard-object.util';
|
import { computeStandardObject } from 'src/engine/workspace-manager/workspace-sync-metadata/utils/compute-standard-object.util';
|
||||||
import { StandardFieldFactory } from 'src/engine/workspace-manager/workspace-sync-metadata/factories/standard-field.factory';
|
import { StandardFieldFactory } from 'src/engine/workspace-manager/workspace-sync-metadata/factories/standard-field.factory';
|
||||||
import { CustomObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/custom-objects/custom.object-metadata';
|
import { CustomWorkspaceEntity } from 'src/engine/twenty-orm/custom.workspace-entity';
|
||||||
|
|
||||||
interface RunCommandOptions {
|
interface RunCommandOptions {
|
||||||
workspaceId?: string;
|
workspaceId?: string;
|
||||||
@ -61,7 +61,7 @@ export class AddStandardIdCommand extends CommandRunner {
|
|||||||
},
|
},
|
||||||
);
|
);
|
||||||
const standardFieldMetadataCollection = this.standardFieldFactory.create(
|
const standardFieldMetadataCollection = this.standardFieldFactory.create(
|
||||||
CustomObjectMetadata,
|
CustomWorkspaceEntity,
|
||||||
{
|
{
|
||||||
workspaceId: '',
|
workspaceId: '',
|
||||||
dataSourceId: '',
|
dataSourceId: '',
|
||||||
|
|||||||
@ -1,20 +0,0 @@
|
|||||||
import { BaseCustomObjectMetadataDecoratorParams } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/reflect-custom-object-metadata.interface';
|
|
||||||
|
|
||||||
import { TypedReflect } from 'src/utils/typed-reflect';
|
|
||||||
|
|
||||||
export function BaseCustomObjectMetadata(
|
|
||||||
params?: BaseCustomObjectMetadataDecoratorParams,
|
|
||||||
): ClassDecorator {
|
|
||||||
return (target) => {
|
|
||||||
const gate = TypedReflect.getMetadata('gate', target);
|
|
||||||
|
|
||||||
TypedReflect.defineMetadata(
|
|
||||||
'extendObjectMetadata',
|
|
||||||
{
|
|
||||||
...params,
|
|
||||||
gate,
|
|
||||||
},
|
|
||||||
target,
|
|
||||||
);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
import { DynamicRelationFieldMetadataDecoratorParams } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/reflect-computed-relation-field-metadata.interface';
|
|
||||||
|
|
||||||
import { TypedReflect } from 'src/utils/typed-reflect';
|
|
||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
|
||||||
|
|
||||||
export function DynamicRelationFieldMetadata(
|
|
||||||
params: DynamicRelationFieldMetadataDecoratorParams,
|
|
||||||
): PropertyDecorator {
|
|
||||||
return (target: object, fieldKey: string) => {
|
|
||||||
const isSystem =
|
|
||||||
TypedReflect.getMetadata('isSystem', target, fieldKey) ?? false;
|
|
||||||
const gate = TypedReflect.getMetadata('gate', target, fieldKey);
|
|
||||||
|
|
||||||
TypedReflect.defineMetadata(
|
|
||||||
'dynamicRelationFieldMetadataMap',
|
|
||||||
{
|
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
paramsFactory: params,
|
|
||||||
isCustom: false,
|
|
||||||
isNullable: true,
|
|
||||||
isSystem,
|
|
||||||
gate,
|
|
||||||
},
|
|
||||||
target.constructor,
|
|
||||||
);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,92 +0,0 @@
|
|||||||
import {
|
|
||||||
FieldMetadataDecoratorParams,
|
|
||||||
ReflectFieldMetadata,
|
|
||||||
} from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/reflect-field-metadata.interface';
|
|
||||||
import { GateDecoratorParams } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/gate-decorator.interface';
|
|
||||||
import { FieldMetadataDefaultValue } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata-default-value.interface';
|
|
||||||
|
|
||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
|
||||||
import { generateDefaultValue } from 'src/engine/metadata-modules/field-metadata/utils/generate-default-value';
|
|
||||||
import { TypedReflect } from 'src/utils/typed-reflect';
|
|
||||||
import { createDeterministicUuid } from 'src/engine/workspace-manager/workspace-sync-metadata/utils/create-deterministic-uuid.util';
|
|
||||||
|
|
||||||
export function FieldMetadata<T extends FieldMetadataType>(
|
|
||||||
params: FieldMetadataDecoratorParams<T>,
|
|
||||||
): PropertyDecorator {
|
|
||||||
return (target: object, fieldKey: string) => {
|
|
||||||
const existingFieldMetadata =
|
|
||||||
TypedReflect.getMetadata('fieldMetadataMap', target.constructor) ?? {};
|
|
||||||
const isNullable =
|
|
||||||
TypedReflect.getMetadata('isNullable', target, fieldKey) ?? false;
|
|
||||||
const isSystem =
|
|
||||||
TypedReflect.getMetadata('isSystem', target, fieldKey) ?? false;
|
|
||||||
const gate = TypedReflect.getMetadata('gate', target, fieldKey);
|
|
||||||
const { joinColumn, standardId, ...restParams } = params;
|
|
||||||
|
|
||||||
TypedReflect.defineMetadata(
|
|
||||||
'fieldMetadataMap',
|
|
||||||
{
|
|
||||||
...existingFieldMetadata,
|
|
||||||
[fieldKey]: generateFieldMetadata<T>(
|
|
||||||
{
|
|
||||||
...restParams,
|
|
||||||
standardId,
|
|
||||||
joinColumn,
|
|
||||||
},
|
|
||||||
fieldKey,
|
|
||||||
isNullable,
|
|
||||||
isSystem,
|
|
||||||
gate,
|
|
||||||
),
|
|
||||||
...(joinColumn && restParams.type === FieldMetadataType.RELATION
|
|
||||||
? {
|
|
||||||
[joinColumn]: generateFieldMetadata<FieldMetadataType.UUID>(
|
|
||||||
{
|
|
||||||
...restParams,
|
|
||||||
standardId: createDeterministicUuid(standardId),
|
|
||||||
type: FieldMetadataType.UUID,
|
|
||||||
label: `${restParams.label} id (foreign key)`,
|
|
||||||
description: `${restParams.description} id foreign key`,
|
|
||||||
defaultValue: null,
|
|
||||||
options: undefined,
|
|
||||||
settings: undefined,
|
|
||||||
joinColumn,
|
|
||||||
},
|
|
||||||
joinColumn,
|
|
||||||
isNullable,
|
|
||||||
true,
|
|
||||||
gate,
|
|
||||||
),
|
|
||||||
}
|
|
||||||
: {}),
|
|
||||||
},
|
|
||||||
target.constructor,
|
|
||||||
);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
|
|
||||||
function generateFieldMetadata<T extends FieldMetadataType>(
|
|
||||||
params: FieldMetadataDecoratorParams<T>,
|
|
||||||
fieldKey: string,
|
|
||||||
isNullable: boolean,
|
|
||||||
isSystem: boolean,
|
|
||||||
gate: GateDecoratorParams | undefined = undefined,
|
|
||||||
): ReflectFieldMetadata[string] {
|
|
||||||
const defaultValue = (params.defaultValue ??
|
|
||||||
generateDefaultValue(
|
|
||||||
params.type,
|
|
||||||
)) as FieldMetadataDefaultValue<'default'> | null;
|
|
||||||
|
|
||||||
return {
|
|
||||||
name: fieldKey,
|
|
||||||
...params,
|
|
||||||
isNullable: params.type === FieldMetadataType.RELATION ? true : isNullable,
|
|
||||||
isSystem,
|
|
||||||
isCustom: false,
|
|
||||||
options: params.options,
|
|
||||||
description: params.description,
|
|
||||||
icon: params.icon,
|
|
||||||
defaultValue,
|
|
||||||
gate,
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
import { GateDecoratorParams } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/gate-decorator.interface';
|
|
||||||
|
|
||||||
import { TypedReflect } from 'src/utils/typed-reflect';
|
|
||||||
|
|
||||||
export function Gate(metadata: GateDecoratorParams) {
|
|
||||||
return function (target: object, fieldKey?: string) {
|
|
||||||
if (fieldKey) {
|
|
||||||
TypedReflect.defineMetadata('gate', metadata, target, fieldKey);
|
|
||||||
} else {
|
|
||||||
TypedReflect.defineMetadata('gate', metadata, target);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
import { TypedReflect } from 'src/utils/typed-reflect';
|
|
||||||
|
|
||||||
export function IsNotAuditLogged() {
|
|
||||||
return function (target: object) {
|
|
||||||
TypedReflect.defineMetadata('isAuditLogged', false, target);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,7 +0,0 @@
|
|||||||
import { TypedReflect } from 'src/utils/typed-reflect';
|
|
||||||
|
|
||||||
export function IsNullable() {
|
|
||||||
return function (target: object, fieldKey: string) {
|
|
||||||
TypedReflect.defineMetadata('isNullable', true, target, fieldKey);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,11 +0,0 @@
|
|||||||
import { TypedReflect } from 'src/utils/typed-reflect';
|
|
||||||
|
|
||||||
export function IsSystem() {
|
|
||||||
return function (target: object, fieldKey?: string) {
|
|
||||||
if (fieldKey) {
|
|
||||||
TypedReflect.defineMetadata('isSystem', true, target, fieldKey);
|
|
||||||
} else {
|
|
||||||
TypedReflect.defineMetadata('isSystem', true, target);
|
|
||||||
}
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
import { ObjectMetadataDecoratorParams } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/reflect-object-metadata.interface';
|
|
||||||
|
|
||||||
import { TypedReflect } from 'src/utils/typed-reflect';
|
|
||||||
import { convertClassNameToObjectMetadataName } from 'src/engine/workspace-manager/workspace-sync-metadata/utils/convert-class-to-object-metadata-name.util';
|
|
||||||
|
|
||||||
export function ObjectMetadata(
|
|
||||||
params: ObjectMetadataDecoratorParams,
|
|
||||||
): ClassDecorator {
|
|
||||||
return (target) => {
|
|
||||||
const isSystem = TypedReflect.getMetadata('isSystem', target) ?? false;
|
|
||||||
const isAuditLogged =
|
|
||||||
TypedReflect.getMetadata('isAuditLogged', target) ?? true;
|
|
||||||
const gate = TypedReflect.getMetadata('gate', target);
|
|
||||||
const objectName = convertClassNameToObjectMetadataName(target.name);
|
|
||||||
|
|
||||||
TypedReflect.defineMetadata(
|
|
||||||
'objectMetadata',
|
|
||||||
{
|
|
||||||
nameSingular: objectName,
|
|
||||||
...params,
|
|
||||||
targetTableName: 'DEPRECATED',
|
|
||||||
isSystem,
|
|
||||||
isCustom: false,
|
|
||||||
isRemote: false,
|
|
||||||
isAuditLogged,
|
|
||||||
description: params.description,
|
|
||||||
icon: params.icon,
|
|
||||||
gate,
|
|
||||||
},
|
|
||||||
target,
|
|
||||||
);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
import 'reflect-metadata';
|
|
||||||
|
|
||||||
import {
|
|
||||||
ReflectRelationMetadata,
|
|
||||||
RelationMetadataDecoratorParams,
|
|
||||||
} from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/reflect-relation-metadata.interface';
|
|
||||||
|
|
||||||
import { TypedReflect } from 'src/utils/typed-reflect';
|
|
||||||
|
|
||||||
export function RelationMetadata<TClass extends object>(
|
|
||||||
params: RelationMetadataDecoratorParams<TClass>,
|
|
||||||
): PropertyDecorator {
|
|
||||||
return (target: object, fieldKey: string) => {
|
|
||||||
const relationMetadataCollection =
|
|
||||||
TypedReflect.getMetadata(
|
|
||||||
'reflectRelationMetadataCollection',
|
|
||||||
target.constructor,
|
|
||||||
) ?? [];
|
|
||||||
const gate = TypedReflect.getMetadata('gate', target, fieldKey);
|
|
||||||
|
|
||||||
TypedReflect.defineMetadata(
|
|
||||||
'reflectRelationMetadataCollection',
|
|
||||||
[
|
|
||||||
...relationMetadataCollection,
|
|
||||||
{
|
|
||||||
target,
|
|
||||||
fieldKey,
|
|
||||||
...params,
|
|
||||||
gate,
|
|
||||||
} satisfies ReflectRelationMetadata,
|
|
||||||
],
|
|
||||||
target.constructor,
|
|
||||||
);
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -6,97 +6,219 @@ import {
|
|||||||
PartialComputedFieldMetadata,
|
PartialComputedFieldMetadata,
|
||||||
PartialFieldMetadata,
|
PartialFieldMetadata,
|
||||||
} from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/partial-field-metadata.interface';
|
} from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/partial-field-metadata.interface';
|
||||||
import { ReflectFieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/reflect-field-metadata.interface';
|
import { WorkspaceEntityMetadataArgs } from 'src/engine/twenty-orm/interfaces/workspace-entity-metadata-args.interface';
|
||||||
import { ReflectObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/reflect-object-metadata.interface';
|
import { WorkspaceFieldMetadataArgs } from 'src/engine/twenty-orm/interfaces/workspace-field-metadata-args.interface';
|
||||||
import { ReflectDynamicRelationFieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/reflect-computed-relation-field-metadata.interface';
|
import { WorkspaceDynamicRelationMetadataArgs } from 'src/engine/twenty-orm/interfaces/workspace-dynamic-relation-metadata-args.interface';
|
||||||
|
import { WorkspaceRelationMetadataArgs } from 'src/engine/twenty-orm/interfaces/workspace-relation-metadata-args.interface';
|
||||||
|
|
||||||
import { TypedReflect } from 'src/utils/typed-reflect';
|
|
||||||
import { isGatedAndNotEnabled } from 'src/engine/workspace-manager/workspace-sync-metadata/utils/is-gate-and-not-enabled.util';
|
import { isGatedAndNotEnabled } from 'src/engine/workspace-manager/workspace-sync-metadata/utils/is-gate-and-not-enabled.util';
|
||||||
|
import { metadataArgsStorage } from 'src/engine/twenty-orm/storage/metadata-args.storage';
|
||||||
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
|
import { createDeterministicUuid } from 'src/engine/workspace-manager/workspace-sync-metadata/utils/create-deterministic-uuid.util';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class StandardFieldFactory {
|
export class StandardFieldFactory {
|
||||||
create(
|
create(
|
||||||
target: object,
|
target: typeof BaseWorkspaceEntity,
|
||||||
context: WorkspaceSyncContext,
|
context: WorkspaceSyncContext,
|
||||||
workspaceFeatureFlagsMap: FeatureFlagMap,
|
workspaceFeatureFlagsMap: FeatureFlagMap,
|
||||||
): (PartialFieldMetadata | PartialComputedFieldMetadata)[] {
|
): Array<PartialFieldMetadata | PartialComputedFieldMetadata> {
|
||||||
const reflectObjectMetadata = TypedReflect.getMetadata(
|
const workspaceEntityMetadataArgs =
|
||||||
'objectMetadata',
|
metadataArgsStorage.filterEntities(target);
|
||||||
target,
|
const metadataCollections = this.collectMetadata(target);
|
||||||
);
|
|
||||||
const reflectFieldMetadataMap =
|
|
||||||
TypedReflect.getMetadata('fieldMetadataMap', target) ?? [];
|
|
||||||
const reflectDynamicRelationFieldMetadataMap = TypedReflect.getMetadata(
|
|
||||||
'dynamicRelationFieldMetadataMap',
|
|
||||||
target,
|
|
||||||
);
|
|
||||||
const partialFieldMetadataCollection: (
|
|
||||||
| PartialFieldMetadata
|
|
||||||
| PartialComputedFieldMetadata
|
|
||||||
)[] = Object.values(reflectFieldMetadataMap)
|
|
||||||
.map((reflectFieldMetadata) =>
|
|
||||||
this.createFieldMetadata(
|
|
||||||
reflectObjectMetadata,
|
|
||||||
reflectFieldMetadata,
|
|
||||||
context,
|
|
||||||
workspaceFeatureFlagsMap,
|
|
||||||
),
|
|
||||||
)
|
|
||||||
.filter((metadata): metadata is PartialFieldMetadata => !!metadata);
|
|
||||||
const partialComputedFieldMetadata = this.createComputedFieldMetadata(
|
|
||||||
reflectDynamicRelationFieldMetadataMap,
|
|
||||||
context,
|
|
||||||
workspaceFeatureFlagsMap,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (partialComputedFieldMetadata) {
|
return [
|
||||||
partialFieldMetadataCollection.push(partialComputedFieldMetadata);
|
...this.processMetadata(
|
||||||
}
|
workspaceEntityMetadataArgs,
|
||||||
|
metadataCollections.fields,
|
||||||
return partialFieldMetadataCollection;
|
context,
|
||||||
|
workspaceFeatureFlagsMap,
|
||||||
|
this.createFieldMetadata,
|
||||||
|
),
|
||||||
|
...this.processMetadata(
|
||||||
|
workspaceEntityMetadataArgs,
|
||||||
|
metadataCollections.relations,
|
||||||
|
context,
|
||||||
|
workspaceFeatureFlagsMap,
|
||||||
|
this.createFieldRelationMetadata,
|
||||||
|
),
|
||||||
|
...this.processMetadata(
|
||||||
|
workspaceEntityMetadataArgs,
|
||||||
|
metadataCollections.dynamicRelations,
|
||||||
|
context,
|
||||||
|
workspaceFeatureFlagsMap,
|
||||||
|
this.createComputedFieldRelationMetadata,
|
||||||
|
),
|
||||||
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
private createFieldMetadata(
|
private collectMetadata(target: typeof BaseWorkspaceEntity) {
|
||||||
reflectObjectMetadata: ReflectObjectMetadata | undefined,
|
|
||||||
reflectFieldMetadata: ReflectFieldMetadata[string],
|
|
||||||
context: WorkspaceSyncContext,
|
|
||||||
workspaceFeatureFlagsMap: FeatureFlagMap,
|
|
||||||
): PartialFieldMetadata | undefined {
|
|
||||||
if (
|
|
||||||
isGatedAndNotEnabled(reflectFieldMetadata.gate, workspaceFeatureFlagsMap)
|
|
||||||
) {
|
|
||||||
return undefined;
|
|
||||||
}
|
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...reflectFieldMetadata,
|
fields: metadataArgsStorage.filterFields(target),
|
||||||
workspaceId: context.workspaceId,
|
relations: metadataArgsStorage.filterRelations(target),
|
||||||
isSystem:
|
dynamicRelations: metadataArgsStorage.filterDynamicRelations(target),
|
||||||
reflectObjectMetadata?.isSystem || reflectFieldMetadata.isSystem,
|
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
private createComputedFieldMetadata(
|
private processMetadata<
|
||||||
reflectDynamicRelationFieldMetadata:
|
T,
|
||||||
| ReflectDynamicRelationFieldMetadata
|
U extends PartialFieldMetadata | PartialComputedFieldMetadata,
|
||||||
| undefined,
|
>(
|
||||||
|
workspaceEntityMetadataArgs: WorkspaceEntityMetadataArgs | undefined,
|
||||||
|
metadataArgs: T[],
|
||||||
|
context: WorkspaceSyncContext,
|
||||||
|
featureFlagsMap: FeatureFlagMap,
|
||||||
|
createMetadata: (
|
||||||
|
workspaceEntityMetadataArgs: WorkspaceEntityMetadataArgs | undefined,
|
||||||
|
args: T,
|
||||||
|
context: WorkspaceSyncContext,
|
||||||
|
featureFlagsMap: FeatureFlagMap,
|
||||||
|
) => U[],
|
||||||
|
): U[] {
|
||||||
|
return metadataArgs
|
||||||
|
.flatMap((args) =>
|
||||||
|
createMetadata(
|
||||||
|
workspaceEntityMetadataArgs,
|
||||||
|
args,
|
||||||
|
context,
|
||||||
|
featureFlagsMap,
|
||||||
|
),
|
||||||
|
)
|
||||||
|
.filter(Boolean) as U[];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create field metadata
|
||||||
|
*/
|
||||||
|
private createFieldMetadata(
|
||||||
|
workspaceEntityMetadataArgs: WorkspaceEntityMetadataArgs | undefined,
|
||||||
|
workspaceFieldMetadataArgs: WorkspaceFieldMetadataArgs,
|
||||||
context: WorkspaceSyncContext,
|
context: WorkspaceSyncContext,
|
||||||
workspaceFeatureFlagsMap: FeatureFlagMap,
|
workspaceFeatureFlagsMap: FeatureFlagMap,
|
||||||
): PartialComputedFieldMetadata | undefined {
|
): PartialFieldMetadata[] {
|
||||||
if (
|
if (
|
||||||
!reflectDynamicRelationFieldMetadata ||
|
|
||||||
isGatedAndNotEnabled(
|
isGatedAndNotEnabled(
|
||||||
reflectDynamicRelationFieldMetadata.gate,
|
workspaceFieldMetadataArgs.gate,
|
||||||
workspaceFeatureFlagsMap,
|
workspaceFeatureFlagsMap,
|
||||||
)
|
)
|
||||||
) {
|
) {
|
||||||
return undefined;
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return {
|
return [
|
||||||
...reflectDynamicRelationFieldMetadata,
|
{
|
||||||
|
type: workspaceFieldMetadataArgs.type,
|
||||||
|
standardId: workspaceFieldMetadataArgs.standardId,
|
||||||
|
name: workspaceFieldMetadataArgs.name,
|
||||||
|
icon: workspaceFieldMetadataArgs.icon,
|
||||||
|
label: workspaceFieldMetadataArgs.label,
|
||||||
|
description: workspaceFieldMetadataArgs.description,
|
||||||
|
defaultValue: workspaceFieldMetadataArgs.defaultValue,
|
||||||
|
options: workspaceFieldMetadataArgs.options,
|
||||||
|
workspaceId: context.workspaceId,
|
||||||
|
isNullable: workspaceFieldMetadataArgs.isNullable,
|
||||||
|
isCustom: false,
|
||||||
|
isSystem:
|
||||||
|
workspaceEntityMetadataArgs?.isSystem ||
|
||||||
|
workspaceFieldMetadataArgs.isSystem,
|
||||||
|
},
|
||||||
|
];
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create relation field metadata
|
||||||
|
*/
|
||||||
|
private createFieldRelationMetadata(
|
||||||
|
workspaceEntityMetadataArgs: WorkspaceEntityMetadataArgs | undefined,
|
||||||
|
workspaceRelationMetadataArgs: WorkspaceRelationMetadataArgs,
|
||||||
|
context: WorkspaceSyncContext,
|
||||||
|
workspaceFeatureFlagsMap: FeatureFlagMap,
|
||||||
|
): PartialFieldMetadata[] {
|
||||||
|
const fieldMetadataCollection: PartialFieldMetadata[] = [];
|
||||||
|
const foreignKeyStandardId = createDeterministicUuid(
|
||||||
|
workspaceRelationMetadataArgs.standardId,
|
||||||
|
);
|
||||||
|
|
||||||
|
if (
|
||||||
|
isGatedAndNotEnabled(
|
||||||
|
workspaceRelationMetadataArgs.gate,
|
||||||
|
workspaceFeatureFlagsMap,
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
if (workspaceRelationMetadataArgs.joinColumn) {
|
||||||
|
fieldMetadataCollection.push({
|
||||||
|
type: FieldMetadataType.UUID,
|
||||||
|
standardId: foreignKeyStandardId,
|
||||||
|
name: workspaceRelationMetadataArgs.joinColumn,
|
||||||
|
label: `${workspaceRelationMetadataArgs.label} id (foreign key)`,
|
||||||
|
description: `${workspaceRelationMetadataArgs.description} id foreign key`,
|
||||||
|
icon: workspaceRelationMetadataArgs.icon,
|
||||||
|
defaultValue: null,
|
||||||
|
options: undefined,
|
||||||
|
settings: undefined,
|
||||||
|
workspaceId: context.workspaceId,
|
||||||
|
isCustom: false,
|
||||||
|
isSystem: true,
|
||||||
|
isNullable: workspaceRelationMetadataArgs.isNullable,
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
fieldMetadataCollection.push({
|
||||||
|
type: FieldMetadataType.RELATION,
|
||||||
|
standardId: workspaceRelationMetadataArgs.standardId,
|
||||||
|
name: workspaceRelationMetadataArgs.name,
|
||||||
|
label: workspaceRelationMetadataArgs.label,
|
||||||
|
description: workspaceRelationMetadataArgs.description,
|
||||||
|
icon: workspaceRelationMetadataArgs.icon,
|
||||||
|
defaultValue: null,
|
||||||
workspaceId: context.workspaceId,
|
workspaceId: context.workspaceId,
|
||||||
isSystem: reflectDynamicRelationFieldMetadata.isSystem,
|
isCustom: false,
|
||||||
};
|
isSystem:
|
||||||
|
workspaceEntityMetadataArgs?.isSystem ||
|
||||||
|
workspaceRelationMetadataArgs.isSystem,
|
||||||
|
isNullable: true,
|
||||||
|
});
|
||||||
|
|
||||||
|
return fieldMetadataCollection;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Create computed field relation metadata
|
||||||
|
*/
|
||||||
|
private createComputedFieldRelationMetadata(
|
||||||
|
workspaceEntityMetadataArgs: WorkspaceEntityMetadataArgs | undefined,
|
||||||
|
workspaceDynamicRelationMetadataArgs:
|
||||||
|
| WorkspaceDynamicRelationMetadataArgs
|
||||||
|
| undefined,
|
||||||
|
context: WorkspaceSyncContext,
|
||||||
|
workspaceFeatureFlagsMap: FeatureFlagMap,
|
||||||
|
): PartialComputedFieldMetadata[] {
|
||||||
|
if (
|
||||||
|
!workspaceDynamicRelationMetadataArgs ||
|
||||||
|
isGatedAndNotEnabled(
|
||||||
|
workspaceDynamicRelationMetadataArgs.gate,
|
||||||
|
workspaceFeatureFlagsMap,
|
||||||
|
)
|
||||||
|
) {
|
||||||
|
return [];
|
||||||
|
}
|
||||||
|
|
||||||
|
return [
|
||||||
|
// Foreign key will be computed in compute-standard-object.util.ts, because we need to know the custom object
|
||||||
|
{
|
||||||
|
type: FieldMetadataType.RELATION,
|
||||||
|
argsFactory: workspaceDynamicRelationMetadataArgs.argsFactory,
|
||||||
|
workspaceId: context.workspaceId,
|
||||||
|
isCustom: false,
|
||||||
|
isSystem:
|
||||||
|
workspaceEntityMetadataArgs?.isSystem ||
|
||||||
|
workspaceDynamicRelationMetadataArgs.isSystem,
|
||||||
|
isNullable: workspaceDynamicRelationMetadataArgs.isNullable,
|
||||||
|
},
|
||||||
|
];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -4,9 +4,9 @@ import { WorkspaceSyncContext } from 'src/engine/workspace-manager/workspace-syn
|
|||||||
import { PartialObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/partial-object-metadata.interface';
|
import { PartialObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/partial-object-metadata.interface';
|
||||||
import { FeatureFlagMap } from 'src/engine/core-modules/feature-flag/interfaces/feature-flag-map.interface';
|
import { FeatureFlagMap } from 'src/engine/core-modules/feature-flag/interfaces/feature-flag-map.interface';
|
||||||
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { TypedReflect } from 'src/utils/typed-reflect';
|
|
||||||
import { isGatedAndNotEnabled } from 'src/engine/workspace-manager/workspace-sync-metadata/utils/is-gate-and-not-enabled.util';
|
import { isGatedAndNotEnabled } from 'src/engine/workspace-manager/workspace-sync-metadata/utils/is-gate-and-not-enabled.util';
|
||||||
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { metadataArgsStorage } from 'src/engine/twenty-orm/storage/metadata-args.storage';
|
||||||
|
|
||||||
import { StandardFieldFactory } from './standard-field.factory';
|
import { StandardFieldFactory } from './standard-field.factory';
|
||||||
|
|
||||||
@ -15,7 +15,7 @@ export class StandardObjectFactory {
|
|||||||
constructor(private readonly standardFieldFactory: StandardFieldFactory) {}
|
constructor(private readonly standardFieldFactory: StandardFieldFactory) {}
|
||||||
|
|
||||||
create(
|
create(
|
||||||
standardObjectMetadataDefinitions: (typeof BaseObjectMetadata)[],
|
standardObjectMetadataDefinitions: (typeof BaseWorkspaceEntity)[],
|
||||||
context: WorkspaceSyncContext,
|
context: WorkspaceSyncContext,
|
||||||
workspaceFeatureFlagsMap: FeatureFlagMap,
|
workspaceFeatureFlagsMap: FeatureFlagMap,
|
||||||
): PartialObjectMetadata[] {
|
): PartialObjectMetadata[] {
|
||||||
@ -27,32 +27,43 @@ export class StandardObjectFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private createObjectMetadata(
|
private createObjectMetadata(
|
||||||
metadata: typeof BaseObjectMetadata,
|
target: typeof BaseWorkspaceEntity,
|
||||||
context: WorkspaceSyncContext,
|
context: WorkspaceSyncContext,
|
||||||
workspaceFeatureFlagsMap: FeatureFlagMap,
|
workspaceFeatureFlagsMap: FeatureFlagMap,
|
||||||
): PartialObjectMetadata | undefined {
|
): PartialObjectMetadata | undefined {
|
||||||
const objectMetadata = TypedReflect.getMetadata('objectMetadata', metadata);
|
const workspaceEntityMetadataArgs =
|
||||||
|
metadataArgsStorage.filterEntities(target);
|
||||||
|
|
||||||
if (!objectMetadata) {
|
if (!workspaceEntityMetadataArgs) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Object metadata decorator not found, can't parse ${metadata.name}`,
|
`Object metadata decorator not found, can't parse ${target.name}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (isGatedAndNotEnabled(objectMetadata.gate, workspaceFeatureFlagsMap)) {
|
if (
|
||||||
|
isGatedAndNotEnabled(
|
||||||
|
workspaceEntityMetadataArgs.gate,
|
||||||
|
workspaceFeatureFlagsMap,
|
||||||
|
)
|
||||||
|
) {
|
||||||
return undefined;
|
return undefined;
|
||||||
}
|
}
|
||||||
|
|
||||||
const fields = this.standardFieldFactory.create(
|
const fields = this.standardFieldFactory.create(
|
||||||
metadata,
|
target,
|
||||||
context,
|
context,
|
||||||
workspaceFeatureFlagsMap,
|
workspaceFeatureFlagsMap,
|
||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
...objectMetadata,
|
...workspaceEntityMetadataArgs,
|
||||||
|
// TODO: Remove targetTableName when we remove the old metadata
|
||||||
|
targetTableName: 'DEPRECATED',
|
||||||
workspaceId: context.workspaceId,
|
workspaceId: context.workspaceId,
|
||||||
dataSourceId: context.dataSourceId,
|
dataSourceId: context.dataSourceId,
|
||||||
|
isCustom: false,
|
||||||
|
isRemote: false,
|
||||||
|
isSystem: workspaceEntityMetadataArgs.isSystem ?? false,
|
||||||
fields,
|
fields,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,17 +3,20 @@ import { Injectable } from '@nestjs/common';
|
|||||||
import { WorkspaceSyncContext } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/workspace-sync-context.interface';
|
import { WorkspaceSyncContext } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/workspace-sync-context.interface';
|
||||||
import { FeatureFlagMap } from 'src/engine/core-modules/feature-flag/interfaces/feature-flag-map.interface';
|
import { FeatureFlagMap } from 'src/engine/core-modules/feature-flag/interfaces/feature-flag-map.interface';
|
||||||
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { TypedReflect } from 'src/utils/typed-reflect';
|
|
||||||
import { isGatedAndNotEnabled } from 'src/engine/workspace-manager/workspace-sync-metadata/utils/is-gate-and-not-enabled.util';
|
import { isGatedAndNotEnabled } from 'src/engine/workspace-manager/workspace-sync-metadata/utils/is-gate-and-not-enabled.util';
|
||||||
import { assert } from 'src/utils/assert';
|
import { assert } from 'src/utils/assert';
|
||||||
import { RelationMetadataEntity } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
import {
|
||||||
|
RelationMetadataEntity,
|
||||||
|
RelationMetadataType,
|
||||||
|
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||||
import { convertClassNameToObjectMetadataName } from 'src/engine/workspace-manager/workspace-sync-metadata/utils/convert-class-to-object-metadata-name.util';
|
import { convertClassNameToObjectMetadataName } from 'src/engine/workspace-manager/workspace-sync-metadata/utils/convert-class-to-object-metadata-name.util';
|
||||||
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { metadataArgsStorage } from 'src/engine/twenty-orm/storage/metadata-args.storage';
|
||||||
|
|
||||||
interface CustomRelationFactory {
|
interface CustomRelationFactory {
|
||||||
object: ObjectMetadataEntity;
|
object: ObjectMetadataEntity;
|
||||||
metadata: typeof BaseObjectMetadata;
|
metadata: typeof BaseWorkspaceEntity;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -26,7 +29,7 @@ export class StandardRelationFactory {
|
|||||||
): Partial<RelationMetadataEntity>[];
|
): Partial<RelationMetadataEntity>[];
|
||||||
|
|
||||||
create(
|
create(
|
||||||
standardObjectMetadataDefinitions: (typeof BaseObjectMetadata)[],
|
standardObjectMetadataDefinitions: (typeof BaseWorkspaceEntity)[],
|
||||||
context: WorkspaceSyncContext,
|
context: WorkspaceSyncContext,
|
||||||
originalObjectMetadataMap: Record<string, ObjectMetadataEntity>,
|
originalObjectMetadataMap: Record<string, ObjectMetadataEntity>,
|
||||||
workspaceFeatureFlagsMap: FeatureFlagMap,
|
workspaceFeatureFlagsMap: FeatureFlagMap,
|
||||||
@ -34,10 +37,10 @@ export class StandardRelationFactory {
|
|||||||
|
|
||||||
create(
|
create(
|
||||||
standardObjectMetadataDefinitionsOrCustomObjectFactories:
|
standardObjectMetadataDefinitionsOrCustomObjectFactories:
|
||||||
| (typeof BaseObjectMetadata)[]
|
| (typeof BaseWorkspaceEntity)[]
|
||||||
| {
|
| {
|
||||||
object: ObjectMetadataEntity;
|
object: ObjectMetadataEntity;
|
||||||
metadata: typeof BaseObjectMetadata;
|
metadata: typeof BaseWorkspaceEntity;
|
||||||
}[],
|
}[],
|
||||||
context: WorkspaceSyncContext,
|
context: WorkspaceSyncContext,
|
||||||
originalObjectMetadataMap: Record<string, ObjectMetadataEntity>,
|
originalObjectMetadataMap: Record<string, ObjectMetadataEntity>,
|
||||||
@ -46,7 +49,7 @@ export class StandardRelationFactory {
|
|||||||
return standardObjectMetadataDefinitionsOrCustomObjectFactories.flatMap(
|
return standardObjectMetadataDefinitionsOrCustomObjectFactories.flatMap(
|
||||||
(
|
(
|
||||||
standardObjectMetadata:
|
standardObjectMetadata:
|
||||||
| typeof BaseObjectMetadata
|
| typeof BaseWorkspaceEntity
|
||||||
| CustomRelationFactory,
|
| CustomRelationFactory,
|
||||||
) =>
|
) =>
|
||||||
this.createRelationMetadata(
|
this.createRelationMetadata(
|
||||||
@ -59,64 +62,68 @@ export class StandardRelationFactory {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private createRelationMetadata(
|
private createRelationMetadata(
|
||||||
standardObjectMetadataOrCustomRelationFactory:
|
workspaceEntityOrCustomRelationFactory:
|
||||||
| typeof BaseObjectMetadata
|
| typeof BaseWorkspaceEntity
|
||||||
| CustomRelationFactory,
|
| CustomRelationFactory,
|
||||||
context: WorkspaceSyncContext,
|
context: WorkspaceSyncContext,
|
||||||
originalObjectMetadataMap: Record<string, ObjectMetadataEntity>,
|
originalObjectMetadataMap: Record<string, ObjectMetadataEntity>,
|
||||||
workspaceFeatureFlagsMap: FeatureFlagMap,
|
workspaceFeatureFlagsMap: FeatureFlagMap,
|
||||||
): Partial<RelationMetadataEntity>[] {
|
): Partial<RelationMetadataEntity>[] {
|
||||||
const standardObjectMetadata =
|
const target =
|
||||||
'metadata' in standardObjectMetadataOrCustomRelationFactory
|
'metadata' in workspaceEntityOrCustomRelationFactory
|
||||||
? standardObjectMetadataOrCustomRelationFactory.metadata
|
? workspaceEntityOrCustomRelationFactory.metadata
|
||||||
: standardObjectMetadataOrCustomRelationFactory;
|
: workspaceEntityOrCustomRelationFactory;
|
||||||
const objectMetadata = TypedReflect.getMetadata(
|
const workspaceEntity =
|
||||||
'metadata' in standardObjectMetadataOrCustomRelationFactory
|
'metadata' in workspaceEntityOrCustomRelationFactory
|
||||||
? 'extendObjectMetadata'
|
? metadataArgsStorage.filterExtendedEntities(target)
|
||||||
: 'objectMetadata',
|
: metadataArgsStorage.filterEntities(target);
|
||||||
standardObjectMetadata,
|
const workspaceRelationMetadataArgsCollection =
|
||||||
);
|
metadataArgsStorage.filterRelations(target);
|
||||||
const reflectRelationMetadataCollection = TypedReflect.getMetadata(
|
|
||||||
'reflectRelationMetadataCollection',
|
|
||||||
standardObjectMetadata,
|
|
||||||
);
|
|
||||||
|
|
||||||
if (!objectMetadata) {
|
if (!workspaceEntity) {
|
||||||
throw new Error(
|
throw new Error(
|
||||||
`Object metadata decorator not found, can't parse ${standardObjectMetadata.name}`,
|
`Object metadata decorator not found, can't parse ${target.name}`,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!reflectRelationMetadataCollection ||
|
!workspaceRelationMetadataArgsCollection ||
|
||||||
isGatedAndNotEnabled(objectMetadata?.gate, workspaceFeatureFlagsMap)
|
isGatedAndNotEnabled(workspaceEntity?.gate, workspaceFeatureFlagsMap)
|
||||||
) {
|
) {
|
||||||
return [];
|
return [];
|
||||||
}
|
}
|
||||||
|
|
||||||
return reflectRelationMetadataCollection
|
return workspaceRelationMetadataArgsCollection
|
||||||
.filter(
|
.filter((workspaceRelationMetadataArgs) => {
|
||||||
(reflectRelationMetadata) =>
|
// We're not storing many-to-one relations in the DB for the moment
|
||||||
!isGatedAndNotEnabled(
|
if (
|
||||||
reflectRelationMetadata.gate,
|
workspaceRelationMetadataArgs.type ===
|
||||||
workspaceFeatureFlagsMap,
|
RelationMetadataType.MANY_TO_ONE
|
||||||
),
|
) {
|
||||||
)
|
return false;
|
||||||
.map((reflectRelationMetadata) => {
|
}
|
||||||
|
|
||||||
|
return !isGatedAndNotEnabled(
|
||||||
|
workspaceRelationMetadataArgs.gate,
|
||||||
|
workspaceFeatureFlagsMap,
|
||||||
|
);
|
||||||
|
})
|
||||||
|
.map((workspaceRelationMetadataArgs) => {
|
||||||
// Compute reflect relation metadata
|
// Compute reflect relation metadata
|
||||||
const fromObjectNameSingular =
|
const fromObjectNameSingular =
|
||||||
'object' in standardObjectMetadataOrCustomRelationFactory
|
'object' in workspaceEntityOrCustomRelationFactory
|
||||||
? standardObjectMetadataOrCustomRelationFactory.object.nameSingular
|
? workspaceEntityOrCustomRelationFactory.object.nameSingular
|
||||||
: convertClassNameToObjectMetadataName(
|
: convertClassNameToObjectMetadataName(
|
||||||
reflectRelationMetadata.target.constructor.name,
|
workspaceRelationMetadataArgs.target.name,
|
||||||
);
|
);
|
||||||
const toObjectNameSingular = convertClassNameToObjectMetadataName(
|
const toObjectNameSingular = convertClassNameToObjectMetadataName(
|
||||||
reflectRelationMetadata.inverseSideTarget().name,
|
workspaceRelationMetadataArgs.inverseSideTarget().name,
|
||||||
);
|
);
|
||||||
const fromFieldMetadataName = reflectRelationMetadata.fieldKey;
|
const fromFieldMetadataName = workspaceRelationMetadataArgs.name;
|
||||||
const toFieldMetadataName =
|
const toFieldMetadataName =
|
||||||
(reflectRelationMetadata.inverseSideFieldKey as string | undefined) ??
|
(workspaceRelationMetadataArgs.inverseSideFieldKey as
|
||||||
fromObjectNameSingular;
|
| string
|
||||||
|
| undefined) ?? fromObjectNameSingular;
|
||||||
const fromObjectMetadata =
|
const fromObjectMetadata =
|
||||||
originalObjectMetadataMap[fromObjectNameSingular];
|
originalObjectMetadataMap[fromObjectNameSingular];
|
||||||
|
|
||||||
@ -156,13 +163,13 @@ export class StandardRelationFactory {
|
|||||||
);
|
);
|
||||||
|
|
||||||
return {
|
return {
|
||||||
relationType: reflectRelationMetadata.type,
|
relationType: workspaceRelationMetadataArgs.type,
|
||||||
fromObjectMetadataId: fromObjectMetadata?.id,
|
fromObjectMetadataId: fromObjectMetadata?.id,
|
||||||
toObjectMetadataId: toObjectMetadata?.id,
|
toObjectMetadataId: toObjectMetadata?.id,
|
||||||
fromFieldMetadataId: fromFieldMetadata?.id,
|
fromFieldMetadataId: fromFieldMetadata?.id,
|
||||||
toFieldMetadataId: toFieldMetadata?.id,
|
toFieldMetadataId: toFieldMetadata?.id,
|
||||||
workspaceId: context.workspaceId,
|
workspaceId: context.workspaceId,
|
||||||
onDeleteAction: reflectRelationMetadata.onDelete,
|
onDeleteAction: workspaceRelationMetadataArgs.onDelete,
|
||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,3 +0,0 @@
|
|||||||
export interface GateDecoratorParams {
|
|
||||||
featureFlag: string;
|
|
||||||
}
|
|
||||||
@ -1,19 +1,31 @@
|
|||||||
import { ReflectDynamicRelationFieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/reflect-computed-relation-field-metadata.interface';
|
import { FieldMetadataInterface } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata.interface';
|
||||||
import { ReflectFieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/reflect-field-metadata.interface';
|
import { WorkspaceDynamicRelationMetadataArgsFactory } from 'src/engine/twenty-orm/interfaces/workspace-dynamic-relation-metadata-args.interface';
|
||||||
|
|
||||||
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
|
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||||
|
|
||||||
export type PartialFieldMetadata = Omit<
|
export type PartialFieldMetadata = Omit<
|
||||||
ReflectFieldMetadata[string],
|
FieldMetadataInterface,
|
||||||
'joinColumn'
|
'id' | 'label' | 'description' | 'objectMetadataId'
|
||||||
> & {
|
> & {
|
||||||
|
standardId: string;
|
||||||
|
label: string | ((objectMetadata: ObjectMetadataEntity) => string);
|
||||||
|
description?: string | ((objectMetadata: ObjectMetadataEntity) => string);
|
||||||
|
icon?: string;
|
||||||
|
isSystem?: boolean;
|
||||||
workspaceId: string;
|
workspaceId: string;
|
||||||
objectMetadataId?: string;
|
objectMetadataId?: string;
|
||||||
};
|
};
|
||||||
|
|
||||||
export type PartialComputedFieldMetadata =
|
export type PartialComputedFieldMetadata = {
|
||||||
ReflectDynamicRelationFieldMetadata & {
|
type: FieldMetadataType.RELATION;
|
||||||
workspaceId: string;
|
argsFactory: WorkspaceDynamicRelationMetadataArgsFactory;
|
||||||
objectMetadataId?: string;
|
isNullable?: boolean;
|
||||||
};
|
isSystem?: boolean;
|
||||||
|
isCustom: boolean;
|
||||||
|
workspaceId: string;
|
||||||
|
objectMetadataId?: string;
|
||||||
|
};
|
||||||
|
|
||||||
export type ComputedPartialFieldMetadata = {
|
export type ComputedPartialFieldMetadata = {
|
||||||
[K in keyof PartialFieldMetadata]: ExcludeFunctions<PartialFieldMetadata[K]>;
|
[K in keyof PartialFieldMetadata]: ExcludeFunctions<PartialFieldMetadata[K]>;
|
||||||
|
|||||||
@ -3,10 +3,14 @@ import {
|
|||||||
PartialComputedFieldMetadata,
|
PartialComputedFieldMetadata,
|
||||||
PartialFieldMetadata,
|
PartialFieldMetadata,
|
||||||
} from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/partial-field-metadata.interface';
|
} from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/partial-field-metadata.interface';
|
||||||
import { ReflectObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/reflect-object-metadata.interface';
|
import { ObjectMetadataInterface } from 'src/engine/metadata-modules/field-metadata/interfaces/object-metadata.interface';
|
||||||
|
|
||||||
export type PartialObjectMetadata = ReflectObjectMetadata & {
|
export type PartialObjectMetadata = Omit<
|
||||||
id?: string;
|
ObjectMetadataInterface,
|
||||||
|
'id' | 'standardId' | 'fromRelations' | 'toRelations' | 'fields' | 'isActive'
|
||||||
|
> & {
|
||||||
|
standardId: string;
|
||||||
|
icon?: string;
|
||||||
workspaceId: string;
|
workspaceId: string;
|
||||||
dataSourceId: string;
|
dataSourceId: string;
|
||||||
fields: (PartialFieldMetadata | PartialComputedFieldMetadata)[];
|
fields: (PartialFieldMetadata | PartialComputedFieldMetadata)[];
|
||||||
|
|||||||
@ -1,10 +0,0 @@
|
|||||||
import { ReflectRelationMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/reflect-relation-metadata.interface';
|
|
||||||
|
|
||||||
export type PartialRelationMetadata = ReflectRelationMetadata & {
|
|
||||||
id: string;
|
|
||||||
workspaceId: string;
|
|
||||||
fromObjectMetadataId: string;
|
|
||||||
toObjectMetadataId: string;
|
|
||||||
fromFieldMetadataId: string;
|
|
||||||
toFieldMetadataId: string;
|
|
||||||
};
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
import { GateDecoratorParams } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/gate-decorator.interface';
|
|
||||||
|
|
||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
|
||||||
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
|
||||||
|
|
||||||
export type DynamicRelationFieldMetadataDecoratorParams = (
|
|
||||||
oppositeObjectMetadata: ObjectMetadataEntity,
|
|
||||||
) => {
|
|
||||||
standardId: string;
|
|
||||||
name: string;
|
|
||||||
label: string;
|
|
||||||
joinColumn: string;
|
|
||||||
description?: string;
|
|
||||||
icon?: string;
|
|
||||||
};
|
|
||||||
|
|
||||||
export interface ReflectDynamicRelationFieldMetadata {
|
|
||||||
type: FieldMetadataType.RELATION;
|
|
||||||
paramsFactory: DynamicRelationFieldMetadataDecoratorParams;
|
|
||||||
isNullable: boolean;
|
|
||||||
isSystem: boolean;
|
|
||||||
isCustom: boolean;
|
|
||||||
gate?: GateDecoratorParams;
|
|
||||||
}
|
|
||||||
@ -1,10 +0,0 @@
|
|||||||
import { GateDecoratorParams } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/gate-decorator.interface';
|
|
||||||
|
|
||||||
export type BaseCustomObjectMetadataDecoratorParams =
|
|
||||||
| { allowObjectNameList?: string[] }
|
|
||||||
| { denyObjectNameList?: string[] };
|
|
||||||
|
|
||||||
export type ReflectBaseCustomObjectMetadata =
|
|
||||||
BaseCustomObjectMetadataDecoratorParams & {
|
|
||||||
gate?: GateDecoratorParams;
|
|
||||||
};
|
|
||||||
@ -1,38 +0,0 @@
|
|||||||
import { FieldMetadataDefaultValue } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata-default-value.interface';
|
|
||||||
import { GateDecoratorParams } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/gate-decorator.interface';
|
|
||||||
import { FieldMetadataOptions } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata-options.interface';
|
|
||||||
import { FieldMetadataSettings } from 'src/engine/metadata-modules/field-metadata/interfaces/field-metadata-settings.interface';
|
|
||||||
|
|
||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
|
||||||
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
|
||||||
|
|
||||||
export interface FieldMetadataDecoratorParams<
|
|
||||||
T extends FieldMetadataType | 'default',
|
|
||||||
> {
|
|
||||||
standardId: string;
|
|
||||||
type: T;
|
|
||||||
label: string | ((objectMetadata: ObjectMetadataEntity) => string);
|
|
||||||
description?: string | ((objectMetadata: ObjectMetadataEntity) => string);
|
|
||||||
icon?: string;
|
|
||||||
defaultValue?: FieldMetadataDefaultValue<T>;
|
|
||||||
joinColumn?: string;
|
|
||||||
options?: FieldMetadataOptions<T>;
|
|
||||||
settings?: FieldMetadataSettings<T>;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ReflectFieldMetadata {
|
|
||||||
[key: string]: Omit<
|
|
||||||
FieldMetadataDecoratorParams<'default'>,
|
|
||||||
'defaultValue' | 'type' | 'options' | 'settings'
|
|
||||||
> & {
|
|
||||||
name: string;
|
|
||||||
type: FieldMetadataType;
|
|
||||||
isNullable: boolean;
|
|
||||||
isSystem: boolean;
|
|
||||||
isCustom: boolean;
|
|
||||||
defaultValue: FieldMetadataDefaultValue<'default'> | null;
|
|
||||||
gate?: GateDecoratorParams;
|
|
||||||
options?: FieldMetadataOptions<'default'> | null;
|
|
||||||
settings?: FieldMetadataSettings<'default'> | null;
|
|
||||||
};
|
|
||||||
}
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
import { GateDecoratorParams } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/gate-decorator.interface';
|
|
||||||
|
|
||||||
export interface ObjectMetadataDecoratorParams {
|
|
||||||
standardId: string;
|
|
||||||
namePlural: string;
|
|
||||||
labelSingular: string;
|
|
||||||
labelPlural: string;
|
|
||||||
description?: string;
|
|
||||||
icon?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ReflectObjectMetadata extends ObjectMetadataDecoratorParams {
|
|
||||||
nameSingular: string;
|
|
||||||
targetTableName: string;
|
|
||||||
isSystem: boolean;
|
|
||||||
isCustom: boolean;
|
|
||||||
isRemote: boolean;
|
|
||||||
isAuditLogged: boolean;
|
|
||||||
gate?: GateDecoratorParams;
|
|
||||||
}
|
|
||||||
@ -1,23 +0,0 @@
|
|||||||
import { ObjectType } from 'typeorm';
|
|
||||||
|
|
||||||
import { GateDecoratorParams } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/gate-decorator.interface';
|
|
||||||
|
|
||||||
import {
|
|
||||||
RelationOnDeleteAction,
|
|
||||||
RelationMetadataType,
|
|
||||||
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
|
||||||
|
|
||||||
export interface RelationMetadataDecoratorParams<T> {
|
|
||||||
type: RelationMetadataType;
|
|
||||||
inverseSideTarget: () => ObjectType<T>;
|
|
||||||
inverseSideFieldKey?: keyof T;
|
|
||||||
onDelete: RelationOnDeleteAction;
|
|
||||||
}
|
|
||||||
|
|
||||||
export interface ReflectRelationMetadata
|
|
||||||
extends RelationMetadataDecoratorParams<any> {
|
|
||||||
target: object;
|
|
||||||
fieldKey: string;
|
|
||||||
gate?: GateDecoratorParams;
|
|
||||||
onDelete: RelationOnDeleteAction;
|
|
||||||
}
|
|
||||||
@ -14,7 +14,7 @@ import { WorkspaceMetadataUpdaterService } from 'src/engine/workspace-manager/wo
|
|||||||
import { WorkspaceSyncStorage } from 'src/engine/workspace-manager/workspace-sync-metadata/storage/workspace-sync.storage';
|
import { WorkspaceSyncStorage } from 'src/engine/workspace-manager/workspace-sync-metadata/storage/workspace-sync.storage';
|
||||||
import { WorkspaceMigrationFieldFactory } from 'src/engine/workspace-manager/workspace-migration-builder/factories/workspace-migration-field.factory';
|
import { WorkspaceMigrationFieldFactory } from 'src/engine/workspace-manager/workspace-migration-builder/factories/workspace-migration-field.factory';
|
||||||
import { StandardFieldFactory } from 'src/engine/workspace-manager/workspace-sync-metadata/factories/standard-field.factory';
|
import { StandardFieldFactory } from 'src/engine/workspace-manager/workspace-sync-metadata/factories/standard-field.factory';
|
||||||
import { CustomObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/custom-objects/custom.object-metadata';
|
import { CustomWorkspaceEntity } from 'src/engine/twenty-orm/custom.workspace-entity';
|
||||||
import { computeStandardObject } from 'src/engine/workspace-manager/workspace-sync-metadata/utils/compute-standard-object.util';
|
import { computeStandardObject } from 'src/engine/workspace-manager/workspace-sync-metadata/utils/compute-standard-object.util';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
@ -56,7 +56,7 @@ export class WorkspaceSyncFieldMetadataService {
|
|||||||
|
|
||||||
// Create standard field metadata collection
|
// Create standard field metadata collection
|
||||||
const standardFieldMetadataCollection = this.standardFieldFactory.create(
|
const standardFieldMetadataCollection = this.standardFieldFactory.create(
|
||||||
CustomObjectMetadata,
|
CustomWorkspaceEntity,
|
||||||
context,
|
context,
|
||||||
workspaceFeatureFlagsMap,
|
workspaceFeatureFlagsMap,
|
||||||
);
|
);
|
||||||
|
|||||||
@ -17,7 +17,7 @@ import { WorkspaceMigrationEntity } from 'src/engine/metadata-modules/workspace-
|
|||||||
import { WorkspaceSyncStorage } from 'src/engine/workspace-manager/workspace-sync-metadata/storage/workspace-sync.storage';
|
import { WorkspaceSyncStorage } from 'src/engine/workspace-manager/workspace-sync-metadata/storage/workspace-sync.storage';
|
||||||
import { WorkspaceMigrationRelationFactory } from 'src/engine/workspace-manager/workspace-migration-builder/factories/workspace-migration-relation.factory';
|
import { WorkspaceMigrationRelationFactory } from 'src/engine/workspace-manager/workspace-migration-builder/factories/workspace-migration-relation.factory';
|
||||||
import { standardObjectMetadataDefinitions } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects';
|
import { standardObjectMetadataDefinitions } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects';
|
||||||
import { CustomObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/custom-objects/custom.object-metadata';
|
import { CustomWorkspaceEntity } from 'src/engine/twenty-orm/custom.workspace-entity';
|
||||||
|
|
||||||
@Injectable()
|
@Injectable()
|
||||||
export class WorkspaceSyncRelationMetadataService {
|
export class WorkspaceSyncRelationMetadataService {
|
||||||
@ -88,7 +88,7 @@ export class WorkspaceSyncRelationMetadataService {
|
|||||||
this.standardRelationFactory.create(
|
this.standardRelationFactory.create(
|
||||||
customObjectMetadataCollection.map((objectMetadata) => ({
|
customObjectMetadataCollection.map((objectMetadata) => ({
|
||||||
object: objectMetadata,
|
object: objectMetadata,
|
||||||
metadata: CustomObjectMetadata,
|
metadata: CustomWorkspaceEntity,
|
||||||
})),
|
})),
|
||||||
context,
|
context,
|
||||||
originalObjectMetadataMap,
|
originalObjectMetadataMap,
|
||||||
|
|||||||
@ -1,38 +0,0 @@
|
|||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
|
||||||
import { BASE_OBJECT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
|
|
||||||
export abstract class BaseObjectMetadata {
|
|
||||||
@FieldMetadata({
|
|
||||||
standardId: BASE_OBJECT_STANDARD_FIELD_IDS.id,
|
|
||||||
type: FieldMetadataType.UUID,
|
|
||||||
label: 'Id',
|
|
||||||
description: 'Id',
|
|
||||||
defaultValue: 'uuid',
|
|
||||||
icon: 'Icon123',
|
|
||||||
})
|
|
||||||
@IsSystem()
|
|
||||||
id: string;
|
|
||||||
|
|
||||||
@FieldMetadata({
|
|
||||||
standardId: BASE_OBJECT_STANDARD_FIELD_IDS.createdAt,
|
|
||||||
type: FieldMetadataType.DATE_TIME,
|
|
||||||
label: 'Creation date',
|
|
||||||
description: 'Creation date',
|
|
||||||
icon: 'IconCalendar',
|
|
||||||
defaultValue: 'now',
|
|
||||||
})
|
|
||||||
createdAt: Date;
|
|
||||||
|
|
||||||
@FieldMetadata({
|
|
||||||
standardId: BASE_OBJECT_STANDARD_FIELD_IDS.updatedAt,
|
|
||||||
type: FieldMetadataType.DATE_TIME,
|
|
||||||
label: 'Update date',
|
|
||||||
description: 'Update date',
|
|
||||||
icon: 'IconCalendar',
|
|
||||||
defaultValue: 'now',
|
|
||||||
})
|
|
||||||
@IsSystem()
|
|
||||||
updatedAt: Date;
|
|
||||||
}
|
|
||||||
@ -1,6 +1,5 @@
|
|||||||
import { ComputedPartialObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/partial-object-metadata.interface';
|
import { ComputedPartialObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/partial-object-metadata.interface';
|
||||||
import { ComputedPartialFieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/partial-field-metadata.interface';
|
import { ComputedPartialFieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/partial-field-metadata.interface';
|
||||||
import { PartialRelationMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/partial-relation-metadata.interface';
|
|
||||||
|
|
||||||
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
import { ObjectMetadataEntity } from 'src/engine/metadata-modules/object-metadata/object-metadata.entity';
|
||||||
import { FieldMetadataEntity } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataEntity } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
@ -28,7 +27,7 @@ export class WorkspaceSyncStorage {
|
|||||||
[];
|
[];
|
||||||
private readonly _relationMetadataDeleteCollection: RelationMetadataEntity[] =
|
private readonly _relationMetadataDeleteCollection: RelationMetadataEntity[] =
|
||||||
[];
|
[];
|
||||||
private readonly _relationMetadataUpdateCollection: Partial<PartialRelationMetadata>[] =
|
private readonly _relationMetadataUpdateCollection: Partial<RelationMetadataEntity>[] =
|
||||||
[];
|
[];
|
||||||
|
|
||||||
constructor() {}
|
constructor() {}
|
||||||
@ -101,7 +100,7 @@ export class WorkspaceSyncStorage {
|
|||||||
this._relationMetadataCreateCollection.push(relation);
|
this._relationMetadataCreateCollection.push(relation);
|
||||||
}
|
}
|
||||||
|
|
||||||
addUpdateRelationMetadata(relation: Partial<PartialRelationMetadata>) {
|
addUpdateRelationMetadata(relation: Partial<RelationMetadataEntity>) {
|
||||||
this._relationMetadataUpdateCollection.push(relation);
|
this._relationMetadataUpdateCollection.push(relation);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -1,9 +1,9 @@
|
|||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
|
||||||
export type ObjectRecord<T extends BaseObjectMetadata> = {
|
export type ObjectRecord<T extends BaseWorkspaceEntity> = {
|
||||||
[K in keyof T as T[K] extends BaseObjectMetadata
|
[K in keyof T as T[K] extends BaseWorkspaceEntity
|
||||||
? `${Extract<K, string>}Id`
|
? `${Extract<K, string>}Id`
|
||||||
: K]: T[K] extends BaseObjectMetadata ? string : T[K];
|
: K]: T[K] extends BaseWorkspaceEntity ? string : T[K];
|
||||||
} & {
|
} & {
|
||||||
[K in keyof T]: T[K] extends BaseObjectMetadata ? ObjectRecord<T[K]> : T[K];
|
[K in keyof T]: T[K] extends BaseWorkspaceEntity ? ObjectRecord<T[K]> : T[K];
|
||||||
};
|
};
|
||||||
|
|||||||
@ -21,11 +21,11 @@ export const computeStandardObject = (
|
|||||||
const fields: ComputedPartialFieldMetadata[] = [];
|
const fields: ComputedPartialFieldMetadata[] = [];
|
||||||
|
|
||||||
for (const partialFieldMetadata of standardObjectMetadata.fields) {
|
for (const partialFieldMetadata of standardObjectMetadata.fields) {
|
||||||
if ('paramsFactory' in partialFieldMetadata) {
|
if ('argsFactory' in partialFieldMetadata) {
|
||||||
// Compute standard fields of custom object
|
// Compute standard fields of custom object
|
||||||
for (const customObjectMetadata of customObjectMetadataCollection) {
|
for (const customObjectMetadata of customObjectMetadataCollection) {
|
||||||
const { paramsFactory, ...rest } = partialFieldMetadata;
|
const { argsFactory, ...rest } = partialFieldMetadata;
|
||||||
const { joinColumn, ...data } = paramsFactory(customObjectMetadata);
|
const { joinColumn, ...data } = argsFactory(customObjectMetadata);
|
||||||
const relationStandardId = createRelationDeterministicUuid({
|
const relationStandardId = createRelationDeterministicUuid({
|
||||||
objectId: customObjectMetadata.id,
|
objectId: customObjectMetadata.id,
|
||||||
standardId: data.standardId,
|
standardId: data.standardId,
|
||||||
@ -35,6 +35,12 @@ export const computeStandardObject = (
|
|||||||
standardId: data.standardId,
|
standardId: data.standardId,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
if (!joinColumn) {
|
||||||
|
throw new Error(
|
||||||
|
`Missing joinColumn for field ${data.name} in object ${customObjectMetadata.nameSingular}`,
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
// Relation
|
// Relation
|
||||||
fields.push({
|
fields.push({
|
||||||
...data,
|
...data,
|
||||||
|
|||||||
@ -1,7 +1,7 @@
|
|||||||
import { GateDecoratorParams } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/gate-decorator.interface';
|
import { Gate } from 'src/engine/twenty-orm/interfaces/gate.interface';
|
||||||
|
|
||||||
export const isGatedAndNotEnabled = (
|
export const isGatedAndNotEnabled = (
|
||||||
gate: GateDecoratorParams | undefined,
|
gate: Gate | undefined,
|
||||||
workspaceFeatureFlagsMap: Record<string, boolean>,
|
workspaceFeatureFlagsMap: Record<string, boolean>,
|
||||||
): boolean => {
|
): boolean => {
|
||||||
const featureFlagValue =
|
const featureFlagValue =
|
||||||
|
|||||||
@ -1,22 +1,22 @@
|
|||||||
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface';
|
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface';
|
||||||
|
|
||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
|
||||||
import { ACTIVITY_TARGET_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { ACTIVITY_TARGET_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { CustomObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/custom-objects/custom.object-metadata';
|
import { CustomWorkspaceEntity } from 'src/engine/twenty-orm/custom.workspace-entity';
|
||||||
import { DynamicRelationFieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/dynamic-field-metadata.interface';
|
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { ActivityObjectMetadata } from 'src/modules/activity/standard-objects/activity.object-metadata';
|
import { ActivityObjectMetadata } from 'src/modules/activity/standard-objects/activity.object-metadata';
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { CompanyObjectMetadata } from 'src/modules/company/standard-objects/company.object-metadata';
|
import { CompanyObjectMetadata } from 'src/modules/company/standard-objects/company.object-metadata';
|
||||||
import { OpportunityObjectMetadata } from 'src/modules/opportunity/standard-objects/opportunity.object-metadata';
|
import { OpportunityObjectMetadata } from 'src/modules/opportunity/standard-objects/opportunity.object-metadata';
|
||||||
import { PersonObjectMetadata } from 'src/modules/person/standard-objects/person.object-metadata';
|
import { PersonObjectMetadata } from 'src/modules/person/standard-objects/person.object-metadata';
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
import { WorkspaceDynamicRelation } from 'src/engine/twenty-orm/decorators/workspace-dynamic-relation.decorator';
|
||||||
|
import { RelationMetadataType } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.activityTarget,
|
standardId: STANDARD_OBJECT_IDS.activityTarget,
|
||||||
namePlural: 'activityTargets',
|
namePlural: 'activityTargets',
|
||||||
labelSingular: 'Activity Target',
|
labelSingular: 'Activity Target',
|
||||||
@ -24,60 +24,73 @@ import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-me
|
|||||||
description: 'An activity target',
|
description: 'An activity target',
|
||||||
icon: 'IconCheckbox',
|
icon: 'IconCheckbox',
|
||||||
})
|
})
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
export class ActivityTargetObjectMetadata extends BaseObjectMetadata {
|
export class ActivityTargetObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: ACTIVITY_TARGET_STANDARD_FIELD_IDS.activity,
|
standardId: ACTIVITY_TARGET_STANDARD_FIELD_IDS.activity,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Activity',
|
label: 'Activity',
|
||||||
description: 'ActivityTarget activity',
|
description: 'ActivityTarget activity',
|
||||||
icon: 'IconNotes',
|
icon: 'IconNotes',
|
||||||
joinColumn: 'activityId',
|
joinColumn: 'activityId',
|
||||||
|
inverseSideTarget: () => ActivityObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'activityTargets',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
activity: Relation<ActivityObjectMetadata>;
|
activity: Relation<ActivityObjectMetadata>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: ACTIVITY_TARGET_STANDARD_FIELD_IDS.person,
|
standardId: ACTIVITY_TARGET_STANDARD_FIELD_IDS.person,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Person',
|
label: 'Person',
|
||||||
description: 'ActivityTarget person',
|
description: 'ActivityTarget person',
|
||||||
icon: 'IconUser',
|
icon: 'IconUser',
|
||||||
joinColumn: 'personId',
|
joinColumn: 'personId',
|
||||||
|
inverseSideTarget: () => PersonObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'activityTargets',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
person: Relation<PersonObjectMetadata>;
|
person: Relation<PersonObjectMetadata>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: ACTIVITY_TARGET_STANDARD_FIELD_IDS.company,
|
standardId: ACTIVITY_TARGET_STANDARD_FIELD_IDS.company,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Company',
|
label: 'Company',
|
||||||
description: 'ActivityTarget company',
|
description: 'ActivityTarget company',
|
||||||
icon: 'IconBuildingSkyscraper',
|
icon: 'IconBuildingSkyscraper',
|
||||||
joinColumn: 'companyId',
|
joinColumn: 'companyId',
|
||||||
|
inverseSideTarget: () => CompanyObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'activityTargets',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
company: Relation<CompanyObjectMetadata>;
|
company: Relation<CompanyObjectMetadata>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: ACTIVITY_TARGET_STANDARD_FIELD_IDS.opportunity,
|
standardId: ACTIVITY_TARGET_STANDARD_FIELD_IDS.opportunity,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Opportunity',
|
label: 'Opportunity',
|
||||||
description: 'ActivityTarget opportunity',
|
description: 'ActivityTarget opportunity',
|
||||||
icon: 'IconTargetArrow',
|
icon: 'IconTargetArrow',
|
||||||
joinColumn: 'opportunityId',
|
joinColumn: 'opportunityId',
|
||||||
|
inverseSideTarget: () => OpportunityObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'activityTargets',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
opportunity: Relation<OpportunityObjectMetadata>;
|
opportunity: Relation<OpportunityObjectMetadata>;
|
||||||
|
|
||||||
@DynamicRelationFieldMetadata((oppositeObjectMetadata) => ({
|
@WorkspaceDynamicRelation({
|
||||||
standardId: ACTIVITY_TARGET_STANDARD_FIELD_IDS.custom,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
name: oppositeObjectMetadata.nameSingular,
|
argsFactory: (oppositeObjectMetadata) => ({
|
||||||
label: oppositeObjectMetadata.labelSingular,
|
standardId: ACTIVITY_TARGET_STANDARD_FIELD_IDS.custom,
|
||||||
description: `ActivityTarget ${oppositeObjectMetadata.labelSingular}`,
|
name: oppositeObjectMetadata.nameSingular,
|
||||||
joinColumn: `${oppositeObjectMetadata.nameSingular}Id`,
|
label: oppositeObjectMetadata.labelSingular,
|
||||||
icon: 'IconBuildingSkyscraper',
|
description: `ActivityTarget ${oppositeObjectMetadata.labelSingular}`,
|
||||||
}))
|
joinColumn: `${oppositeObjectMetadata.nameSingular}Id`,
|
||||||
custom: Relation<CustomObjectMetadata>;
|
icon: 'IconBuildingSkyscraper',
|
||||||
|
}),
|
||||||
|
inverseSideTarget: () => CustomWorkspaceEntity,
|
||||||
|
inverseSideFieldKey: 'activityTargets',
|
||||||
|
})
|
||||||
|
custom: Relation<CustomWorkspaceEntity>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,19 +7,19 @@ import {
|
|||||||
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
import { ACTIVITY_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { ACTIVITY_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { RelationMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/relation-metadata.decorator';
|
|
||||||
import { ActivityTargetObjectMetadata } from 'src/modules/activity/standard-objects/activity-target.object-metadata';
|
import { ActivityTargetObjectMetadata } from 'src/modules/activity/standard-objects/activity-target.object-metadata';
|
||||||
import { AttachmentObjectMetadata } from 'src/modules/attachment/standard-objects/attachment.object-metadata';
|
import { AttachmentObjectMetadata } from 'src/modules/attachment/standard-objects/attachment.object-metadata';
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { CommentObjectMetadata } from 'src/modules/activity/standard-objects/comment.object-metadata';
|
import { CommentObjectMetadata } from 'src/modules/activity/standard-objects/comment.object-metadata';
|
||||||
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.activity,
|
standardId: STANDARD_OBJECT_IDS.activity,
|
||||||
namePlural: 'activities',
|
namePlural: 'activities',
|
||||||
labelSingular: 'Activity',
|
labelSingular: 'Activity',
|
||||||
@ -27,10 +27,10 @@ import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-me
|
|||||||
description: 'An activity',
|
description: 'An activity',
|
||||||
icon: 'IconCheckbox',
|
icon: 'IconCheckbox',
|
||||||
})
|
})
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
export class ActivityObjectMetadata extends BaseObjectMetadata {
|
export class ActivityObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: ACTIVITY_STANDARD_FIELD_IDS.title,
|
standardId: ACTIVITY_STANDARD_FIELD_IDS.title,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Title',
|
label: 'Title',
|
||||||
@ -39,7 +39,7 @@ export class ActivityObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
title: string;
|
title: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: ACTIVITY_STANDARD_FIELD_IDS.body,
|
standardId: ACTIVITY_STANDARD_FIELD_IDS.body,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Body',
|
label: 'Body',
|
||||||
@ -48,7 +48,7 @@ export class ActivityObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
body: string;
|
body: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: ACTIVITY_STANDARD_FIELD_IDS.type,
|
standardId: ACTIVITY_STANDARD_FIELD_IDS.type,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Type',
|
label: 'Type',
|
||||||
@ -58,100 +58,97 @@ export class ActivityObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
type: string;
|
type: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: ACTIVITY_STANDARD_FIELD_IDS.reminderAt,
|
standardId: ACTIVITY_STANDARD_FIELD_IDS.reminderAt,
|
||||||
type: FieldMetadataType.DATE_TIME,
|
type: FieldMetadataType.DATE_TIME,
|
||||||
label: 'Reminder Date',
|
label: 'Reminder Date',
|
||||||
description: 'Activity reminder date',
|
description: 'Activity reminder date',
|
||||||
icon: 'IconCalendarEvent',
|
icon: 'IconCalendarEvent',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
reminderAt: Date;
|
reminderAt: Date;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: ACTIVITY_STANDARD_FIELD_IDS.dueAt,
|
standardId: ACTIVITY_STANDARD_FIELD_IDS.dueAt,
|
||||||
type: FieldMetadataType.DATE_TIME,
|
type: FieldMetadataType.DATE_TIME,
|
||||||
label: 'Due Date',
|
label: 'Due Date',
|
||||||
description: 'Activity due date',
|
description: 'Activity due date',
|
||||||
icon: 'IconCalendarEvent',
|
icon: 'IconCalendarEvent',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
dueAt: Date;
|
dueAt: Date;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: ACTIVITY_STANDARD_FIELD_IDS.completedAt,
|
standardId: ACTIVITY_STANDARD_FIELD_IDS.completedAt,
|
||||||
type: FieldMetadataType.DATE_TIME,
|
type: FieldMetadataType.DATE_TIME,
|
||||||
label: 'Completion Date',
|
label: 'Completion Date',
|
||||||
description: 'Activity completion date',
|
description: 'Activity completion date',
|
||||||
icon: 'IconCheck',
|
icon: 'IconCheck',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
completedAt: Date;
|
completedAt: Date;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: ACTIVITY_STANDARD_FIELD_IDS.activityTargets,
|
standardId: ACTIVITY_STANDARD_FIELD_IDS.activityTargets,
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Targets',
|
label: 'Targets',
|
||||||
description: 'Activity targets',
|
description: 'Activity targets',
|
||||||
icon: 'IconCheckbox',
|
icon: 'IconCheckbox',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
inverseSideTarget: () => ActivityTargetObjectMetadata,
|
inverseSideTarget: () => ActivityTargetObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
activityTargets: Relation<ActivityTargetObjectMetadata[]>;
|
activityTargets: Relation<ActivityTargetObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: ACTIVITY_STANDARD_FIELD_IDS.attachments,
|
standardId: ACTIVITY_STANDARD_FIELD_IDS.attachments,
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Attachments',
|
label: 'Attachments',
|
||||||
description: 'Activity attachments',
|
description: 'Activity attachments',
|
||||||
icon: 'IconFileImport',
|
icon: 'IconFileImport',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
inverseSideTarget: () => AttachmentObjectMetadata,
|
inverseSideTarget: () => AttachmentObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
attachments: Relation<AttachmentObjectMetadata[]>;
|
attachments: Relation<AttachmentObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: ACTIVITY_STANDARD_FIELD_IDS.comments,
|
standardId: ACTIVITY_STANDARD_FIELD_IDS.comments,
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Comments',
|
label: 'Comments',
|
||||||
description: 'Activity comments',
|
description: 'Activity comments',
|
||||||
icon: 'IconComment',
|
icon: 'IconComment',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
inverseSideTarget: () => CommentObjectMetadata,
|
inverseSideTarget: () => CommentObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
comments: Relation<CommentObjectMetadata[]>;
|
comments: Relation<CommentObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: ACTIVITY_STANDARD_FIELD_IDS.author,
|
standardId: ACTIVITY_STANDARD_FIELD_IDS.author,
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Author',
|
label: 'Author',
|
||||||
description: 'Activity author',
|
description: 'Activity author',
|
||||||
icon: 'IconUserCircle',
|
icon: 'IconUserCircle',
|
||||||
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
|
inverseSideTarget: () => WorkspaceMemberObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'authoredActivities',
|
||||||
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
joinColumn: 'authorId',
|
joinColumn: 'authorId',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
author: Relation<WorkspaceMemberObjectMetadata>;
|
author: Relation<WorkspaceMemberObjectMetadata>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: ACTIVITY_STANDARD_FIELD_IDS.assignee,
|
standardId: ACTIVITY_STANDARD_FIELD_IDS.assignee,
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Assignee',
|
label: 'Assignee',
|
||||||
description: 'Activity assignee',
|
description: 'Activity assignee',
|
||||||
icon: 'IconUserCircle',
|
icon: 'IconUserCircle',
|
||||||
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
|
inverseSideTarget: () => WorkspaceMemberObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'assignedActivities',
|
||||||
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
joinColumn: 'assigneeId',
|
joinColumn: 'assigneeId',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
assignee: Relation<WorkspaceMemberObjectMetadata>;
|
assignee: Relation<WorkspaceMemberObjectMetadata>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,15 +3,17 @@ import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/i
|
|||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
import { COMMENT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { COMMENT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { ActivityObjectMetadata } from 'src/modules/activity/standard-objects/activity.object-metadata';
|
import { ActivityObjectMetadata } from 'src/modules/activity/standard-objects/activity.object-metadata';
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
import { RelationMetadataType } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.comment,
|
standardId: STANDARD_OBJECT_IDS.comment,
|
||||||
namePlural: 'comments',
|
namePlural: 'comments',
|
||||||
labelSingular: 'Comment',
|
labelSingular: 'Comment',
|
||||||
@ -19,10 +21,10 @@ import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-me
|
|||||||
description: 'A comment',
|
description: 'A comment',
|
||||||
icon: 'IconMessageCircle',
|
icon: 'IconMessageCircle',
|
||||||
})
|
})
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
export class CommentObjectMetadata extends BaseObjectMetadata {
|
export class CommentObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: COMMENT_STANDARD_FIELD_IDS.body,
|
standardId: COMMENT_STANDARD_FIELD_IDS.body,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Body',
|
label: 'Body',
|
||||||
@ -31,23 +33,27 @@ export class CommentObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
body: string;
|
body: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: COMMENT_STANDARD_FIELD_IDS.author,
|
standardId: COMMENT_STANDARD_FIELD_IDS.author,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Author',
|
label: 'Author',
|
||||||
description: 'Comment author',
|
description: 'Comment author',
|
||||||
icon: 'IconCircleUser',
|
icon: 'IconCircleUser',
|
||||||
joinColumn: 'authorId',
|
joinColumn: 'authorId',
|
||||||
|
inverseSideTarget: () => WorkspaceMemberObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'authoredComments',
|
||||||
})
|
})
|
||||||
author: Relation<WorkspaceMemberObjectMetadata>;
|
author: Relation<WorkspaceMemberObjectMetadata>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: COMMENT_STANDARD_FIELD_IDS.activity,
|
standardId: COMMENT_STANDARD_FIELD_IDS.activity,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Activity',
|
label: 'Activity',
|
||||||
description: 'Comment activity',
|
description: 'Comment activity',
|
||||||
icon: 'IconNotes',
|
icon: 'IconNotes',
|
||||||
joinColumn: 'activityId',
|
joinColumn: 'activityId',
|
||||||
|
inverseSideTarget: () => ActivityObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'comments',
|
||||||
})
|
})
|
||||||
activity: Relation<ActivityObjectMetadata>;
|
activity: Relation<ActivityObjectMetadata>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,14 +1,14 @@
|
|||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
import { API_KEY_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { API_KEY_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.apiKey,
|
standardId: STANDARD_OBJECT_IDS.apiKey,
|
||||||
namePlural: 'apiKeys',
|
namePlural: 'apiKeys',
|
||||||
labelSingular: 'Api Key',
|
labelSingular: 'Api Key',
|
||||||
@ -16,10 +16,10 @@ import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-
|
|||||||
description: 'An api key',
|
description: 'An api key',
|
||||||
icon: 'IconRobot',
|
icon: 'IconRobot',
|
||||||
})
|
})
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
export class ApiKeyObjectMetadata extends BaseObjectMetadata {
|
export class ApiKeyObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: API_KEY_STANDARD_FIELD_IDS.name,
|
standardId: API_KEY_STANDARD_FIELD_IDS.name,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Name',
|
label: 'Name',
|
||||||
@ -28,7 +28,7 @@ export class ApiKeyObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: API_KEY_STANDARD_FIELD_IDS.expiresAt,
|
standardId: API_KEY_STANDARD_FIELD_IDS.expiresAt,
|
||||||
type: FieldMetadataType.DATE_TIME,
|
type: FieldMetadataType.DATE_TIME,
|
||||||
label: 'Expiration date',
|
label: 'Expiration date',
|
||||||
@ -37,13 +37,13 @@ export class ApiKeyObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
expiresAt: Date;
|
expiresAt: Date;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: API_KEY_STANDARD_FIELD_IDS.revokedAt,
|
standardId: API_KEY_STANDARD_FIELD_IDS.revokedAt,
|
||||||
type: FieldMetadataType.DATE_TIME,
|
type: FieldMetadataType.DATE_TIME,
|
||||||
label: 'Revocation date',
|
label: 'Revocation date',
|
||||||
description: 'ApiKey revocation date',
|
description: 'ApiKey revocation date',
|
||||||
icon: 'IconCalendar',
|
icon: 'IconCalendar',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
revokedAt?: Date;
|
revokedAt?: Date;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,21 +3,23 @@ import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/i
|
|||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
import { ATTACHMENT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { ATTACHMENT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { CustomObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/custom-objects/custom.object-metadata';
|
import { CustomWorkspaceEntity } from 'src/engine/twenty-orm/custom.workspace-entity';
|
||||||
import { DynamicRelationFieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/dynamic-field-metadata.interface';
|
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { ActivityObjectMetadata } from 'src/modules/activity/standard-objects/activity.object-metadata';
|
import { ActivityObjectMetadata } from 'src/modules/activity/standard-objects/activity.object-metadata';
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { CompanyObjectMetadata } from 'src/modules/company/standard-objects/company.object-metadata';
|
import { CompanyObjectMetadata } from 'src/modules/company/standard-objects/company.object-metadata';
|
||||||
import { OpportunityObjectMetadata } from 'src/modules/opportunity/standard-objects/opportunity.object-metadata';
|
import { OpportunityObjectMetadata } from 'src/modules/opportunity/standard-objects/opportunity.object-metadata';
|
||||||
import { PersonObjectMetadata } from 'src/modules/person/standard-objects/person.object-metadata';
|
import { PersonObjectMetadata } from 'src/modules/person/standard-objects/person.object-metadata';
|
||||||
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
import { RelationMetadataType } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
import { WorkspaceDynamicRelation } from 'src/engine/twenty-orm/decorators/workspace-dynamic-relation.decorator';
|
||||||
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.attachment,
|
standardId: STANDARD_OBJECT_IDS.attachment,
|
||||||
namePlural: 'attachments',
|
namePlural: 'attachments',
|
||||||
labelSingular: 'Attachment',
|
labelSingular: 'Attachment',
|
||||||
@ -25,10 +27,10 @@ import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-me
|
|||||||
description: 'An attachment',
|
description: 'An attachment',
|
||||||
icon: 'IconFileImport',
|
icon: 'IconFileImport',
|
||||||
})
|
})
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
export class AttachmentObjectMetadata extends BaseObjectMetadata {
|
export class AttachmentObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: ATTACHMENT_STANDARD_FIELD_IDS.name,
|
standardId: ATTACHMENT_STANDARD_FIELD_IDS.name,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Name',
|
label: 'Name',
|
||||||
@ -37,7 +39,7 @@ export class AttachmentObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: ATTACHMENT_STANDARD_FIELD_IDS.fullPath,
|
standardId: ATTACHMENT_STANDARD_FIELD_IDS.fullPath,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Full path',
|
label: 'Full path',
|
||||||
@ -46,7 +48,7 @@ export class AttachmentObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
fullPath: string;
|
fullPath: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: ATTACHMENT_STANDARD_FIELD_IDS.type,
|
standardId: ATTACHMENT_STANDARD_FIELD_IDS.type,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Type',
|
label: 'Type',
|
||||||
@ -55,67 +57,82 @@ export class AttachmentObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
type: string;
|
type: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: ATTACHMENT_STANDARD_FIELD_IDS.author,
|
standardId: ATTACHMENT_STANDARD_FIELD_IDS.author,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Author',
|
label: 'Author',
|
||||||
description: 'Attachment author',
|
description: 'Attachment author',
|
||||||
icon: 'IconCircleUser',
|
icon: 'IconCircleUser',
|
||||||
joinColumn: 'authorId',
|
joinColumn: 'authorId',
|
||||||
|
inverseSideTarget: () => WorkspaceMemberObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'authoredAttachments',
|
||||||
})
|
})
|
||||||
author: Relation<WorkspaceMemberObjectMetadata>;
|
author: Relation<WorkspaceMemberObjectMetadata>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: ATTACHMENT_STANDARD_FIELD_IDS.activity,
|
standardId: ATTACHMENT_STANDARD_FIELD_IDS.activity,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Activity',
|
label: 'Activity',
|
||||||
description: 'Attachment activity',
|
description: 'Attachment activity',
|
||||||
icon: 'IconNotes',
|
icon: 'IconNotes',
|
||||||
joinColumn: 'activityId',
|
joinColumn: 'activityId',
|
||||||
|
inverseSideTarget: () => ActivityObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'attachments',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
activity: Relation<ActivityObjectMetadata>;
|
activity: Relation<ActivityObjectMetadata>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: ATTACHMENT_STANDARD_FIELD_IDS.person,
|
standardId: ATTACHMENT_STANDARD_FIELD_IDS.person,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Person',
|
label: 'Person',
|
||||||
description: 'Attachment person',
|
description: 'Attachment person',
|
||||||
icon: 'IconUser',
|
icon: 'IconUser',
|
||||||
joinColumn: 'personId',
|
joinColumn: 'personId',
|
||||||
|
inverseSideTarget: () => PersonObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'attachments',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
person: Relation<PersonObjectMetadata>;
|
person: Relation<PersonObjectMetadata>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: ATTACHMENT_STANDARD_FIELD_IDS.company,
|
standardId: ATTACHMENT_STANDARD_FIELD_IDS.company,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Company',
|
label: 'Company',
|
||||||
description: 'Attachment company',
|
description: 'Attachment company',
|
||||||
icon: 'IconBuildingSkyscraper',
|
icon: 'IconBuildingSkyscraper',
|
||||||
joinColumn: 'companyId',
|
joinColumn: 'companyId',
|
||||||
|
inverseSideTarget: () => CompanyObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'attachments',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
company: Relation<CompanyObjectMetadata>;
|
company: Relation<CompanyObjectMetadata>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: ATTACHMENT_STANDARD_FIELD_IDS.opportunity,
|
standardId: ATTACHMENT_STANDARD_FIELD_IDS.opportunity,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Opportunity',
|
label: 'Opportunity',
|
||||||
description: 'Attachment opportunity',
|
description: 'Attachment opportunity',
|
||||||
icon: 'IconBuildingSkyscraper',
|
icon: 'IconBuildingSkyscraper',
|
||||||
joinColumn: 'opportunityId',
|
joinColumn: 'opportunityId',
|
||||||
|
inverseSideTarget: () => OpportunityObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'attachments',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
opportunity: Relation<OpportunityObjectMetadata>;
|
opportunity: Relation<OpportunityObjectMetadata>;
|
||||||
|
|
||||||
@DynamicRelationFieldMetadata((oppositeObjectMetadata) => ({
|
@WorkspaceDynamicRelation({
|
||||||
standardId: ATTACHMENT_STANDARD_FIELD_IDS.custom,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
name: oppositeObjectMetadata.nameSingular,
|
argsFactory: (oppositeObjectMetadata) => ({
|
||||||
label: oppositeObjectMetadata.labelSingular,
|
standardId: ATTACHMENT_STANDARD_FIELD_IDS.custom,
|
||||||
description: `Attachment ${oppositeObjectMetadata.labelSingular}`,
|
name: oppositeObjectMetadata.nameSingular,
|
||||||
joinColumn: `${oppositeObjectMetadata.nameSingular}Id`,
|
label: oppositeObjectMetadata.labelSingular,
|
||||||
icon: 'IconBuildingSkyscraper',
|
description: `Attachment ${oppositeObjectMetadata.labelSingular}`,
|
||||||
}))
|
joinColumn: `${oppositeObjectMetadata.nameSingular}Id`,
|
||||||
custom: Relation<CustomObjectMetadata>;
|
icon: 'IconBuildingSkyscraper',
|
||||||
|
}),
|
||||||
|
inverseSideTarget: () => CustomWorkspaceEntity,
|
||||||
|
inverseSideFieldKey: 'attachments',
|
||||||
|
})
|
||||||
|
custom: Relation<CustomWorkspaceEntity>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,14 +3,17 @@ import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/i
|
|||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
import { CALENDAR_CHANNEL_EVENT_ASSOCIATION_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { CALENDAR_CHANNEL_EVENT_ASSOCIATION_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { CalendarEventObjectMetadata } from 'src/modules/calendar/standard-objects/calendar-event.object-metadata';
|
import { CalendarEventObjectMetadata } from 'src/modules/calendar/standard-objects/calendar-event.object-metadata';
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceGate } from 'src/engine/twenty-orm/decorators/workspace-gate.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
import { RelationMetadataType } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.calendarChannelEventAssociation,
|
standardId: STANDARD_OBJECT_IDS.calendarChannelEventAssociation,
|
||||||
namePlural: 'calendarChannelEventAssociations',
|
namePlural: 'calendarChannelEventAssociations',
|
||||||
labelSingular: 'Calendar Channel Event Association',
|
labelSingular: 'Calendar Channel Event Association',
|
||||||
@ -18,32 +21,10 @@ import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-me
|
|||||||
description: 'Calendar Channel Event Associations',
|
description: 'Calendar Channel Event Associations',
|
||||||
icon: 'IconCalendar',
|
icon: 'IconCalendar',
|
||||||
})
|
})
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
export class CalendarChannelEventAssociationObjectMetadata extends BaseObjectMetadata {
|
export class CalendarChannelEventAssociationObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId:
|
|
||||||
CALENDAR_CHANNEL_EVENT_ASSOCIATION_STANDARD_FIELD_IDS.calendarChannel,
|
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Channel ID',
|
|
||||||
description: 'Channel ID',
|
|
||||||
icon: 'IconCalendar',
|
|
||||||
joinColumn: 'calendarChannelId',
|
|
||||||
})
|
|
||||||
calendarChannel: Relation<CalendarEventObjectMetadata>;
|
|
||||||
|
|
||||||
@FieldMetadata({
|
|
||||||
standardId:
|
|
||||||
CALENDAR_CHANNEL_EVENT_ASSOCIATION_STANDARD_FIELD_IDS.calendarEvent,
|
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Event ID',
|
|
||||||
description: 'Event ID',
|
|
||||||
icon: 'IconCalendar',
|
|
||||||
joinColumn: 'calendarEventId',
|
|
||||||
})
|
|
||||||
calendarEvent: Relation<CalendarEventObjectMetadata>;
|
|
||||||
|
|
||||||
@FieldMetadata({
|
|
||||||
standardId:
|
standardId:
|
||||||
CALENDAR_CHANNEL_EVENT_ASSOCIATION_STANDARD_FIELD_IDS.eventExternalId,
|
CALENDAR_CHANNEL_EVENT_ASSOCIATION_STANDARD_FIELD_IDS.eventExternalId,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
@ -52,4 +33,30 @@ export class CalendarChannelEventAssociationObjectMetadata extends BaseObjectMet
|
|||||||
icon: 'IconCalendar',
|
icon: 'IconCalendar',
|
||||||
})
|
})
|
||||||
eventExternalId: string;
|
eventExternalId: string;
|
||||||
|
|
||||||
|
@WorkspaceRelation({
|
||||||
|
standardId:
|
||||||
|
CALENDAR_CHANNEL_EVENT_ASSOCIATION_STANDARD_FIELD_IDS.calendarChannel,
|
||||||
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
|
label: 'Channel ID',
|
||||||
|
description: 'Channel ID',
|
||||||
|
icon: 'IconCalendar',
|
||||||
|
joinColumn: 'calendarChannelId',
|
||||||
|
inverseSideTarget: () => CalendarEventObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'calendarChannelEventAssociations',
|
||||||
|
})
|
||||||
|
calendarChannel: Relation<CalendarEventObjectMetadata>;
|
||||||
|
|
||||||
|
@WorkspaceRelation({
|
||||||
|
standardId:
|
||||||
|
CALENDAR_CHANNEL_EVENT_ASSOCIATION_STANDARD_FIELD_IDS.calendarEvent,
|
||||||
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
|
label: 'Event ID',
|
||||||
|
description: 'Event ID',
|
||||||
|
icon: 'IconCalendar',
|
||||||
|
joinColumn: 'calendarEventId',
|
||||||
|
inverseSideTarget: () => CalendarEventObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'calendarChannelEventAssociations',
|
||||||
|
})
|
||||||
|
calendarEvent: Relation<CalendarEventObjectMetadata>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,21 +7,21 @@ import {
|
|||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
import { CALENDAR_CHANNEL_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { CALENDAR_CHANNEL_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { ConnectedAccountObjectMetadata } from 'src/modules/connected-account/standard-objects/connected-account.object-metadata';
|
import { ConnectedAccountObjectMetadata } from 'src/modules/connected-account/standard-objects/connected-account.object-metadata';
|
||||||
import { CalendarChannelEventAssociationObjectMetadata } from 'src/modules/calendar/standard-objects/calendar-channel-event-association.object-metadata';
|
import { CalendarChannelEventAssociationObjectMetadata } from 'src/modules/calendar/standard-objects/calendar-channel-event-association.object-metadata';
|
||||||
import { RelationMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/relation-metadata.decorator';
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
|
||||||
export enum CalendarChannelVisibility {
|
export enum CalendarChannelVisibility {
|
||||||
METADATA = 'METADATA',
|
METADATA = 'METADATA',
|
||||||
SHARE_EVERYTHING = 'SHARE_EVERYTHING',
|
SHARE_EVERYTHING = 'SHARE_EVERYTHING',
|
||||||
}
|
}
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.calendarChannel,
|
standardId: STANDARD_OBJECT_IDS.calendarChannel,
|
||||||
namePlural: 'calendarChannels',
|
namePlural: 'calendarChannels',
|
||||||
labelSingular: 'Calendar Channel',
|
labelSingular: 'Calendar Channel',
|
||||||
@ -29,20 +29,10 @@ export enum CalendarChannelVisibility {
|
|||||||
description: 'Calendar Channels',
|
description: 'Calendar Channels',
|
||||||
icon: 'IconCalendar',
|
icon: 'IconCalendar',
|
||||||
})
|
})
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
export class CalendarChannelObjectMetadata extends BaseObjectMetadata {
|
export class CalendarChannelObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.connectedAccount,
|
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Connected Account',
|
|
||||||
description: 'Connected Account',
|
|
||||||
icon: 'IconUserCircle',
|
|
||||||
joinColumn: 'connectedAccountId',
|
|
||||||
})
|
|
||||||
connectedAccount: Relation<ConnectedAccountObjectMetadata>;
|
|
||||||
|
|
||||||
@FieldMetadata({
|
|
||||||
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.handle,
|
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.handle,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Handle',
|
label: 'Handle',
|
||||||
@ -51,7 +41,7 @@ export class CalendarChannelObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
handle: string;
|
handle: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.visibility,
|
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.visibility,
|
||||||
type: FieldMetadataType.SELECT,
|
type: FieldMetadataType.SELECT,
|
||||||
label: 'Visibility',
|
label: 'Visibility',
|
||||||
@ -75,7 +65,7 @@ export class CalendarChannelObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
visibility: string;
|
visibility: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId:
|
standardId:
|
||||||
CALENDAR_CHANNEL_STANDARD_FIELD_IDS.isContactAutoCreationEnabled,
|
CALENDAR_CHANNEL_STANDARD_FIELD_IDS.isContactAutoCreationEnabled,
|
||||||
type: FieldMetadataType.BOOLEAN,
|
type: FieldMetadataType.BOOLEAN,
|
||||||
@ -86,7 +76,7 @@ export class CalendarChannelObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
isContactAutoCreationEnabled: boolean;
|
isContactAutoCreationEnabled: boolean;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.isSyncEnabled,
|
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.isSyncEnabled,
|
||||||
type: FieldMetadataType.BOOLEAN,
|
type: FieldMetadataType.BOOLEAN,
|
||||||
label: 'Is Sync Enabled',
|
label: 'Is Sync Enabled',
|
||||||
@ -96,7 +86,7 @@ export class CalendarChannelObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
isSyncEnabled: boolean;
|
isSyncEnabled: boolean;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.syncCursor,
|
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.syncCursor,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Sync Cursor',
|
label: 'Sync Cursor',
|
||||||
@ -106,16 +96,25 @@ export class CalendarChannelObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
syncCursor: string;
|
syncCursor: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
|
standardId: CALENDAR_CHANNEL_STANDARD_FIELD_IDS.connectedAccount,
|
||||||
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
|
label: 'Connected Account',
|
||||||
|
description: 'Connected Account',
|
||||||
|
icon: 'IconUserCircle',
|
||||||
|
joinColumn: 'connectedAccountId',
|
||||||
|
inverseSideTarget: () => ConnectedAccountObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'calendarChannels',
|
||||||
|
})
|
||||||
|
connectedAccount: Relation<ConnectedAccountObjectMetadata>;
|
||||||
|
|
||||||
|
@WorkspaceRelation({
|
||||||
standardId:
|
standardId:
|
||||||
CALENDAR_CHANNEL_STANDARD_FIELD_IDS.calendarChannelEventAssociations,
|
CALENDAR_CHANNEL_STANDARD_FIELD_IDS.calendarChannelEventAssociations,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Calendar Channel Event Associations',
|
label: 'Calendar Channel Event Associations',
|
||||||
description: 'Calendar Channel Event Associations',
|
description: 'Calendar Channel Event Associations',
|
||||||
icon: 'IconCalendar',
|
icon: 'IconCalendar',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => CalendarChannelEventAssociationObjectMetadata,
|
inverseSideTarget: () => CalendarChannelEventAssociationObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
|
|||||||
@ -3,15 +3,17 @@ import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/i
|
|||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
import { CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { CalendarEventObjectMetadata } from 'src/modules/calendar/standard-objects/calendar-event.object-metadata';
|
import { CalendarEventObjectMetadata } from 'src/modules/calendar/standard-objects/calendar-event.object-metadata';
|
||||||
import { PersonObjectMetadata } from 'src/modules/person/standard-objects/person.object-metadata';
|
import { PersonObjectMetadata } from 'src/modules/person/standard-objects/person.object-metadata';
|
||||||
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
import { RelationMetadataType } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
|
||||||
export enum CalendarEventParticipantResponseStatus {
|
export enum CalendarEventParticipantResponseStatus {
|
||||||
NEEDS_ACTION = 'NEEDS_ACTION',
|
NEEDS_ACTION = 'NEEDS_ACTION',
|
||||||
@ -20,7 +22,7 @@ export enum CalendarEventParticipantResponseStatus {
|
|||||||
ACCEPTED = 'ACCEPTED',
|
ACCEPTED = 'ACCEPTED',
|
||||||
}
|
}
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.calendarEventParticipant,
|
standardId: STANDARD_OBJECT_IDS.calendarEventParticipant,
|
||||||
namePlural: 'calendarEventParticipants',
|
namePlural: 'calendarEventParticipants',
|
||||||
labelSingular: 'Calendar event participant',
|
labelSingular: 'Calendar event participant',
|
||||||
@ -28,20 +30,10 @@ export enum CalendarEventParticipantResponseStatus {
|
|||||||
description: 'Calendar event participants',
|
description: 'Calendar event participants',
|
||||||
icon: 'IconCalendar',
|
icon: 'IconCalendar',
|
||||||
})
|
})
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
export class CalendarEventParticipantObjectMetadata extends BaseObjectMetadata {
|
export class CalendarEventParticipantObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.calendarEvent,
|
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Event ID',
|
|
||||||
description: 'Event ID',
|
|
||||||
icon: 'IconCalendar',
|
|
||||||
joinColumn: 'calendarEventId',
|
|
||||||
})
|
|
||||||
calendarEvent: Relation<CalendarEventObjectMetadata>;
|
|
||||||
|
|
||||||
@FieldMetadata({
|
|
||||||
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.handle,
|
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.handle,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Handle',
|
label: 'Handle',
|
||||||
@ -50,7 +42,7 @@ export class CalendarEventParticipantObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
handle: string;
|
handle: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.displayName,
|
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.displayName,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Display Name',
|
label: 'Display Name',
|
||||||
@ -59,7 +51,7 @@ export class CalendarEventParticipantObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
displayName: string;
|
displayName: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.isOrganizer,
|
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.isOrganizer,
|
||||||
type: FieldMetadataType.BOOLEAN,
|
type: FieldMetadataType.BOOLEAN,
|
||||||
label: 'Is Organizer',
|
label: 'Is Organizer',
|
||||||
@ -69,7 +61,7 @@ export class CalendarEventParticipantObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
isOrganizer: boolean;
|
isOrganizer: boolean;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.responseStatus,
|
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.responseStatus,
|
||||||
type: FieldMetadataType.SELECT,
|
type: FieldMetadataType.SELECT,
|
||||||
label: 'Response Status',
|
label: 'Response Status',
|
||||||
@ -105,25 +97,41 @@ export class CalendarEventParticipantObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
responseStatus: string;
|
responseStatus: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
|
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.calendarEvent,
|
||||||
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
|
label: 'Event ID',
|
||||||
|
description: 'Event ID',
|
||||||
|
icon: 'IconCalendar',
|
||||||
|
joinColumn: 'calendarEventId',
|
||||||
|
inverseSideTarget: () => CalendarEventObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'calendarEventParticipants',
|
||||||
|
})
|
||||||
|
calendarEvent: Relation<CalendarEventObjectMetadata>;
|
||||||
|
|
||||||
|
@WorkspaceRelation({
|
||||||
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.person,
|
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.person,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Person',
|
label: 'Person',
|
||||||
description: 'Person',
|
description: 'Person',
|
||||||
icon: 'IconUser',
|
icon: 'IconUser',
|
||||||
joinColumn: 'personId',
|
joinColumn: 'personId',
|
||||||
|
inverseSideTarget: () => PersonObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'calendarEventParticipants',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
person: Relation<PersonObjectMetadata>;
|
person: Relation<PersonObjectMetadata>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.workspaceMember,
|
standardId: CALENDAR_EVENT_PARTICIPANT_STANDARD_FIELD_IDS.workspaceMember,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Workspace Member',
|
label: 'Workspace Member',
|
||||||
description: 'Workspace Member',
|
description: 'Workspace Member',
|
||||||
icon: 'IconUser',
|
icon: 'IconUser',
|
||||||
joinColumn: 'workspaceMemberId',
|
joinColumn: 'workspaceMemberId',
|
||||||
|
inverseSideTarget: () => WorkspaceMemberObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'calendarEventParticipants',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
workspaceMember: Relation<WorkspaceMemberObjectMetadata>;
|
workspaceMember: Relation<WorkspaceMemberObjectMetadata>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,24 +1,24 @@
|
|||||||
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface';
|
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface';
|
||||||
|
|
||||||
import { RelationMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/relation-metadata.decorator';
|
|
||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
import {
|
import {
|
||||||
RelationMetadataType,
|
RelationMetadataType,
|
||||||
RelationOnDeleteAction,
|
RelationOnDeleteAction,
|
||||||
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { CalendarChannelEventAssociationObjectMetadata } from 'src/modules/calendar/standard-objects/calendar-channel-event-association.object-metadata';
|
import { CalendarChannelEventAssociationObjectMetadata } from 'src/modules/calendar/standard-objects/calendar-channel-event-association.object-metadata';
|
||||||
import { CalendarEventParticipantObjectMetadata } from 'src/modules/calendar/standard-objects/calendar-event-participant.object-metadata';
|
import { CalendarEventParticipantObjectMetadata } from 'src/modules/calendar/standard-objects/calendar-event-participant.object-metadata';
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { CALENDAR_EVENT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { CALENDAR_EVENT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { LinkMetadata } from 'src/engine/metadata-modules/field-metadata/composite-types/link.composite-type';
|
import { LinkMetadata } from 'src/engine/metadata-modules/field-metadata/composite-types/link.composite-type';
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.calendarEvent,
|
standardId: STANDARD_OBJECT_IDS.calendarEvent,
|
||||||
namePlural: 'calendarEvents',
|
namePlural: 'calendarEvents',
|
||||||
labelSingular: 'Calendar event',
|
labelSingular: 'Calendar event',
|
||||||
@ -26,10 +26,10 @@ import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-me
|
|||||||
description: 'Calendar events',
|
description: 'Calendar events',
|
||||||
icon: 'IconCalendar',
|
icon: 'IconCalendar',
|
||||||
})
|
})
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
export class CalendarEventObjectMetadata extends BaseObjectMetadata {
|
export class CalendarEventObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.title,
|
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.title,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Title',
|
label: 'Title',
|
||||||
@ -38,7 +38,7 @@ export class CalendarEventObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
title: string;
|
title: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.isCanceled,
|
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.isCanceled,
|
||||||
type: FieldMetadataType.BOOLEAN,
|
type: FieldMetadataType.BOOLEAN,
|
||||||
label: 'Is canceled',
|
label: 'Is canceled',
|
||||||
@ -47,7 +47,7 @@ export class CalendarEventObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
isCanceled: boolean;
|
isCanceled: boolean;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.isFullDay,
|
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.isFullDay,
|
||||||
type: FieldMetadataType.BOOLEAN,
|
type: FieldMetadataType.BOOLEAN,
|
||||||
label: 'Is Full Day',
|
label: 'Is Full Day',
|
||||||
@ -56,47 +56,47 @@ export class CalendarEventObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
isFullDay: boolean;
|
isFullDay: boolean;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.startsAt,
|
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.startsAt,
|
||||||
type: FieldMetadataType.DATE_TIME,
|
type: FieldMetadataType.DATE_TIME,
|
||||||
label: 'Start Date',
|
label: 'Start Date',
|
||||||
description: 'Start Date',
|
description: 'Start Date',
|
||||||
icon: 'IconCalendarClock',
|
icon: 'IconCalendarClock',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
startsAt: string | null;
|
startsAt: string | null;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.endsAt,
|
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.endsAt,
|
||||||
type: FieldMetadataType.DATE_TIME,
|
type: FieldMetadataType.DATE_TIME,
|
||||||
label: 'End Date',
|
label: 'End Date',
|
||||||
description: 'End Date',
|
description: 'End Date',
|
||||||
icon: 'IconCalendarClock',
|
icon: 'IconCalendarClock',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
endsAt: string | null;
|
endsAt: string | null;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.externalCreatedAt,
|
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.externalCreatedAt,
|
||||||
type: FieldMetadataType.DATE_TIME,
|
type: FieldMetadataType.DATE_TIME,
|
||||||
label: 'Creation DateTime',
|
label: 'Creation DateTime',
|
||||||
description: 'Creation DateTime',
|
description: 'Creation DateTime',
|
||||||
icon: 'IconCalendarPlus',
|
icon: 'IconCalendarPlus',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
externalCreatedAt: string | null;
|
externalCreatedAt: string | null;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.externalUpdatedAt,
|
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.externalUpdatedAt,
|
||||||
type: FieldMetadataType.DATE_TIME,
|
type: FieldMetadataType.DATE_TIME,
|
||||||
label: 'Update DateTime',
|
label: 'Update DateTime',
|
||||||
description: 'Update DateTime',
|
description: 'Update DateTime',
|
||||||
icon: 'IconCalendarCog',
|
icon: 'IconCalendarCog',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
externalUpdatedAt: string | null;
|
externalUpdatedAt: string | null;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.description,
|
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.description,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Description',
|
label: 'Description',
|
||||||
@ -105,7 +105,7 @@ export class CalendarEventObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
description: string;
|
description: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.location,
|
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.location,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Location',
|
label: 'Location',
|
||||||
@ -114,7 +114,7 @@ export class CalendarEventObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
location: string;
|
location: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.iCalUID,
|
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.iCalUID,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'iCal UID',
|
label: 'iCal UID',
|
||||||
@ -123,7 +123,7 @@ export class CalendarEventObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
iCalUID: string;
|
iCalUID: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.conferenceSolution,
|
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.conferenceSolution,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Conference Solution',
|
label: 'Conference Solution',
|
||||||
@ -132,17 +132,17 @@ export class CalendarEventObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
conferenceSolution: string;
|
conferenceSolution: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.conferenceLink,
|
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.conferenceLink,
|
||||||
type: FieldMetadataType.LINK,
|
type: FieldMetadataType.LINK,
|
||||||
label: 'Meet Link',
|
label: 'Meet Link',
|
||||||
description: 'Meet Link',
|
description: 'Meet Link',
|
||||||
icon: 'IconLink',
|
icon: 'IconLink',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
conferenceLink: LinkMetadata;
|
conferenceLink: LinkMetadata;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.recurringEventExternalId,
|
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.recurringEventExternalId,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Recurring Event ID',
|
label: 'Recurring Event ID',
|
||||||
@ -151,33 +151,26 @@ export class CalendarEventObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
recurringEventExternalId: string;
|
recurringEventExternalId: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId:
|
standardId:
|
||||||
CALENDAR_EVENT_STANDARD_FIELD_IDS.calendarChannelEventAssociations,
|
CALENDAR_EVENT_STANDARD_FIELD_IDS.calendarChannelEventAssociations,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Calendar Channel Event Associations',
|
label: 'Calendar Channel Event Associations',
|
||||||
description: 'Calendar Channel Event Associations',
|
description: 'Calendar Channel Event Associations',
|
||||||
icon: 'IconCalendar',
|
icon: 'IconCalendar',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => CalendarChannelEventAssociationObjectMetadata,
|
inverseSideTarget: () => CalendarChannelEventAssociationObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
inverseSideFieldKey: 'calendarEvent',
|
|
||||||
})
|
})
|
||||||
calendarChannelEventAssociations: Relation<
|
calendarChannelEventAssociations: Relation<
|
||||||
CalendarChannelEventAssociationObjectMetadata[]
|
CalendarChannelEventAssociationObjectMetadata[]
|
||||||
>;
|
>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.calendarEventParticipants,
|
standardId: CALENDAR_EVENT_STANDARD_FIELD_IDS.calendarEventParticipants,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Event Participants',
|
label: 'Event Participants',
|
||||||
description: 'Event Participants',
|
description: 'Event Participants',
|
||||||
icon: 'IconUserCircle',
|
icon: 'IconUserCircle',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => CalendarEventParticipantObjectMetadata,
|
inverseSideTarget: () => CalendarEventParticipantObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
|
|||||||
@ -9,21 +9,21 @@ import {
|
|||||||
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
import { COMPANY_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { COMPANY_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { RelationMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/relation-metadata.decorator';
|
|
||||||
import { ActivityTargetObjectMetadata } from 'src/modules/activity/standard-objects/activity-target.object-metadata';
|
import { ActivityTargetObjectMetadata } from 'src/modules/activity/standard-objects/activity-target.object-metadata';
|
||||||
import { AttachmentObjectMetadata } from 'src/modules/attachment/standard-objects/attachment.object-metadata';
|
import { AttachmentObjectMetadata } from 'src/modules/attachment/standard-objects/attachment.object-metadata';
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { FavoriteObjectMetadata } from 'src/modules/favorite/standard-objects/favorite.object-metadata';
|
import { FavoriteObjectMetadata } from 'src/modules/favorite/standard-objects/favorite.object-metadata';
|
||||||
import { OpportunityObjectMetadata } from 'src/modules/opportunity/standard-objects/opportunity.object-metadata';
|
import { OpportunityObjectMetadata } from 'src/modules/opportunity/standard-objects/opportunity.object-metadata';
|
||||||
import { PersonObjectMetadata } from 'src/modules/person/standard-objects/person.object-metadata';
|
import { PersonObjectMetadata } from 'src/modules/person/standard-objects/person.object-metadata';
|
||||||
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
||||||
import { TimelineActivityObjectMetadata } from 'src/modules/timeline/standard-objects/timeline-activity.object-metadata';
|
import { TimelineActivityObjectMetadata } from 'src/modules/timeline/standard-objects/timeline-activity.object-metadata';
|
||||||
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.company,
|
standardId: STANDARD_OBJECT_IDS.company,
|
||||||
namePlural: 'companies',
|
namePlural: 'companies',
|
||||||
labelSingular: 'Company',
|
labelSingular: 'Company',
|
||||||
@ -31,8 +31,8 @@ import { TimelineActivityObjectMetadata } from 'src/modules/timeline/standard-ob
|
|||||||
description: 'A company',
|
description: 'A company',
|
||||||
icon: 'IconBuildingSkyscraper',
|
icon: 'IconBuildingSkyscraper',
|
||||||
})
|
})
|
||||||
export class CompanyObjectMetadata extends BaseObjectMetadata {
|
export class CompanyObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.name,
|
standardId: COMPANY_STANDARD_FIELD_IDS.name,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Name',
|
label: 'Name',
|
||||||
@ -41,7 +41,7 @@ export class CompanyObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.domainName,
|
standardId: COMPANY_STANDARD_FIELD_IDS.domainName,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Domain Name',
|
label: 'Domain Name',
|
||||||
@ -51,7 +51,7 @@ export class CompanyObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
domainName?: string;
|
domainName?: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.address,
|
standardId: COMPANY_STANDARD_FIELD_IDS.address,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Address',
|
label: 'Address',
|
||||||
@ -60,37 +60,37 @@ export class CompanyObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
address: string;
|
address: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.employees,
|
standardId: COMPANY_STANDARD_FIELD_IDS.employees,
|
||||||
type: FieldMetadataType.NUMBER,
|
type: FieldMetadataType.NUMBER,
|
||||||
label: 'Employees',
|
label: 'Employees',
|
||||||
description: 'Number of employees in the company',
|
description: 'Number of employees in the company',
|
||||||
icon: 'IconUsers',
|
icon: 'IconUsers',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
employees: number;
|
employees: number;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.linkedinLink,
|
standardId: COMPANY_STANDARD_FIELD_IDS.linkedinLink,
|
||||||
type: FieldMetadataType.LINK,
|
type: FieldMetadataType.LINK,
|
||||||
label: 'Linkedin',
|
label: 'Linkedin',
|
||||||
description: 'The company Linkedin account',
|
description: 'The company Linkedin account',
|
||||||
icon: 'IconBrandLinkedin',
|
icon: 'IconBrandLinkedin',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
linkedinLink: LinkMetadata;
|
linkedinLink: LinkMetadata;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.xLink,
|
standardId: COMPANY_STANDARD_FIELD_IDS.xLink,
|
||||||
type: FieldMetadataType.LINK,
|
type: FieldMetadataType.LINK,
|
||||||
label: 'X',
|
label: 'X',
|
||||||
description: 'The company Twitter/X account',
|
description: 'The company Twitter/X account',
|
||||||
icon: 'IconBrandX',
|
icon: 'IconBrandX',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
xLink: LinkMetadata;
|
xLink: LinkMetadata;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.annualRecurringRevenue,
|
standardId: COMPANY_STANDARD_FIELD_IDS.annualRecurringRevenue,
|
||||||
type: FieldMetadataType.CURRENCY,
|
type: FieldMetadataType.CURRENCY,
|
||||||
label: 'ARR',
|
label: 'ARR',
|
||||||
@ -98,10 +98,10 @@ export class CompanyObjectMetadata extends BaseObjectMetadata {
|
|||||||
'Annual Recurring Revenue: The actual or estimated annual revenue of the company',
|
'Annual Recurring Revenue: The actual or estimated annual revenue of the company',
|
||||||
icon: 'IconMoneybag',
|
icon: 'IconMoneybag',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
annualRecurringRevenue: CurrencyMetadata;
|
annualRecurringRevenue: CurrencyMetadata;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.idealCustomerProfile,
|
standardId: COMPANY_STANDARD_FIELD_IDS.idealCustomerProfile,
|
||||||
type: FieldMetadataType.BOOLEAN,
|
type: FieldMetadataType.BOOLEAN,
|
||||||
label: 'ICP',
|
label: 'ICP',
|
||||||
@ -112,119 +112,104 @@ export class CompanyObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
idealCustomerProfile: boolean;
|
idealCustomerProfile: boolean;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.position,
|
standardId: COMPANY_STANDARD_FIELD_IDS.position,
|
||||||
type: FieldMetadataType.POSITION,
|
type: FieldMetadataType.POSITION,
|
||||||
label: 'Position',
|
label: 'Position',
|
||||||
description: 'Company record position',
|
description: 'Company record position',
|
||||||
icon: 'IconHierarchy2',
|
icon: 'IconHierarchy2',
|
||||||
})
|
})
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
position: number;
|
position: number;
|
||||||
|
|
||||||
// Relations
|
// Relations
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.people,
|
standardId: COMPANY_STANDARD_FIELD_IDS.people,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'People',
|
label: 'People',
|
||||||
description: 'People linked to the company.',
|
description: 'People linked to the company.',
|
||||||
icon: 'IconUsers',
|
icon: 'IconUsers',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => PersonObjectMetadata,
|
inverseSideTarget: () => PersonObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
people: Relation<PersonObjectMetadata[]>;
|
people: Relation<PersonObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.accountOwner,
|
standardId: COMPANY_STANDARD_FIELD_IDS.accountOwner,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Account Owner',
|
label: 'Account Owner',
|
||||||
description:
|
description:
|
||||||
'Your team member responsible for managing the company account',
|
'Your team member responsible for managing the company account',
|
||||||
icon: 'IconUserCircle',
|
icon: 'IconUserCircle',
|
||||||
joinColumn: 'accountOwnerId',
|
joinColumn: 'accountOwnerId',
|
||||||
|
inverseSideTarget: () => WorkspaceMemberObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'accountOwnerForCompanies',
|
||||||
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
accountOwner: WorkspaceMemberObjectMetadata;
|
accountOwner: Relation<WorkspaceMemberObjectMetadata>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.activityTargets,
|
standardId: COMPANY_STANDARD_FIELD_IDS.activityTargets,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Activities',
|
label: 'Activities',
|
||||||
description: 'Activities tied to the company',
|
description: 'Activities tied to the company',
|
||||||
icon: 'IconCheckbox',
|
icon: 'IconCheckbox',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => ActivityTargetObjectMetadata,
|
inverseSideTarget: () => ActivityTargetObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
activityTargets: Relation<ActivityTargetObjectMetadata[]>;
|
activityTargets: Relation<ActivityTargetObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.opportunities,
|
standardId: COMPANY_STANDARD_FIELD_IDS.opportunities,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Opportunities',
|
label: 'Opportunities',
|
||||||
description: 'Opportunities linked to the company.',
|
description: 'Opportunities linked to the company.',
|
||||||
icon: 'IconTargetArrow',
|
icon: 'IconTargetArrow',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => OpportunityObjectMetadata,
|
inverseSideTarget: () => OpportunityObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
opportunities: Relation<OpportunityObjectMetadata[]>;
|
opportunities: Relation<OpportunityObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.favorites,
|
standardId: COMPANY_STANDARD_FIELD_IDS.favorites,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Favorites',
|
label: 'Favorites',
|
||||||
description: 'Favorites linked to the company',
|
description: 'Favorites linked to the company',
|
||||||
icon: 'IconHeart',
|
icon: 'IconHeart',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => FavoriteObjectMetadata,
|
inverseSideTarget: () => FavoriteObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
favorites: Relation<FavoriteObjectMetadata[]>;
|
favorites: Relation<FavoriteObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.attachments,
|
standardId: COMPANY_STANDARD_FIELD_IDS.attachments,
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Attachments',
|
|
||||||
description: 'Attachments linked to the company.',
|
|
||||||
icon: 'IconFileImport',
|
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
|
label: 'Attachments',
|
||||||
|
description: 'Attachments linked to the company',
|
||||||
|
icon: 'IconFileImport',
|
||||||
inverseSideTarget: () => AttachmentObjectMetadata,
|
inverseSideTarget: () => AttachmentObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
attachments: Relation<AttachmentObjectMetadata[]>;
|
attachments: Relation<AttachmentObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: COMPANY_STANDARD_FIELD_IDS.timelineActivities,
|
standardId: COMPANY_STANDARD_FIELD_IDS.timelineActivities,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Timeline Activities',
|
label: 'Timeline Activities',
|
||||||
description: 'Timeline Activities linked to the company',
|
description: 'Timeline Activities linked to the company',
|
||||||
icon: 'IconIconTimelineEvent',
|
icon: 'IconIconTimelineEvent',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => TimelineActivityObjectMetadata,
|
inverseSideTarget: () => TimelineActivityObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
timelineActivities: Relation<TimelineActivityObjectMetadata[]>;
|
timelineActivities: Relation<TimelineActivityObjectMetadata[]>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,14 +3,16 @@ import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/i
|
|||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
import { BLOCKLIST_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { BLOCKLIST_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
import { RelationMetadataType } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.blocklist,
|
standardId: STANDARD_OBJECT_IDS.blocklist,
|
||||||
namePlural: 'blocklists',
|
namePlural: 'blocklists',
|
||||||
labelSingular: 'Blocklist',
|
labelSingular: 'Blocklist',
|
||||||
@ -18,10 +20,10 @@ import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-me
|
|||||||
description: 'Blocklist',
|
description: 'Blocklist',
|
||||||
icon: 'IconForbid2',
|
icon: 'IconForbid2',
|
||||||
})
|
})
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
export class BlocklistObjectMetadata extends BaseObjectMetadata {
|
export class BlocklistObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: BLOCKLIST_STANDARD_FIELD_IDS.handle,
|
standardId: BLOCKLIST_STANDARD_FIELD_IDS.handle,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Handle',
|
label: 'Handle',
|
||||||
@ -30,13 +32,15 @@ export class BlocklistObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
handle: string;
|
handle: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: BLOCKLIST_STANDARD_FIELD_IDS.workspaceMember,
|
standardId: BLOCKLIST_STANDARD_FIELD_IDS.workspaceMember,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'WorkspaceMember',
|
label: 'WorkspaceMember',
|
||||||
description: 'WorkspaceMember',
|
description: 'WorkspaceMember',
|
||||||
icon: 'IconCircleUser',
|
icon: 'IconCircleUser',
|
||||||
joinColumn: 'workspaceMemberId',
|
joinColumn: 'workspaceMemberId',
|
||||||
|
inverseSideTarget: () => WorkspaceMemberObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'blocklist',
|
||||||
})
|
})
|
||||||
workspaceMember: Relation<WorkspaceMemberObjectMetadata>;
|
workspaceMember: Relation<WorkspaceMemberObjectMetadata>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,22 +7,22 @@ import {
|
|||||||
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
import { CONNECTED_ACCOUNT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { CONNECTED_ACCOUNT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { RelationMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/relation-metadata.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { CalendarChannelObjectMetadata } from 'src/modules/calendar/standard-objects/calendar-channel.object-metadata';
|
import { CalendarChannelObjectMetadata } from 'src/modules/calendar/standard-objects/calendar-channel.object-metadata';
|
||||||
import { MessageChannelObjectMetadata } from 'src/modules/messaging/standard-objects/message-channel.object-metadata';
|
import { MessageChannelObjectMetadata } from 'src/modules/messaging/standard-objects/message-channel.object-metadata';
|
||||||
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
|
||||||
export enum ConnectedAccountProvider {
|
export enum ConnectedAccountProvider {
|
||||||
GOOGLE = 'google',
|
GOOGLE = 'google',
|
||||||
}
|
}
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.connectedAccount,
|
standardId: STANDARD_OBJECT_IDS.connectedAccount,
|
||||||
namePlural: 'connectedAccounts',
|
namePlural: 'connectedAccounts',
|
||||||
labelSingular: 'Connected Account',
|
labelSingular: 'Connected Account',
|
||||||
@ -30,10 +30,10 @@ export enum ConnectedAccountProvider {
|
|||||||
description: 'A connected account',
|
description: 'A connected account',
|
||||||
icon: 'IconAt',
|
icon: 'IconAt',
|
||||||
})
|
})
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
export class ConnectedAccountObjectMetadata extends BaseObjectMetadata {
|
export class ConnectedAccountObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CONNECTED_ACCOUNT_STANDARD_FIELD_IDS.handle,
|
standardId: CONNECTED_ACCOUNT_STANDARD_FIELD_IDS.handle,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'handle',
|
label: 'handle',
|
||||||
@ -42,7 +42,7 @@ export class ConnectedAccountObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
handle: string;
|
handle: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CONNECTED_ACCOUNT_STANDARD_FIELD_IDS.provider,
|
standardId: CONNECTED_ACCOUNT_STANDARD_FIELD_IDS.provider,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'provider',
|
label: 'provider',
|
||||||
@ -51,7 +51,7 @@ export class ConnectedAccountObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
provider: ConnectedAccountProvider; // field metadata should be a SELECT
|
provider: ConnectedAccountProvider; // field metadata should be a SELECT
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CONNECTED_ACCOUNT_STANDARD_FIELD_IDS.accessToken,
|
standardId: CONNECTED_ACCOUNT_STANDARD_FIELD_IDS.accessToken,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Access Token',
|
label: 'Access Token',
|
||||||
@ -60,7 +60,7 @@ export class ConnectedAccountObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
accessToken: string;
|
accessToken: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CONNECTED_ACCOUNT_STANDARD_FIELD_IDS.refreshToken,
|
standardId: CONNECTED_ACCOUNT_STANDARD_FIELD_IDS.refreshToken,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Refresh Token',
|
label: 'Refresh Token',
|
||||||
@ -69,17 +69,7 @@ export class ConnectedAccountObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
refreshToken: string;
|
refreshToken: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CONNECTED_ACCOUNT_STANDARD_FIELD_IDS.accountOwner,
|
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Account Owner',
|
|
||||||
description: 'Account Owner',
|
|
||||||
icon: 'IconUserCircle',
|
|
||||||
joinColumn: 'accountOwnerId',
|
|
||||||
})
|
|
||||||
accountOwner: Relation<WorkspaceMemberObjectMetadata>;
|
|
||||||
|
|
||||||
@FieldMetadata({
|
|
||||||
standardId: CONNECTED_ACCOUNT_STANDARD_FIELD_IDS.lastSyncHistoryId,
|
standardId: CONNECTED_ACCOUNT_STANDARD_FIELD_IDS.lastSyncHistoryId,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Last sync history ID',
|
label: 'Last sync history ID',
|
||||||
@ -88,39 +78,45 @@ export class ConnectedAccountObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
lastSyncHistoryId: string;
|
lastSyncHistoryId: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: CONNECTED_ACCOUNT_STANDARD_FIELD_IDS.authFailedAt,
|
standardId: CONNECTED_ACCOUNT_STANDARD_FIELD_IDS.authFailedAt,
|
||||||
type: FieldMetadataType.DATE_TIME,
|
type: FieldMetadataType.DATE_TIME,
|
||||||
label: 'Auth failed at',
|
label: 'Auth failed at',
|
||||||
description: 'Auth failed at',
|
description: 'Auth failed at',
|
||||||
icon: 'IconX',
|
icon: 'IconX',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
authFailedAt: Date;
|
authFailedAt: Date;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: CONNECTED_ACCOUNT_STANDARD_FIELD_IDS.messageChannels,
|
standardId: CONNECTED_ACCOUNT_STANDARD_FIELD_IDS.accountOwner,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Message Channel',
|
label: 'Account Owner',
|
||||||
description: 'Message Channel',
|
description: 'Account Owner',
|
||||||
icon: 'IconMessage',
|
icon: 'IconUserCircle',
|
||||||
|
joinColumn: 'accountOwnerId',
|
||||||
|
inverseSideTarget: () => WorkspaceMemberObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'connectedAccounts',
|
||||||
})
|
})
|
||||||
@RelationMetadata({
|
accountOwner: Relation<WorkspaceMemberObjectMetadata>;
|
||||||
|
|
||||||
|
@WorkspaceRelation({
|
||||||
|
standardId: CONNECTED_ACCOUNT_STANDARD_FIELD_IDS.messageChannels,
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
|
label: 'Message Channels',
|
||||||
|
description: 'Message Channels',
|
||||||
|
icon: 'IconMessage',
|
||||||
inverseSideTarget: () => MessageChannelObjectMetadata,
|
inverseSideTarget: () => MessageChannelObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
messageChannels: Relation<MessageChannelObjectMetadata[]>;
|
messageChannels: Relation<MessageChannelObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: CONNECTED_ACCOUNT_STANDARD_FIELD_IDS.calendarChannels,
|
standardId: CONNECTED_ACCOUNT_STANDARD_FIELD_IDS.calendarChannels,
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Calendar Channel',
|
|
||||||
description: 'Calendar Channel',
|
|
||||||
icon: 'IconCalendar',
|
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
|
label: 'Calendar Channels',
|
||||||
|
description: 'Calendar Channels',
|
||||||
|
icon: 'IconCalendar',
|
||||||
inverseSideTarget: () => CalendarChannelObjectMetadata,
|
inverseSideTarget: () => CalendarChannelObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
|
|||||||
@ -3,20 +3,22 @@ import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/i
|
|||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
import { FAVORITE_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { FAVORITE_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { CustomObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/custom-objects/custom.object-metadata';
|
import { CustomWorkspaceEntity } from 'src/engine/twenty-orm/custom.workspace-entity';
|
||||||
import { DynamicRelationFieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/dynamic-field-metadata.interface';
|
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { CompanyObjectMetadata } from 'src/modules/company/standard-objects/company.object-metadata';
|
import { CompanyObjectMetadata } from 'src/modules/company/standard-objects/company.object-metadata';
|
||||||
import { OpportunityObjectMetadata } from 'src/modules/opportunity/standard-objects/opportunity.object-metadata';
|
import { OpportunityObjectMetadata } from 'src/modules/opportunity/standard-objects/opportunity.object-metadata';
|
||||||
import { PersonObjectMetadata } from 'src/modules/person/standard-objects/person.object-metadata';
|
import { PersonObjectMetadata } from 'src/modules/person/standard-objects/person.object-metadata';
|
||||||
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
import { RelationMetadataType } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
import { WorkspaceDynamicRelation } from 'src/engine/twenty-orm/decorators/workspace-dynamic-relation.decorator';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.favorite,
|
standardId: STANDARD_OBJECT_IDS.favorite,
|
||||||
namePlural: 'favorites',
|
namePlural: 'favorites',
|
||||||
labelSingular: 'Favorite',
|
labelSingular: 'Favorite',
|
||||||
@ -24,10 +26,10 @@ import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-me
|
|||||||
description: 'A favorite',
|
description: 'A favorite',
|
||||||
icon: 'IconHeart',
|
icon: 'IconHeart',
|
||||||
})
|
})
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
export class FavoriteObjectMetadata extends BaseObjectMetadata {
|
export class FavoriteObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: FAVORITE_STANDARD_FIELD_IDS.position,
|
standardId: FAVORITE_STANDARD_FIELD_IDS.position,
|
||||||
type: FieldMetadataType.NUMBER,
|
type: FieldMetadataType.NUMBER,
|
||||||
label: 'Position',
|
label: 'Position',
|
||||||
@ -38,56 +40,69 @@ export class FavoriteObjectMetadata extends BaseObjectMetadata {
|
|||||||
position: number;
|
position: number;
|
||||||
|
|
||||||
// Relations
|
// Relations
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: FAVORITE_STANDARD_FIELD_IDS.workspaceMember,
|
standardId: FAVORITE_STANDARD_FIELD_IDS.workspaceMember,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Workspace Member',
|
label: 'Workspace Member',
|
||||||
description: 'Favorite workspace member',
|
description: 'Favorite workspace member',
|
||||||
icon: 'IconCircleUser',
|
icon: 'IconCircleUser',
|
||||||
joinColumn: 'workspaceMemberId',
|
joinColumn: 'workspaceMemberId',
|
||||||
|
inverseSideFieldKey: 'favorites',
|
||||||
|
inverseSideTarget: () => WorkspaceMemberObjectMetadata,
|
||||||
})
|
})
|
||||||
workspaceMember: Relation<WorkspaceMemberObjectMetadata>;
|
workspaceMember: Relation<WorkspaceMemberObjectMetadata>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: FAVORITE_STANDARD_FIELD_IDS.person,
|
standardId: FAVORITE_STANDARD_FIELD_IDS.person,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Person',
|
label: 'Person',
|
||||||
description: 'Favorite person',
|
description: 'Favorite person',
|
||||||
icon: 'IconUser',
|
icon: 'IconUser',
|
||||||
joinColumn: 'personId',
|
joinColumn: 'personId',
|
||||||
|
inverseSideTarget: () => PersonObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'favorites',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
person: Relation<PersonObjectMetadata>;
|
person: Relation<PersonObjectMetadata>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: FAVORITE_STANDARD_FIELD_IDS.company,
|
standardId: FAVORITE_STANDARD_FIELD_IDS.company,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Company',
|
label: 'Company',
|
||||||
description: 'Favorite company',
|
description: 'Favorite company',
|
||||||
icon: 'IconBuildingSkyscraper',
|
icon: 'IconBuildingSkyscraper',
|
||||||
joinColumn: 'companyId',
|
joinColumn: 'companyId',
|
||||||
|
inverseSideTarget: () => CompanyObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'favorites',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
company: Relation<CompanyObjectMetadata>;
|
company: Relation<CompanyObjectMetadata>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: FAVORITE_STANDARD_FIELD_IDS.opportunity,
|
standardId: FAVORITE_STANDARD_FIELD_IDS.opportunity,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Opportunity',
|
label: 'Opportunity',
|
||||||
description: 'Favorite opportunity',
|
description: 'Favorite opportunity',
|
||||||
icon: 'IconTargetArrow',
|
icon: 'IconTargetArrow',
|
||||||
joinColumn: 'opportunityId',
|
joinColumn: 'opportunityId',
|
||||||
|
inverseSideTarget: () => OpportunityObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'favorites',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
opportunity: Relation<OpportunityObjectMetadata>;
|
opportunity: Relation<OpportunityObjectMetadata>;
|
||||||
|
|
||||||
@DynamicRelationFieldMetadata((oppositeObjectMetadata) => ({
|
@WorkspaceDynamicRelation({
|
||||||
standardId: FAVORITE_STANDARD_FIELD_IDS.custom,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
name: oppositeObjectMetadata.nameSingular,
|
argsFactory: (oppositeObjectMetadata) => ({
|
||||||
label: oppositeObjectMetadata.labelSingular,
|
standardId: FAVORITE_STANDARD_FIELD_IDS.custom,
|
||||||
description: `Favorite ${oppositeObjectMetadata.labelSingular}`,
|
name: oppositeObjectMetadata.nameSingular,
|
||||||
joinColumn: `${oppositeObjectMetadata.nameSingular}Id`,
|
label: oppositeObjectMetadata.labelSingular,
|
||||||
icon: 'IconBuildingSkyscraper',
|
description: `Favorite ${oppositeObjectMetadata.labelSingular}`,
|
||||||
}))
|
joinColumn: `${oppositeObjectMetadata.nameSingular}Id`,
|
||||||
custom: Relation<CustomObjectMetadata>;
|
icon: 'IconBuildingSkyscraper',
|
||||||
|
}),
|
||||||
|
inverseSideTarget: () => CustomWorkspaceEntity,
|
||||||
|
inverseSideFieldKey: 'favorites',
|
||||||
|
})
|
||||||
|
custom: Relation<CustomWorkspaceEntity>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,17 +3,19 @@ import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/i
|
|||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
import { MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { MessageChannelObjectMetadata } from 'src/modules/messaging/standard-objects/message-channel.object-metadata';
|
import { MessageChannelObjectMetadata } from 'src/modules/messaging/standard-objects/message-channel.object-metadata';
|
||||||
import { MessageThreadObjectMetadata } from 'src/modules/messaging/standard-objects/message-thread.object-metadata';
|
import { MessageThreadObjectMetadata } from 'src/modules/messaging/standard-objects/message-thread.object-metadata';
|
||||||
import { MessageObjectMetadata } from 'src/modules/messaging/standard-objects/message.object-metadata';
|
import { MessageObjectMetadata } from 'src/modules/messaging/standard-objects/message.object-metadata';
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
import { RelationMetadataType } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.messageChannelMessageAssociation,
|
standardId: STANDARD_OBJECT_IDS.messageChannelMessageAssociation,
|
||||||
namePlural: 'messageChannelMessageAssociations',
|
namePlural: 'messageChannelMessageAssociations',
|
||||||
labelSingular: 'Message Channel Message Association',
|
labelSingular: 'Message Channel Message Association',
|
||||||
@ -21,33 +23,10 @@ import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-me
|
|||||||
description: 'Message Synced with a Message Channel',
|
description: 'Message Synced with a Message Channel',
|
||||||
icon: 'IconMessage',
|
icon: 'IconMessage',
|
||||||
})
|
})
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
export class MessageChannelMessageAssociationObjectMetadata extends BaseObjectMetadata {
|
export class MessageChannelMessageAssociationObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId:
|
|
||||||
MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_STANDARD_FIELD_IDS.messageChannel,
|
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Message Channel Id',
|
|
||||||
description: 'Message Channel Id',
|
|
||||||
icon: 'IconHash',
|
|
||||||
joinColumn: 'messageChannelId',
|
|
||||||
})
|
|
||||||
@IsNullable()
|
|
||||||
messageChannel: Relation<MessageChannelObjectMetadata>;
|
|
||||||
|
|
||||||
@FieldMetadata({
|
|
||||||
standardId: MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_STANDARD_FIELD_IDS.message,
|
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Message Id',
|
|
||||||
description: 'Message Id',
|
|
||||||
icon: 'IconHash',
|
|
||||||
joinColumn: 'messageId',
|
|
||||||
})
|
|
||||||
@IsNullable()
|
|
||||||
message: Relation<MessageObjectMetadata>;
|
|
||||||
|
|
||||||
@FieldMetadata({
|
|
||||||
standardId:
|
standardId:
|
||||||
MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_STANDARD_FIELD_IDS.messageExternalId,
|
MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_STANDARD_FIELD_IDS.messageExternalId,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
@ -55,22 +34,10 @@ export class MessageChannelMessageAssociationObjectMetadata extends BaseObjectMe
|
|||||||
description: 'Message id from the messaging provider',
|
description: 'Message id from the messaging provider',
|
||||||
icon: 'IconHash',
|
icon: 'IconHash',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
messageExternalId: string;
|
messageExternalId: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId:
|
|
||||||
MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_STANDARD_FIELD_IDS.messageThread,
|
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Message Thread Id',
|
|
||||||
description: 'Message Thread Id',
|
|
||||||
icon: 'IconHash',
|
|
||||||
joinColumn: 'messageThreadId',
|
|
||||||
})
|
|
||||||
@IsNullable()
|
|
||||||
messageThread: Relation<MessageThreadObjectMetadata>;
|
|
||||||
|
|
||||||
@FieldMetadata({
|
|
||||||
standardId:
|
standardId:
|
||||||
MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_STANDARD_FIELD_IDS.messageThreadExternalId,
|
MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_STANDARD_FIELD_IDS.messageThreadExternalId,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
@ -78,6 +45,47 @@ export class MessageChannelMessageAssociationObjectMetadata extends BaseObjectMe
|
|||||||
description: 'Thread id from the messaging provider',
|
description: 'Thread id from the messaging provider',
|
||||||
icon: 'IconHash',
|
icon: 'IconHash',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
messageThreadExternalId: string;
|
messageThreadExternalId: string;
|
||||||
|
|
||||||
|
@WorkspaceRelation({
|
||||||
|
standardId:
|
||||||
|
MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_STANDARD_FIELD_IDS.messageChannel,
|
||||||
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
|
label: 'Message Channel Id',
|
||||||
|
description: 'Message Channel Id',
|
||||||
|
icon: 'IconHash',
|
||||||
|
joinColumn: 'messageChannelId',
|
||||||
|
inverseSideTarget: () => MessageChannelObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'messageChannelMessageAssociations',
|
||||||
|
})
|
||||||
|
@WorkspaceIsNullable()
|
||||||
|
messageChannel: Relation<MessageChannelObjectMetadata>;
|
||||||
|
|
||||||
|
@WorkspaceRelation({
|
||||||
|
standardId: MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_STANDARD_FIELD_IDS.message,
|
||||||
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
|
label: 'Message Id',
|
||||||
|
description: 'Message Id',
|
||||||
|
icon: 'IconHash',
|
||||||
|
joinColumn: 'messageId',
|
||||||
|
inverseSideTarget: () => MessageObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'messageChannelMessageAssociations',
|
||||||
|
})
|
||||||
|
@WorkspaceIsNullable()
|
||||||
|
message: Relation<MessageObjectMetadata>;
|
||||||
|
|
||||||
|
@WorkspaceRelation({
|
||||||
|
standardId:
|
||||||
|
MESSAGE_CHANNEL_MESSAGE_ASSOCIATION_STANDARD_FIELD_IDS.messageThread,
|
||||||
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
|
label: 'Message Thread Id',
|
||||||
|
description: 'Message Thread Id',
|
||||||
|
icon: 'IconHash',
|
||||||
|
joinColumn: 'messageThreadId',
|
||||||
|
inverseSideTarget: () => MessageThreadObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'messageChannelMessageAssociations',
|
||||||
|
})
|
||||||
|
@WorkspaceIsNullable()
|
||||||
|
messageThread: Relation<MessageThreadObjectMetadata>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,15 +7,15 @@ import {
|
|||||||
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
import { MESSAGE_CHANNEL_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { MESSAGE_CHANNEL_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { RelationMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/relation-metadata.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { ConnectedAccountObjectMetadata } from 'src/modules/connected-account/standard-objects/connected-account.object-metadata';
|
import { ConnectedAccountObjectMetadata } from 'src/modules/connected-account/standard-objects/connected-account.object-metadata';
|
||||||
import { MessageChannelMessageAssociationObjectMetadata } from 'src/modules/messaging/standard-objects/message-channel-message-association.object-metadata';
|
import { MessageChannelMessageAssociationObjectMetadata } from 'src/modules/messaging/standard-objects/message-channel-message-association.object-metadata';
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
|
||||||
export enum MessageChannelSyncStatus {
|
export enum MessageChannelSyncStatus {
|
||||||
PENDING = 'PENDING',
|
PENDING = 'PENDING',
|
||||||
@ -35,7 +35,7 @@ export enum MessageChannelType {
|
|||||||
SMS = 'sms',
|
SMS = 'sms',
|
||||||
}
|
}
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.messageChannel,
|
standardId: STANDARD_OBJECT_IDS.messageChannel,
|
||||||
namePlural: 'messageChannels',
|
namePlural: 'messageChannels',
|
||||||
labelSingular: 'Message Channel',
|
labelSingular: 'Message Channel',
|
||||||
@ -43,10 +43,10 @@ export enum MessageChannelType {
|
|||||||
description: 'Message Channels',
|
description: 'Message Channels',
|
||||||
icon: 'IconMessage',
|
icon: 'IconMessage',
|
||||||
})
|
})
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
export class MessageChannelObjectMetadata extends BaseObjectMetadata {
|
export class MessageChannelObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.visibility,
|
standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.visibility,
|
||||||
type: FieldMetadataType.SELECT,
|
type: FieldMetadataType.SELECT,
|
||||||
label: 'Visibility',
|
label: 'Visibility',
|
||||||
@ -76,7 +76,7 @@ export class MessageChannelObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
visibility: string;
|
visibility: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.handle,
|
standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.handle,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Handle',
|
label: 'Handle',
|
||||||
@ -85,17 +85,7 @@ export class MessageChannelObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
handle: string;
|
handle: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.connectedAccount,
|
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Connected Account',
|
|
||||||
description: 'Connected Account',
|
|
||||||
icon: 'IconUserCircle',
|
|
||||||
joinColumn: 'connectedAccountId',
|
|
||||||
})
|
|
||||||
connectedAccount: Relation<ConnectedAccountObjectMetadata>;
|
|
||||||
|
|
||||||
@FieldMetadata({
|
|
||||||
standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.type,
|
standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.type,
|
||||||
type: FieldMetadataType.SELECT,
|
type: FieldMetadataType.SELECT,
|
||||||
label: 'Type',
|
label: 'Type',
|
||||||
@ -119,7 +109,7 @@ export class MessageChannelObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
type: string;
|
type: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.isContactAutoCreationEnabled,
|
standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.isContactAutoCreationEnabled,
|
||||||
type: FieldMetadataType.BOOLEAN,
|
type: FieldMetadataType.BOOLEAN,
|
||||||
label: 'Is Contact Auto Creation Enabled',
|
label: 'Is Contact Auto Creation Enabled',
|
||||||
@ -129,7 +119,7 @@ export class MessageChannelObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
isContactAutoCreationEnabled: boolean;
|
isContactAutoCreationEnabled: boolean;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.isSyncEnabled,
|
standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.isSyncEnabled,
|
||||||
type: FieldMetadataType.BOOLEAN,
|
type: FieldMetadataType.BOOLEAN,
|
||||||
label: 'Is Sync Enabled',
|
label: 'Is Sync Enabled',
|
||||||
@ -139,25 +129,7 @@ export class MessageChannelObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
isSyncEnabled: boolean;
|
isSyncEnabled: boolean;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId:
|
|
||||||
MESSAGE_CHANNEL_STANDARD_FIELD_IDS.messageChannelMessageAssociations,
|
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Message Channel Association',
|
|
||||||
description: 'Messages from the channel.',
|
|
||||||
icon: 'IconMessage',
|
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => MessageChannelMessageAssociationObjectMetadata,
|
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
|
||||||
})
|
|
||||||
@IsNullable()
|
|
||||||
messageChannelMessageAssociations: Relation<
|
|
||||||
MessageChannelMessageAssociationObjectMetadata[]
|
|
||||||
>;
|
|
||||||
|
|
||||||
@FieldMetadata({
|
|
||||||
standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.syncCursor,
|
standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.syncCursor,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Last sync cursor',
|
label: 'Last sync cursor',
|
||||||
@ -166,17 +138,17 @@ export class MessageChannelObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
syncCursor: string;
|
syncCursor: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.syncedAt,
|
standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.syncedAt,
|
||||||
type: FieldMetadataType.DATE_TIME,
|
type: FieldMetadataType.DATE_TIME,
|
||||||
label: 'Last sync date',
|
label: 'Last sync date',
|
||||||
description: 'Last sync date',
|
description: 'Last sync date',
|
||||||
icon: 'IconHistory',
|
icon: 'IconHistory',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
syncedAt: string;
|
syncedAt: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.syncStatus,
|
standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.syncStatus,
|
||||||
type: FieldMetadataType.SELECT,
|
type: FieldMetadataType.SELECT,
|
||||||
label: 'Last sync status',
|
label: 'Last sync status',
|
||||||
@ -209,16 +181,43 @@ export class MessageChannelObjectMetadata extends BaseObjectMetadata {
|
|||||||
},
|
},
|
||||||
],
|
],
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
syncStatus: MessageChannelSyncStatus;
|
syncStatus: MessageChannelSyncStatus;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.ongoingSyncStartedAt,
|
standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.ongoingSyncStartedAt,
|
||||||
type: FieldMetadataType.DATE_TIME,
|
type: FieldMetadataType.DATE_TIME,
|
||||||
label: 'Ongoing sync started at',
|
label: 'Ongoing sync started at',
|
||||||
description: 'Ongoing sync started at',
|
description: 'Ongoing sync started at',
|
||||||
icon: 'IconHistory',
|
icon: 'IconHistory',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
ongoingSyncStartedAt: string;
|
ongoingSyncStartedAt: string;
|
||||||
|
|
||||||
|
@WorkspaceRelation({
|
||||||
|
standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.connectedAccount,
|
||||||
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
|
label: 'Connected Account',
|
||||||
|
description: 'Connected Account',
|
||||||
|
icon: 'IconUserCircle',
|
||||||
|
joinColumn: 'connectedAccountId',
|
||||||
|
inverseSideTarget: () => ConnectedAccountObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'messageChannels',
|
||||||
|
})
|
||||||
|
connectedAccount: Relation<ConnectedAccountObjectMetadata>;
|
||||||
|
|
||||||
|
@WorkspaceRelation({
|
||||||
|
standardId:
|
||||||
|
MESSAGE_CHANNEL_STANDARD_FIELD_IDS.messageChannelMessageAssociations,
|
||||||
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
|
label: 'Message Channel Association',
|
||||||
|
description: 'Messages from the channel.',
|
||||||
|
icon: 'IconMessage',
|
||||||
|
inverseSideTarget: () => MessageChannelMessageAssociationObjectMetadata,
|
||||||
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
|
})
|
||||||
|
@WorkspaceIsNullable()
|
||||||
|
messageChannelMessageAssociations: Relation<
|
||||||
|
MessageChannelMessageAssociationObjectMetadata[]
|
||||||
|
>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,17 +3,19 @@ import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/i
|
|||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
import { MESSAGE_PARTICIPANT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { MESSAGE_PARTICIPANT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { MessageObjectMetadata } from 'src/modules/messaging/standard-objects/message.object-metadata';
|
import { MessageObjectMetadata } from 'src/modules/messaging/standard-objects/message.object-metadata';
|
||||||
import { PersonObjectMetadata } from 'src/modules/person/standard-objects/person.object-metadata';
|
import { PersonObjectMetadata } from 'src/modules/person/standard-objects/person.object-metadata';
|
||||||
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
import { RelationMetadataType } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.messageParticipant,
|
standardId: STANDARD_OBJECT_IDS.messageParticipant,
|
||||||
namePlural: 'messageParticipants',
|
namePlural: 'messageParticipants',
|
||||||
labelSingular: 'Message Participant',
|
labelSingular: 'Message Participant',
|
||||||
@ -21,20 +23,10 @@ import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-me
|
|||||||
description: 'Message Participants',
|
description: 'Message Participants',
|
||||||
icon: 'IconUserCircle',
|
icon: 'IconUserCircle',
|
||||||
})
|
})
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
export class MessageParticipantObjectMetadata extends BaseObjectMetadata {
|
export class MessageParticipantObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: MESSAGE_PARTICIPANT_STANDARD_FIELD_IDS.message,
|
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Message',
|
|
||||||
description: 'Message',
|
|
||||||
icon: 'IconMessage',
|
|
||||||
joinColumn: 'messageId',
|
|
||||||
})
|
|
||||||
message: Relation<MessageObjectMetadata>;
|
|
||||||
|
|
||||||
@FieldMetadata({
|
|
||||||
standardId: MESSAGE_PARTICIPANT_STANDARD_FIELD_IDS.role,
|
standardId: MESSAGE_PARTICIPANT_STANDARD_FIELD_IDS.role,
|
||||||
type: FieldMetadataType.SELECT,
|
type: FieldMetadataType.SELECT,
|
||||||
label: 'Role',
|
label: 'Role',
|
||||||
@ -50,7 +42,7 @@ export class MessageParticipantObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
role: string;
|
role: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: MESSAGE_PARTICIPANT_STANDARD_FIELD_IDS.handle,
|
standardId: MESSAGE_PARTICIPANT_STANDARD_FIELD_IDS.handle,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Handle',
|
label: 'Handle',
|
||||||
@ -59,7 +51,7 @@ export class MessageParticipantObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
handle: string;
|
handle: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: MESSAGE_PARTICIPANT_STANDARD_FIELD_IDS.displayName,
|
standardId: MESSAGE_PARTICIPANT_STANDARD_FIELD_IDS.displayName,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Display Name',
|
label: 'Display Name',
|
||||||
@ -68,25 +60,41 @@ export class MessageParticipantObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
displayName: string;
|
displayName: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
|
standardId: MESSAGE_PARTICIPANT_STANDARD_FIELD_IDS.message,
|
||||||
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
|
label: 'Message',
|
||||||
|
description: 'Message',
|
||||||
|
icon: 'IconMessage',
|
||||||
|
joinColumn: 'messageId',
|
||||||
|
inverseSideTarget: () => MessageObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'messageParticipants',
|
||||||
|
})
|
||||||
|
message: Relation<MessageObjectMetadata>;
|
||||||
|
|
||||||
|
@WorkspaceRelation({
|
||||||
standardId: MESSAGE_PARTICIPANT_STANDARD_FIELD_IDS.person,
|
standardId: MESSAGE_PARTICIPANT_STANDARD_FIELD_IDS.person,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Person',
|
label: 'Person',
|
||||||
description: 'Person',
|
description: 'Person',
|
||||||
icon: 'IconUser',
|
icon: 'IconUser',
|
||||||
joinColumn: 'personId',
|
joinColumn: 'personId',
|
||||||
|
inverseSideTarget: () => PersonObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'messageParticipants',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
person: Relation<PersonObjectMetadata>;
|
person: Relation<PersonObjectMetadata>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: MESSAGE_PARTICIPANT_STANDARD_FIELD_IDS.workspaceMember,
|
standardId: MESSAGE_PARTICIPANT_STANDARD_FIELD_IDS.workspaceMember,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Workspace Member',
|
label: 'Workspace Member',
|
||||||
description: 'Workspace member',
|
description: 'Workspace member',
|
||||||
icon: 'IconCircleUser',
|
icon: 'IconCircleUser',
|
||||||
joinColumn: 'workspaceMemberId',
|
joinColumn: 'workspaceMemberId',
|
||||||
|
inverseSideTarget: () => WorkspaceMemberObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'messageParticipants',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
workspaceMember: Relation<WorkspaceMemberObjectMetadata>;
|
workspaceMember: Relation<WorkspaceMemberObjectMetadata>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,23 +1,21 @@
|
|||||||
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface';
|
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface';
|
||||||
|
|
||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
|
||||||
import {
|
import {
|
||||||
RelationMetadataType,
|
RelationMetadataType,
|
||||||
RelationOnDeleteAction,
|
RelationOnDeleteAction,
|
||||||
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
import { MESSAGE_THREAD_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { MESSAGE_THREAD_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { RelationMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/relation-metadata.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { MessageChannelMessageAssociationObjectMetadata } from 'src/modules/messaging/standard-objects/message-channel-message-association.object-metadata';
|
import { MessageChannelMessageAssociationObjectMetadata } from 'src/modules/messaging/standard-objects/message-channel-message-association.object-metadata';
|
||||||
import { MessageObjectMetadata } from 'src/modules/messaging/standard-objects/message.object-metadata';
|
import { MessageObjectMetadata } from 'src/modules/messaging/standard-objects/message.object-metadata';
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.messageThread,
|
standardId: STANDARD_OBJECT_IDS.messageThread,
|
||||||
namePlural: 'messageThreads',
|
namePlural: 'messageThreads',
|
||||||
labelSingular: 'Message Thread',
|
labelSingular: 'Message Thread',
|
||||||
@ -25,38 +23,32 @@ import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-me
|
|||||||
description: 'Message Thread',
|
description: 'Message Thread',
|
||||||
icon: 'IconMessage',
|
icon: 'IconMessage',
|
||||||
})
|
})
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
export class MessageThreadObjectMetadata extends BaseObjectMetadata {
|
export class MessageThreadObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: MESSAGE_THREAD_STANDARD_FIELD_IDS.messages,
|
standardId: MESSAGE_THREAD_STANDARD_FIELD_IDS.messages,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Messages',
|
label: 'Messages',
|
||||||
description: 'Messages from the thread.',
|
description: 'Messages from the thread.',
|
||||||
icon: 'IconMessage',
|
icon: 'IconMessage',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => MessageObjectMetadata,
|
inverseSideTarget: () => MessageObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
messages: Relation<MessageObjectMetadata[]>;
|
messages: Relation<MessageObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId:
|
standardId:
|
||||||
MESSAGE_THREAD_STANDARD_FIELD_IDS.messageChannelMessageAssociations,
|
MESSAGE_THREAD_STANDARD_FIELD_IDS.messageChannelMessageAssociations,
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Message Channel Association',
|
|
||||||
description: 'Messages from the channel.',
|
|
||||||
icon: 'IconMessage',
|
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
|
label: 'Message Channel Association',
|
||||||
|
description: 'Messages from the channel',
|
||||||
|
icon: 'IconMessage',
|
||||||
inverseSideTarget: () => MessageChannelMessageAssociationObjectMetadata,
|
inverseSideTarget: () => MessageChannelMessageAssociationObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.RESTRICT,
|
onDelete: RelationOnDeleteAction.RESTRICT,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
messageChannelMessageAssociations: Relation<
|
messageChannelMessageAssociations: Relation<
|
||||||
MessageChannelMessageAssociationObjectMetadata[]
|
MessageChannelMessageAssociationObjectMetadata[]
|
||||||
>;
|
>;
|
||||||
|
|||||||
@ -7,18 +7,18 @@ import {
|
|||||||
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
import { MESSAGE_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { MESSAGE_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { RelationMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/relation-metadata.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { MessageChannelMessageAssociationObjectMetadata } from 'src/modules/messaging/standard-objects/message-channel-message-association.object-metadata';
|
import { MessageChannelMessageAssociationObjectMetadata } from 'src/modules/messaging/standard-objects/message-channel-message-association.object-metadata';
|
||||||
import { MessageParticipantObjectMetadata } from 'src/modules/messaging/standard-objects/message-participant.object-metadata';
|
import { MessageParticipantObjectMetadata } from 'src/modules/messaging/standard-objects/message-participant.object-metadata';
|
||||||
import { MessageThreadObjectMetadata } from 'src/modules/messaging/standard-objects/message-thread.object-metadata';
|
import { MessageThreadObjectMetadata } from 'src/modules/messaging/standard-objects/message-thread.object-metadata';
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.message,
|
standardId: STANDARD_OBJECT_IDS.message,
|
||||||
namePlural: 'messages',
|
namePlural: 'messages',
|
||||||
labelSingular: 'Message',
|
labelSingular: 'Message',
|
||||||
@ -26,10 +26,10 @@ import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-me
|
|||||||
description: 'Message',
|
description: 'Message',
|
||||||
icon: 'IconMessage',
|
icon: 'IconMessage',
|
||||||
})
|
})
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
export class MessageObjectMetadata extends BaseObjectMetadata {
|
export class MessageObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: MESSAGE_STANDARD_FIELD_IDS.headerMessageId,
|
standardId: MESSAGE_STANDARD_FIELD_IDS.headerMessageId,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Header message Id',
|
label: 'Header message Id',
|
||||||
@ -38,18 +38,7 @@ export class MessageObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
headerMessageId: string;
|
headerMessageId: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: MESSAGE_STANDARD_FIELD_IDS.messageThread,
|
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Message Thread Id',
|
|
||||||
description: 'Message Thread Id',
|
|
||||||
icon: 'IconHash',
|
|
||||||
joinColumn: 'messageThreadId',
|
|
||||||
})
|
|
||||||
@IsNullable()
|
|
||||||
messageThread: Relation<MessageThreadObjectMetadata>;
|
|
||||||
|
|
||||||
@FieldMetadata({
|
|
||||||
standardId: MESSAGE_STANDARD_FIELD_IDS.direction,
|
standardId: MESSAGE_STANDARD_FIELD_IDS.direction,
|
||||||
type: FieldMetadataType.SELECT,
|
type: FieldMetadataType.SELECT,
|
||||||
label: 'Direction',
|
label: 'Direction',
|
||||||
@ -63,7 +52,7 @@ export class MessageObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
direction: string;
|
direction: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: MESSAGE_STANDARD_FIELD_IDS.subject,
|
standardId: MESSAGE_STANDARD_FIELD_IDS.subject,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Subject',
|
label: 'Subject',
|
||||||
@ -72,7 +61,7 @@ export class MessageObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
subject: string;
|
subject: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: MESSAGE_STANDARD_FIELD_IDS.text,
|
standardId: MESSAGE_STANDARD_FIELD_IDS.text,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Text',
|
label: 'Text',
|
||||||
@ -81,45 +70,52 @@ export class MessageObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
text: string;
|
text: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: MESSAGE_STANDARD_FIELD_IDS.receivedAt,
|
standardId: MESSAGE_STANDARD_FIELD_IDS.receivedAt,
|
||||||
type: FieldMetadataType.DATE_TIME,
|
type: FieldMetadataType.DATE_TIME,
|
||||||
label: 'Received At',
|
label: 'Received At',
|
||||||
description: 'The date the message was received',
|
description: 'The date the message was received',
|
||||||
icon: 'IconCalendar',
|
icon: 'IconCalendar',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
receivedAt: string;
|
receivedAt: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
|
standardId: MESSAGE_STANDARD_FIELD_IDS.messageThread,
|
||||||
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
|
label: 'Message Thread Id',
|
||||||
|
description: 'Message Thread Id',
|
||||||
|
icon: 'IconHash',
|
||||||
|
joinColumn: 'messageThreadId',
|
||||||
|
inverseSideTarget: () => MessageThreadObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'messages',
|
||||||
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
|
})
|
||||||
|
@WorkspaceIsNullable()
|
||||||
|
messageThread: Relation<MessageThreadObjectMetadata>;
|
||||||
|
|
||||||
|
@WorkspaceRelation({
|
||||||
standardId: MESSAGE_STANDARD_FIELD_IDS.messageParticipants,
|
standardId: MESSAGE_STANDARD_FIELD_IDS.messageParticipants,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Message Participants',
|
label: 'Message Participants',
|
||||||
description: 'Message Participants',
|
description: 'Message Participants',
|
||||||
icon: 'IconUserCircle',
|
icon: 'IconUserCircle',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => MessageParticipantObjectMetadata,
|
inverseSideTarget: () => MessageParticipantObjectMetadata,
|
||||||
inverseSideFieldKey: 'message',
|
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
messageParticipants: Relation<MessageParticipantObjectMetadata[]>;
|
messageParticipants: Relation<MessageParticipantObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: MESSAGE_STANDARD_FIELD_IDS.messageChannelMessageAssociations,
|
standardId: MESSAGE_STANDARD_FIELD_IDS.messageChannelMessageAssociations,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Message Channel Association',
|
label: 'Message Channel Association',
|
||||||
description: 'Messages from the channel.',
|
description: 'Messages from the channel.',
|
||||||
icon: 'IconMessage',
|
icon: 'IconMessage',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => MessageChannelMessageAssociationObjectMetadata,
|
inverseSideTarget: () => MessageChannelMessageAssociationObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
messageChannelMessageAssociations: Relation<
|
messageChannelMessageAssociations: Relation<
|
||||||
MessageChannelMessageAssociationObjectMetadata[]
|
MessageChannelMessageAssociationObjectMetadata[]
|
||||||
>;
|
>;
|
||||||
|
|||||||
@ -8,21 +8,21 @@ import {
|
|||||||
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
import { OPPORTUNITY_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { OPPORTUNITY_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { RelationMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/relation-metadata.decorator';
|
|
||||||
import { ActivityTargetObjectMetadata } from 'src/modules/activity/standard-objects/activity-target.object-metadata';
|
import { ActivityTargetObjectMetadata } from 'src/modules/activity/standard-objects/activity-target.object-metadata';
|
||||||
import { AttachmentObjectMetadata } from 'src/modules/attachment/standard-objects/attachment.object-metadata';
|
import { AttachmentObjectMetadata } from 'src/modules/attachment/standard-objects/attachment.object-metadata';
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { CompanyObjectMetadata } from 'src/modules/company/standard-objects/company.object-metadata';
|
import { CompanyObjectMetadata } from 'src/modules/company/standard-objects/company.object-metadata';
|
||||||
import { FavoriteObjectMetadata } from 'src/modules/favorite/standard-objects/favorite.object-metadata';
|
import { FavoriteObjectMetadata } from 'src/modules/favorite/standard-objects/favorite.object-metadata';
|
||||||
import { PersonObjectMetadata } from 'src/modules/person/standard-objects/person.object-metadata';
|
import { PersonObjectMetadata } from 'src/modules/person/standard-objects/person.object-metadata';
|
||||||
import { TimelineActivityObjectMetadata } from 'src/modules/timeline/standard-objects/timeline-activity.object-metadata';
|
import { TimelineActivityObjectMetadata } from 'src/modules/timeline/standard-objects/timeline-activity.object-metadata';
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.opportunity,
|
standardId: STANDARD_OBJECT_IDS.opportunity,
|
||||||
namePlural: 'opportunities',
|
namePlural: 'opportunities',
|
||||||
labelSingular: 'Opportunity',
|
labelSingular: 'Opportunity',
|
||||||
@ -30,9 +30,9 @@ import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-me
|
|||||||
description: 'An opportunity',
|
description: 'An opportunity',
|
||||||
icon: 'IconTargetArrow',
|
icon: 'IconTargetArrow',
|
||||||
})
|
})
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
export class OpportunityObjectMetadata extends BaseObjectMetadata {
|
export class OpportunityObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.name,
|
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.name,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Name',
|
label: 'Name',
|
||||||
@ -41,27 +41,27 @@ export class OpportunityObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.amount,
|
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.amount,
|
||||||
type: FieldMetadataType.CURRENCY,
|
type: FieldMetadataType.CURRENCY,
|
||||||
label: 'Amount',
|
label: 'Amount',
|
||||||
description: 'Opportunity amount',
|
description: 'Opportunity amount',
|
||||||
icon: 'IconCurrencyDollar',
|
icon: 'IconCurrencyDollar',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
amount: CurrencyMetadata;
|
amount: CurrencyMetadata;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.closeDate,
|
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.closeDate,
|
||||||
type: FieldMetadataType.DATE_TIME,
|
type: FieldMetadataType.DATE_TIME,
|
||||||
label: 'Close date',
|
label: 'Close date',
|
||||||
description: 'Opportunity close date',
|
description: 'Opportunity close date',
|
||||||
icon: 'IconCalendarEvent',
|
icon: 'IconCalendarEvent',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
closeDate: Date;
|
closeDate: Date;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.probability,
|
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.probability,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Probability',
|
label: 'Probability',
|
||||||
@ -71,7 +71,7 @@ export class OpportunityObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
probability: string;
|
probability: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.stage,
|
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.stage,
|
||||||
type: FieldMetadataType.SELECT,
|
type: FieldMetadataType.SELECT,
|
||||||
label: 'Stage',
|
label: 'Stage',
|
||||||
@ -93,97 +93,91 @@ export class OpportunityObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
stage: string;
|
stage: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.position,
|
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.position,
|
||||||
type: FieldMetadataType.POSITION,
|
type: FieldMetadataType.POSITION,
|
||||||
label: 'Position',
|
label: 'Position',
|
||||||
description: 'Opportunity record position',
|
description: 'Opportunity record position',
|
||||||
icon: 'IconHierarchy2',
|
icon: 'IconHierarchy2',
|
||||||
})
|
})
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
position: number;
|
position: number;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.pointOfContact,
|
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.pointOfContact,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Point of Contact',
|
label: 'Point of Contact',
|
||||||
description: 'Opportunity point of contact',
|
description: 'Opportunity point of contact',
|
||||||
icon: 'IconUser',
|
icon: 'IconUser',
|
||||||
joinColumn: 'pointOfContactId',
|
joinColumn: 'pointOfContactId',
|
||||||
|
inverseSideTarget: () => PersonObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'pointOfContactForOpportunities',
|
||||||
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
pointOfContact: Relation<PersonObjectMetadata>;
|
pointOfContact: Relation<PersonObjectMetadata>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.company,
|
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.company,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Company',
|
label: 'Company',
|
||||||
description: 'Opportunity company',
|
description: 'Opportunity company',
|
||||||
icon: 'IconBuildingSkyscraper',
|
icon: 'IconBuildingSkyscraper',
|
||||||
joinColumn: 'companyId',
|
joinColumn: 'companyId',
|
||||||
|
inverseSideTarget: () => CompanyObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'opportunities',
|
||||||
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
company: Relation<CompanyObjectMetadata>;
|
company: Relation<CompanyObjectMetadata>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.favorites,
|
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.favorites,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Favorites',
|
label: 'Favorites',
|
||||||
description: 'Favorites linked to the opportunity',
|
description: 'Favorites linked to the opportunity',
|
||||||
icon: 'IconHeart',
|
icon: 'IconHeart',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => FavoriteObjectMetadata,
|
inverseSideTarget: () => FavoriteObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
favorites: Relation<FavoriteObjectMetadata[]>;
|
favorites: Relation<FavoriteObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.activityTargets,
|
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.activityTargets,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Activities',
|
label: 'Activities',
|
||||||
description: 'Activities tied to the opportunity',
|
description: 'Activities tied to the opportunity',
|
||||||
icon: 'IconCheckbox',
|
icon: 'IconCheckbox',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => ActivityTargetObjectMetadata,
|
inverseSideTarget: () => ActivityTargetObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
activityTargets: Relation<ActivityTargetObjectMetadata[]>;
|
activityTargets: Relation<ActivityTargetObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.attachments,
|
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.attachments,
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Attachments',
|
|
||||||
description: 'Attachments linked to the opportunity.',
|
|
||||||
icon: 'IconFileImport',
|
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
|
label: 'Attachments',
|
||||||
|
description: 'Attachments linked to the opportunity',
|
||||||
|
icon: 'IconFileImport',
|
||||||
inverseSideTarget: () => AttachmentObjectMetadata,
|
inverseSideTarget: () => AttachmentObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
attachments: Relation<AttachmentObjectMetadata[]>;
|
attachments: Relation<AttachmentObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.timelineActivities,
|
standardId: OPPORTUNITY_STANDARD_FIELD_IDS.timelineActivities,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Timeline Activities',
|
label: 'Timeline Activities',
|
||||||
description: 'Timeline Activities linked to the opportunity.',
|
description: 'Timeline Activities linked to the opportunity.',
|
||||||
icon: 'IconTimelineEvent',
|
icon: 'IconTimelineEvent',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => TimelineActivityObjectMetadata,
|
inverseSideTarget: () => TimelineActivityObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
timelineActivities: Relation<TimelineActivityObjectMetadata[]>;
|
timelineActivities: Relation<TimelineActivityObjectMetadata[]>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,22 +9,22 @@ import {
|
|||||||
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
import { PERSON_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { PERSON_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { RelationMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/relation-metadata.decorator';
|
|
||||||
import { ActivityTargetObjectMetadata } from 'src/modules/activity/standard-objects/activity-target.object-metadata';
|
import { ActivityTargetObjectMetadata } from 'src/modules/activity/standard-objects/activity-target.object-metadata';
|
||||||
import { AttachmentObjectMetadata } from 'src/modules/attachment/standard-objects/attachment.object-metadata';
|
import { AttachmentObjectMetadata } from 'src/modules/attachment/standard-objects/attachment.object-metadata';
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { CalendarEventParticipantObjectMetadata } from 'src/modules/calendar/standard-objects/calendar-event-participant.object-metadata';
|
import { CalendarEventParticipantObjectMetadata } from 'src/modules/calendar/standard-objects/calendar-event-participant.object-metadata';
|
||||||
import { CompanyObjectMetadata } from 'src/modules/company/standard-objects/company.object-metadata';
|
import { CompanyObjectMetadata } from 'src/modules/company/standard-objects/company.object-metadata';
|
||||||
import { FavoriteObjectMetadata } from 'src/modules/favorite/standard-objects/favorite.object-metadata';
|
import { FavoriteObjectMetadata } from 'src/modules/favorite/standard-objects/favorite.object-metadata';
|
||||||
import { MessageParticipantObjectMetadata } from 'src/modules/messaging/standard-objects/message-participant.object-metadata';
|
import { MessageParticipantObjectMetadata } from 'src/modules/messaging/standard-objects/message-participant.object-metadata';
|
||||||
import { OpportunityObjectMetadata } from 'src/modules/opportunity/standard-objects/opportunity.object-metadata';
|
import { OpportunityObjectMetadata } from 'src/modules/opportunity/standard-objects/opportunity.object-metadata';
|
||||||
import { TimelineActivityObjectMetadata } from 'src/modules/timeline/standard-objects/timeline-activity.object-metadata';
|
import { TimelineActivityObjectMetadata } from 'src/modules/timeline/standard-objects/timeline-activity.object-metadata';
|
||||||
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.person,
|
standardId: STANDARD_OBJECT_IDS.person,
|
||||||
namePlural: 'people',
|
namePlural: 'people',
|
||||||
labelSingular: 'Person',
|
labelSingular: 'Person',
|
||||||
@ -32,18 +32,18 @@ import { TimelineActivityObjectMetadata } from 'src/modules/timeline/standard-ob
|
|||||||
description: 'A person',
|
description: 'A person',
|
||||||
icon: 'IconUser',
|
icon: 'IconUser',
|
||||||
})
|
})
|
||||||
export class PersonObjectMetadata extends BaseObjectMetadata {
|
export class PersonObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: PERSON_STANDARD_FIELD_IDS.name,
|
standardId: PERSON_STANDARD_FIELD_IDS.name,
|
||||||
type: FieldMetadataType.FULL_NAME,
|
type: FieldMetadataType.FULL_NAME,
|
||||||
label: 'Name',
|
label: 'Name',
|
||||||
description: 'Contact’s name',
|
description: 'Contact’s name',
|
||||||
icon: 'IconUser',
|
icon: 'IconUser',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
name: FullNameMetadata;
|
name: FullNameMetadata;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: PERSON_STANDARD_FIELD_IDS.email,
|
standardId: PERSON_STANDARD_FIELD_IDS.email,
|
||||||
type: FieldMetadataType.EMAIL,
|
type: FieldMetadataType.EMAIL,
|
||||||
label: 'Email',
|
label: 'Email',
|
||||||
@ -52,27 +52,27 @@ export class PersonObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
email: string;
|
email: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: PERSON_STANDARD_FIELD_IDS.linkedinLink,
|
standardId: PERSON_STANDARD_FIELD_IDS.linkedinLink,
|
||||||
type: FieldMetadataType.LINK,
|
type: FieldMetadataType.LINK,
|
||||||
label: 'Linkedin',
|
label: 'Linkedin',
|
||||||
description: 'Contact’s Linkedin account',
|
description: 'Contact’s Linkedin account',
|
||||||
icon: 'IconBrandLinkedin',
|
icon: 'IconBrandLinkedin',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
linkedinLink: LinkMetadata;
|
linkedinLink: LinkMetadata;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: PERSON_STANDARD_FIELD_IDS.xLink,
|
standardId: PERSON_STANDARD_FIELD_IDS.xLink,
|
||||||
type: FieldMetadataType.LINK,
|
type: FieldMetadataType.LINK,
|
||||||
label: 'X',
|
label: 'X',
|
||||||
description: 'Contact’s X/Twitter account',
|
description: 'Contact’s X/Twitter account',
|
||||||
icon: 'IconBrandX',
|
icon: 'IconBrandX',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
xLink: LinkMetadata;
|
xLink: LinkMetadata;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: PERSON_STANDARD_FIELD_IDS.jobTitle,
|
standardId: PERSON_STANDARD_FIELD_IDS.jobTitle,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Job Title',
|
label: 'Job Title',
|
||||||
@ -81,7 +81,7 @@ export class PersonObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
jobTitle: string;
|
jobTitle: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: PERSON_STANDARD_FIELD_IDS.phone,
|
standardId: PERSON_STANDARD_FIELD_IDS.phone,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Phone',
|
label: 'Phone',
|
||||||
@ -90,7 +90,7 @@ export class PersonObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
phone: string;
|
phone: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: PERSON_STANDARD_FIELD_IDS.city,
|
standardId: PERSON_STANDARD_FIELD_IDS.city,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'City',
|
label: 'City',
|
||||||
@ -99,141 +99,122 @@ export class PersonObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
city: string;
|
city: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: PERSON_STANDARD_FIELD_IDS.avatarUrl,
|
standardId: PERSON_STANDARD_FIELD_IDS.avatarUrl,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Avatar',
|
label: 'Avatar',
|
||||||
description: 'Contact’s avatar',
|
description: 'Contact’s avatar',
|
||||||
icon: 'IconFileUpload',
|
icon: 'IconFileUpload',
|
||||||
})
|
})
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
avatarUrl: string;
|
avatarUrl: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: PERSON_STANDARD_FIELD_IDS.position,
|
standardId: PERSON_STANDARD_FIELD_IDS.position,
|
||||||
type: FieldMetadataType.POSITION,
|
type: FieldMetadataType.POSITION,
|
||||||
label: 'Position',
|
label: 'Position',
|
||||||
description: 'Person record Position',
|
description: 'Person record Position',
|
||||||
icon: 'IconHierarchy2',
|
icon: 'IconHierarchy2',
|
||||||
})
|
})
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
position: number;
|
position: number;
|
||||||
|
|
||||||
// Relations
|
// Relations
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: PERSON_STANDARD_FIELD_IDS.company,
|
standardId: PERSON_STANDARD_FIELD_IDS.company,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Company',
|
label: 'Company',
|
||||||
description: 'Contact’s company',
|
description: 'Contact’s company',
|
||||||
icon: 'IconBuildingSkyscraper',
|
icon: 'IconBuildingSkyscraper',
|
||||||
joinColumn: 'companyId',
|
joinColumn: 'companyId',
|
||||||
|
inverseSideTarget: () => CompanyObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'people',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
company: Relation<CompanyObjectMetadata>;
|
company: Relation<CompanyObjectMetadata>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: PERSON_STANDARD_FIELD_IDS.pointOfContactForOpportunities,
|
standardId: PERSON_STANDARD_FIELD_IDS.pointOfContactForOpportunities,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'POC for Opportunities',
|
label: 'POC for Opportunities',
|
||||||
description: 'Point of Contact for Opportunities',
|
description: 'Point of Contact for Opportunities',
|
||||||
icon: 'IconTargetArrow',
|
icon: 'IconTargetArrow',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => OpportunityObjectMetadata,
|
inverseSideTarget: () => OpportunityObjectMetadata,
|
||||||
inverseSideFieldKey: 'pointOfContact',
|
inverseSideFieldKey: 'pointOfContact',
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
pointOfContactForOpportunities: Relation<OpportunityObjectMetadata[]>;
|
pointOfContactForOpportunities: Relation<OpportunityObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: PERSON_STANDARD_FIELD_IDS.activityTargets,
|
standardId: PERSON_STANDARD_FIELD_IDS.activityTargets,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Activities',
|
label: 'Activities',
|
||||||
description: 'Activities tied to the contact',
|
description: 'Activities tied to the contact',
|
||||||
icon: 'IconCheckbox',
|
icon: 'IconCheckbox',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => ActivityTargetObjectMetadata,
|
inverseSideTarget: () => ActivityTargetObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
activityTargets: Relation<ActivityTargetObjectMetadata[]>;
|
activityTargets: Relation<ActivityTargetObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: PERSON_STANDARD_FIELD_IDS.favorites,
|
standardId: PERSON_STANDARD_FIELD_IDS.favorites,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Favorites',
|
label: 'Favorites',
|
||||||
description: 'Favorites linked to the contact',
|
description: 'Favorites linked to the contact',
|
||||||
icon: 'IconHeart',
|
icon: 'IconHeart',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => FavoriteObjectMetadata,
|
inverseSideTarget: () => FavoriteObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
favorites: Relation<FavoriteObjectMetadata[]>;
|
favorites: Relation<FavoriteObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: PERSON_STANDARD_FIELD_IDS.attachments,
|
standardId: PERSON_STANDARD_FIELD_IDS.attachments,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Attachments',
|
label: 'Attachments',
|
||||||
description: 'Attachments linked to the contact.',
|
description: 'Attachments linked to the contact.',
|
||||||
icon: 'IconFileImport',
|
icon: 'IconFileImport',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => AttachmentObjectMetadata,
|
inverseSideTarget: () => AttachmentObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
attachments: Relation<AttachmentObjectMetadata[]>;
|
attachments: Relation<AttachmentObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: PERSON_STANDARD_FIELD_IDS.messageParticipants,
|
standardId: PERSON_STANDARD_FIELD_IDS.messageParticipants,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Message Participants',
|
label: 'Message Participants',
|
||||||
description: 'Message Participants',
|
description: 'Message Participants',
|
||||||
icon: 'IconUserCircle',
|
icon: 'IconUserCircle',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => MessageParticipantObjectMetadata,
|
inverseSideTarget: () => MessageParticipantObjectMetadata,
|
||||||
inverseSideFieldKey: 'person',
|
inverseSideFieldKey: 'person',
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
messageParticipants: Relation<MessageParticipantObjectMetadata[]>;
|
messageParticipants: Relation<MessageParticipantObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: PERSON_STANDARD_FIELD_IDS.calendarEventParticipants,
|
standardId: PERSON_STANDARD_FIELD_IDS.calendarEventParticipants,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Calendar Event Participants',
|
label: 'Calendar Event Participants',
|
||||||
description: 'Calendar Event Participants',
|
description: 'Calendar Event Participants',
|
||||||
icon: 'IconCalendar',
|
icon: 'IconCalendar',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => CalendarEventParticipantObjectMetadata,
|
inverseSideTarget: () => CalendarEventParticipantObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
calendarEventParticipants: Relation<CalendarEventParticipantObjectMetadata[]>;
|
calendarEventParticipants: Relation<CalendarEventParticipantObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: PERSON_STANDARD_FIELD_IDS.timelineActivities,
|
standardId: PERSON_STANDARD_FIELD_IDS.timelineActivities,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Events',
|
label: 'Events',
|
||||||
description: 'Events linked to the company',
|
description: 'Events linked to the company',
|
||||||
icon: 'IconTimelineEvent',
|
icon: 'IconTimelineEvent',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => TimelineActivityObjectMetadata,
|
inverseSideTarget: () => TimelineActivityObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
timelineActivities: Relation<TimelineActivityObjectMetadata[]>;
|
timelineActivities: Relation<TimelineActivityObjectMetadata[]>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,14 +3,16 @@ import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/i
|
|||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
import { AUDIT_LOGS_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { AUDIT_LOGS_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
||||||
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
import { RelationMetadataType } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.auditLog,
|
standardId: STANDARD_OBJECT_IDS.auditLog,
|
||||||
namePlural: 'auditLogs',
|
namePlural: 'auditLogs',
|
||||||
labelSingular: 'Audit Log',
|
labelSingular: 'Audit Log',
|
||||||
@ -18,9 +20,9 @@ import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/stan
|
|||||||
description: 'An audit log of actions performed in the system',
|
description: 'An audit log of actions performed in the system',
|
||||||
icon: 'IconIconTimelineEvent',
|
icon: 'IconIconTimelineEvent',
|
||||||
})
|
})
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
export class AuditLogObjectMetadata extends BaseObjectMetadata {
|
export class AuditLogObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: AUDIT_LOGS_STANDARD_FIELD_IDS.name,
|
standardId: AUDIT_LOGS_STANDARD_FIELD_IDS.name,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Event name',
|
label: 'Event name',
|
||||||
@ -29,17 +31,17 @@ export class AuditLogObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: AUDIT_LOGS_STANDARD_FIELD_IDS.properties,
|
standardId: AUDIT_LOGS_STANDARD_FIELD_IDS.properties,
|
||||||
type: FieldMetadataType.RAW_JSON,
|
type: FieldMetadataType.RAW_JSON,
|
||||||
label: 'Event details',
|
label: 'Event details',
|
||||||
description: 'Json value for event details',
|
description: 'Json value for event details',
|
||||||
icon: 'IconListDetails',
|
icon: 'IconListDetails',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
properties: JSON;
|
properties: JSON;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: AUDIT_LOGS_STANDARD_FIELD_IDS.context,
|
standardId: AUDIT_LOGS_STANDARD_FIELD_IDS.context,
|
||||||
type: FieldMetadataType.RAW_JSON,
|
type: FieldMetadataType.RAW_JSON,
|
||||||
label: 'Event context',
|
label: 'Event context',
|
||||||
@ -47,10 +49,10 @@ export class AuditLogObjectMetadata extends BaseObjectMetadata {
|
|||||||
'Json object to provide context (user, device, workspace, etc.)',
|
'Json object to provide context (user, device, workspace, etc.)',
|
||||||
icon: 'IconListDetails',
|
icon: 'IconListDetails',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
context: JSON;
|
context: JSON;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: AUDIT_LOGS_STANDARD_FIELD_IDS.objectName,
|
standardId: AUDIT_LOGS_STANDARD_FIELD_IDS.objectName,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Object name',
|
label: 'Object name',
|
||||||
@ -59,7 +61,7 @@ export class AuditLogObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
objectName: string;
|
objectName: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: AUDIT_LOGS_STANDARD_FIELD_IDS.objectName,
|
standardId: AUDIT_LOGS_STANDARD_FIELD_IDS.objectName,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Object name',
|
label: 'Object name',
|
||||||
@ -68,24 +70,26 @@ export class AuditLogObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
objectMetadataId: string;
|
objectMetadataId: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: AUDIT_LOGS_STANDARD_FIELD_IDS.recordId,
|
standardId: AUDIT_LOGS_STANDARD_FIELD_IDS.recordId,
|
||||||
type: FieldMetadataType.UUID,
|
type: FieldMetadataType.UUID,
|
||||||
label: 'Object id',
|
label: 'Object id',
|
||||||
description: 'Event name/type',
|
description: 'Event name/type',
|
||||||
icon: 'IconAbc',
|
icon: 'IconAbc',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
recordId: string;
|
recordId: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: AUDIT_LOGS_STANDARD_FIELD_IDS.workspaceMember,
|
standardId: AUDIT_LOGS_STANDARD_FIELD_IDS.workspaceMember,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'Workspace Member',
|
label: 'Workspace Member',
|
||||||
description: 'Event workspace member',
|
description: 'Event workspace member',
|
||||||
icon: 'IconCircleUser',
|
icon: 'IconCircleUser',
|
||||||
joinColumn: 'workspaceMemberId',
|
joinColumn: 'workspaceMemberId',
|
||||||
|
inverseSideTarget: () => WorkspaceMemberObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'auditLogs',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
workspaceMember: Relation<WorkspaceMemberObjectMetadata>;
|
workspaceMember: Relation<WorkspaceMemberObjectMetadata>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,15 @@
|
|||||||
import { FeatureFlagKeys } from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
import { FeatureFlagKeys } from 'src/engine/core-modules/feature-flag/feature-flag.entity';
|
||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceGate } from 'src/engine/twenty-orm/decorators/workspace-gate.decorator';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
import { BEHAVIORAL_EVENT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { BEHAVIORAL_EVENT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { Gate } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/gate.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.behavioralEvent,
|
standardId: STANDARD_OBJECT_IDS.behavioralEvent,
|
||||||
namePlural: 'behavioralEvents',
|
namePlural: 'behavioralEvents',
|
||||||
labelSingular: 'Behavioral Event',
|
labelSingular: 'Behavioral Event',
|
||||||
@ -17,11 +17,11 @@ import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-
|
|||||||
description: 'An event related to user behavior',
|
description: 'An event related to user behavior',
|
||||||
icon: 'IconIconTimelineEvent',
|
icon: 'IconIconTimelineEvent',
|
||||||
})
|
})
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
@Gate({
|
@WorkspaceGate({
|
||||||
featureFlag: FeatureFlagKeys.IsEventObjectEnabled,
|
featureFlag: FeatureFlagKeys.IsEventObjectEnabled,
|
||||||
})
|
})
|
||||||
export class BehavioralEventObjectMetadata extends BaseObjectMetadata {
|
export class BehavioralEventObjectMetadata extends BaseWorkspaceEntity {
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
* Common in Segment, Rudderstack, etc.
|
* Common in Segment, Rudderstack, etc.
|
||||||
@ -29,7 +29,7 @@ export class BehavioralEventObjectMetadata extends BaseObjectMetadata {
|
|||||||
* But doesn't feel that useful.
|
* But doesn't feel that useful.
|
||||||
* Let's try living without it.
|
* Let's try living without it.
|
||||||
*
|
*
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: behavioralEventStandardFieldIds.type,
|
standardId: behavioralEventStandardFieldIds.type,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Event type',
|
label: 'Event type',
|
||||||
@ -39,7 +39,7 @@ export class BehavioralEventObjectMetadata extends BaseObjectMetadata {
|
|||||||
type: string;
|
type: string;
|
||||||
*/
|
*/
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: BEHAVIORAL_EVENT_STANDARD_FIELD_IDS.name,
|
standardId: BEHAVIORAL_EVENT_STANDARD_FIELD_IDS.name,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Event name',
|
label: 'Event name',
|
||||||
@ -48,17 +48,17 @@ export class BehavioralEventObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: BEHAVIORAL_EVENT_STANDARD_FIELD_IDS.properties,
|
standardId: BEHAVIORAL_EVENT_STANDARD_FIELD_IDS.properties,
|
||||||
type: FieldMetadataType.RAW_JSON,
|
type: FieldMetadataType.RAW_JSON,
|
||||||
label: 'Event details',
|
label: 'Event details',
|
||||||
description: 'Json value for event details',
|
description: 'Json value for event details',
|
||||||
icon: 'IconListDetails',
|
icon: 'IconListDetails',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
properties: JSON;
|
properties: JSON;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: BEHAVIORAL_EVENT_STANDARD_FIELD_IDS.context,
|
standardId: BEHAVIORAL_EVENT_STANDARD_FIELD_IDS.context,
|
||||||
type: FieldMetadataType.RAW_JSON,
|
type: FieldMetadataType.RAW_JSON,
|
||||||
label: 'Event context',
|
label: 'Event context',
|
||||||
@ -66,10 +66,10 @@ export class BehavioralEventObjectMetadata extends BaseObjectMetadata {
|
|||||||
'Json object to provide context (user, device, workspace, etc.)',
|
'Json object to provide context (user, device, workspace, etc.)',
|
||||||
icon: 'IconListDetails',
|
icon: 'IconListDetails',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
context: JSON;
|
context: JSON;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: BEHAVIORAL_EVENT_STANDARD_FIELD_IDS.objectName,
|
standardId: BEHAVIORAL_EVENT_STANDARD_FIELD_IDS.objectName,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Object name',
|
label: 'Object name',
|
||||||
@ -78,13 +78,13 @@ export class BehavioralEventObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
objectName: string;
|
objectName: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: BEHAVIORAL_EVENT_STANDARD_FIELD_IDS.recordId,
|
standardId: BEHAVIORAL_EVENT_STANDARD_FIELD_IDS.recordId,
|
||||||
type: FieldMetadataType.UUID,
|
type: FieldMetadataType.UUID,
|
||||||
label: 'Object id',
|
label: 'Object id',
|
||||||
description: 'Event name/type',
|
description: 'Event name/type',
|
||||||
icon: 'IconAbc',
|
icon: 'IconAbc',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
recordId: string;
|
recordId: string;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,20 +3,22 @@ import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/i
|
|||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
import { TIMELINE_ACTIVITY_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { TIMELINE_ACTIVITY_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { DynamicRelationFieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/dynamic-field-metadata.interface';
|
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { CompanyObjectMetadata } from 'src/modules/company/standard-objects/company.object-metadata';
|
import { CompanyObjectMetadata } from 'src/modules/company/standard-objects/company.object-metadata';
|
||||||
import { OpportunityObjectMetadata } from 'src/modules/opportunity/standard-objects/opportunity.object-metadata';
|
import { OpportunityObjectMetadata } from 'src/modules/opportunity/standard-objects/opportunity.object-metadata';
|
||||||
import { PersonObjectMetadata } from 'src/modules/person/standard-objects/person.object-metadata';
|
import { PersonObjectMetadata } from 'src/modules/person/standard-objects/person.object-metadata';
|
||||||
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
import { WorkspaceMemberObjectMetadata } from 'src/modules/workspace-member/standard-objects/workspace-member.object-metadata';
|
||||||
import { CustomObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/custom-objects/custom.object-metadata';
|
import { CustomWorkspaceEntity } from 'src/engine/twenty-orm/custom.workspace-entity';
|
||||||
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
import { RelationMetadataType } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
|
import { WorkspaceDynamicRelation } from 'src/engine/twenty-orm/decorators/workspace-dynamic-relation.decorator';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.timelineActivity,
|
standardId: STANDARD_OBJECT_IDS.timelineActivity,
|
||||||
namePlural: 'timelineActivities',
|
namePlural: 'timelineActivities',
|
||||||
labelSingular: 'Timeline Activity',
|
labelSingular: 'Timeline Activity',
|
||||||
@ -24,10 +26,10 @@ import { CustomObjectMetadata } from 'src/engine/workspace-manager/workspace-syn
|
|||||||
description: 'Aggregated / filtered event to be displayed on the timeline',
|
description: 'Aggregated / filtered event to be displayed on the timeline',
|
||||||
icon: 'IconIconTimelineEvent',
|
icon: 'IconIconTimelineEvent',
|
||||||
})
|
})
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
export class TimelineActivityObjectMetadata extends BaseObjectMetadata {
|
export class TimelineActivityObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.happensAt,
|
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.happensAt,
|
||||||
type: FieldMetadataType.DATE_TIME,
|
type: FieldMetadataType.DATE_TIME,
|
||||||
label: 'Creation date',
|
label: 'Creation date',
|
||||||
@ -37,7 +39,7 @@ export class TimelineActivityObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
happensAt: Date;
|
happensAt: Date;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.name,
|
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.name,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Event name',
|
label: 'Event name',
|
||||||
@ -46,73 +48,18 @@ export class TimelineActivityObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.properties,
|
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.properties,
|
||||||
type: FieldMetadataType.RAW_JSON,
|
type: FieldMetadataType.RAW_JSON,
|
||||||
label: 'Event details',
|
label: 'Event details',
|
||||||
description: 'Json value for event details',
|
description: 'Json value for event details',
|
||||||
icon: 'IconListDetails',
|
icon: 'IconListDetails',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
properties: JSON;
|
properties: JSON;
|
||||||
|
|
||||||
// Who made the action
|
|
||||||
@FieldMetadata({
|
|
||||||
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.workspaceMember,
|
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Workspace Member',
|
|
||||||
description: 'Event workspace member',
|
|
||||||
icon: 'IconCircleUser',
|
|
||||||
joinColumn: 'workspaceMemberId',
|
|
||||||
})
|
|
||||||
@IsNullable()
|
|
||||||
workspaceMember: Relation<WorkspaceMemberObjectMetadata>;
|
|
||||||
|
|
||||||
@FieldMetadata({
|
|
||||||
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.person,
|
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Person',
|
|
||||||
description: 'Event person',
|
|
||||||
icon: 'IconUser',
|
|
||||||
joinColumn: 'personId',
|
|
||||||
})
|
|
||||||
@IsNullable()
|
|
||||||
person: Relation<PersonObjectMetadata>;
|
|
||||||
|
|
||||||
@FieldMetadata({
|
|
||||||
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.company,
|
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Company',
|
|
||||||
description: 'Event company',
|
|
||||||
icon: 'IconBuildingSkyscraper',
|
|
||||||
joinColumn: 'companyId',
|
|
||||||
})
|
|
||||||
@IsNullable()
|
|
||||||
company: Relation<CompanyObjectMetadata>;
|
|
||||||
|
|
||||||
@FieldMetadata({
|
|
||||||
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.opportunity,
|
|
||||||
type: FieldMetadataType.RELATION,
|
|
||||||
label: 'Opportunity',
|
|
||||||
description: 'Events opportunity',
|
|
||||||
icon: 'IconTargetArrow',
|
|
||||||
joinColumn: 'opportunityId',
|
|
||||||
})
|
|
||||||
@IsNullable()
|
|
||||||
opportunity: Relation<OpportunityObjectMetadata>;
|
|
||||||
|
|
||||||
@DynamicRelationFieldMetadata((oppositeObjectMetadata) => ({
|
|
||||||
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.custom,
|
|
||||||
name: oppositeObjectMetadata.nameSingular,
|
|
||||||
label: oppositeObjectMetadata.labelSingular,
|
|
||||||
description: `Event ${oppositeObjectMetadata.labelSingular}`,
|
|
||||||
joinColumn: `${oppositeObjectMetadata.nameSingular}Id`,
|
|
||||||
icon: 'IconTimeline',
|
|
||||||
}))
|
|
||||||
custom: Relation<CustomObjectMetadata>;
|
|
||||||
|
|
||||||
// Special objects that don't have their own timeline and are 'link' to the main object
|
// Special objects that don't have their own timeline and are 'link' to the main object
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.linkedRecordCachedName,
|
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.linkedRecordCachedName,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Linked Record cached name',
|
label: 'Linked Record cached name',
|
||||||
@ -121,23 +68,91 @@ export class TimelineActivityObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
linkedRecordCachedName: string;
|
linkedRecordCachedName: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.linkedRecordId,
|
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.linkedRecordId,
|
||||||
type: FieldMetadataType.UUID,
|
type: FieldMetadataType.UUID,
|
||||||
label: 'Linked Record id',
|
label: 'Linked Record id',
|
||||||
description: 'Linked Record id',
|
description: 'Linked Record id',
|
||||||
icon: 'IconAbc',
|
icon: 'IconAbc',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
linkedRecordId: string;
|
linkedRecordId: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.linkedObjectMetadataId,
|
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.linkedObjectMetadataId,
|
||||||
type: FieldMetadataType.UUID,
|
type: FieldMetadataType.UUID,
|
||||||
label: 'Linked Object Metadata Id',
|
label: 'Linked Object Metadata Id',
|
||||||
description: 'inked Object Metadata Id',
|
description: 'inked Object Metadata Id',
|
||||||
icon: 'IconAbc',
|
icon: 'IconAbc',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
linkedObjectMetadataId: string;
|
linkedObjectMetadataId: string;
|
||||||
|
|
||||||
|
// Who made the action
|
||||||
|
@WorkspaceRelation({
|
||||||
|
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.workspaceMember,
|
||||||
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
|
label: 'Workspace Member',
|
||||||
|
description: 'Event workspace member',
|
||||||
|
icon: 'IconCircleUser',
|
||||||
|
joinColumn: 'workspaceMemberId',
|
||||||
|
inverseSideTarget: () => WorkspaceMemberObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'timelineActivities',
|
||||||
|
})
|
||||||
|
@WorkspaceIsNullable()
|
||||||
|
workspaceMember: Relation<WorkspaceMemberObjectMetadata>;
|
||||||
|
|
||||||
|
@WorkspaceRelation({
|
||||||
|
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.person,
|
||||||
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
|
label: 'Person',
|
||||||
|
description: 'Event person',
|
||||||
|
icon: 'IconUser',
|
||||||
|
joinColumn: 'personId',
|
||||||
|
inverseSideTarget: () => PersonObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'timelineActivities',
|
||||||
|
})
|
||||||
|
@WorkspaceIsNullable()
|
||||||
|
person: Relation<PersonObjectMetadata>;
|
||||||
|
|
||||||
|
@WorkspaceRelation({
|
||||||
|
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.company,
|
||||||
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
|
label: 'Company',
|
||||||
|
description: 'Event company',
|
||||||
|
icon: 'IconBuildingSkyscraper',
|
||||||
|
joinColumn: 'companyId',
|
||||||
|
inverseSideTarget: () => CompanyObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'timelineActivities',
|
||||||
|
})
|
||||||
|
@WorkspaceIsNullable()
|
||||||
|
company: Relation<CompanyObjectMetadata>;
|
||||||
|
|
||||||
|
@WorkspaceRelation({
|
||||||
|
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.opportunity,
|
||||||
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
|
label: 'Opportunity',
|
||||||
|
description: 'Event opportunity',
|
||||||
|
icon: 'IconTargetArrow',
|
||||||
|
joinColumn: 'opportunityId',
|
||||||
|
inverseSideTarget: () => OpportunityObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'timelineActivities',
|
||||||
|
})
|
||||||
|
@WorkspaceIsNullable()
|
||||||
|
opportunity: Relation<OpportunityObjectMetadata>;
|
||||||
|
|
||||||
|
@WorkspaceDynamicRelation({
|
||||||
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
|
argsFactory: (oppositeObjectMetadata) => ({
|
||||||
|
standardId: TIMELINE_ACTIVITY_STANDARD_FIELD_IDS.custom,
|
||||||
|
name: oppositeObjectMetadata.nameSingular,
|
||||||
|
label: oppositeObjectMetadata.labelSingular,
|
||||||
|
description: `Event ${oppositeObjectMetadata.labelSingular}`,
|
||||||
|
joinColumn: `${oppositeObjectMetadata.nameSingular}Id`,
|
||||||
|
icon: 'IconTimeline',
|
||||||
|
}),
|
||||||
|
inverseSideTarget: () => CustomWorkspaceEntity,
|
||||||
|
inverseSideFieldKey: 'timelineActivities',
|
||||||
|
})
|
||||||
|
custom: Relation<CustomWorkspaceEntity>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,15 +1,17 @@
|
|||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
|
import { RelationMetadataType } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
import { VIEW_FIELD_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { VIEW_FIELD_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { ViewObjectMetadata } from 'src/modules/view/standard-objects/view.object-metadata';
|
import { ViewObjectMetadata } from 'src/modules/view/standard-objects/view.object-metadata';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.viewField,
|
standardId: STANDARD_OBJECT_IDS.viewField,
|
||||||
namePlural: 'viewFields',
|
namePlural: 'viewFields',
|
||||||
labelSingular: 'View Field',
|
labelSingular: 'View Field',
|
||||||
@ -17,10 +19,10 @@ import { ViewObjectMetadata } from 'src/modules/view/standard-objects/view.objec
|
|||||||
description: '(System) View Fields',
|
description: '(System) View Fields',
|
||||||
icon: 'IconTag',
|
icon: 'IconTag',
|
||||||
})
|
})
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
export class ViewFieldObjectMetadata extends BaseObjectMetadata {
|
export class ViewFieldObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: VIEW_FIELD_STANDARD_FIELD_IDS.fieldMetadataId,
|
standardId: VIEW_FIELD_STANDARD_FIELD_IDS.fieldMetadataId,
|
||||||
type: FieldMetadataType.UUID,
|
type: FieldMetadataType.UUID,
|
||||||
label: 'Field Metadata Id',
|
label: 'Field Metadata Id',
|
||||||
@ -29,7 +31,7 @@ export class ViewFieldObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
fieldMetadataId: string;
|
fieldMetadataId: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: VIEW_FIELD_STANDARD_FIELD_IDS.isVisible,
|
standardId: VIEW_FIELD_STANDARD_FIELD_IDS.isVisible,
|
||||||
type: FieldMetadataType.BOOLEAN,
|
type: FieldMetadataType.BOOLEAN,
|
||||||
label: 'Visible',
|
label: 'Visible',
|
||||||
@ -39,7 +41,7 @@ export class ViewFieldObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
isVisible: boolean;
|
isVisible: boolean;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: VIEW_FIELD_STANDARD_FIELD_IDS.size,
|
standardId: VIEW_FIELD_STANDARD_FIELD_IDS.size,
|
||||||
type: FieldMetadataType.NUMBER,
|
type: FieldMetadataType.NUMBER,
|
||||||
label: 'Size',
|
label: 'Size',
|
||||||
@ -49,7 +51,7 @@ export class ViewFieldObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
size: number;
|
size: number;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: VIEW_FIELD_STANDARD_FIELD_IDS.position,
|
standardId: VIEW_FIELD_STANDARD_FIELD_IDS.position,
|
||||||
type: FieldMetadataType.NUMBER,
|
type: FieldMetadataType.NUMBER,
|
||||||
label: 'Position',
|
label: 'Position',
|
||||||
@ -59,14 +61,16 @@ export class ViewFieldObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
position: number;
|
position: number;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: VIEW_FIELD_STANDARD_FIELD_IDS.view,
|
standardId: VIEW_FIELD_STANDARD_FIELD_IDS.view,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'View',
|
label: 'View',
|
||||||
description: 'View Field related view',
|
description: 'View Field related view',
|
||||||
icon: 'IconLayoutCollage',
|
icon: 'IconLayoutCollage',
|
||||||
|
inverseSideTarget: () => ViewObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'viewFields',
|
||||||
joinColumn: 'viewId',
|
joinColumn: 'viewId',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
view?: ViewObjectMetadata;
|
view?: ViewObjectMetadata;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,15 +3,17 @@ import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/i
|
|||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
import { VIEW_FILTER_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { VIEW_FILTER_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { ViewObjectMetadata } from 'src/modules/view/standard-objects/view.object-metadata';
|
import { ViewObjectMetadata } from 'src/modules/view/standard-objects/view.object-metadata';
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
import { RelationMetadataType } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.viewFilter,
|
standardId: STANDARD_OBJECT_IDS.viewFilter,
|
||||||
namePlural: 'viewFilters',
|
namePlural: 'viewFilters',
|
||||||
labelSingular: 'View Filter',
|
labelSingular: 'View Filter',
|
||||||
@ -19,10 +21,10 @@ import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-me
|
|||||||
description: '(System) View Filters',
|
description: '(System) View Filters',
|
||||||
icon: 'IconFilterBolt',
|
icon: 'IconFilterBolt',
|
||||||
})
|
})
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
export class ViewFilterObjectMetadata extends BaseObjectMetadata {
|
export class ViewFilterObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: VIEW_FILTER_STANDARD_FIELD_IDS.fieldMetadataId,
|
standardId: VIEW_FILTER_STANDARD_FIELD_IDS.fieldMetadataId,
|
||||||
type: FieldMetadataType.UUID,
|
type: FieldMetadataType.UUID,
|
||||||
label: 'Field Metadata Id',
|
label: 'Field Metadata Id',
|
||||||
@ -30,7 +32,7 @@ export class ViewFilterObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
fieldMetadataId: string;
|
fieldMetadataId: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: VIEW_FILTER_STANDARD_FIELD_IDS.operand,
|
standardId: VIEW_FILTER_STANDARD_FIELD_IDS.operand,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Operand',
|
label: 'Operand',
|
||||||
@ -39,7 +41,7 @@ export class ViewFilterObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
operand: string;
|
operand: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: VIEW_FILTER_STANDARD_FIELD_IDS.value,
|
standardId: VIEW_FILTER_STANDARD_FIELD_IDS.value,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Value',
|
label: 'Value',
|
||||||
@ -47,7 +49,7 @@ export class ViewFilterObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
value: string;
|
value: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: VIEW_FILTER_STANDARD_FIELD_IDS.displayValue,
|
standardId: VIEW_FILTER_STANDARD_FIELD_IDS.displayValue,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Display Value',
|
label: 'Display Value',
|
||||||
@ -55,14 +57,16 @@ export class ViewFilterObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
displayValue: string;
|
displayValue: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: VIEW_FILTER_STANDARD_FIELD_IDS.view,
|
standardId: VIEW_FILTER_STANDARD_FIELD_IDS.view,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'View',
|
label: 'View',
|
||||||
description: 'View Filter related view',
|
description: 'View Filter related view',
|
||||||
icon: 'IconLayoutCollage',
|
icon: 'IconLayoutCollage',
|
||||||
joinColumn: 'viewId',
|
joinColumn: 'viewId',
|
||||||
|
inverseSideTarget: () => ViewObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'viewFilters',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
view: Relation<ViewObjectMetadata>;
|
view: Relation<ViewObjectMetadata>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -3,15 +3,17 @@ import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/i
|
|||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
import { VIEW_SORT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { VIEW_SORT_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { ViewObjectMetadata } from 'src/modules/view/standard-objects/view.object-metadata';
|
import { ViewObjectMetadata } from 'src/modules/view/standard-objects/view.object-metadata';
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
import { RelationMetadataType } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.viewSort,
|
standardId: STANDARD_OBJECT_IDS.viewSort,
|
||||||
namePlural: 'viewSorts',
|
namePlural: 'viewSorts',
|
||||||
labelSingular: 'View Sort',
|
labelSingular: 'View Sort',
|
||||||
@ -19,10 +21,10 @@ import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-me
|
|||||||
description: '(System) View Sorts',
|
description: '(System) View Sorts',
|
||||||
icon: 'IconArrowsSort',
|
icon: 'IconArrowsSort',
|
||||||
})
|
})
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
export class ViewSortObjectMetadata extends BaseObjectMetadata {
|
export class ViewSortObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: VIEW_SORT_STANDARD_FIELD_IDS.fieldMetadataId,
|
standardId: VIEW_SORT_STANDARD_FIELD_IDS.fieldMetadataId,
|
||||||
type: FieldMetadataType.UUID,
|
type: FieldMetadataType.UUID,
|
||||||
label: 'Field Metadata Id',
|
label: 'Field Metadata Id',
|
||||||
@ -31,7 +33,7 @@ export class ViewSortObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
fieldMetadataId: string;
|
fieldMetadataId: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: VIEW_SORT_STANDARD_FIELD_IDS.direction,
|
standardId: VIEW_SORT_STANDARD_FIELD_IDS.direction,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Direction',
|
label: 'Direction',
|
||||||
@ -40,14 +42,16 @@ export class ViewSortObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
direction: string;
|
direction: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: VIEW_SORT_STANDARD_FIELD_IDS.view,
|
standardId: VIEW_SORT_STANDARD_FIELD_IDS.view,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.MANY_TO_ONE,
|
||||||
label: 'View',
|
label: 'View',
|
||||||
description: 'View Sort related view',
|
description: 'View Sort related view',
|
||||||
icon: 'IconLayoutCollage',
|
icon: 'IconLayoutCollage',
|
||||||
joinColumn: 'viewId',
|
joinColumn: 'viewId',
|
||||||
|
inverseSideTarget: () => ViewObjectMetadata,
|
||||||
|
inverseSideFieldKey: 'viewSorts',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
view: Relation<ViewObjectMetadata>;
|
view: Relation<ViewObjectMetadata>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -7,18 +7,18 @@ import {
|
|||||||
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
import { VIEW_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { VIEW_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { RelationMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/relation-metadata.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { ViewFieldObjectMetadata } from 'src/modules/view/standard-objects/view-field.object-metadata';
|
import { ViewFieldObjectMetadata } from 'src/modules/view/standard-objects/view-field.object-metadata';
|
||||||
import { ViewFilterObjectMetadata } from 'src/modules/view/standard-objects/view-filter.object-metadata';
|
import { ViewFilterObjectMetadata } from 'src/modules/view/standard-objects/view-filter.object-metadata';
|
||||||
import { ViewSortObjectMetadata } from 'src/modules/view/standard-objects/view-sort.object-metadata';
|
import { ViewSortObjectMetadata } from 'src/modules/view/standard-objects/view-sort.object-metadata';
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.view,
|
standardId: STANDARD_OBJECT_IDS.view,
|
||||||
namePlural: 'views',
|
namePlural: 'views',
|
||||||
labelSingular: 'View',
|
labelSingular: 'View',
|
||||||
@ -26,10 +26,10 @@ import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-me
|
|||||||
description: '(System) Views',
|
description: '(System) Views',
|
||||||
icon: 'IconLayoutCollage',
|
icon: 'IconLayoutCollage',
|
||||||
})
|
})
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
export class ViewObjectMetadata extends BaseObjectMetadata {
|
export class ViewObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: VIEW_STANDARD_FIELD_IDS.name,
|
standardId: VIEW_STANDARD_FIELD_IDS.name,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Name',
|
label: 'Name',
|
||||||
@ -37,7 +37,7 @@ export class ViewObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
name: string;
|
name: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: VIEW_STANDARD_FIELD_IDS.objectMetadataId,
|
standardId: VIEW_STANDARD_FIELD_IDS.objectMetadataId,
|
||||||
type: FieldMetadataType.UUID,
|
type: FieldMetadataType.UUID,
|
||||||
label: 'Object Metadata Id',
|
label: 'Object Metadata Id',
|
||||||
@ -45,7 +45,7 @@ export class ViewObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
objectMetadataId: string;
|
objectMetadataId: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: VIEW_STANDARD_FIELD_IDS.type,
|
standardId: VIEW_STANDARD_FIELD_IDS.type,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Type',
|
label: 'Type',
|
||||||
@ -54,7 +54,7 @@ export class ViewObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
type: string;
|
type: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: VIEW_STANDARD_FIELD_IDS.key,
|
standardId: VIEW_STANDARD_FIELD_IDS.key,
|
||||||
type: FieldMetadataType.SELECT,
|
type: FieldMetadataType.SELECT,
|
||||||
label: 'Key',
|
label: 'Key',
|
||||||
@ -62,10 +62,10 @@ export class ViewObjectMetadata extends BaseObjectMetadata {
|
|||||||
options: [{ value: 'INDEX', label: 'Index', position: 0, color: 'red' }],
|
options: [{ value: 'INDEX', label: 'Index', position: 0, color: 'red' }],
|
||||||
defaultValue: "'INDEX'",
|
defaultValue: "'INDEX'",
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
key: string;
|
key: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: VIEW_STANDARD_FIELD_IDS.icon,
|
standardId: VIEW_STANDARD_FIELD_IDS.icon,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Icon',
|
label: 'Icon',
|
||||||
@ -73,7 +73,7 @@ export class ViewObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
icon: string;
|
icon: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: VIEW_STANDARD_FIELD_IDS.kanbanFieldMetadataId,
|
standardId: VIEW_STANDARD_FIELD_IDS.kanbanFieldMetadataId,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'kanbanfieldMetadataId',
|
label: 'kanbanfieldMetadataId',
|
||||||
@ -81,16 +81,16 @@ export class ViewObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
kanbanFieldMetadataId: string;
|
kanbanFieldMetadataId: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: VIEW_STANDARD_FIELD_IDS.position,
|
standardId: VIEW_STANDARD_FIELD_IDS.position,
|
||||||
type: FieldMetadataType.POSITION,
|
type: FieldMetadataType.POSITION,
|
||||||
label: 'Position',
|
label: 'Position',
|
||||||
description: 'View position',
|
description: 'View position',
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
position: number;
|
position: number;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: VIEW_STANDARD_FIELD_IDS.isCompact,
|
standardId: VIEW_STANDARD_FIELD_IDS.isCompact,
|
||||||
type: FieldMetadataType.BOOLEAN,
|
type: FieldMetadataType.BOOLEAN,
|
||||||
label: 'Compact View',
|
label: 'Compact View',
|
||||||
@ -99,48 +99,39 @@ export class ViewObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
isCompact: boolean;
|
isCompact: boolean;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: VIEW_STANDARD_FIELD_IDS.viewFields,
|
standardId: VIEW_STANDARD_FIELD_IDS.viewFields,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'View Fields',
|
label: 'View Fields',
|
||||||
description: 'View Fields',
|
description: 'View Fields',
|
||||||
icon: 'IconTag',
|
icon: 'IconTag',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => ViewFieldObjectMetadata,
|
inverseSideTarget: () => ViewFieldObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
viewFields: Relation<ViewFieldObjectMetadata[]>;
|
viewFields: Relation<ViewFieldObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: VIEW_STANDARD_FIELD_IDS.viewFilters,
|
standardId: VIEW_STANDARD_FIELD_IDS.viewFilters,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'View Filters',
|
label: 'View Filters',
|
||||||
description: 'View Filters',
|
description: 'View Filters',
|
||||||
icon: 'IconFilterBolt',
|
icon: 'IconFilterBolt',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => ViewFilterObjectMetadata,
|
inverseSideTarget: () => ViewFilterObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
viewFilters: Relation<ViewFilterObjectMetadata[]>;
|
viewFilters: Relation<ViewFilterObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: VIEW_STANDARD_FIELD_IDS.viewSorts,
|
standardId: VIEW_STANDARD_FIELD_IDS.viewSorts,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'View Sorts',
|
label: 'View Sorts',
|
||||||
description: 'View Sorts',
|
description: 'View Sorts',
|
||||||
icon: 'IconArrowsSort',
|
icon: 'IconArrowsSort',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => ViewSortObjectMetadata,
|
inverseSideTarget: () => ViewSortObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
viewSorts: Relation<ViewSortObjectMetadata[]>;
|
viewSorts: Relation<ViewSortObjectMetadata[]>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,13 +1,13 @@
|
|||||||
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity';
|
||||||
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
import { WEBHOOK_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { WEBHOOK_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.webhook,
|
standardId: STANDARD_OBJECT_IDS.webhook,
|
||||||
namePlural: 'webhooks',
|
namePlural: 'webhooks',
|
||||||
labelSingular: 'Webhook',
|
labelSingular: 'Webhook',
|
||||||
@ -15,10 +15,10 @@ import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-
|
|||||||
description: 'A webhook',
|
description: 'A webhook',
|
||||||
icon: 'IconRobot',
|
icon: 'IconRobot',
|
||||||
})
|
})
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
export class WebhookObjectMetadata extends BaseObjectMetadata {
|
export class WebhookObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: WEBHOOK_STANDARD_FIELD_IDS.targetUrl,
|
standardId: WEBHOOK_STANDARD_FIELD_IDS.targetUrl,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Target Url',
|
label: 'Target Url',
|
||||||
@ -27,7 +27,7 @@ export class WebhookObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
targetUrl: string;
|
targetUrl: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: WEBHOOK_STANDARD_FIELD_IDS.operation,
|
standardId: WEBHOOK_STANDARD_FIELD_IDS.operation,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Operation',
|
label: 'Operation',
|
||||||
|
|||||||
@ -8,13 +8,8 @@ import {
|
|||||||
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
} from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||||
import { WORKSPACE_MEMBER_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
import { WORKSPACE_MEMBER_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||||
import { FieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/field-metadata.decorator';
|
|
||||||
import { IsSystem } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-system.decorator';
|
|
||||||
import { ObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/object-metadata.decorator';
|
|
||||||
import { RelationMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/relation-metadata.decorator';
|
|
||||||
import { ActivityObjectMetadata } from 'src/modules/activity/standard-objects/activity.object-metadata';
|
import { ActivityObjectMetadata } from 'src/modules/activity/standard-objects/activity.object-metadata';
|
||||||
import { AttachmentObjectMetadata } from 'src/modules/attachment/standard-objects/attachment.object-metadata';
|
import { AttachmentObjectMetadata } from 'src/modules/attachment/standard-objects/attachment.object-metadata';
|
||||||
import { BaseObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/standard-objects/base.object-metadata';
|
|
||||||
import { BlocklistObjectMetadata } from 'src/modules/connected-account/standard-objects/blocklist.object-metadata';
|
import { BlocklistObjectMetadata } from 'src/modules/connected-account/standard-objects/blocklist.object-metadata';
|
||||||
import { CalendarEventParticipantObjectMetadata } from 'src/modules/calendar/standard-objects/calendar-event-participant.object-metadata';
|
import { CalendarEventParticipantObjectMetadata } from 'src/modules/calendar/standard-objects/calendar-event-participant.object-metadata';
|
||||||
import { CommentObjectMetadata } from 'src/modules/activity/standard-objects/comment.object-metadata';
|
import { CommentObjectMetadata } from 'src/modules/activity/standard-objects/comment.object-metadata';
|
||||||
@ -22,12 +17,17 @@ import { CompanyObjectMetadata } from 'src/modules/company/standard-objects/comp
|
|||||||
import { ConnectedAccountObjectMetadata } from 'src/modules/connected-account/standard-objects/connected-account.object-metadata';
|
import { ConnectedAccountObjectMetadata } from 'src/modules/connected-account/standard-objects/connected-account.object-metadata';
|
||||||
import { FavoriteObjectMetadata } from 'src/modules/favorite/standard-objects/favorite.object-metadata';
|
import { FavoriteObjectMetadata } from 'src/modules/favorite/standard-objects/favorite.object-metadata';
|
||||||
import { MessageParticipantObjectMetadata } from 'src/modules/messaging/standard-objects/message-participant.object-metadata';
|
import { MessageParticipantObjectMetadata } from 'src/modules/messaging/standard-objects/message-participant.object-metadata';
|
||||||
import { IsNullable } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-nullable.decorator';
|
|
||||||
import { TimelineActivityObjectMetadata } from 'src/modules/timeline/standard-objects/timeline-activity.object-metadata';
|
import { TimelineActivityObjectMetadata } from 'src/modules/timeline/standard-objects/timeline-activity.object-metadata';
|
||||||
import { AuditLogObjectMetadata } from 'src/modules/timeline/standard-objects/audit-log.object-metadata';
|
import { AuditLogObjectMetadata } from 'src/modules/timeline/standard-objects/audit-log.object-metadata';
|
||||||
import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-metadata/decorators/is-not-audit-logged.decorator';
|
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||||
|
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-object.decorator';
|
||||||
|
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator';
|
||||||
|
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator';
|
||||||
|
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator';
|
||||||
|
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator';
|
||||||
|
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@WorkspaceEntity({
|
||||||
standardId: STANDARD_OBJECT_IDS.workspaceMember,
|
standardId: STANDARD_OBJECT_IDS.workspaceMember,
|
||||||
namePlural: 'workspaceMembers',
|
namePlural: 'workspaceMembers',
|
||||||
labelSingular: 'Workspace Member',
|
labelSingular: 'Workspace Member',
|
||||||
@ -35,10 +35,10 @@ import { IsNotAuditLogged } from 'src/engine/workspace-manager/workspace-sync-me
|
|||||||
description: 'A workspace member',
|
description: 'A workspace member',
|
||||||
icon: 'IconUserCircle',
|
icon: 'IconUserCircle',
|
||||||
})
|
})
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
@IsNotAuditLogged()
|
@WorkspaceIsNotAuditLogged()
|
||||||
export class WorkspaceMemberObjectMetadata extends BaseObjectMetadata {
|
export class WorkspaceMemberObjectMetadata extends BaseWorkspaceEntity {
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.name,
|
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.name,
|
||||||
type: FieldMetadataType.FULL_NAME,
|
type: FieldMetadataType.FULL_NAME,
|
||||||
label: 'Name',
|
label: 'Name',
|
||||||
@ -47,7 +47,7 @@ export class WorkspaceMemberObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
name: FullNameMetadata;
|
name: FullNameMetadata;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.colorScheme,
|
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.colorScheme,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Color Scheme',
|
label: 'Color Scheme',
|
||||||
@ -57,7 +57,7 @@ export class WorkspaceMemberObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
colorScheme: string;
|
colorScheme: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.locale,
|
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.locale,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Language',
|
label: 'Language',
|
||||||
@ -67,7 +67,7 @@ export class WorkspaceMemberObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
locale: string;
|
locale: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.avatarUrl,
|
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.avatarUrl,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'Avatar Url',
|
label: 'Avatar Url',
|
||||||
@ -76,7 +76,7 @@ export class WorkspaceMemberObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
avatarUrl: string;
|
avatarUrl: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.userEmail,
|
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.userEmail,
|
||||||
type: FieldMetadataType.TEXT,
|
type: FieldMetadataType.TEXT,
|
||||||
label: 'User Email',
|
label: 'User Email',
|
||||||
@ -85,7 +85,7 @@ export class WorkspaceMemberObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
userEmail: string;
|
userEmail: string;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceField({
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.userId,
|
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.userId,
|
||||||
type: FieldMetadataType.UUID,
|
type: FieldMetadataType.UUID,
|
||||||
label: 'User Id',
|
label: 'User Id',
|
||||||
@ -95,184 +95,148 @@ export class WorkspaceMemberObjectMetadata extends BaseObjectMetadata {
|
|||||||
userId: string;
|
userId: string;
|
||||||
|
|
||||||
// Relations
|
// Relations
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.authoredActivities,
|
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.authoredActivities,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Authored activities',
|
label: 'Authored activities',
|
||||||
description: 'Activities created by the workspace member',
|
description: 'Activities created by the workspace member',
|
||||||
icon: 'IconCheckbox',
|
icon: 'IconCheckbox',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => ActivityObjectMetadata,
|
inverseSideTarget: () => ActivityObjectMetadata,
|
||||||
inverseSideFieldKey: 'author',
|
inverseSideFieldKey: 'author',
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
authoredActivities: Relation<ActivityObjectMetadata[]>;
|
authoredActivities: Relation<ActivityObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.assignedActivities,
|
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.assignedActivities,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Assigned activities',
|
label: 'Assigned activities',
|
||||||
description: 'Activities assigned to the workspace member',
|
description: 'Activities assigned to the workspace member',
|
||||||
icon: 'IconCheckbox',
|
icon: 'IconCheckbox',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => ActivityObjectMetadata,
|
inverseSideTarget: () => ActivityObjectMetadata,
|
||||||
inverseSideFieldKey: 'assignee',
|
inverseSideFieldKey: 'assignee',
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
assignedActivities: Relation<ActivityObjectMetadata[]>;
|
assignedActivities: Relation<ActivityObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.favorites,
|
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.favorites,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Favorites',
|
label: 'Favorites',
|
||||||
description: 'Favorites linked to the workspace member',
|
description: 'Favorites linked to the workspace member',
|
||||||
icon: 'IconHeart',
|
icon: 'IconHeart',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => FavoriteObjectMetadata,
|
inverseSideTarget: () => FavoriteObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
favorites: Relation<FavoriteObjectMetadata[]>;
|
favorites: Relation<FavoriteObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.accountOwnerForCompanies,
|
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.accountOwnerForCompanies,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Account Owner For Companies',
|
label: 'Account Owner For Companies',
|
||||||
description: 'Account owner for companies',
|
description: 'Account owner for companies',
|
||||||
icon: 'IconBriefcase',
|
icon: 'IconBriefcase',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => CompanyObjectMetadata,
|
inverseSideTarget: () => CompanyObjectMetadata,
|
||||||
inverseSideFieldKey: 'accountOwner',
|
inverseSideFieldKey: 'accountOwner',
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
accountOwnerForCompanies: Relation<CompanyObjectMetadata[]>;
|
accountOwnerForCompanies: Relation<CompanyObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.authoredAttachments,
|
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.authoredAttachments,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Authored attachments',
|
label: 'Authored attachments',
|
||||||
description: 'Attachments created by the workspace member',
|
description: 'Attachments created by the workspace member',
|
||||||
icon: 'IconFileImport',
|
icon: 'IconFileImport',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => AttachmentObjectMetadata,
|
inverseSideTarget: () => AttachmentObjectMetadata,
|
||||||
inverseSideFieldKey: 'author',
|
inverseSideFieldKey: 'author',
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
authoredAttachments: Relation<AttachmentObjectMetadata[]>;
|
authoredAttachments: Relation<AttachmentObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.authoredComments,
|
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.authoredComments,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Authored comments',
|
label: 'Authored comments',
|
||||||
description: 'Authored comments',
|
description: 'Authored comments',
|
||||||
icon: 'IconComment',
|
icon: 'IconComment',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => CommentObjectMetadata,
|
inverseSideTarget: () => CommentObjectMetadata,
|
||||||
inverseSideFieldKey: 'author',
|
inverseSideFieldKey: 'author',
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
authoredComments: Relation<CommentObjectMetadata[]>;
|
authoredComments: Relation<CommentObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.connectedAccounts,
|
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.connectedAccounts,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Connected accounts',
|
label: 'Connected accounts',
|
||||||
description: 'Connected accounts',
|
description: 'Connected accounts',
|
||||||
icon: 'IconAt',
|
icon: 'IconAt',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => ConnectedAccountObjectMetadata,
|
inverseSideTarget: () => ConnectedAccountObjectMetadata,
|
||||||
inverseSideFieldKey: 'accountOwner',
|
inverseSideFieldKey: 'accountOwner',
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
connectedAccounts: Relation<ConnectedAccountObjectMetadata[]>;
|
connectedAccounts: Relation<ConnectedAccountObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.messageParticipants,
|
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.messageParticipants,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Message Participants',
|
label: 'Message Participants',
|
||||||
description: 'Message Participants',
|
description: 'Message Participants',
|
||||||
icon: 'IconUserCircle',
|
icon: 'IconUserCircle',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => MessageParticipantObjectMetadata,
|
inverseSideTarget: () => MessageParticipantObjectMetadata,
|
||||||
inverseSideFieldKey: 'workspaceMember',
|
inverseSideFieldKey: 'workspaceMember',
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
messageParticipants: Relation<MessageParticipantObjectMetadata[]>;
|
messageParticipants: Relation<MessageParticipantObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.blocklist,
|
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.blocklist,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Blocklist',
|
label: 'Blocklist',
|
||||||
description: 'Blocklisted handles',
|
description: 'Blocklisted handles',
|
||||||
icon: 'IconForbid2',
|
icon: 'IconForbid2',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => BlocklistObjectMetadata,
|
inverseSideTarget: () => BlocklistObjectMetadata,
|
||||||
inverseSideFieldKey: 'workspaceMember',
|
inverseSideFieldKey: 'workspaceMember',
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
blocklist: Relation<BlocklistObjectMetadata[]>;
|
blocklist: Relation<BlocklistObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.calendarEventParticipants,
|
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.calendarEventParticipants,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Calendar Event Participants',
|
label: 'Calendar Event Participants',
|
||||||
description: 'Calendar Event Participants',
|
description: 'Calendar Event Participants',
|
||||||
icon: 'IconCalendar',
|
icon: 'IconCalendar',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => CalendarEventParticipantObjectMetadata,
|
inverseSideTarget: () => CalendarEventParticipantObjectMetadata,
|
||||||
inverseSideFieldKey: 'workspaceMember',
|
inverseSideFieldKey: 'workspaceMember',
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
calendarEventParticipants: Relation<CalendarEventParticipantObjectMetadata[]>;
|
calendarEventParticipants: Relation<CalendarEventParticipantObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.timelineActivities,
|
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.timelineActivities,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Events',
|
label: 'Events',
|
||||||
description: 'Events linked to the workspace member',
|
description: 'Events linked to the workspace member',
|
||||||
icon: 'IconTimelineEvent',
|
icon: 'IconTimelineEvent',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => TimelineActivityObjectMetadata,
|
inverseSideTarget: () => TimelineActivityObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.CASCADE,
|
onDelete: RelationOnDeleteAction.CASCADE,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
timelineActivities: Relation<TimelineActivityObjectMetadata[]>;
|
timelineActivities: Relation<TimelineActivityObjectMetadata[]>;
|
||||||
|
|
||||||
@FieldMetadata({
|
@WorkspaceRelation({
|
||||||
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.auditLogs,
|
standardId: WORKSPACE_MEMBER_STANDARD_FIELD_IDS.auditLogs,
|
||||||
type: FieldMetadataType.RELATION,
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
label: 'Aud tLogs',
|
label: 'Audit Logs',
|
||||||
description: 'Audit Logs linked to the workspace member',
|
description: 'Audit Logs linked to the workspace member',
|
||||||
icon: 'IconTimelineEvent',
|
icon: 'IconTimelineEvent',
|
||||||
})
|
|
||||||
@RelationMetadata({
|
|
||||||
type: RelationMetadataType.ONE_TO_MANY,
|
|
||||||
inverseSideTarget: () => AuditLogObjectMetadata,
|
inverseSideTarget: () => AuditLogObjectMetadata,
|
||||||
onDelete: RelationOnDeleteAction.SET_NULL,
|
onDelete: RelationOnDeleteAction.SET_NULL,
|
||||||
})
|
})
|
||||||
@IsNullable()
|
@WorkspaceIsNullable()
|
||||||
@IsSystem()
|
@WorkspaceIsSystem()
|
||||||
auditLogs: Relation<AuditLogObjectMetadata[]>;
|
auditLogs: Relation<AuditLogObjectMetadata[]>;
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,24 +1,8 @@
|
|||||||
import 'reflect-metadata';
|
import 'reflect-metadata';
|
||||||
|
|
||||||
import { GateDecoratorParams } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/gate-decorator.interface';
|
|
||||||
import { ReflectBaseCustomObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/reflect-custom-object-metadata.interface';
|
|
||||||
import { ReflectDynamicRelationFieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/reflect-computed-relation-field-metadata.interface';
|
|
||||||
import { ReflectFieldMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/reflect-field-metadata.interface';
|
|
||||||
import { ReflectObjectMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/reflect-object-metadata.interface';
|
|
||||||
import { ReflectRelationMetadata } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/reflect-relation-metadata.interface';
|
|
||||||
import { Gate } from 'src/engine/twenty-orm/interfaces/gate.interface';
|
import { Gate } from 'src/engine/twenty-orm/interfaces/gate.interface';
|
||||||
|
|
||||||
export interface ReflectMetadataTypeMap {
|
export interface ReflectMetadataTypeMap {
|
||||||
objectMetadata: ReflectObjectMetadata;
|
|
||||||
extendObjectMetadata: ReflectBaseCustomObjectMetadata;
|
|
||||||
fieldMetadataMap: ReflectFieldMetadata;
|
|
||||||
dynamicRelationFieldMetadataMap: ReflectDynamicRelationFieldMetadata;
|
|
||||||
reflectRelationMetadataCollection: ReflectRelationMetadata[];
|
|
||||||
gate: GateDecoratorParams;
|
|
||||||
isNullable: true;
|
|
||||||
isSystem: true;
|
|
||||||
isAuditLogged: false;
|
|
||||||
|
|
||||||
['workspace:is-nullable-metadata-args']: true;
|
['workspace:is-nullable-metadata-args']: true;
|
||||||
['workspace:gate-metadata-args']: Gate;
|
['workspace:gate-metadata-args']: Gate;
|
||||||
['workspace:is-system-metadata-args']: true;
|
['workspace:is-system-metadata-args']: true;
|
||||||
|
|||||||
Reference in New Issue
Block a user