diff options
Diffstat (limited to 'app/services/jira_connect_installations/destroy_service.rb')
-rw-r--r-- | app/services/jira_connect_installations/destroy_service.rb | 24 |
1 files changed, 24 insertions, 0 deletions
diff --git a/app/services/jira_connect_installations/destroy_service.rb b/app/services/jira_connect_installations/destroy_service.rb new file mode 100644 index 00000000000..cfe58575dcf --- /dev/null +++ b/app/services/jira_connect_installations/destroy_service.rb @@ -0,0 +1,24 @@ +# frozen_string_literal: true + +module JiraConnectInstallations + class DestroyService + def self.execute(installation, jira_connect_base_path, jira_connect_uninstalled_event_path) + new(installation, jira_connect_base_path, jira_connect_uninstalled_event_path).execute + end + + def initialize(installation, jira_connect_base_path, jira_connect_uninstalled_event_path) + @installation = installation + @jira_connect_base_path = jira_connect_base_path + @jira_connect_uninstalled_event_path = jira_connect_uninstalled_event_path + end + + def execute + if @installation.instance_url.present? + JiraConnect::ForwardEventWorker.perform_async(@installation.id, @jira_connect_base_path, @jira_connect_uninstalled_event_path) + return true + end + + @installation.destroy + end + end +end |