From 52f1f33944adc3f4a2f74c2e3b5878fe6880766b Mon Sep 17 00:00:00 2001 From: Jessica McInchak Date: Wed, 11 Dec 2024 14:36:52 +0100 Subject: [PATCH] add S3 destination --- .../pay/service/inviteToPay/createPaymentSendEvents.ts | 10 ++++++++++ .../modules/send/createSendEvents/controller.ts | 1 + 2 files changed, 11 insertions(+) diff --git a/api.planx.uk/modules/pay/service/inviteToPay/createPaymentSendEvents.ts b/api.planx.uk/modules/pay/service/inviteToPay/createPaymentSendEvents.ts index 092ea8854e..86b22b7e76 100644 --- a/api.planx.uk/modules/pay/service/inviteToPay/createPaymentSendEvents.ts +++ b/api.planx.uk/modules/pay/service/inviteToPay/createPaymentSendEvents.ts @@ -98,6 +98,16 @@ const createPaymentSendEvents = async ( combinedResponse["uniform"] = uniformEvent; } + if (destinations.includes("s3")) { + const s3Event = await createScheduledEvent({ + webhook: `{{HASURA_PLANX_API_URL}}/upload-submission/${teamSlug}`, + schedule_at: now, + payload: eventPayload, + comment: `upload_submission_${payload.sessionId}`, + }); + combinedResponse["s3"] = s3Event; + } + return res.json(combinedResponse); } catch (error) { return next({ diff --git a/api.planx.uk/modules/send/createSendEvents/controller.ts b/api.planx.uk/modules/send/createSendEvents/controller.ts index d2cb83e9a9..bf50a134ee 100644 --- a/api.planx.uk/modules/send/createSendEvents/controller.ts +++ b/api.planx.uk/modules/send/createSendEvents/controller.ts @@ -3,6 +3,7 @@ import { createScheduledEvent } from "../../../lib/hasura/metadata/index.js"; import type { CreateSendEventsController } from "./types.js"; // Create "One-off Scheduled Events" in Hasura from Send component for selected destinations +// REMINDER to keep these destinations in sync with api.planx.uk/modules/pay/service/inviteToPay/createPaymentSendEvents.ts const createSendEvents: CreateSendEventsController = async ( _req, res,