Skip to content

Commit

Permalink
ref: use new factory function in controller
Browse files Browse the repository at this point in the history
  • Loading branch information
mantariksh committed Mar 31, 2021
1 parent a0e5a8f commit 693cf78
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ import { mapVerifyMyInfoError } from '../../myinfo/myinfo.util'
import { SpcpFactory } from '../../spcp/spcp.factory'
import { getPopulatedUserById } from '../../user/user.service'
import { VerifiedContentFactory } from '../../verified-content/verified-content.factory'
import { pushData as webhookPushData } from '../../webhook/webhook.service'
import { WebhookFactory } from '../../webhook/webhook.factory'
import {
getProcessedResponses,
sendEmailConfirmations,
Expand Down Expand Up @@ -360,12 +360,16 @@ export const handleEncryptedSubmission: RequestHandler = async (req, res) => {
})

// Fire webhooks if available
// Note that we push data to webhook endpoints on a best effort basis
// As such, we should not await on these post requests
const webhookUrl = form.webhook?.url
const submissionWebhookView = submission.getWebhookView()
if (webhookUrl) {
// Note that we push data to webhook endpoints on a best effort basis
// As such, we should not await on these post requests
void webhookPushData(webhookUrl, submissionWebhookView)
void WebhookFactory.sendWebhook(
submission,
webhookUrl,
).andThen((response) =>
WebhookFactory.saveWebhookRecord(submission._id, response),
)
}

// Send Email Confirmations
Expand Down
30 changes: 0 additions & 30 deletions src/app/modules/webhook/webhook.middleware.ts

This file was deleted.

0 comments on commit 693cf78

Please sign in to comment.