Production Build Working
This commit is contained in:
@@ -6,10 +6,10 @@ module Baclight
|
||||
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
|
||||
source: :baclight_employers
|
||||
has_many :baclight_members,
|
||||
through: :baclight_employers,
|
||||
source: :baclight_member
|
||||
source: :baclight_members
|
||||
|
||||
alias_attribute :id, :id
|
||||
alias_attribute :name, :name
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
module Baclight
|
||||
class DocumentCategory < BaclightRecord
|
||||
|
||||
self.table_name = 'document_categories'
|
||||
|
||||
alias_attribute :id, :id
|
||||
alias_attribute :display_name, :display_name
|
||||
alias_attribute :created_at, :created_at
|
||||
alias_attribute :updated_at, :updated_at
|
||||
|
||||
has_many :document_uploads, class_name: "Baclight::DocumentUpload", foreign_key: "category_id", primary_key: "id"
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,19 @@
|
||||
module Baclight
|
||||
class DocumentUpload < BaclightRecord
|
||||
|
||||
self.table_name = 'document_uploads'
|
||||
|
||||
alias_attribute :id, :id
|
||||
alias_attribute :filename, :filename
|
||||
alias_attribute :file_type, :file_type
|
||||
alias_attribute :file_data, :file_data
|
||||
alias_attribute :pl_plan_key, :pl_plan_key
|
||||
alias_attribute :active, :active
|
||||
alias_attribute :category_id, :category_id
|
||||
alias_attribute :created_at, :created_at
|
||||
alias_attribute :updated_at, :updated_at
|
||||
|
||||
belongs_to :document_category, class_name: "Baclight::DocumentUpload", foreign_key: "category_id"
|
||||
|
||||
end
|
||||
end
|
||||
@@ -3,22 +3,27 @@ module Baclight
|
||||
|
||||
self.table_name = 'Employers'
|
||||
|
||||
has_one :baclight_carrier, through: :baclight_broker
|
||||
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
|
||||
# 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 carrier_id
|
||||
self.baclight_broker.carrier_id
|
||||
end
|
||||
|
||||
def belongs_to_levels
|
||||
self.joins(baclight_broker: :baclight_carrier).select(
|
||||
|
||||
@@ -5,14 +5,14 @@ module Baclight
|
||||
|
||||
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
|
||||
# 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
|
||||
@@ -6,7 +6,7 @@ module Baclight
|
||||
belongs_to :baclight_employer, class_name: "Baclight::Employer", foreign_key: "employer_id"
|
||||
|
||||
scope :active, -> {
|
||||
where(active: true)
|
||||
where(active: true)
|
||||
}
|
||||
|
||||
# alias_attribute :id, :id
|
||||
@@ -40,5 +40,19 @@ module Baclight
|
||||
baclight_employer&.baclight_broker&.carrier_id
|
||||
end
|
||||
|
||||
def eff_date
|
||||
participation = Vhcs::PbProductParticipation.joins('INNER JOIN "PBCoveredEntities" ON "PBProductParticipation"."PBProductParticipationKey" = "PBCoveredEntities"."PBProductParticipationKey"').where('"PBCoveredEntities"."PBEntityKey" = ?', pb_entity_key).order(out_of_effect: :desc).first
|
||||
eff_date = nil
|
||||
if participation
|
||||
in_effect = participation.in_effect
|
||||
out_of_effect = participation.out_of_effect
|
||||
|
||||
if in_effect <= (Date.today + 90.days) && (out_of_effect - 1.day) > Date.today && out_of_effect > in_effect
|
||||
eff_date = in_effect.strftime("%m/%d/%Y")
|
||||
end
|
||||
end
|
||||
eff_date
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
+39
-42
@@ -2,7 +2,7 @@ class User < ApplicationRecord
|
||||
include Devise::JWT::RevocationStrategies::JTIMatcher
|
||||
|
||||
devise :database_authenticatable, :registerable,
|
||||
:validatable, :jwt_authenticatable, jwt_revocation_strategy: self
|
||||
:validatable, :recoverable, :jwt_authenticatable, jwt_revocation_strategy: self
|
||||
# Include default devise modules. Others available are:
|
||||
# :recoverable, :rememberable, :confirmable, :lockable, :timeoutable, :trackable and :omniauthable
|
||||
|
||||
@@ -30,46 +30,34 @@ class User < ApplicationRecord
|
||||
@keychain ||= case role
|
||||
when "member"
|
||||
if role_entity.present?
|
||||
# belongs_to = {
|
||||
# employer_id: role_entity.employer_id,
|
||||
# broker_id: role_entity&.baclight_employer.broker_id,
|
||||
# carrier_id:role_entity&.baclight_employer&.baclight_broker&.carrier_id
|
||||
# }
|
||||
keys = role_entity.attributes.with_indifferent_access.slice(
|
||||
:id, :name, :family_id, :mb_member_key, :pb_entity_key, :pl_plan_key
|
||||
role_entity.attributes.with_indifferent_access.slice(
|
||||
:id, :name, :family_id, :mb_member_key, :pb_entity_key, :pl_plan_key, :employer_id
|
||||
)
|
||||
|
||||
keys #.merge(belongs_to)
|
||||
end
|
||||
when "employer"
|
||||
if role_entity.present?
|
||||
belongs_to = role_entity.joins(broker: :carrier).select(
|
||||
'brokers.id AS broker_id',
|
||||
'carriers.id AS carrier_id'
|
||||
role_entity.attributes.with_indifferent_access.slice(
|
||||
:id, :name, :pl_plan_key, :company_pb_entity_key, :plan_id, :group_number
|
||||
)
|
||||
|
||||
|
||||
keys = role_entity.attributes.with_indifferent_access.slice(
|
||||
:name, :pl_plan_key, :company_pb_entity_key, :plan_id, :group_number
|
||||
)
|
||||
|
||||
keys.merge(belongs_to)
|
||||
end
|
||||
when "broker"
|
||||
if role_entity.present?
|
||||
belongs_to = role_entity.joins(:carrier).select(
|
||||
'carriers.id AS carrier_id'
|
||||
)
|
||||
role_entity.attributes.with_indifferent_access.slice(
|
||||
:name, :id
|
||||
).merge(belongs_to)
|
||||
end
|
||||
when "provider"
|
||||
if role_entity.present?
|
||||
role_entity.attributes.with_indifferent_access.slice(
|
||||
:name, :pb_entity_key, :tax_id, :family_id
|
||||
)
|
||||
end
|
||||
when "provider"
|
||||
{
|
||||
id: self.id,
|
||||
name: self.name,
|
||||
tax_id: self.role_id
|
||||
}
|
||||
# if role_entity.present?
|
||||
# role_entity.attributes.with_indifferent_access.slice(
|
||||
# :id, :name, :pb_entity_key, :tax_id, :family_id
|
||||
# )
|
||||
# end
|
||||
when "carrier"
|
||||
if role_entity.present?
|
||||
role_entity.attributes.with_indifferent_access.slice(
|
||||
@@ -77,6 +65,11 @@ class User < ApplicationRecord
|
||||
)
|
||||
end
|
||||
# when "admin"
|
||||
# if role_entity.present?
|
||||
# role_entity.attributes.with_indifferent_access.slice(
|
||||
# :name, :id
|
||||
# )
|
||||
# end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -91,33 +84,37 @@ class User < ApplicationRecord
|
||||
find_initial_member
|
||||
end
|
||||
when "employer"
|
||||
Baclight::Employer.find_by(company_pb_entity_key: role_id)
|
||||
Baclight::Employer.find_by(pl_plan_key: role_id)
|
||||
when "broker"
|
||||
Baclight::Broker.find_by(broker_id: role_id)
|
||||
Baclight::Broker.find_by(id: role_id)
|
||||
when "provider"
|
||||
Baclight::Provider.find_by(tax_id: role_id)
|
||||
when "carrier"
|
||||
Baclight::Carrier.find_by(carrier_id: role_id)
|
||||
Baclight::Carrier.find_by(id: role_id)
|
||||
# when "admin"
|
||||
end
|
||||
end
|
||||
|
||||
def sync_role_entity
|
||||
if role == "member"
|
||||
self.name = role_entity.name.split(",").reverse.join(" ").squish
|
||||
else
|
||||
self.name = role_entity.name
|
||||
unless role == "provider"
|
||||
if role == "member"
|
||||
self.name = role_entity.name.split(",").reverse.join(" ").squish
|
||||
else
|
||||
self.name = role_entity.name
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def role_entity_exists
|
||||
if role_entity.blank?
|
||||
errors.add(:role, "#{role} with id #{role_id} was not found.")
|
||||
end
|
||||
if role == "member"
|
||||
dob = Vhcs::VwmbMember.find_by(pb_entity_key: role_id).date_of_birth
|
||||
unless dob == date_of_birth
|
||||
errors.add(:role, "#{role} with id #{role_id} and #{date_of_birth} was not found.")
|
||||
unless role == "provider"
|
||||
if role_entity.blank?
|
||||
errors.add(:role, "#{role} with id #{role_id} was not found.")
|
||||
end
|
||||
if role == "member"
|
||||
dob = Vhcs::VwmbMember.find_by(pb_entity_key: role_id).date_of_birth
|
||||
unless dob == date_of_birth
|
||||
errors.add(:role, "#{role} with id #{role_id} and #{date_of_birth} was not found.")
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
@@ -0,0 +1,55 @@
|
||||
module Vhcs
|
||||
class PbProductParticipation < VhcsRecord
|
||||
|
||||
self.table_name = 'PbProductParticipation'
|
||||
|
||||
alias_attribute :pb_product_participation_key, :PBProductParticipationKey
|
||||
alias_attribute :pb_affiliation_key, :PBAffiliationKey
|
||||
alias_attribute :pb_product_availability_key, :PBProductAvailabilityKey
|
||||
alias_attribute :coverage_type_code, :CoverageTypeCode
|
||||
alias_attribute :optional_amount, :OptionalAmount
|
||||
alias_attribute :in_effect, :InEffect
|
||||
alias_attribute :out_of_effect, :OutOfEffect
|
||||
alias_attribute :in_effect_reason_code, :InEffectReasonCode
|
||||
alias_attribute :out_of_effect_reason_code, :OutOfEffectReasonCode
|
||||
alias_attribute :when_last_changed, :WhenLastChanged
|
||||
alias_attribute :who_last_changed, :WhoLastChanged
|
||||
alias_attribute :user_defined_rate_criteria_value_1, :UserDefinedRateCriteriaValue1
|
||||
alias_attribute :user_defined_rate_criteria_value_2, :UserDefinedRateCriteriaValue2
|
||||
alias_attribute :user_defined_rate_criteria_value_3, :UserDefinedRateCriteriaValue3
|
||||
alias_attribute :user_defined_rate_criteria_record_id_1, :UserDefinedRateCriteriaRecordID1
|
||||
alias_attribute :user_defined_rate_criteria_record_id_2, :UserDefinedRateCriteriaRecordID2
|
||||
alias_attribute :user_defined_rate_criteria_record_id_3, :UserDefinedRateCriteriaRecordID3
|
||||
alias_attribute :optional_amount_record_id, :OptionalAmountRecordID
|
||||
alias_attribute :primary_pb_affiliation_key, :PrimaryPBAffiliationKey
|
||||
alias_attribute :payment_type_record_id_g_1_7_7, :PaymentTypeRecordID_G177
|
||||
|
||||
def attributes
|
||||
rails_like = {
|
||||
pb_product_participation_key: self.pb_product_participation_key,
|
||||
pb_affiliation_key: self.pb_affiliation_key,
|
||||
pb_product_availability_key: self.pb_product_availability_key,
|
||||
coverage_type_code: self.coverage_type_code,
|
||||
optional_amount: self.optional_amount,
|
||||
in_effect: self.in_effect,
|
||||
out_of_effect: self.out_of_effect,
|
||||
in_effect_reason_code: self.in_effect_reason_code,
|
||||
out_of_effect_reason_code: self.out_of_effect_reason_code,
|
||||
when_last_changed: self.when_last_changed,
|
||||
who_last_changed: self.who_last_changed,
|
||||
user_defined_rate_criteria_value_1: self.user_defined_rate_criteria_value_1,
|
||||
user_defined_rate_criteria_value_2: self.user_defined_rate_criteria_value_2,
|
||||
user_defined_rate_criteria_value_3: self.user_defined_rate_criteria_value_3,
|
||||
user_defined_rate_criteria_record_id_1: self.user_defined_rate_criteria_record_id_1,
|
||||
user_defined_rate_criteria_record_id_2: self.user_defined_rate_criteria_record_id_2,
|
||||
user_defined_rate_criteria_record_id_3: self.user_defined_rate_criteria_record_id_3,
|
||||
optional_amount_record_id: self.optional_amount_record_id,
|
||||
primary_pb_affiliation_key: self.primary_pb_affiliation_key,
|
||||
payment_type_record_id_g_1_7_7: self.payment_type_record_id_g_1_7_7,
|
||||
}
|
||||
super.merge(rails_like)
|
||||
end
|
||||
|
||||
|
||||
end
|
||||
end
|
||||
Reference in New Issue
Block a user