2020-07-01 17:08:51 -04:00
|
|
|
# frozen_string_literal: true
|
|
|
|
|
|
|
|
class Approval < ApplicationRecord
|
2020-12-08 19:09:42 -05:00
|
|
|
include CreatedAtFilterable
|
2022-08-16 08:12:38 -04:00
|
|
|
include Importable
|
2020-12-08 19:09:42 -05:00
|
|
|
|
2020-07-01 17:08:51 -04:00
|
|
|
belongs_to :user
|
|
|
|
belongs_to :merge_request
|
|
|
|
|
2022-08-16 08:12:38 -04:00
|
|
|
validates :merge_request_id, presence: true, unless: :importing?
|
2020-07-01 17:08:51 -04:00
|
|
|
validates :user_id, presence: true, uniqueness: { scope: [:merge_request_id] }
|
|
|
|
|
|
|
|
scope :with_user, -> { joins(:user) }
|
|
|
|
end
|