Class: Collavre::Creatives::IndexQuery
- Inherits:
-
Object
- Object
- Collavre::Creatives::IndexQuery
- Defined in:
- app/services/collavre/creatives/index_query.rb
Defined Under Namespace
Classes: Result
Constant Summary collapse
- SIMPLE_SEARCH_LIMIT =
Cap flat search results for the lightweight picker popup (simple mode). The full-page search (no ‘simple` flag) is intentionally unbounded.
50- PERMISSION_FILTER_BATCH =
Permission-check matched rows in rank order in slices of this size, so a heavily-matched query only checks the prefix needed to fill the cap rather than its entire match set.
200
Instance Method Summary collapse
- #call ⇒ Object
-
#initialize(user:, params: {}) ⇒ IndexQuery
constructor
A new instance of IndexQuery.
Constructor Details
#initialize(user:, params: {}) ⇒ IndexQuery
Returns a new instance of IndexQuery.
24 25 26 27 |
# File 'app/services/collavre/creatives/index_query.rb', line 24 def initialize(user:, params: {}) @user = user @params = params.with_indifferent_access end |
Instance Method Details
#call ⇒ Object
29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 |
# File 'app/services/collavre/creatives/index_query.rb', line 29 def call result = resolve_creatives shared_creative = result[:parent] || result[:creatives]&.first shared_list = shared_creative ? shared_creative.all_shared_users : [] Result.new( creatives: result[:creatives], parent_creative: result[:parent], shared_creative: shared_creative, shared_list: shared_list, overall_progress: result[:overall_progress] || 0, allowed_creative_ids: result[:allowed_ids], progress_map: result[:progress_map] ) end |