creating the messagefolder entity (#9933)
first step for the https://github.com/twentyhq/core-team-issues/issues/149 issue
This commit is contained in:
@ -22,6 +22,7 @@ import { STANDARD_OBJECT_ICONS } from 'src/engine/workspace-manager/workspace-sy
|
||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||
import { ConnectedAccountWorkspaceEntity } from 'src/modules/connected-account/standard-objects/connected-account.workspace-entity';
|
||||
import { MessageChannelMessageAssociationWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-channel-message-association.workspace-entity';
|
||||
import { MessageFolderWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-folder.workspace-entity';
|
||||
|
||||
export enum MessageChannelSyncStatus {
|
||||
NOT_SYNCED = 'NOT_SYNCED',
|
||||
@ -380,4 +381,16 @@ export class MessageChannelWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
messageChannelMessageAssociations: Relation<
|
||||
MessageChannelMessageAssociationWorkspaceEntity[]
|
||||
>;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId: MESSAGE_CHANNEL_STANDARD_FIELD_IDS.messageFolders,
|
||||
type: RelationMetadataType.ONE_TO_MANY,
|
||||
label: msg`Message Folders`,
|
||||
description: msg`Message Folders`,
|
||||
icon: 'IconFolder',
|
||||
inverseSideTarget: () => MessageFolderWorkspaceEntity,
|
||||
onDelete: RelationOnDeleteAction.CASCADE,
|
||||
})
|
||||
@WorkspaceIsNullable()
|
||||
messageFolders: Relation<MessageFolderWorkspaceEntity[]>;
|
||||
}
|
||||
|
||||
@ -0,0 +1,59 @@
|
||||
import { msg } from '@lingui/core/macro';
|
||||
import { FieldMetadataType } from 'twenty-shared';
|
||||
import { Relation } from 'typeorm';
|
||||
|
||||
import { RelationMetadataType } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity';
|
||||
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity';
|
||||
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-entity.decorator';
|
||||
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 { WorkspaceJoinColumn } from 'src/engine/twenty-orm/decorators/workspace-join-column.decorator';
|
||||
import { WorkspaceRelation } from 'src/engine/twenty-orm/decorators/workspace-relation.decorator';
|
||||
import { MESSAGE_FOLDER_STANDARD_FIELD_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-field-ids';
|
||||
import { STANDARD_OBJECT_ICONS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-icons';
|
||||
import { STANDARD_OBJECT_IDS } from 'src/engine/workspace-manager/workspace-sync-metadata/constants/standard-object-ids';
|
||||
import { MessageChannelWorkspaceEntity } from 'src/modules/messaging/common/standard-objects/message-channel.workspace-entity';
|
||||
|
||||
@WorkspaceEntity({
|
||||
standardId: STANDARD_OBJECT_IDS.messageFolder,
|
||||
namePlural: 'messageFolders',
|
||||
labelSingular: msg`Message Folder`,
|
||||
labelPlural: msg`Message Folders`,
|
||||
description: msg`Folder for Message Channel`,
|
||||
icon: STANDARD_OBJECT_ICONS.messageFolder,
|
||||
})
|
||||
@WorkspaceIsNotAuditLogged()
|
||||
@WorkspaceIsSystem()
|
||||
export class MessageFolderWorkspaceEntity extends BaseWorkspaceEntity {
|
||||
@WorkspaceField({
|
||||
standardId: MESSAGE_FOLDER_STANDARD_FIELD_IDS.name,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: msg`Name`,
|
||||
description: msg`Folder name`,
|
||||
icon: 'IconFolder',
|
||||
})
|
||||
name: string;
|
||||
|
||||
@WorkspaceRelation({
|
||||
standardId: MESSAGE_FOLDER_STANDARD_FIELD_IDS.messageChannel,
|
||||
type: RelationMetadataType.MANY_TO_ONE,
|
||||
label: msg`Message Channel`,
|
||||
description: msg`Message Channel`,
|
||||
icon: 'IconMessage',
|
||||
inverseSideTarget: () => MessageChannelWorkspaceEntity,
|
||||
})
|
||||
messageChannel: Relation<MessageChannelWorkspaceEntity>;
|
||||
|
||||
@WorkspaceField({
|
||||
standardId: MESSAGE_FOLDER_STANDARD_FIELD_IDS.syncCursor,
|
||||
type: FieldMetadataType.TEXT,
|
||||
label: msg`Sync Cursor`,
|
||||
description: msg`Sync Cursor`,
|
||||
icon: 'IconHash',
|
||||
})
|
||||
syncCursor: string;
|
||||
|
||||
@WorkspaceJoinColumn('messageChannel')
|
||||
messageChannelId: string;
|
||||
}
|
||||
Reference in New Issue
Block a user