chore: code cleanup

This commit is contained in:
Jamie Howard 2023-05-30 10:14:13 +01:00
parent 9f8acd2374
commit a43f1233d3

View File

@ -50,18 +50,17 @@ const fromDBObject = (row) => {
}; };
}; };
const webhookEventValidator = async (allowedEvents, events) => const webhookEventValidator = async (allowedEvents, events) => {
mapAsync( const allowedValues = Array.from(allowedEvents.values());
events,
(event) => { await mapAsync(events, (event) => {
if (Array.from(allowedEvents.values()).includes(event)) { if (allowedValues.includes(event)) {
return; return;
} }
throw new ValidationError(`Webhook event ${event} is not supported`); throw new ValidationError(`Webhook event ${event} is not supported`);
}, });
{} };
);
const createWebhookStore = ({ db }) => { const createWebhookStore = ({ db }) => {
const webhookQueries = db.query('webhook'); const webhookQueries = db.query('webhook');