Software: Apache/2.4.41 (Ubuntu). PHP/8.0.30 uname -a: Linux apirnd 5.4.0-204-generic #224-Ubuntu SMP Thu Dec 5 13:38:28 UTC 2024 x86_64 uid=33(www-data) gid=33(www-data) groups=33(www-data) Safe-mode: OFF (not secure) /var/www/html/wincloud_gateway/node_modules/strapi/lib/services/ drwxr-xr-x | |
| Viewing file: Select action/file-type: /**
* Webhook store is the implementation of webhook storage over the core_store
*/
'use strict';
const webhookModel = config => ({
connection: config.get('database.defaultConnection'),
uid: 'strapi::webhooks',
globalId: 'StrapiWebhooks',
collectionName: 'strapi_webhooks',
info: {
name: 'Strapi webhooks',
description: '',
},
pluginOptions: {
'content-manager': {
visible: false,
},
'content-type-builder': {
visible: false,
},
},
attributes: {
name: {
type: 'string',
},
url: {
type: 'text',
},
headers: {
type: 'json',
},
events: {
type: 'json',
},
enabled: {
type: 'boolean',
},
},
});
const toDBObject = data => {
return {
name: data.name,
url: data.url,
headers: data.headers,
events: data.events,
enabled: data.isEnabled,
};
};
const fromDBObject = row => {
return {
id: row.id,
name: row.name,
url: row.url,
headers: row.headers,
events: row.events,
isEnabled: row.enabled,
};
};
const createWebhookStore = ({ db }) => {
const webhookQueries = db.query('strapi_webhooks');
return {
async findWebhooks() {
const results = await webhookQueries.find();
return results.map(fromDBObject);
},
async findWebhook(id) {
const result = await webhookQueries.findOne({ id });
return result ? fromDBObject(result) : null;
},
createWebhook(data) {
return webhookQueries.create(toDBObject({ ...data, isEnabled: true })).then(fromDBObject);
},
async updateWebhook(id, data) {
const webhook = await webhookQueries.update({ id }, toDBObject(data));
return webhook ? fromDBObject(webhook) : null;
},
async deleteWebhook(id) {
const webhook = await webhookQueries.delete({ id });
return webhook ? fromDBObject(webhook) : null;
},
};
};
module.exports = {
webhookModel,
createWebhookStore,
};
|
:: Command execute :: | |
--[ c99shell v. 2.5 [PHP 8 Update] [24.05.2025] | Generation time: 0.0052 ]-- |