From 9cfced1732633ddc575a5a41c401b6c95df1f50c Mon Sep 17 00:00:00 2001 From: James Cole Date: Wed, 13 Apr 2022 14:21:33 +0200 Subject: [PATCH] Move constants to dedicated enum --- app/Enums/WebhookDelivery.php | 27 +++++++++++++++++++++++++++ app/Enums/WebhookResponse.php | 29 +++++++++++++++++++++++++++++ app/Enums/WebhookTrigger.php | 29 +++++++++++++++++++++++++++++ app/Models/Webhook.php | 14 -------------- 4 files changed, 85 insertions(+), 14 deletions(-) create mode 100644 app/Enums/WebhookDelivery.php create mode 100644 app/Enums/WebhookResponse.php create mode 100644 app/Enums/WebhookTrigger.php diff --git a/app/Enums/WebhookDelivery.php b/app/Enums/WebhookDelivery.php new file mode 100644 index 0000000000..c81dbc31b6 --- /dev/null +++ b/app/Enums/WebhookDelivery.php @@ -0,0 +1,27 @@ +. + */ + +namespace FireflyIII\Enums; + +enum WebhookDelivery: int +{ + case DELIVERY_JSON = 300; +} \ No newline at end of file diff --git a/app/Enums/WebhookResponse.php b/app/Enums/WebhookResponse.php new file mode 100644 index 0000000000..c7d1eeb67f --- /dev/null +++ b/app/Enums/WebhookResponse.php @@ -0,0 +1,29 @@ +. + */ + +namespace FireflyIII\Enums; + +enum WebhookResponse: int +{ + case RESPONSE_TRANSACTIONS = 200; + case RESPONSE_ACCOUNTS = 210; + case RESPONSE_NONE = 220; +} \ No newline at end of file diff --git a/app/Enums/WebhookTrigger.php b/app/Enums/WebhookTrigger.php new file mode 100644 index 0000000000..e08b9af436 --- /dev/null +++ b/app/Enums/WebhookTrigger.php @@ -0,0 +1,29 @@ +. + */ + +namespace FireflyIII\Enums; + +enum WebhookTrigger: int +{ + case TRIGGER_STORE_TRANSACTION = 100; + case TRIGGER_UPDATE_TRANSACTION = 110; + case TRIGGER_DESTROY_TRANSACTION = 120; +} \ No newline at end of file diff --git a/app/Models/Webhook.php b/app/Models/Webhook.php index f036fb3abe..b16ec4ef30 100644 --- a/app/Models/Webhook.php +++ b/app/Models/Webhook.php @@ -77,20 +77,6 @@ use Symfony\Component\HttpKernel\Exception\NotFoundHttpException; class Webhook extends Model { use SoftDeletes; - - // dont forget to update the config in firefly.php - // triggers - public const DELIVERY_JSON = 300; - public const RESPONSE_ACCOUNTS = 210; - public const RESPONSE_NONE = 220; - - // actions - public const RESPONSE_TRANSACTIONS = 200; - public const TRIGGER_DESTROY_TRANSACTION = 120; - public const TRIGGER_STORE_TRANSACTION = 100; - - // delivery - public const TRIGGER_UPDATE_TRANSACTION = 110; protected $casts = [ 'active' => 'boolean',