forked from twentyhq/twenty
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Trigger workflow run manually (twentyhq#6696)
Fix twentyhq#6669 - create a commun function `startWorkflowRun` that both create the run object and the job for executing the workflow - use it in both the `workflowEventJob` and the `runWorkflowVersion` endpoint Bonus: - use filtering for exceptions instead of a util. It avoids doing a try catch in all endpoint
- Loading branch information
Showing
43 changed files
with
452 additions
and
316 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
packages/twenty-server/src/engine/core-modules/actor/actor.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Module } from '@nestjs/common'; | ||
import { TypeOrmModule } from '@nestjs/typeorm'; | ||
|
||
import { CreatedByPreQueryHook } from 'src/engine/core-modules/actor/query-hooks/created-by.pre-query-hook'; | ||
import { FieldMetadataEntity } from 'src/engine/metadata-modules/field-metadata/field-metadata.entity'; | ||
|
||
@Module({ | ||
imports: [TypeOrmModule.forFeature([FieldMetadataEntity], 'metadata')], | ||
providers: [CreatedByPreQueryHook], | ||
exports: [CreatedByPreQueryHook], | ||
}) | ||
export class ActorModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
...server/src/engine/core-modules/actor/utils/build-created-by-from-workspace-member.util.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { User } from 'src/engine/core-modules/user/user.entity'; | ||
import { FieldActorSource } from 'src/engine/metadata-modules/field-metadata/composite-types/actor.composite-type'; | ||
|
||
export const buildCreatedByFromWorkspaceMember = ( | ||
workspaceMemberId: string, | ||
user: User, | ||
) => ({ | ||
workspaceMemberId, | ||
source: FieldActorSource.MANUAL, | ||
name: `${user.firstName} ${user.lastName}`, | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
packages/twenty-server/src/engine/core-modules/workflow/core-workflow-trigger.module.ts
This file was deleted.
Oops, something went wrong.
9 changes: 9 additions & 0 deletions
9
packages/twenty-server/src/engine/core-modules/workflow/dtos/workflow-run.dto.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
import { Field, ObjectType } from '@nestjs/graphql'; | ||
|
||
import { UUIDScalarType } from 'src/engine/api/graphql/workspace-schema-builder/graphql-types/scalars'; | ||
|
||
@ObjectType('WorkflowRun') | ||
export class WorkflowRunDTO { | ||
@Field(() => UUIDScalarType) | ||
workflowRunId: string; | ||
} |
14 changes: 0 additions & 14 deletions
14
packages/twenty-server/src/engine/core-modules/workflow/dtos/workflow-trigger-result.dto.ts
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
10 changes: 10 additions & 0 deletions
10
packages/twenty-server/src/engine/core-modules/workflow/workflow-trigger-api.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
import { Module } from '@nestjs/common'; | ||
|
||
import { WorkflowTriggerResolver } from 'src/engine/core-modules/workflow/workflow-trigger.resolver'; | ||
import { WorkflowTriggerModule } from 'src/modules/workflow/workflow-trigger/workflow-trigger.module'; | ||
|
||
@Module({ | ||
imports: [WorkflowTriggerModule], | ||
providers: [WorkflowTriggerResolver], | ||
}) | ||
export class WorkflowTriggerApiModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
packages/twenty-server/src/engine/decorators/auth/auth-workspace-member-id.decorator.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { ExecutionContext, createParamDecorator } from '@nestjs/common'; | ||
|
||
import { getRequest } from 'src/utils/extract-request'; | ||
|
||
export const AuthWorkspaceMemberId = createParamDecorator( | ||
(data: unknown, ctx: ExecutionContext) => { | ||
const request = getRequest(ctx); | ||
|
||
return request.workspaceMemberId; | ||
}, | ||
); |
Oops, something went wrong.