Its been a while
This commit is contained in:
@@ -0,0 +1,19 @@
|
||||
module Baclight
|
||||
class Broker < BaclightRecord
|
||||
|
||||
self.table_name = 'Brokers'
|
||||
|
||||
belongs_to :baclight_carrier, class_name: "Baclight::Carrier", foreign_key: "carrier_id"
|
||||
has_many :baclight_employers, class_name: "Baclight::Employer", foreign_key: "broker_id", primary_key: "id"
|
||||
has_many :baclight_members,
|
||||
through: :baclight_employers,
|
||||
source: :baclight_member
|
||||
|
||||
alias_attribute :id, :id
|
||||
alias_attribute :name, :name
|
||||
alias_attribute :carrier_id, :carrier_id
|
||||
alias_attribute :created_at, :created_at
|
||||
alias_attribute :updated_at, :updated_at
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,20 @@
|
||||
module Baclight
|
||||
class Carrier < BaclightRecord
|
||||
|
||||
self.table_name = 'Carriers'
|
||||
|
||||
has_many :baclight_brokers, class_name: "Baclight::Broker", foreign_key: "carrier_id", primary_key: "id"
|
||||
has_many :baclight_employers,
|
||||
through: :baclight_brokers,
|
||||
source: :baclight_employer
|
||||
has_many :baclight_members,
|
||||
through: :baclight_employers,
|
||||
source: :baclight_member
|
||||
|
||||
alias_attribute :id, :id
|
||||
alias_attribute :name, :name
|
||||
alias_attribute :created_at, :created_at
|
||||
alias_attribute :updated_at, :updated_at
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,31 @@
|
||||
module Baclight
|
||||
class Employer < BaclightRecord
|
||||
|
||||
self.table_name = 'Employers'
|
||||
|
||||
belongs_to :baclight_broker, class_name: "Baclight::Broker", foreign_key: "broker_id"
|
||||
has_many :baclight_members, class_name: "Baclight::Member", foreign_key: "employer_id", primary_key: "id"
|
||||
|
||||
alias_attribute :id, :id
|
||||
alias_attribute :name, :name
|
||||
alias_attribute :slug, :slug
|
||||
alias_attribute :pl_plan_key, :pl_plan_key
|
||||
alias_attribute :company_pb_entity_key, :company_pb_entity_key
|
||||
alias_attribute :plan_id, :plan_id
|
||||
alias_attribute :group_number, :group_number
|
||||
alias_attribute :effective_date, :effective_date
|
||||
alias_attribute :active, :active
|
||||
alias_attribute :initialized, :initialized
|
||||
alias_attribute :broker_id, :broker_id
|
||||
alias_attribute :created_at, :created_at
|
||||
alias_attribute :updated_at, :updated_at
|
||||
|
||||
def belongs_to_levels
|
||||
self.joins(baclight_broker: :baclight_carrier).select(
|
||||
'baclight_broker.id AS broker_id',
|
||||
'baclight_carrier.id AS carrier_id'
|
||||
)
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,18 @@
|
||||
module Baclight
|
||||
class IdCardPlan < BaclightRecord
|
||||
|
||||
self.table_name = 'id_card_plans'
|
||||
|
||||
has_many :baclight_id_card_plan_benefits, class_name: "Baclight::IdCardPlanBenefit", foreign_key: "plan_id", primary_key: "id"
|
||||
|
||||
alias_attribute :id, :id
|
||||
alias_attribute :title, :title
|
||||
alias_attribute :pb_product_key, :pb_product_key
|
||||
alias_attribute :pl_plan_key, :pl_plan_key
|
||||
alias_attribute :template, :template
|
||||
alias_attribute :setup_id, :setup_id
|
||||
alias_attribute :created_at, :created_at
|
||||
alias_attribute :updated_at, :updated_at
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,17 @@
|
||||
module Baclight
|
||||
class IdCardPlanBenefit < BaclightRecord
|
||||
|
||||
self.table_name = 'id_card_plan_benefits'
|
||||
|
||||
belongs_to :baclight_id_card_plan, class_name: "Baclight::IdCardPlan", foreign_key: "plan_id"
|
||||
|
||||
alias_attribute :id, :id
|
||||
alias_attribute :benefit_desc, :benefit_desc
|
||||
alias_attribute :benefit, :benefit
|
||||
alias_attribute :sequence, :sequence
|
||||
alias_attribute :plan_id, :plan_id
|
||||
alias_attribute :created_at, :created_at
|
||||
alias_attribute :updated_at, :updated_at
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,25 @@
|
||||
module Baclight
|
||||
class IdCardSetup < BaclightRecord
|
||||
|
||||
self.table_name = 'id_card_setups'
|
||||
|
||||
alias_attribute :id, :id
|
||||
alias_attribute :print_name, :print_name
|
||||
alias_attribute :network_provider, :network_provider
|
||||
alias_attribute :card_template, :card_template
|
||||
alias_attribute :card_color, :card_color
|
||||
alias_attribute :rx_group_number, :rx_group_number
|
||||
alias_attribute :pl_plan_key, :pl_plan_key
|
||||
alias_attribute :has_divisions, :has_divisions
|
||||
alias_attribute :has_dental, :has_dental
|
||||
alias_attribute :active, :active
|
||||
alias_attribute :initialized, :initialized
|
||||
alias_attribute :employer_id, :employer_id
|
||||
alias_attribute :network_logo_id, :network_logo_id
|
||||
alias_attribute :provider_section_id, :provider_section_id
|
||||
alias_attribute :rx_section_id, :rx_section_id
|
||||
alias_attribute :created_at, :created_at
|
||||
alias_attribute :updated_at, :updated_at
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,44 @@
|
||||
module Baclight
|
||||
class Member < BaclightRecord
|
||||
|
||||
self.table_name = 'Members'
|
||||
|
||||
belongs_to :baclight_employer, class_name: "Baclight::Employer", foreign_key: "employer_id"
|
||||
|
||||
scope :active, -> {
|
||||
where(active: true)
|
||||
}
|
||||
|
||||
# alias_attribute :id, :id
|
||||
# alias_attribute :name, :name
|
||||
# alias_attribute :family_id, :family_id
|
||||
# alias_attribute :mb_member_key, :mb_member_key
|
||||
# alias_attribute :pb_entity_key, :pb_entity_key
|
||||
# alias_attribute :pl_plan_key, :pl_plan_key
|
||||
# alias_attribute :id_card_display_name, :id_card_display_name
|
||||
# alias_attribute :coverage_class, :coverage_class
|
||||
# alias_attribute :division, :division
|
||||
# alias_attribute :dental_plan_key, :dental_plan_key
|
||||
# alias_attribute :dependents, :dependents
|
||||
# alias_attribute :employer_id, :employer_id
|
||||
# alias_attribute :id_card_plan_id, :id_card_plan_id
|
||||
# alias_attribute :created_at, :created_at
|
||||
# alias_attribute :updated_at, :updated_at
|
||||
|
||||
# def member_belongs_to
|
||||
# {
|
||||
# broker_id: baclight_employer&.broker_id,
|
||||
# carrier_id: baclight_employer&.baclight_broker&.carrier_id
|
||||
# }
|
||||
# end
|
||||
|
||||
def broker_id
|
||||
baclight_employer&.broker_id
|
||||
end
|
||||
|
||||
def carrier_id
|
||||
baclight_employer&.baclight_broker&.carrier_id
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,16 @@
|
||||
module Baclight
|
||||
class Provider < BaclightRecord
|
||||
|
||||
self.table_name = 'Providers'
|
||||
|
||||
alias_attribute :id, :id
|
||||
alias_attribute :name, :name
|
||||
alias_attribute :pb_entity_key, :pb_entity_key
|
||||
alias_attribute :tax_id, :tax_id
|
||||
alias_attribute :family_id, :family_id
|
||||
alias_attribute :provider_group_id, :provider_group_id
|
||||
alias_attribute :created_at, :created_at
|
||||
alias_attribute :updated_at, :updated_at
|
||||
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user