class Billing::TransactionDay < ApplicationRecord
  belongs_to :detail, class_name: 'Billing::TransactionDetail'

  has_many :processed_transactions
  has_many :plan_transactions, through: :detail

  scope :by_date_range, ->(range) { where(date: range) if range }
  scope :by_category, ->(id) { where(billing_transaction_details: { subcategory_id: id }) if id }
end
