summaryrefslogtreecommitdiff
path: root/app/models/alert_management/metric_image.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/alert_management/metric_image.rb')
-rw-r--r--app/models/alert_management/metric_image.rb25
1 files changed, 25 insertions, 0 deletions
diff --git a/app/models/alert_management/metric_image.rb b/app/models/alert_management/metric_image.rb
new file mode 100644
index 00000000000..8175a31be7a
--- /dev/null
+++ b/app/models/alert_management/metric_image.rb
@@ -0,0 +1,25 @@
+# frozen_string_literal: true
+
+module AlertManagement
+ class MetricImage < ApplicationRecord
+ include MetricImageUploading
+ self.table_name = 'alert_management_alert_metric_images'
+
+ belongs_to :alert, class_name: 'AlertManagement::Alert', foreign_key: 'alert_id', inverse_of: :metric_images
+
+ def self.available_for?(project)
+ true
+ end
+
+ private
+
+ def local_path
+ Gitlab::Routing.url_helpers.alert_metric_image_upload_path(
+ filename: file.filename,
+ id: file.upload.model_id,
+ model: model_name.param_key,
+ mounted_as: 'file'
+ )
+ end
+ end
+end