Skip to content

Commit 4421189

Browse files
committed
fix: dont check for valid key /appkey in create-step
1 parent 7b32b33 commit 4421189

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

packages/backend/src/graphql/mutations/create-step.ts

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,19 @@ const createStep: MutationResolvers['createStep'] = async (
1313
) => {
1414
const { input } = params
1515

16-
const triggerOrAction = await App.findTriggerOrActionByKey(
17-
input.appKey,
18-
input.key,
19-
)
16+
/**
17+
* appKey and key are optional, we allow creating of empty step for if-then branches
18+
*/
19+
if (input.appKey && input.key) {
20+
const triggerOrAction = await App.findTriggerOrActionByKey(
21+
input.appKey,
22+
input.key,
23+
)
2024

21-
if (!triggerOrAction) {
22-
throw new BadUserInputError('No such trigger or action')
23-
}
24-
if ('hiddenFromUser' in triggerOrAction && triggerOrAction.hiddenFromUser) {
25-
throw new BadUserInputError('Action can only be created by system')
25+
if ('hiddenFromUser' in triggerOrAction && triggerOrAction.hiddenFromUser) {
26+
throw new BadUserInputError('Action can only be created by system')
27+
}
2628
}
27-
2829
return await Step.transaction(async (trx) => {
2930
await trx.raw('SET TRANSACTION ISOLATION LEVEL SERIALIZABLE;')
3031

0 commit comments

Comments
 (0)