Add notifications of severed relationships (#27511)
This commit is contained in:
parent
8a1423a474
commit
44bf7b8128
39 changed files with 781 additions and 54 deletions
27
app/models/account_relationship_severance_event.rb
Normal file
27
app/models/account_relationship_severance_event.rb
Normal file
|
@ -0,0 +1,27 @@
|
|||
# frozen_string_literal: true
|
||||
|
||||
#
|
||||
# == Schema Information
|
||||
#
|
||||
# Table name: account_relationship_severance_events
|
||||
#
|
||||
# id :bigint(8) not null, primary key
|
||||
# account_id :bigint(8) not null
|
||||
# relationship_severance_event_id :bigint(8) not null
|
||||
# created_at :datetime not null
|
||||
# updated_at :datetime not null
|
||||
#
|
||||
class AccountRelationshipSeveranceEvent < ApplicationRecord
|
||||
belongs_to :account
|
||||
belongs_to :relationship_severance_event
|
||||
|
||||
delegate :severed_relationships, :type, :target_name, :purged, to: :relationship_severance_event, prefix: false
|
||||
|
||||
before_create :set_relationships_count!
|
||||
|
||||
private
|
||||
|
||||
def set_relationships_count!
|
||||
self.relationships_count = severed_relationships.where(local_account: account).count
|
||||
end
|
||||
end
|
Loading…
Add table
Add a link
Reference in a new issue