Skip to content

Commit 76981f8

Browse files
authored
Merge pull request #10 from codee-sh/fix-types
refactor: Update value handling in automation rules and triggers
2 parents 67c97c0 + e5c0dc1 commit 76981f8

2 files changed

Lines changed: 10 additions & 22 deletions

File tree

src/workflows/mpn-automation/steps/edit-automation-rules.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ export const editAutomationRulesStep = createStep(
112112
await mpnAutomationService.updateMpnAutomationRuleValues(
113113
valuesToUpdate.map((value) => ({
114114
id: value.id!,
115-
value: value.value,
115+
value: value.value as any,
116116
}))
117117
)
118118
}
@@ -121,7 +121,7 @@ export const editAutomationRulesStep = createStep(
121121
await mpnAutomationService.createMpnAutomationRuleValues(
122122
valuesToCreate.map((value) => ({
123123
rule_id: rule.id!,
124-
value: value.value,
124+
value: value.value as any,
125125
}))
126126
)
127127
}
@@ -148,7 +148,7 @@ export const editAutomationRulesStep = createStep(
148148
await mpnAutomationService.createMpnAutomationRuleValues(
149149
rule.rule_values.map((value) => ({
150150
rule_id: newRule[0].id,
151-
value: value.value,
151+
value: value.value as any,
152152
}))
153153
)
154154
}

src/workflows/mpn-automation/steps/retrieve-automation-triggers-by-event.ts

Lines changed: 7 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -58,35 +58,23 @@ export const getAutomationTriggersByEventStep = createStep(
5858
id: trigger.id,
5959
name: trigger.name,
6060
description: trigger.description,
61-
trigger_type: trigger.trigger_type as TriggerType,
61+
trigger_type: trigger.trigger_type,
6262
event_name: trigger.event_name,
6363
interval_minutes: trigger.interval_minutes,
6464
active: trigger.active,
65-
channels: trigger.channels as Record<
66-
string,
67-
boolean
68-
> | null,
69-
metadata: trigger.metadata as Record<
70-
string,
71-
any
72-
> | null,
65+
channels: trigger.channels,
66+
metadata: trigger.metadata,
7367
rules: (trigger.rules || []).map((rule) => ({
7468
id: rule.id,
7569
attribute: rule.attribute,
7670
operator: rule.operator,
7771
description: rule.description,
78-
metadata: rule.metadata as Record<
79-
string,
80-
any
81-
> | null,
72+
metadata: rule.metadata,
8273
rule_values: (rule.rule_values || []).map(
8374
(value) => ({
8475
id: value.id,
85-
value: value.value,
86-
metadata: value.metadata as Record<
87-
string,
88-
any
89-
> | null,
76+
value: value.value as any,
77+
metadata: value.metadata,
9078
})
9179
),
9280
})),
@@ -95,7 +83,7 @@ export const getAutomationTriggersByEventStep = createStep(
9583
action_type: action.action_type,
9684
config: action.config,
9785
})),
98-
}))
86+
})) as AutomationTrigger[]
9987

10088
return new StepResponse(triggersData, triggersData)
10189
}

0 commit comments

Comments
 (0)