Skip to content

Commit

Permalink
Merge pull request #514 from wri/feature/api-documents-filter-by-cont…
Browse files Browse the repository at this point in the history
…ract-signature

Feature/api documents filter by contract signature
  • Loading branch information
tsubik authored Dec 10, 2024
2 parents dfd8e11 + 59e1ff2 commit ee265dc
Show file tree
Hide file tree
Showing 7 changed files with 71 additions and 59 deletions.
1 change: 1 addition & 0 deletions .github/workflows/linters.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt update --fix-missing
sudo apt-get install libgdal-dev
- name: Set up Ruby
uses: ruby/setup-ruby@v1
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/security.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ jobs:
- uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt update --fix-missing
sudo apt-get install libgdal-dev
- name: Set up Ruby
uses: ruby/setup-ruby@v1
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ jobs:

- name: Install dependencies
run: |
sudo apt update --fix-missing
sudo apt-get install libgdal-dev
- name: Set up Ruby
Expand Down Expand Up @@ -58,8 +59,7 @@ jobs:
- name: Install dependencies
run: |
sudo apt update --fix-missing
sudo apt-get -yqq install gdal-bin
sudo apt-get install libgdal-dev
sudo apt-get -yqq install gdal-bin libgdal-dev
npm install -g mjml
- name: Set up Ruby
Expand Down
115 changes: 60 additions & 55 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -158,7 +158,7 @@ GEM
mutex_m
securerandom (>= 0.3)
tzinfo (~> 2.0)
acts_as_list (1.2.3)
acts_as_list (1.2.4)
activerecord (>= 6.1)
activesupport (>= 6.1)
addressable (2.8.7)
Expand Down Expand Up @@ -257,7 +257,7 @@ GEM
activerecord (>= 5.a)
database_cleaner-core (~> 2.0.0)
database_cleaner-core (2.0.1)
date (3.4.0)
date (3.4.1)
debug (1.9.2)
irb (~> 1.10)
reline (>= 0.3.8)
Expand All @@ -284,12 +284,12 @@ GEM
railties (>= 5.0.0)
faker (3.5.1)
i18n (>= 1.8.11, < 2)
faraday (2.12.0)
faraday-net_http (>= 2.0, < 3.4)
faraday (2.12.2)
faraday-net_http (>= 2.0, < 3.5)
json
logger
faraday-net_http (3.3.0)
net-http
faraday-net_http (3.4.0)
net-http (>= 0.5.0)
faraday-retry (2.2.1)
faraday (~> 2.0)
ferrum (0.15)
Expand All @@ -305,14 +305,16 @@ GEM
formtastic (5.0.0)
actionpack (>= 6.0.0)
formtastic_i18n (0.7.0)
gapic-common (0.23.0)
gapic-common (0.24.0)
faraday (>= 1.9, < 3.a)
faraday-retry (>= 1.0, < 3.a)
google-cloud-env (~> 2.2)
google-logging-utils (~> 0.1)
google-protobuf (>= 3.25, < 5.a)
googleapis-common-protos (~> 1.6)
googleapis-common-protos-types (~> 1.15)
googleauth (~> 1.11)
grpc (~> 1.65)
googleauth (~> 1.12)
grpc (~> 1.66)
gdal (3.0.0)
globalid (1.2.1)
activesupport (>= 6.1)
Expand All @@ -339,19 +341,20 @@ GEM
googleapis-common-protos (>= 1.3.10, < 2.a)
googleapis-common-protos-types (>= 1.0.5, < 2.a)
googleauth (>= 0.16.2, < 2.a)
google-cloud-translate-v3 (1.1.1)
google-cloud-translate-v3 (1.2.0)
gapic-common (>= 0.21.1, < 2.a)
google-cloud-errors (~> 1.0)
google-cloud-location (>= 0.7, < 2.a)
google-iam-v1 (>= 0.7, < 2.a)
google-iam-v1 (1.0.1)
google-iam-v1 (1.1.0)
gapic-common (>= 0.21.1, < 2.a)
google-cloud-errors (~> 1.0)
grpc-google-iam-v1 (~> 1.1)
google-protobuf (4.28.3)
google-logging-utils (0.1.0)
google-protobuf (4.29.1)
bigdecimal
rake (>= 13)
google-protobuf (4.28.3-x86_64-linux)
google-protobuf (4.29.1-x86_64-linux)
bigdecimal
rake (>= 13)
googleapis-common-protos (1.6.0)
Expand All @@ -360,19 +363,20 @@ GEM
grpc (~> 1.41)
googleapis-common-protos-types (1.16.0)
google-protobuf (>= 3.18, < 5.a)
googleauth (1.11.2)
googleauth (1.12.0)
faraday (>= 1.0, < 3.a)
google-cloud-env (~> 2.1)
google-cloud-env (~> 2.2)
google-logging-utils (~> 0.1)
jwt (>= 1.4, < 3.0)
multi_json (~> 1.11)
os (>= 0.9, < 2.0)
signet (>= 0.16, < 2.a)
groupdate (6.5.1)
activesupport (>= 7)
grpc (1.67.0)
grpc (1.68.1)
google-protobuf (>= 3.25, < 5.0)
googleapis-common-protos-types (~> 1.0)
grpc (1.67.0-x86_64-linux)
grpc (1.68.1-x86_64-linux)
google-protobuf (>= 3.25, < 5.0)
googleapis-common-protos-types (~> 1.0)
grpc-google-iam-v1 (1.8.0)
Expand All @@ -389,7 +393,7 @@ GEM
http-cookie (~> 1.0)
http-form_data (~> 2.2)
llhttp-ffi (~> 0.5.0)
http-cookie (1.0.7)
http-cookie (1.0.8)
domain_name (~> 0.5)
http-form_data (2.3.0)
i18n (1.14.6)
Expand All @@ -405,15 +409,15 @@ GEM
has_scope (>= 0.6)
railties (>= 6.0)
responders (>= 2)
io-console (0.7.2)
io-console (0.8.0)
irb (1.14.1)
rdoc (>= 4.0.0)
reline (>= 0.4.2)
jquery-rails (4.6.0)
rails-dom-testing (>= 1, < 3)
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.8.1)
json (2.9.0)
jsonapi-resources (0.9.12)
activerecord (>= 4.1)
concurrent-ruby
Expand Down Expand Up @@ -447,7 +451,7 @@ GEM
llhttp-ffi (0.5.0)
ffi-compiler (~> 1.0)
rake (~> 13.0)
logger (1.6.1)
logger (1.6.2)
loofah (2.23.1)
crass (~> 1.0.2)
nokogiri (>= 1.12.0)
Expand All @@ -461,17 +465,17 @@ GEM
mime-types (3.6.0)
logger
mime-types-data (~> 3.2015)
mime-types-data (3.2024.1105)
mime-types-data (3.2024.1203)
mini_magick (4.13.2)
mini_mime (1.1.5)
mini_portile2 (2.8.7)
minitest (5.25.1)
mini_portile2 (2.8.8)
minitest (5.25.4)
mjml-rails (4.12.1)
msgpack (1.7.5)
multi_json (1.15.0)
mustache (1.1.1)
mutex_m (0.2.0)
net-http (0.5.0)
mutex_m (0.3.0)
net-http (0.6.0)
uri
net-imap (0.5.1)
date
Expand All @@ -488,10 +492,10 @@ GEM
net-protocol
net-ssh (7.3.0)
nio4r (2.7.4)
nokogiri (1.16.7)
nokogiri (1.17.0)
mini_portile2 (~> 2.8.2)
racc (~> 1.4)
nokogiri (1.16.7-x86_64-linux)
nokogiri (1.17.0-x86_64-linux)
racc (~> 1.4)
oj (3.16.7)
bigdecimal (>= 3.0)
Expand All @@ -513,10 +517,11 @@ GEM
patience_diff (1.2.0)
optimist (~> 3.0)
pg (1.5.9)
psych (5.2.0)
psych (5.2.1)
date
stringio
public_suffix (6.0.1)
puma (6.4.3)
puma (6.5.0)
nio4r (~> 2.0)
racc (1.8.1)
rack (3.0.11)
Expand All @@ -528,7 +533,7 @@ GEM
rack (>= 3.0.0)
rack-test (2.1.0)
rack (>= 1.3)
rackup (2.2.0)
rackup (2.2.1)
rack (>= 3)
rails (7.1.5)
actioncable (= 7.1.5)
Expand All @@ -553,9 +558,9 @@ GEM
activesupport (>= 4.2)
choice (~> 0.2.0)
ruby-graphviz (~> 1.2)
rails-html-sanitizer (1.6.0)
rails-html-sanitizer (1.6.1)
loofah (~> 2.21)
nokogiri (~> 1.14)
nokogiri (>= 1.15.7, != 1.16.7, != 1.16.6, != 1.16.5, != 1.16.4, != 1.16.3, != 1.16.2, != 1.16.1, != 1.16.0.rc1, != 1.16.0)
railties (7.1.5)
actionpack (= 7.1.5)
activesupport (= 7.1.5)
Expand All @@ -570,7 +575,7 @@ GEM
activerecord (>= 6.1.5)
activesupport (>= 6.1.5)
i18n
rdoc (6.7.0)
rdoc (6.8.1)
psych (>= 4.0.0)
redcarpet (3.6.0)
redis (5.3.0)
Expand All @@ -593,8 +598,8 @@ GEM
redis-store (>= 1.2, < 2)
redis-store (1.11.0)
redis (>= 4, < 6)
regexp_parser (2.9.2)
reline (0.5.11)
regexp_parser (2.9.3)
reline (0.5.12)
io-console (~> 0.5)
request_store (1.7.0)
rack (>= 1.4)
Expand Down Expand Up @@ -632,14 +637,14 @@ GEM
rspec-expectations (~> 3.13)
rspec-mocks (~> 3.13)
rspec-support (~> 3.13)
rspec-support (3.13.1)
rswag-api (2.15.0)
activesupport (>= 5.2, < 8.0)
railties (>= 5.2, < 8.0)
rswag-ui (2.15.0)
actionpack (>= 5.2, < 8.0)
railties (>= 5.2, < 8.0)
rubocop (1.66.1)
rspec-support (3.13.2)
rswag-api (2.16.0)
activesupport (>= 5.2, < 8.1)
railties (>= 5.2, < 8.1)
rswag-ui (2.16.0)
actionpack (>= 5.2, < 8.1)
railties (>= 5.2, < 8.1)
rubocop (1.68.0)
json (~> 2.3)
language_server-protocol (>= 3.17.0)
parallel (~> 1.10)
Expand All @@ -649,7 +654,7 @@ GEM
rubocop-ast (>= 1.32.2, < 2.0)
ruby-progressbar (~> 1.7)
unicode-display_width (>= 2.4.0, < 3.0)
rubocop-ast (1.35.0)
rubocop-ast (1.36.2)
parser (>= 3.3.1.0)
rubocop-performance (1.22.1)
rubocop (>= 1.48.1, < 2.0)
Expand Down Expand Up @@ -678,21 +683,21 @@ GEM
sprockets (> 3.0)
sprockets-rails
tilt
securerandom (0.3.2)
securerandom (0.4.0)
sendgrid-actionmailer (3.2.0)
mail (~> 2.7)
sendgrid-ruby (~> 6.4)
sendgrid-ruby (6.7.0)
ruby_http_client (~> 3.4)
sentry-rails (5.21.0)
sentry-rails (5.22.0)
railties (>= 5.0)
sentry-ruby (~> 5.21.0)
sentry-ruby (5.21.0)
sentry-ruby (~> 5.22.0)
sentry-ruby (5.22.0)
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
shoulda-matchers (4.0.1)
activesupport (>= 4.2.0)
sidekiq (7.3.5)
sidekiq (7.3.6)
connection_pool (>= 2.3.0)
logger
rack (>= 2.2.4)
Expand Down Expand Up @@ -722,10 +727,10 @@ GEM
net-ssh (>= 2.8.0)
ostruct
ssrf_filter (1.2.0)
standard (1.41.1)
standard (1.42.1)
language_server-protocol (~> 3.17.0.2)
lint_roller (~> 1.0)
rubocop (~> 1.66.0)
rubocop (~> 1.68.0)
standard-custom (~> 1.0.0)
standard-performance (~> 1.5)
standard-custom (1.0.2)
Expand All @@ -735,7 +740,7 @@ GEM
lint_roller (~> 1.1)
rubocop-performance (~> 1.22.0)
stringio (3.1.2)
super_diff (0.13.0)
super_diff (0.14.0)
attr_extras (>= 6.2.4)
diff-lcs
patience_diff
Expand All @@ -751,7 +756,7 @@ GEM
unaccent (0.4.0)
unicode-display_width (2.6.0)
uniform_notifier (1.16.0)
uri (1.0.1)
uri (1.0.2)
warden (1.2.9)
rack (>= 2.0.9)
web-console (4.2.1)
Expand All @@ -763,7 +768,7 @@ GEM
addressable (>= 2.8.0)
crack (>= 0.3.2)
hashdiff (>= 0.4.0, < 2.0.0)
webrick (1.9.0)
webrick (1.9.1)
websocket-driver (0.7.6)
websocket-extensions (>= 0.1.0)
websocket-extensions (0.1.5)
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/v1/sessions_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ class SessionsController < APIController

def create
@user = User.find_by(email: auth_params[:email])
if @user&.valid_password?(auth_params[:password]) && @user&.is_active
if @user.present? && @user.valid_password?(auth_params[:password]) && @user.is_active
token = Auth.issue({user: @user.id})
@user.update_tracked_fields!(request)
render json: {token: token, role: @user.user_permission.user_role,
Expand Down
4 changes: 4 additions & 0 deletions app/resources/concerns/operator_documentable.rb
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,10 @@ module OperatorDocumentable

filters :type, :status, :operator_id, :fmu_id, :required_operator_document_id, :country_ids, :source, :legal_categories, :forest_types

filter :contract_signature, apply: ->(records, value, _options) {
records.joins(:required_operator_document).where(required_operator_document: {contract_signature: value})
}

privateable :document_visible?, [:start_date, :expire_date, :note, :reason, :response_date, :source_info, :uploaded_by, :created_at, :updated_at]

def admin_comment
Expand Down
3 changes: 2 additions & 1 deletion lib/tasks/single_use/quality_control.rake
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ namespace :quality_control do

passed = version.changeset["validation_status"].last == "Ready for publication"
before_changes = version.reify
comment = before_changes&.admin_comment
# next line rubocop reporting some false positive, it's not useless assignment
comment = before_changes&.admin_comment # rubocop:disable Link/UselessAssignment

if version.changeset.key?("admin_comment")
comment = version.changeset["admin_comment"].last
Expand Down

0 comments on commit ee265dc

Please sign in to comment.