mirror of
https://github.com/twentyhq/twenty.git
synced 2024-11-23 22:12:24 +03:00
2812 create message recipient data model (#2961)
* create message-recipient * connections with other models * add to index * fix file name
This commit is contained in:
parent
a21fc4976b
commit
6977fd4ce2
@ -7,6 +7,7 @@ import { CompanyObjectMetadata } from 'src/workspace/workspace-sync-metadata/sta
|
|||||||
import { ConnectedAccountObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/connected-account.object-metadata';
|
import { ConnectedAccountObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/connected-account.object-metadata';
|
||||||
import { FavoriteObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/favorite.object-metadata';
|
import { FavoriteObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/favorite.object-metadata';
|
||||||
import { MessageChannelObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/message-channel.object-metadata';
|
import { MessageChannelObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/message-channel.object-metadata';
|
||||||
|
import { MessageRecipientObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/message-recipient.object-metadata';
|
||||||
import { MessageThreadObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/message-thread.object-metadata';
|
import { MessageThreadObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/message-thread.object-metadata';
|
||||||
import { MessageObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/message.object-metadata';
|
import { MessageObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/message.object-metadata';
|
||||||
import { OpportunityObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/opportunity.object-metadata';
|
import { OpportunityObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/opportunity.object-metadata';
|
||||||
@ -16,7 +17,7 @@ import { ViewFieldObjectMetadata } from 'src/workspace/workspace-sync-metadata/s
|
|||||||
import { ViewFilterObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/view-filter.object-metadata';
|
import { ViewFilterObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/view-filter.object-metadata';
|
||||||
import { ViewSortObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/view-sort.object-metadata';
|
import { ViewSortObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/view-sort.object-metadata';
|
||||||
import { ViewObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/view.object-metadata';
|
import { ViewObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/view.object-metadata';
|
||||||
import { WebhookObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/webook.object-metadata';
|
import { WebhookObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/webhook.object-metadata';
|
||||||
import { WorkspaceMemberObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/workspace-member.object-metadata';
|
import { WorkspaceMemberObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/workspace-member.object-metadata';
|
||||||
|
|
||||||
export const standardObjectMetadata = [
|
export const standardObjectMetadata = [
|
||||||
@ -40,4 +41,5 @@ export const standardObjectMetadata = [
|
|||||||
MessageThreadObjectMetadata,
|
MessageThreadObjectMetadata,
|
||||||
MessageObjectMetadata,
|
MessageObjectMetadata,
|
||||||
MessageChannelObjectMetadata,
|
MessageChannelObjectMetadata,
|
||||||
|
MessageRecipientObjectMetadata,
|
||||||
];
|
];
|
||||||
|
@ -0,0 +1,77 @@
|
|||||||
|
import { FieldMetadataType } from 'src/metadata/field-metadata/field-metadata.entity';
|
||||||
|
import {
|
||||||
|
ObjectMetadata,
|
||||||
|
IsSystem,
|
||||||
|
FieldMetadata,
|
||||||
|
IsNullable,
|
||||||
|
} from 'src/workspace/workspace-sync-metadata/decorators/metadata.decorator';
|
||||||
|
import { BaseObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/base.object-metadata';
|
||||||
|
import { MessageObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/message.object-metadata';
|
||||||
|
import { PersonObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/person.object-metadata';
|
||||||
|
import { WorkspaceMemberObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/workspace-member.object-metadata';
|
||||||
|
|
||||||
|
@ObjectMetadata({
|
||||||
|
namePlural: 'messageRecipients',
|
||||||
|
labelSingular: 'Message Recipient',
|
||||||
|
labelPlural: 'Message Recipients',
|
||||||
|
description: 'Message Recipients',
|
||||||
|
icon: 'IconUserCircle',
|
||||||
|
})
|
||||||
|
@IsSystem()
|
||||||
|
export class MessageRecipientObjectMetadata extends BaseObjectMetadata {
|
||||||
|
@FieldMetadata({
|
||||||
|
type: FieldMetadataType.RELATION,
|
||||||
|
label: 'Message',
|
||||||
|
description: 'Message',
|
||||||
|
icon: 'IconMessage',
|
||||||
|
joinColumn: 'messageId',
|
||||||
|
})
|
||||||
|
message: MessageObjectMetadata;
|
||||||
|
|
||||||
|
@FieldMetadata({
|
||||||
|
// this will be a type select: from, to, cc, bcc
|
||||||
|
type: FieldMetadataType.TEXT,
|
||||||
|
label: 'Role',
|
||||||
|
description: 'Role',
|
||||||
|
icon: 'IconAt',
|
||||||
|
defaultValue: { value: 'from' },
|
||||||
|
})
|
||||||
|
role: string;
|
||||||
|
|
||||||
|
@FieldMetadata({
|
||||||
|
type: FieldMetadataType.TEXT,
|
||||||
|
label: 'Handle',
|
||||||
|
description: 'Handle',
|
||||||
|
icon: 'IconAt',
|
||||||
|
})
|
||||||
|
handle: string;
|
||||||
|
|
||||||
|
@FieldMetadata({
|
||||||
|
type: FieldMetadataType.TEXT,
|
||||||
|
label: 'Display Name',
|
||||||
|
description: 'Display Name',
|
||||||
|
icon: 'IconUser',
|
||||||
|
})
|
||||||
|
@IsNullable()
|
||||||
|
displayName: string;
|
||||||
|
|
||||||
|
@FieldMetadata({
|
||||||
|
type: FieldMetadataType.RELATION,
|
||||||
|
label: 'Person',
|
||||||
|
description: 'Person',
|
||||||
|
icon: 'IconUser',
|
||||||
|
joinColumn: 'personId',
|
||||||
|
})
|
||||||
|
@IsNullable()
|
||||||
|
person: PersonObjectMetadata;
|
||||||
|
|
||||||
|
@FieldMetadata({
|
||||||
|
type: FieldMetadataType.RELATION,
|
||||||
|
label: 'Workspace Member',
|
||||||
|
description: 'Workspace member',
|
||||||
|
icon: 'IconCircleUser',
|
||||||
|
joinColumn: 'workspaceMemberId',
|
||||||
|
})
|
||||||
|
@IsNullable()
|
||||||
|
workspaceMember: WorkspaceMemberObjectMetadata;
|
||||||
|
}
|
@ -1,11 +1,14 @@
|
|||||||
import { FieldMetadataType } from 'src/metadata/field-metadata/field-metadata.entity';
|
import { FieldMetadataType } from 'src/metadata/field-metadata/field-metadata.entity';
|
||||||
|
import { RelationMetadataType } from 'src/metadata/relation-metadata/relation-metadata.entity';
|
||||||
import {
|
import {
|
||||||
ObjectMetadata,
|
ObjectMetadata,
|
||||||
IsSystem,
|
IsSystem,
|
||||||
FieldMetadata,
|
FieldMetadata,
|
||||||
IsNullable,
|
IsNullable,
|
||||||
|
RelationMetadata,
|
||||||
} from 'src/workspace/workspace-sync-metadata/decorators/metadata.decorator';
|
} from 'src/workspace/workspace-sync-metadata/decorators/metadata.decorator';
|
||||||
import { BaseObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/base.object-metadata';
|
import { BaseObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/base.object-metadata';
|
||||||
|
import { MessageRecipientObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/message-recipient.object-metadata';
|
||||||
import { MessageThreadObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/message-thread.object-metadata';
|
import { MessageThreadObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/message-thread.object-metadata';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@ObjectMetadata({
|
||||||
@ -73,4 +76,18 @@ export class MessageObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
@IsNullable()
|
@IsNullable()
|
||||||
body: string;
|
body: string;
|
||||||
|
|
||||||
|
@FieldMetadata({
|
||||||
|
type: FieldMetadataType.RELATION,
|
||||||
|
label: 'Message Recipients',
|
||||||
|
description: 'Message Recipients',
|
||||||
|
icon: 'IconUserCircle',
|
||||||
|
})
|
||||||
|
@RelationMetadata({
|
||||||
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
|
objectName: 'messageRecipient',
|
||||||
|
inverseSideFieldName: 'message',
|
||||||
|
})
|
||||||
|
@IsNullable()
|
||||||
|
messageRecipients: MessageRecipientObjectMetadata[];
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import { AttachmentObjectMetadata } from 'src/workspace/workspace-sync-metadata/
|
|||||||
import { BaseObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/base.object-metadata';
|
import { BaseObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/base.object-metadata';
|
||||||
import { CompanyObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/company.object-metadata';
|
import { CompanyObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/company.object-metadata';
|
||||||
import { FavoriteObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/favorite.object-metadata';
|
import { FavoriteObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/favorite.object-metadata';
|
||||||
|
import { MessageRecipientObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/message-recipient.object-metadata';
|
||||||
import { OpportunityObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/opportunity.object-metadata';
|
import { OpportunityObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/opportunity.object-metadata';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@ObjectMetadata({
|
||||||
@ -173,4 +174,18 @@ export class PersonObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
@IsNullable()
|
@IsNullable()
|
||||||
attachments: AttachmentObjectMetadata[];
|
attachments: AttachmentObjectMetadata[];
|
||||||
|
|
||||||
|
@FieldMetadata({
|
||||||
|
type: FieldMetadataType.RELATION,
|
||||||
|
label: 'Message Recipients',
|
||||||
|
description: 'Message Recipients',
|
||||||
|
icon: 'IconUserCircle',
|
||||||
|
})
|
||||||
|
@RelationMetadata({
|
||||||
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
|
objectName: 'messageRecipient',
|
||||||
|
inverseSideFieldName: 'person',
|
||||||
|
})
|
||||||
|
@IsNullable()
|
||||||
|
messageRecipients: MessageRecipientObjectMetadata[];
|
||||||
}
|
}
|
||||||
|
@ -15,6 +15,7 @@ import { CommentObjectMetadata } from 'src/workspace/workspace-sync-metadata/sta
|
|||||||
import { CompanyObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/company.object-metadata';
|
import { CompanyObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/company.object-metadata';
|
||||||
import { ConnectedAccountObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/connected-account.object-metadata';
|
import { ConnectedAccountObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/connected-account.object-metadata';
|
||||||
import { FavoriteObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/favorite.object-metadata';
|
import { FavoriteObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/favorite.object-metadata';
|
||||||
|
import { MessageRecipientObjectMetadata } from 'src/workspace/workspace-sync-metadata/standard-objects/message-recipient.object-metadata';
|
||||||
|
|
||||||
@ObjectMetadata({
|
@ObjectMetadata({
|
||||||
namePlural: 'workspaceMembers',
|
namePlural: 'workspaceMembers',
|
||||||
@ -164,4 +165,18 @@ export class WorkspaceMemberObjectMetadata extends BaseObjectMetadata {
|
|||||||
})
|
})
|
||||||
@IsNullable()
|
@IsNullable()
|
||||||
connectedAccounts: ConnectedAccountObjectMetadata[];
|
connectedAccounts: ConnectedAccountObjectMetadata[];
|
||||||
|
|
||||||
|
@FieldMetadata({
|
||||||
|
type: FieldMetadataType.RELATION,
|
||||||
|
label: 'Message Recipients',
|
||||||
|
description: 'Message Recipients',
|
||||||
|
icon: 'IconUserCircle',
|
||||||
|
})
|
||||||
|
@RelationMetadata({
|
||||||
|
type: RelationMetadataType.ONE_TO_MANY,
|
||||||
|
objectName: 'messageRecipient',
|
||||||
|
inverseSideFieldName: 'workspaceMember',
|
||||||
|
})
|
||||||
|
@IsNullable()
|
||||||
|
messageRecipients: MessageRecipientObjectMetadata[];
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user