2
0

fix(api): 🩹 Switch from stepId to id (for Zapier)

This commit is contained in:
Baptiste Arnaud
2022-02-21 14:14:03 +01:00
parent 5edd63c5f6
commit e3704f6dd9
2 changed files with 3 additions and 3 deletions

View File

@ -15,7 +15,7 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
select: { blocks: true }, select: { blocks: true },
}) })
const emptyWebhookSteps = (typebot?.blocks as Block[]).reduce< const emptyWebhookSteps = (typebot?.blocks as Block[]).reduce<
{ blockId: string; stepId: string; name: string }[] { blockId: string; id: string; name: string }[]
>((emptyWebhookSteps, block) => { >((emptyWebhookSteps, block) => {
const steps = block.steps.filter( const steps = block.steps.filter(
(step) => step.type === IntegrationStepType.WEBHOOK && !step.webhook.url (step) => step.type === IntegrationStepType.WEBHOOK && !step.webhook.url
@ -23,8 +23,8 @@ const handler = async (req: NextApiRequest, res: NextApiResponse) => {
return [ return [
...emptyWebhookSteps, ...emptyWebhookSteps,
...steps.map((s) => ({ ...steps.map((s) => ({
id: s.id,
blockId: s.blockId, blockId: s.blockId,
stepId: s.id,
name: `${block.title} > ${s.id}`, name: `${block.title} > ${s.id}`,
})), })),
] ]

View File

@ -49,7 +49,7 @@ test('can get webhook steps', async ({ request }) => {
const { steps } = await response.json() const { steps } = await response.json()
expect(steps).toHaveLength(1) expect(steps).toHaveLength(1)
expect(steps[0]).toEqual({ expect(steps[0]).toEqual({
stepId: 'step1', id: 'step1',
blockId: 'block1', blockId: 'block1',
name: 'Block #1 > step1', name: 'Block #1 > step1',
}) })