Skip to content

Commit 13b1360

Browse files
committed
Fixed permission issue
cleaned webhook
1 parent b4ac1da commit 13b1360

File tree

2 files changed

+6
-3
lines changed

2 files changed

+6
-3
lines changed

middleware/auth.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
let Role = require("../models/role.js");
22
let _ = require("lodash");
3-
let swaggerJSON = require("../api-docs/api-paths.json");
3+
let swaggerJSON = {...require("../api-docs/api-entity-paths.json"), ...require("../api-docs/api-paths.json")};
44

55

66
//todo: allow for multiple permissions

plugins/webhooks/main.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,11 @@ function* run(config, provide, channels) {
2525
let webhooks = await db("webhooks").where(true, true);
2626
let webhook_responses = await Promise.reduce(webhooks, async (responses, webhook) => {
2727

28-
let parsedEvent = Object.values(event).map(eventValue => entry)
29-
let webhookRequest = fetch(webhook.endpoint_url, {method: "POST", body: JSON.stringify({event_name : eventName, event_data : event}), headers})
28+
let parsedEvent = Object.entries(event).reduce((acc, [key, eventValue]) => {
29+
acc[key] = eventValue.data ? eventValue.data : eventValue;
30+
return acc;
31+
}, {});
32+
let webhookRequest = fetch(webhook.endpoint_url, {method: "POST", body: JSON.stringify({event_name : eventName, event_data : parsedEvent}), headers})
3033
.then(response => {
3134
if (!response.ok) {
3235
console.error("error making webhook request", response.statusText);

0 commit comments

Comments
 (0)