workarea-api-admin 4.5.5 → 4.5.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 41f9a13fcd33480e0029dd9e1da664d0903a08a9b195831da0c0a78bf8bafdda
4
- data.tar.gz: 115207e72a4e1c829b7d678d988ad6f177de6b0ebad3334cffc7f5e269f97032
3
+ metadata.gz: 73b13580adeadec266393c807ff389f70684dd538a08744c21d926d1b1a70662
4
+ data.tar.gz: c06a7dbe0e69cdf10f5cee49e65087b19bfa390861ee7f1fb39c7b15eafebf35
5
5
  SHA512:
6
- metadata.gz: 26b2bef73243cdf4a8b9bb03fd75d20c76e194d1bd709241e0168bbcc493eddf4d3a2d82426d892be34525695db7f9a7cfd945204ebc7f82eb2f56f8b84130c1
7
- data.tar.gz: 439beacb0e655180a98356659d31cf184b09c79d48f3f9346ce168f039dc5a1fc04185d743a677dc2d70a420fde18a346e1314040ce6df19d17ec9655c947051
6
+ metadata.gz: e7b53927b51128022e2404f58f75f811a1332104374e6cb802775c09f187cd5da79d32fae950c5e93d319def28bf0eebf82b1a4f0a2b1a10e9916e74ed571dbc
7
+ data.tar.gz: 9a2c721e8b8a25fc602eb5dd46c3c4ab4b1805aee7b344ce53f49c4cc82efb79a1b0ebdb90559ec5f92d72bebe62b103de94a63ee7b65d30f180bc28051c27fe
@@ -4,9 +4,6 @@ module Workarea
4
4
  module DateFiltering
5
5
  extend ActiveSupport::Concern
6
6
  included do
7
- index({ updated_at: 1 })
8
- index({ created_at: 1 })
9
-
10
7
  scope :by_updated_at, ->(starts_at:, ends_at:) do
11
8
  query = criteria
12
9
  query = query.where(:updated_at.gte => starts_at) unless starts_at.nil?
@@ -19,3 +19,4 @@ end
19
19
  require 'workarea/api/version'
20
20
  require 'workarea/api/admin/engine'
21
21
  require 'workarea/api/admin/swagger'
22
+ require 'workarea/api/admin/date_indexes'
@@ -0,0 +1,23 @@
1
+
2
+ module Workarea
3
+ module Api
4
+ module Admin
5
+ module DateIndexes
6
+ extend self
7
+
8
+ # We do this separately from the DateFiltering module to ensure
9
+ # this happens after a model has defined all of its normal indexes. This
10
+ # prevents the date filtering indexes from applying before explicity
11
+ # defined indexes for models that could include options like a TTL.
12
+ def load
13
+ ::Mongoid.models.each do |model|
14
+ if model < ApplicationDocument
15
+ model.index({ updated_at: 1 })
16
+ model.index({ created_at: 1 })
17
+ end
18
+ end
19
+ end
20
+ end
21
+ end
22
+ end
23
+ end
@@ -14,10 +14,12 @@ module Workarea
14
14
 
15
15
  config.after_initialize do
16
16
  Workarea::Api::Admin::Swagger.generate!
17
+ Workarea::Api::Admin::DateIndexes.load
17
18
  end
18
19
 
19
20
  config.to_prepare do
20
21
  ApplicationDocument.include(DateFiltering)
22
+ Workarea::Api::Admin::DateIndexes.load
21
23
  end
22
24
  end
23
25
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: workarea-api-admin
3
3
  version: !ruby/object:Gem::Version
4
- version: 4.5.5
4
+ version: 4.5.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Ben Crouse
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-08-19 00:00:00.000000000 Z
11
+ date: 2020-12-02 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: workarea
@@ -102,6 +102,7 @@ files:
102
102
  - config/locales/en.yml
103
103
  - config/routes.rb
104
104
  - lib/workarea/api/admin.rb
105
+ - lib/workarea/api/admin/date_indexes.rb
105
106
  - lib/workarea/api/admin/engine.rb
106
107
  - lib/workarea/api/admin/swagger.rb
107
108
  - test/documentation/workarea/api/admin/categories_documentation_test.rb