debian-mirror-gitlab/app/models/achievements/user_achievement.rb

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

24 lines
689 B
Ruby
Raw Normal View History

2023-03-17 16:20:25 +05:30
# frozen_string_literal: true
module Achievements
class UserAchievement < ApplicationRecord
belongs_to :achievement, inverse_of: :user_achievements, optional: false
belongs_to :user, inverse_of: :user_achievements, optional: false
belongs_to :awarded_by_user,
class_name: 'User',
inverse_of: :awarded_user_achievements,
2023-05-27 22:25:52 +05:30
optional: false
2023-03-17 16:20:25 +05:30
belongs_to :revoked_by_user,
class_name: 'User',
inverse_of: :revoked_user_achievements,
optional: true
2023-05-27 22:25:52 +05:30
scope :not_revoked, -> { where(revoked_by_user_id: nil) }
def revoked?
revoked_by_user_id.present?
end
2023-03-17 16:20:25 +05:30
end
end