blob: d820124d26fb328994da4af9c3542e50ec43b430 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
# frozen_string_literal: true
module Mutations
module AlertManagement
class UpdateAlertStatus < Base
graphql_name 'UpdateAlertStatus'
argument :status, Types::AlertManagement::StatusEnum,
required: true,
description: 'The status to set the alert'
def resolve(args)
alert = authorized_find!(project_path: args[:project_path], iid: args[:iid])
result = update_status(alert, args[:status])
prepare_response(result)
end
private
def update_status(alert, status)
::AlertManagement::UpdateAlertStatusService
.new(alert, current_user, status)
.execute
end
def prepare_response(result)
{
alert: result.payload[:alert],
errors: result.errors
}
end
end
end
end
|