uc3-dmp-id 0.1.60 → 0.1.62

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: 791179155f0be964f0cfc186f26de88e9f0774ee9ebb671f7856074b1d40639e
4
- data.tar.gz: 0bf38f90d0863863362ea4fb5357566d8b262c2036840d78519796e2d55d893a
3
+ metadata.gz: 289f8d64c3d235bd1dcfa4944f61f9b02df27a10269fe4e488f22e07858ca7a7
4
+ data.tar.gz: 8cf27583d3ac6dc860b451358d5ddc2c398138106f95829234ade8f075e1bbcf
5
5
  SHA512:
6
- metadata.gz: e938eb3ddaa088e2cc17bb6a4202de8673c5eeb046c47207e1c040eff8775fdede2b835a90758ab8e892490677b93502c205b0244fae3884299498caf27575a8
7
- data.tar.gz: ae45834944f078ab9e0d3fae1c6b32d2f5015c5b74b46c526c62b457b22e329662c6049ba4dd090e67f4c7f4208d9a1f858cb62b4dc52fa8b1e2bc1b4b17f692
6
+ metadata.gz: 0e37a65b597ce40874d7380ca16af810eb0a87a21251cbf9edd1b770cfa64d7fee113746669899879aaa9bd55abdbc91e5cfdde8ceabab73c4939193dbfcd9e1
7
+ data.tar.gz: 12f88664290e9d479c099d3fa28a1657182b40146dbb1cb4c55f28b0f44102d962ad0f11e1d30767b160dbfd502af0e24ee03ec54d1af484191f5853e500927f
@@ -19,28 +19,34 @@ module Uc3DmpId
19
19
 
20
20
  ORCID_DOMAIN = 'https://orcid.org/'
21
21
  ROR_DOMAIN = 'https://ror.org/'
22
+ SORT_OPTIONS = %w[title modified]
23
+ SORT_DIRECTIONS = %w[asc desc]
24
+ MAX_PAGE_SIZE = 100
25
+ DEFAULT_PAGE_SIZE = 25
26
+ DEFAULT_SORT_OPTION = 'modified'
27
+ DEFAULT_SORT_DIR = 'desc'
22
28
 
23
29
  class << self
24
30
  # TODO: Replace this with ElasticSearch
25
31
  def search_dmps(args:, logger: nil)
26
32
  # Fetch the DMPs for each of the possible filter options
27
33
  client = Uc3DmpDynamo::Client.new(table: ENV['DYNAMO_INDEX_TABLE'])
28
- owner_pks = _by_owner(owner: args['owner'], client:, logger:) unless args['owner'].nil?
29
- org_pks = _by_org(org: args['org'], client:, logger:) unless args['org'].nil?
30
- funder_pks = _by_funder(funder: args['funder'], client:, logger:) unless args['funder'].nil?
34
+ owner = args['owner']
35
+ org = args['org']
36
+ funder = args['funder']
37
+
38
+ owner_pks = owner.nil? ? [] : _by_owner(owner: owner, client:, logger:)
39
+ org_pks = org.nil? ? [] : _by_org(org: org, client:, logger:)
40
+ funder_pks = funder.nil? ? [] : _by_funder(funder: funder, client:, logger:)
41
+ pks = [owner_pks, org_pks, funder_pks].reject(&:empty?)
31
42
  return [] if owner_pks.empty? && org_pks.empty? && funder_pks.empty?
32
43
 
33
44
  # Only use the DMPs that fit all of the filter criteria
34
- dmps = owner_pks & org_pks & funder_pks
45
+ dmps = pks.reduce(:&).flatten.uniq
35
46
  return [] if dmps.nil? || dmps.empty?
36
47
 
37
- # Perfom search operations
38
48
 
39
- # Handle sort
40
-
41
- # Handle pagination
42
-
43
- # Fetch full DMP records
49
+ # Fetch full DMP records for the results
44
50
  client = Uc3DmpDynamo::Client.new(table: ENV['DYNAMO_TABLE'])
45
51
  _fetch_dmps(client:, pks: dmps.map { |dmp| dmp['pk'] }, logger:)
46
52
  end
@@ -1,5 +1,5 @@
1
1
  # frozen_string_literal: true
2
2
 
3
3
  module Uc3DmpId
4
- VERSION = '0.1.60'
4
+ VERSION = '0.1.62'
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: uc3-dmp-id
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.60
4
+ version: 0.1.62
5
5
  platform: ruby
6
6
  authors:
7
7
  - Brian Riley
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2024-07-10 00:00:00.000000000 Z
11
+ date: 2024-07-11 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: json