Sha256: 05cc94d8e9468135b23e78d32179dd441ae4fd1a3110158304f325952eebe607

Contents?: true

Size: 676 Bytes

Versions: 21

Compression:

Stored size: 676 Bytes

Contents

# frozen_string_literal: true

require_dependency "renalware/letters"

module Renalware
  module Letters
    module QueryableLetter
      def finder_needs_type_condition?
        false
      end

      def ransackable_scopes(_auth_object = nil)
        %i(state_eq)
      end

      def state_eq(state = :draft)
        where(type: Letter.state_class_name(state))
      end
    end

    class LetterQuery
      def initialize(q: nil)
        @q = q || {}
        @q[:s] ||= ["issued_on desc"]
      end

      def call
        search.result
      end

      def search
        @search ||= Letter.extend(QueryableLetter).includes(:event).search(@q)
      end
    end
  end
end

Version data entries

21 entries across 21 versions & 1 rubygems

Version Path
renalware-core-2.0.32 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.31 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.30 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.28 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.27 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.26 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.25 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.24 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.23 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.22 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.21 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.20 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.18 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.17 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.16 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.15 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.14 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.13 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.12 app/models/renalware/letters/letter_query.rb
renalware-core-2.0.11 app/models/renalware/letters/letter_query.rb