debian-mirror-gitlab/app/models/issue_assignee.rb

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

17 lines
565 B
Ruby
Raw Normal View History

2018-11-18 11:00:15 +05:30
# frozen_string_literal: true
2019-07-07 11:18:12 +05:30
class IssueAssignee < ApplicationRecord
2021-03-11 19:13:27 +05:30
extend SuppressCompositePrimaryKeyWarning
2017-08-17 22:00:37 +05:30
belongs_to :issue
2020-07-28 23:09:34 +05:30
belongs_to :assignee, class_name: "User", foreign_key: :user_id, inverse_of: :issue_assignees
2020-03-13 15:44:24 +05:30
validates :assignee, uniqueness: { scope: :issue_id }
2020-07-28 23:09:34 +05:30
2021-06-08 01:23:25 +05:30
scope :in_projects, ->(project_ids) { joins(:issue).where(issues: { project_id: project_ids }) }
2020-07-28 23:09:34 +05:30
scope :on_issues, ->(issue_ids) { where(issue_id: issue_ids) }
2021-01-03 14:25:43 +05:30
scope :for_assignee, ->(user) { where(assignee: user) }
2017-08-17 22:00:37 +05:30
end
2019-12-04 20:38:33 +05:30
2021-06-08 01:23:25 +05:30
IssueAssignee.prepend_mod_with('IssueAssignee')