Commit d1dccaa4 authored by Vitali Tatarintev's avatar Vitali Tatarintev

Merge branch '216672-prometheus-service' into 'master'

Inherit BaseProjectService for prometheus services

See merge request gitlab-org/gitlab!74676
parents 20bf2b40 ade38e8f
......@@ -82,17 +82,17 @@ module Projects
def create_service
Projects::Prometheus::Alerts::CreateService
.new(project, current_user, alerts_params)
.new(project: project, current_user: current_user, params: alerts_params)
end
def update_service
Projects::Prometheus::Alerts::UpdateService
.new(project, current_user, alerts_params)
.new(project: project, current_user: current_user, params: alerts_params)
end
def destroy_service
Projects::Prometheus::Alerts::DestroyService
.new(project, current_user, nil)
.new(project: project, current_user: current_user, params: nil)
end
def schedule_prometheus_update!
......
......@@ -3,7 +3,7 @@
module Projects
module Prometheus
module Alerts
class CreateService < BaseService
class CreateService < BaseProjectService
include AlertParams
def execute
......
......@@ -3,7 +3,7 @@
module Projects
module Prometheus
module Alerts
class DestroyService < BaseService
class DestroyService < BaseProjectService
def execute(alert)
alert.destroy
end
......
......@@ -3,7 +3,7 @@
module Projects
module Prometheus
module Alerts
class UpdateService < BaseService
class UpdateService < BaseProjectService
include AlertParams
def execute(alert)
......
......@@ -6,7 +6,7 @@ RSpec.describe Projects::Prometheus::Alerts::CreateService do
let_it_be(:project) { create(:project) }
let_it_be(:user) { create(:user) }
let(:service) { described_class.new(project, user, params) }
let(:service) { described_class.new(project: project, current_user: user, params: params) }
subject { service.execute }
......
......@@ -7,7 +7,7 @@ RSpec.describe Projects::Prometheus::Alerts::DestroyService do
let_it_be(:user) { create(:user) }
let_it_be(:alert) { create(:prometheus_alert, project: project) }
let(:service) { described_class.new(project, user, nil) }
let(:service) { described_class.new(project: project, current_user: user, params: nil) }
describe '#execute' do
subject { service.execute(alert) }
......
......@@ -11,7 +11,7 @@ RSpec.describe Projects::Prometheus::Alerts::UpdateService do
create(:prometheus_alert, project: project, environment: environment)
end
let(:service) { described_class.new(project, user, params) }
let(:service) { described_class.new(project: project, current_user: user, params: params) }
let(:params) do
{
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment