summaryrefslogtreecommitdiff
path: root/app/models/alert_management/metric_image.rb
blob: 8175a31be7a77a6055c8a18b8adf94baa16ab4af (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
# 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