Skip to content

Commit

Permalink
rename markWebhookAsHandled
Browse files Browse the repository at this point in the history
function doesn't mark a webhook as handled, only creates a database entry
  • Loading branch information
FreekBes committed Oct 4, 2024
1 parent 9c9b160 commit 3fb10fb
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/routes/hooks.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export enum WebhookHandledStatus {
Error = "error",
};

export const markWebhookAsHandled = async function(prisma: PrismaClient, webhookHeaders: WebhookHeaders, body: string): Promise<void> {
export const addWebhookToDB = async function(prisma: PrismaClient, webhookHeaders: WebhookHeaders, body: string): Promise<void> {
await prisma.intraWebhook.create({
data: {
model: webhookHeaders.modelType,
Expand Down Expand Up @@ -57,7 +57,7 @@ export const setupWebhookRoutes = function(app: Express, prisma: PrismaClient):
// Handle all Intra webhooks
const webhookHeaders = parseWebhookHeaders(req);
console.log(`Received ${webhookHeaders.modelType} ${webhookHeaders.eventType} webhook ${webhookHeaders.deliveryId}`, req.body);
await markWebhookAsHandled(prisma, webhookHeaders, req.body);
await addWebhookToDB(prisma, webhookHeaders, req.body);
try {
switch (webhookHeaders.modelType) {
case "location": // location close
Expand Down

0 comments on commit 3fb10fb

Please sign in to comment.