1
1
import { Relation } from 'src/engine/workspace-manager/workspace-sync-metadata/interfaces/relation.interface' ;
2
2
3
+ import { FeatureFlagKey } from 'src/engine/core-modules/feature-flag/enums/feature-flag-key.enum' ;
3
4
import { FieldMetadataType } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity' ;
4
5
import { RelationMetadataType } from 'src/engine/metadata-modules/relation-metadata/relation-metadata.entity' ;
5
6
import { BaseWorkspaceEntity } from 'src/engine/twenty-orm/base.workspace-entity' ;
6
7
import { CustomWorkspaceEntity } from 'src/engine/twenty-orm/custom.workspace-entity' ;
7
8
import { WorkspaceDynamicRelation } from 'src/engine/twenty-orm/decorators/workspace-dynamic-relation.decorator' ;
8
9
import { WorkspaceEntity } from 'src/engine/twenty-orm/decorators/workspace-entity.decorator' ;
9
10
import { WorkspaceField } from 'src/engine/twenty-orm/decorators/workspace-field.decorator' ;
11
+ import { WorkspaceGate } from 'src/engine/twenty-orm/decorators/workspace-gate.decorator' ;
10
12
import { WorkspaceIsNotAuditLogged } from 'src/engine/twenty-orm/decorators/workspace-is-not-audit-logged.decorator' ;
11
13
import { WorkspaceIsNullable } from 'src/engine/twenty-orm/decorators/workspace-is-nullable.decorator' ;
12
14
import { WorkspaceIsSystem } from 'src/engine/twenty-orm/decorators/workspace-is-system.decorator' ;
@@ -19,6 +21,9 @@ import { NoteWorkspaceEntity } from 'src/modules/note/standard-objects/note.work
19
21
import { OpportunityWorkspaceEntity } from 'src/modules/opportunity/standard-objects/opportunity.workspace-entity' ;
20
22
import { PersonWorkspaceEntity } from 'src/modules/person/standard-objects/person.workspace-entity' ;
21
23
import { TaskWorkspaceEntity } from 'src/modules/task/standard-objects/task.workspace-entity' ;
24
+ import { WorkflowRunWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-run.workspace-entity' ;
25
+ import { WorkflowVersionWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow-version.workspace-entity' ;
26
+ import { WorkflowWorkspaceEntity } from 'src/modules/workflow/common/standard-objects/workflow.workspace-entity' ;
22
27
import { WorkspaceMemberWorkspaceEntity } from 'src/modules/workspace-member/standard-objects/workspace-member.workspace-entity' ;
23
28
24
29
@WorkspaceEntity ( {
@@ -182,6 +187,69 @@ export class TimelineActivityWorkspaceEntity extends BaseWorkspaceEntity {
182
187
@WorkspaceJoinColumn ( 'task' )
183
188
taskId : string | null ;
184
189
190
+ @WorkspaceRelation ( {
191
+ standardId : TIMELINE_ACTIVITY_STANDARD_FIELD_IDS . workflow ,
192
+ type : RelationMetadataType . MANY_TO_ONE ,
193
+ label : 'Workflow' ,
194
+ description : 'Event workflow' ,
195
+ icon : 'IconTargetArrow' ,
196
+ inverseSideTarget : ( ) => WorkflowWorkspaceEntity ,
197
+ inverseSideFieldKey : 'timelineActivities' ,
198
+ } )
199
+ @WorkspaceGate ( {
200
+ featureFlag : FeatureFlagKey . IsWorkflowEnabled ,
201
+ } )
202
+ @WorkspaceIsNullable ( )
203
+ workflow : Relation < WorkflowWorkspaceEntity > | null ;
204
+
205
+ @WorkspaceJoinColumn ( 'workflow' )
206
+ @WorkspaceGate ( {
207
+ featureFlag : FeatureFlagKey . IsWorkflowEnabled ,
208
+ } )
209
+ workflowId : string | null ;
210
+
211
+ @WorkspaceRelation ( {
212
+ standardId : TIMELINE_ACTIVITY_STANDARD_FIELD_IDS . workflowVersion ,
213
+ type : RelationMetadataType . MANY_TO_ONE ,
214
+ label : 'WorkflowVersion' ,
215
+ description : 'Event workflow version' ,
216
+ icon : 'IconTargetArrow' ,
217
+ inverseSideTarget : ( ) => WorkflowVersionWorkspaceEntity ,
218
+ inverseSideFieldKey : 'timelineActivities' ,
219
+ } )
220
+ @WorkspaceGate ( {
221
+ featureFlag : FeatureFlagKey . IsWorkflowEnabled ,
222
+ } )
223
+ @WorkspaceIsNullable ( )
224
+ workflowVersion : Relation < WorkflowVersionWorkspaceEntity > | null ;
225
+
226
+ @WorkspaceJoinColumn ( 'workflowVersion' )
227
+ @WorkspaceGate ( {
228
+ featureFlag : FeatureFlagKey . IsWorkflowEnabled ,
229
+ } )
230
+ workflowVersionId : string | null ;
231
+
232
+ @WorkspaceRelation ( {
233
+ standardId : TIMELINE_ACTIVITY_STANDARD_FIELD_IDS . workflowRun ,
234
+ type : RelationMetadataType . MANY_TO_ONE ,
235
+ label : 'Workflow Run' ,
236
+ description : 'Event workflow run' ,
237
+ icon : 'IconTargetArrow' ,
238
+ inverseSideTarget : ( ) => WorkflowRunWorkspaceEntity ,
239
+ inverseSideFieldKey : 'timelineActivities' ,
240
+ } )
241
+ @WorkspaceGate ( {
242
+ featureFlag : FeatureFlagKey . IsWorkflowEnabled ,
243
+ } )
244
+ @WorkspaceIsNullable ( )
245
+ workflowRun : Relation < WorkflowRunWorkspaceEntity > | null ;
246
+
247
+ @WorkspaceJoinColumn ( 'workflowRun' )
248
+ @WorkspaceGate ( {
249
+ featureFlag : FeatureFlagKey . IsWorkflowEnabled ,
250
+ } )
251
+ workflowRunId : string | null ;
252
+
185
253
@WorkspaceDynamicRelation ( {
186
254
type : RelationMetadataType . MANY_TO_ONE ,
187
255
argsFactory : ( oppositeObjectMetadata ) => ( {
0 commit comments