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:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 73b13580adeadec266393c807ff389f70684dd538a08744c21d926d1b1a70662
|
4
|
+
data.tar.gz: c06a7dbe0e69cdf10f5cee49e65087b19bfa390861ee7f1fb39c7b15eafebf35
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
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?
|
data/lib/workarea/api/admin.rb
CHANGED
@@ -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.
|
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-
|
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
|