Module: CollectionObjects::FilterParams
- Included in:
- CollectionObjectsController, Tasks::Dwc::DashboardController
- Defined in:
- app/controllers/collection_objects/filter_params.rb
Instance Method Summary collapse
- #collection_object_api_params ⇒ Object private
- #collection_object_filter_params ⇒ Object private
- #filtered_collection_objects ⇒ Object private
Instance Method Details
#collection_object_api_params ⇒ Object (private)
107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 |
# File 'app/controllers/collection_objects/filter_params.rb', line 107 def collection_object_api_params a = params.permit( :recent, ::Queries::CollectingEvent::Filter::ATTRIBUTES, :ancestor_id, :buffered_collecting_event, :buffered_determinations, :buffered_other_labels, :collecting_event, :collection_object_type, :collector_ids_or, :current_determinations, :depictions, :determiner_id_or, :dwc_indexed, :end_date, # CE filter :exact_buffered_collecting_event, :exact_buffered_determinations, :exact_buffered_other_labels, :geo_json, :geographic_area, :georeferences, :identifier, :identifier_end, :identifier_exact, :identifier_start, :identifiers, :in_labels, :in_verbatim_locality, :loaned, :md5_verbatim_label, # CE filter :namespace_id, :never_loaned, :note_exact, :note_text, :notes, :on_loan, :partial_overlap_dates, # CE filter :preparation_type, :preparation_type_id, :radius, :repository, :repository_id, :sled_image_id, :spatial_geographic_areas, :start_date, :taxon_determinations, :type_material, :type_specimen_taxon_name_id, :user_date_end, :user_date_start, :user_id, :user_target, :validity, :with_buffered_collecting_event, :with_buffered_determinations, :with_buffered_other_labels, :wkt, # CE filter biocuration_class_ids: [], biological_relationship_ids: [], collecting_event_ids: [], collector_ids: [], determiner_id: [], geographic_area_id: [], # CE filter is_type: [], keyword_id_and: [], keyword_id_or: [], loan_id: [], otu_ids: [], preparation_type_id: [], # collecting_event: { # :recent, # keyword_id_and: [] # } ) a[:user_id] = params[:user_id] if params[:user_id] && is_project_member_by_id(params[:user_id], sessions_current_project_id) # double check vs. setting project_id from API a end |
#collection_object_filter_params ⇒ Object (private)
14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 |
# File 'app/controllers/collection_objects/filter_params.rb', line 14 def collection_object_filter_params a = params.permit( :recent, ::Queries::CollectingEvent::Filter::ATTRIBUTES, :ancestor_id, :buffered_collecting_event, :buffered_determinations, :buffered_other_labels, :collecting_event, :collection_object_type, :collector_ids_or, :current_determinations, :current_repository, :current_repository_id, :depictions, :determiner_id_or, :determiner_name_regex, :dwc_indexed, :end_date, :exact_buffered_collecting_event, :exact_buffered_determinations, :exact_buffered_other_labels, :geo_json, :geographic_area, :georeferences, :identifier, :identifier_end, :identifier_exact, :identifier_start, :identifiers, :in_labels, :in_verbatim_locality, :loaned, :md5_verbatim_label, :namespace_id, :never_loaned, :note_exact, :note_text, :notes, :object_global_id, :on_loan, :partial_overlap_dates, :preparation_type, :preparation_type_id, :radius, # CE filter :repository, :repository_id, :sled_image_id, :spatial_geographic_areas, :start_date, # CE filter :taxon_determination_id, :taxon_determinations, :type_material, :type_specimen_taxon_name_id, :user_date_end, :user_date_start, :user_id, :user_target, :validity, :with_buffered_collecting_event, :with_buffered_determinations, :with_buffered_other_labels, :wkt, :data_attribute_exact_value, # DataAttributes concern :data_attributes, # DataAttributes concern biocuration_class_ids: [], biological_relationship_ids: [], collecting_event_ids: [], collecting_event_wildcards: [], # !! TODO, factor into CONSTANT collector_id: [], # data_attribute_predicate_id: [], # DataAttributes concern data_attribute_value: [], # DataAttributes concern determiner_id: [], geographic_area_id: [], is_type: [], keyword_id_and: [], keyword_id_or: [], loan_id: [], otu_ids: [], preparation_type_id: [], # user_id: [] # collecting_event: { # :recent, # keyword_id_and: [] # } ) # TODO: check user_id: [] a[:user_id] = params[:user_id] if params[:user_id] && is_project_member_by_id(params[:user_id], sessions_current_project_id) # double check vs. setting project_id from API a end |
#filtered_collection_objects ⇒ Object (private)
5 6 7 8 9 10 11 12 |
# File 'app/controllers/collection_objects/filter_params.rb', line 5 def filtered_collection_objects # !! Do not add order() here, it breaks DwC integration ::Queries::CollectionObject::Filter. new(collection_object_filter_params).all.where(project_id: sessions_current_project_id) # Apply pagination during use # page(params[:page]).per(params[:per] || 500) end |