summaryrefslogtreecommitdiff
path: root/app/models/chat_name.rb
diff options
context:
space:
mode:
authorKamil Trzcinski <ayufan@ayufan.eu>2016-11-13 20:35:47 +0100
committerKamil Trzcinski <ayufan@ayufan.eu>2016-11-16 13:42:35 +0100
commitc60437786bfe43344b4a5eb040437f73f37c6396 (patch)
treefe90ee0dd9e556369e7f53ce4a03e2751b486682 /app/models/chat_name.rb
parentc5169b5d447ab6c73bbe542c071a4054c5969165 (diff)
downloadgitlab-ce-c60437786bfe43344b4a5eb040437f73f37c6396.tar.gz
Create relation between chat user and GitLab user and allow to authorize them [ci skip]
Diffstat (limited to 'app/models/chat_name.rb')
-rw-r--r--app/models/chat_name.rb12
1 files changed, 12 insertions, 0 deletions
diff --git a/app/models/chat_name.rb b/app/models/chat_name.rb
new file mode 100644
index 00000000000..f321db75eeb
--- /dev/null
+++ b/app/models/chat_name.rb
@@ -0,0 +1,12 @@
+class ChatName < ActiveRecord::Base
+ belongs_to :service
+ belongs_to :user
+
+ validates :user, presence: true
+ validates :service, presence: true
+ validates :team_id, presence: true
+ validates :chat_id, presence: true
+
+ validates :user_id, uniqueness: { scope: [:service_id] }
+ validates :chat_id, uniqueness: { scope: [:service_id, :team_id] }
+end