summaryrefslogtreecommitdiff
path: root/app/models/merge_request/predictions.rb
blob: 61494ca584ccb47c6027e0c9edcab40927b3e24e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
# frozen_string_literal: true

class MergeRequest::Predictions < ApplicationRecord  # rubocop:disable Style/ClassAndModuleChildren
  belongs_to :merge_request, inverse_of: :predictions

  validates :suggested_reviewers, json_schema: { filename: 'merge_request_predictions_suggested_reviewers' }
  validates :accepted_reviewers, json_schema: { filename: 'merge_request_predictions_accepted_reviewers' }

  def suggested_reviewer_usernames
    Array.wrap(suggested_reviewers['reviewers'])
  end

  def accepted_reviewer_usernames
    Array.wrap(accepted_reviewers['reviewers'])
  end
end