forest_admin_datasource_active_record 1.0.0.pre.beta.47 → 1.0.0.pre.beta.49

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: cdcd9294dea10cadd5dded524d1384d64ce7406076ecd6a5f5a024c03a4d377f
4
- data.tar.gz: 8d84560eb10754d5f66722fddb8189203af433bdf1344cb800ecaa966ed61171
3
+ metadata.gz: 3751729665ad36eddcb41f4e994f500e560475c7f7ae96a7f70f2609270572fd
4
+ data.tar.gz: 48081174198bec227b8b6114fe5cfa35b72c917ad5a95bea4755be32e420cf0f
5
5
  SHA512:
6
- metadata.gz: 7ff18cacf134668c70a6f2ffdc5510597fb86fb04c3df74a2bea583d9c045454e360d0dce8bf56adb3ea981d2e15f6a05afa08454fed60697fac2115b77d0228
7
- data.tar.gz: 5eb548cfe3eab7c7bc0e783bd90c852f46108006df0824905b22a14451c1988367535de3f45fcc1399b5d620af77ed54b382c9f3e974676b6469b84db6275067
6
+ metadata.gz: 955a888a7c4fa73370b581a8f78a50b7e2eaf24b65324aded83acc2d195f32449767d7f9a2c75a8b8c02f12f81ddfe30d5e77325edb0868f0616d80d551f4774
7
+ data.tar.gz: 3d2f22d5028b5f7e08e25567d7f6f7975c0e9e657d8b2e2ad43ee3a9adb148117bb7cdaa64cca8132f778d4f74690f6bad8195eb9129c220ff0ab311374cdc92
@@ -17,7 +17,7 @@ admin work on any Ruby application."
17
17
 
18
18
  spec.metadata["homepage_uri"] = spec.homepage
19
19
  spec.metadata["source_code_uri"] = "https://github.com/ForestAdmin/agent-ruby"
20
- spec.metadata["changelog_uri"] = "https://github.com/ForestAdmin/agent-ruby/CHANGELOG.md"
20
+ spec.metadata["changelog_uri"] = "https://github.com/ForestAdmin/agent-ruby/blob/main/CHANGELOG.md"
21
21
  spec.metadata["rubygems_mfa_required"] = "false"
22
22
 
23
23
  # Specify which files should be added to the gem when it is released.
@@ -16,9 +16,9 @@ module ForestAdminDatasourceActiveRecord
16
16
  end
17
17
 
18
18
  def list(_caller, filter, projection)
19
- query = Utils::Query.new(self, projection, filter).build
19
+ query = Utils::Query.new(self, projection, filter)
20
20
 
21
- query.all.map { |record| Utils::ActiveRecordSerializer.new(record).to_hash }
21
+ query.get.map { |record| Utils::ActiveRecordSerializer.new(record).to_hash }
22
22
  end
23
23
 
24
24
  def aggregate(_caller, filter, aggregation, limit = nil)
@@ -18,9 +18,16 @@ module ForestAdminDatasourceActiveRecord
18
18
  apply_select
19
19
  end
20
20
 
21
+ def get
22
+ build
23
+
24
+ return @query.all if @filter.page.nil?
25
+
26
+ @query.offset(@filter.page.offset).limit(@filter.page.limit)
27
+ end
28
+
21
29
  def apply_filter
22
30
  @query = apply_condition_tree(@filter.condition_tree) unless @filter.condition_tree.nil?
23
- @query = apply_pagination(@filter.page) unless @filter.page.nil?
24
31
  @query = apply_sort(@filter.sort) unless @filter.sort.nil?
25
32
 
26
33
  @query
@@ -92,11 +99,6 @@ module ForestAdminDatasourceActiveRecord
92
99
  "#{@collection.model.table_name}.#{relation_schema.foreign_key}"
93
100
  end
94
101
  end
95
-
96
- # @query = @query.select(query_select.join(', '))
97
- # @query = @query.eager_load(@projection.relations.keys.map(&:to_sym))
98
- # # TODO: replace eager_load by joins because eager_load select ALL columns of relation
99
- # # @query = @query.joins(@projection.relations.keys.map(&:to_sym))
100
102
  end
101
103
 
102
104
  @query
@@ -37,8 +37,8 @@ module ForestAdminDatasourceActiveRecord
37
37
  def compute_result_aggregate(rows)
38
38
  rows.map do |row|
39
39
  {
40
- value: row.send(@operation.to_sym),
41
- group: @aggregation.groups.each_with_object({}) do |group, memo|
40
+ 'value' => row.send(@operation.to_sym),
41
+ 'group' => @aggregation.groups.each_with_object({}) do |group, memo|
42
42
  memo[group[:field]] = row.send(group[:field].to_sym)
43
43
  end
44
44
  }
@@ -1,3 +1,3 @@
1
1
  module ForestAdminDatasourceActiveRecord
2
- VERSION = "1.0.0-beta.47"
2
+ VERSION = "1.0.0-beta.49"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: forest_admin_datasource_active_record
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.0.pre.beta.47
4
+ version: 1.0.0.pre.beta.49
5
5
  platform: ruby
6
6
  authors:
7
7
  - Matthieu
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: exe
11
11
  cert_chain: []
12
- date: 2024-05-22 00:00:00.000000000 Z
12
+ date: 2024-05-23 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activerecord
@@ -65,7 +65,6 @@ extra_rdoc_files: []
65
65
  files:
66
66
  - ".rspec"
67
67
  - LICENSE
68
- - README.md
69
68
  - Rakefile
70
69
  - forest_admin_datasource_active_record.gemspec
71
70
  - lib/forest_admin_datasource_active_record.rb
@@ -86,7 +85,7 @@ licenses:
86
85
  metadata:
87
86
  homepage_uri: https://www.forestadmin.com
88
87
  source_code_uri: https://github.com/ForestAdmin/agent-ruby
89
- changelog_uri: https://github.com/ForestAdmin/agent-ruby/CHANGELOG.md
88
+ changelog_uri: https://github.com/ForestAdmin/agent-ruby/blob/main/CHANGELOG.md
90
89
  rubygems_mfa_required: 'false'
91
90
  post_install_message:
92
91
  rdoc_options: []
data/README.md DELETED
@@ -1,31 +0,0 @@
1
- # ForestAdminDatasourceActiveRecord
2
-
3
- TODO: Delete this and the text below, and describe your gem
4
-
5
- Welcome to your new gem! In this directory, you'll find the files you need to be able to package up your Ruby library into a gem. Put your Ruby code in the file `lib/forest_admin_datasource_active_record`. To experiment with that code, run `bin/console` for an interactive prompt.
6
-
7
- ## Installation
8
-
9
- TODO: Replace `UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG` with your gem name right after releasing it to RubyGems.org. Please do not do it earlier due to security reasons. Alternatively, replace this section with instructions to install your gem from git if you don't plan to release to RubyGems.org.
10
-
11
- Install the gem and add to the application's Gemfile by executing:
12
-
13
- $ bundle add UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
14
-
15
- If bundler is not being used to manage dependencies, install the gem by executing:
16
-
17
- $ gem install UPDATE_WITH_YOUR_GEM_NAME_PRIOR_TO_RELEASE_TO_RUBYGEMS_ORG
18
-
19
- ## Usage
20
-
21
- TODO: Write usage instructions here
22
-
23
- ## Development
24
-
25
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
26
-
27
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and the created tag, and push the `.gem` file to [rubygems.org](https://rubygems.org).
28
-
29
- ## Contributing
30
-
31
- Bug reports and pull requests are welcome on GitHub at https://github.com/[USERNAME]/forest_admin_datasource_active_record.