Skip to content

Commit

Permalink
Merge branch 'master' into feature/APPEALS-28087-36678
Browse files Browse the repository at this point in the history
  • Loading branch information
mattray-gov committed Jul 1, 2024
2 parents 6fbfd20 + 02eb203 commit 2099b27
Show file tree
Hide file tree
Showing 239 changed files with 8,197 additions and 4,410 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ jobs:
- name: install node version
uses: actions/setup-node@v4
with:
node-version: '14.20.0'
node-version: '16.16.0'

# If we don't explicitly set this, the runner doesn't find the path when trying to save the cache
- name: Set yarn cache directory
Expand Down Expand Up @@ -286,7 +286,7 @@ jobs:
- name: install node version
uses: actions/setup-node@v4
with:
node-version: '14.20.0'
node-version: '16.16.0'

- name: validate node version
run: ./ci-bin/capture-log "node -v"
Expand Down Expand Up @@ -339,7 +339,7 @@ jobs:
- name: install node version
uses: actions/setup-node@v4
with:
node-version: '14.20.0'
node-version: '16.16.0'

- name: Install Node Dependencies
run: ./ci-bin/capture-log "cd client && yarn install --frozen-lockfile"
Expand Down
2 changes: 1 addition & 1 deletion .nvmrc
Original file line number Diff line number Diff line change
@@ -1 +1 @@
14.20.0
16.16.0
1 change: 1 addition & 0 deletions .reek.yml
Original file line number Diff line number Diff line change
Expand Up @@ -198,6 +198,7 @@ detectors:
- UpdateCachedAppealsAttributesJob
- Veteran
- LegacyDocket
- Test::UsersController
TooManyConstants:
exclude:
- Fakes::BGSServicePOA
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,10 @@ RUN apt -y update && \
echo "deb https://dl.yarnpkg.com/debian/ stable main" | tee /etc/apt/sources.list.d/yarn.list && \
apt -y update

#install node
# Install node
RUN mkdir /usr/local/nvm
ENV NVM_DIR /usr/local/nvm
ENV NODE_VERSION 14.20.0
ENV NODE_VERSION 16.16.0
ENV NVM_INSTALL_PATH $NVM_DIR/versions/node/v$NODE_VERSION
RUN curl --silent -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
RUN source $NVM_DIR/nvm.sh \
Expand Down
7 changes: 5 additions & 2 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,14 @@ gem "acts_as_tree"

# amoeba gem for cloning appeals
gem "amoeba"
gem "aws-sdk"
# BGS

gem "bgs", git: "https://github.com/department-of-veterans-affairs/ruby-bgs.git", ref: "a2e055b5a52bd1e2bb8c2b3b8d5820b1a404cd3d"
# Bootsnap speeds up app boot (and started to be a default gem in 5.2).
gem "bootsnap", require: false
gem "browser"
gem "business_time", "~> 0.9.3"
gem "caseflow", git: "https://github.com/department-of-veterans-affairs/caseflow-commons", ref: "871f7034c502f8d7101bde74e58606716b601c70"
gem "caseflow", git: "https://github.com/department-of-veterans-affairs/caseflow-commons", ref: "716b58caf2116da5fca21c3b3aeea6c9712f3b9d"
gem "connect_mpi", git: "https://github.com/department-of-veterans-affairs/connect-mpi.git", ref: "a3a58c64f85b980a8b5ea6347430dd73a99ea74c"
gem "connect_vbms", git: "https://github.com/department-of-veterans-affairs/connect_vbms.git", ref: "9807d9c9f0f3e3494a60b6693dc4f455c1e3e922"
gem "console_tree_renderer", git: "https://github.com/department-of-veterans-affairs/console-tree-renderer.git", tag: "v0.1.1"
Expand Down Expand Up @@ -66,6 +66,8 @@ gem "redis-namespace"
gem "redis-rails", "~> 5.0.2"
gem "request_store"
gem "roo", "~> 2.7"
gem "rswag-api"
gem "rswag-ui"
# Use SCSS for stylesheets
gem "sass-rails", "~> 5.0"
# Error reporting to Sentry
Expand Down Expand Up @@ -114,6 +116,7 @@ group :test, :development, :demo do
gem "rspec-rails"
# For CircleCI test metadata analysis
gem "rspec_junit_formatter"
gem "rswag-specs"
gem "rubocop", "= 0.83", require: false
gem "rubocop-performance"
gem "rubocop-rails"
Expand Down
25 changes: 21 additions & 4 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ GIT

GIT
remote: https://github.com/department-of-veterans-affairs/caseflow-commons
revision: 871f7034c502f8d7101bde74e58606716b601c70
ref: 871f7034c502f8d7101bde74e58606716b601c70
revision: 716b58caf2116da5fca21c3b3aeea6c9712f3b9d
ref: 716b58caf2116da5fca21c3b3aeea6c9712f3b9d
specs:
caseflow (0.4.8)
aws-sdk (~> 3.2)
aws-sdk-s3
bourbon (= 4.2.7)
d3-rails
jquery-rails
Expand Down Expand Up @@ -1642,6 +1642,8 @@ GEM
railties (>= 4.2.0)
thor (>= 0.14, < 2.0)
json (2.3.0)
json-schema (4.3.0)
addressable (>= 2.8)
json_schemer (0.2.16)
ecma-re-validator (~> 0.2)
hana (~> 1.3)
Expand Down Expand Up @@ -1868,6 +1870,17 @@ GEM
rspec-support (3.9.2)
rspec_junit_formatter (0.4.1)
rspec-core (>= 2, < 4, != 2.12.0)
rswag-api (2.13.0)
activesupport (>= 3.1, < 7.2)
railties (>= 3.1, < 7.2)
rswag-specs (2.13.0)
activesupport (>= 3.1, < 7.2)
json-schema (>= 2.2, < 5.0)
railties (>= 3.1, < 7.2)
rspec-core (>= 2.14)
rswag-ui (2.13.0)
actionpack (>= 3.1, < 7.2)
railties (>= 3.1, < 7.2)
rubocop (0.83.0)
parallel (~> 1.10)
parser (>= 2.7.0.1)
Expand Down Expand Up @@ -2022,6 +2035,7 @@ DEPENDENCIES
acts_as_tree
amoeba
anbt-sql-formatter
aws-sdk
bgs!
bootsnap
brakeman
Expand Down Expand Up @@ -2092,6 +2106,9 @@ DEPENDENCIES
rspec-rails
rspec-retry
rspec_junit_formatter
rswag-api
rswag-specs
rswag-ui
rubocop (= 0.83)
rubocop-performance
rubocop-rails
Expand Down Expand Up @@ -2122,4 +2139,4 @@ DEPENDENCIES
ziptz

BUNDLED WITH
2.4.19
2.4.17
3 changes: 3 additions & 0 deletions Makefile.example
Original file line number Diff line number Diff line change
Expand Up @@ -135,6 +135,9 @@ destroy: clean
lint: ## Run linter for javascript and ruby
bundle exec rake lint

rubocop: ## Run linter for ruby
bundle exec rake rubocop -a

jslint: ## Run linter for javascript
cd client && yarn run lint

Expand Down
10 changes: 10 additions & 0 deletions app/controllers/api/application_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -92,4 +92,14 @@ def upstream_known_error(error)
]
}, status: error.code || :bad_request
end

def endpoint_disabled(message)
result = {
uuid: SecureRandom.uuid,
code: "VEFSERR50102",
message: "Operation not enabled. #{message}"
}

render json: result, status: :not_implemented
end
end
28 changes: 28 additions & 0 deletions app/controllers/api/v1/cmp_controller.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# frozen_string_literal: true

class Api::V1::CmpController < Api::ApplicationController
def upload
endpoint_disabled("Payload is valid: #{validate_payload?}")
rescue StandardError => error
raise error
end

private

def upload_params
params.permit(:payload, file: [])
end

def validate_payload?
payload = JSON.parse(upload_params[:payload])

validate_provider_data?(payload["providerData"]) if payload.present?
end

def validate_provider_data?(provider_data)
return false if provider_data.blank?

Rails.logger.info("provider data is #{provider_data}")
true
end
end
10 changes: 9 additions & 1 deletion app/controllers/explain_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ def access_allowed?
Rails.env.development?
end

helper_method :legacy_appeal?, :appeal,
helper_method :legacy_appeal?, :appeal, :appeal_affinity,
:show_pii_query_param, :fields_query_param, :sections_query_param,
:treee_fields, :enabled_sections,
:available_fields,
Expand Down Expand Up @@ -147,6 +147,14 @@ def appeal
@appeal ||= fetch_appeal
end

def appeal_affinity
@appeal_affinity ||= if legacy_appeal?
VACOLS::Case.find_by(bfkey: appeal.vacols_id)&.appeal_affinity
else
appeal.appeal_affinity
end
end

def fetch_appeal
if appeal_id.start_with?("ama-")
record_id = appeal_id.delete_prefix("ama-")
Expand Down
2 changes: 1 addition & 1 deletion app/controllers/metrics/v2/logs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ def create
private

def metrics_not_saved
render json: { error_code: "Metrics not saved for user" }, status: :unprocessable_entity
render json: { error_code: "Metrics not saved for user" }, status: :accepted
end

def allowed_params
Expand Down
4 changes: 3 additions & 1 deletion app/controllers/route_docs_controller.rb
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,9 @@ def controller_klass

def index
all_routes = Rails.application.routes.routes.map(&method(:documented_route))
@routes = all_routes.compact.sort_by { |rt| [(rt.schema.present? ? 0 : 1), rt.path] }
@routes = all_routes.compact
.filter { |route| route.schema.present? }
.sort_by { |rt| [(rt.schema.present? ? 0 : 1), rt.path] }
end

private
Expand Down
21 changes: 21 additions & 0 deletions app/controllers/swagger/cmp/swagger.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---
openapi: 3.0.2
info:
title: API V1
version: v1
security:
- bearerAuth: []
servers:
- url: /api/v1/
paths:
"/cmp":
$ref: "./v1/upload.yml"
components:
securitySchemes:
bearerAuth:
type: http
scheme: bearer
description: API Key provided by Caseflow
schemas:
payload:
$ref: "./v1/payload.yml"
15 changes: 15 additions & 0 deletions app/controllers/swagger/cmp/v1/baseErrorResponse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
type: object
title: Vefs Error Response
description: The root schema comprises generic File Store Errors.
examples:
- uuid: d1abad83-5468-4031-b42a-c487e19f46c7
code: VEFSERR0000
message: Unable to create valid response.
properties:
uuid:
type: string
format: uuid
title: Error UUID
description: UUID used to trace the error response
examples:
- d1abad83-5468-4031-b42a-c487e19f46c7
7 changes: 7 additions & 0 deletions app/controllers/swagger/cmp/v1/contentName.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
type: string
title: Content Name
description: The content name of the document being uploaded. This must be unique for the folder being uploaded to. For instance the document "pdf.pdf" cannot be uploaded twice for fileNumber 987654321. The acceptable file extensions are png, pdf, tif, tiff, txt, jpg, jpeg, and bmp.
minLength: 4
maxLength: 256
pattern: "^[a-zA-Z0-9 Q`'~=+#^@$&-_.(){};[]E]+.[a-zA-Z]{3,4}$"
example: filename.pdf
13 changes: 13 additions & 0 deletions app/controllers/swagger/cmp/v1/noApiKeyResponse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
type: object
title: Vefs No/Invalid API Key Error Response
description: Error response when no or invalid API Key is present on the request
properties:
messages:
type: array
items:
type: object
properties:
status:
type: string
enum:
- "unauthorized"
11 changes: 11 additions & 0 deletions app/controllers/swagger/cmp/v1/payload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
type: object
title: Upload Payload
description: Payload containing content name and the provider specific data. <a href="#model-payload">Schema can be found here.</a>
required:
- contentName
- providerData
properties:
contentName:
$ref: './contentName.yml'
providerData:
$ref: './uploadProviderDataRequest.yml'
Loading

0 comments on commit 2099b27

Please sign in to comment.