summaryrefslogtreecommitdiff
path: root/app/models/approval.rb
diff options
context:
space:
mode:
Diffstat (limited to 'app/models/approval.rb')
-rw-r--r--app/models/approval.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/app/models/approval.rb b/app/models/approval.rb
new file mode 100644
index 00000000000..bc123de0b20
--- /dev/null
+++ b/app/models/approval.rb
@@ -0,0 +1,11 @@
+# frozen_string_literal: true
+
+class Approval < ApplicationRecord
+ belongs_to :user
+ belongs_to :merge_request
+
+ validates :merge_request_id, presence: true
+ validates :user_id, presence: true, uniqueness: { scope: [:merge_request_id] }
+
+ scope :with_user, -> { joins(:user) }
+end