Skip to content

Commit

Permalink
Merge pull request #22017 from department-of-veterans-affairs/release…
Browse files Browse the repository at this point in the history
…/R.1.5.1_FY24Q3.5

Release R1.5.1 FY24Q3.5
  • Loading branch information
roberttravispierce authored Jun 27, 2024
2 parents b75d2f0 + 6ca18ab commit 02eb203
Show file tree
Hide file tree
Showing 188 changed files with 6,014 additions and 2,019 deletions.
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
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'
78 changes: 78 additions & 0 deletions app/controllers/swagger/cmp/v1/upload.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
post:
tags:
- File
summary: Upload a file with associated provider data
description: |-
### Upload a file.
This endpoint when given a file and associated data returns a UUID which is a reference to the created object within Caseflow. Information on how to properly create a payload object for this endpoint is available in the schema section <a href="#model-payload">here</a>. (Upload Payload)
operationId: upload
parameters:
- name: X-Folder-URI
in: header
description: >-
This should have a value of BIN:NAME:Caseflow
required: true
schema:
type: string
example: 'BIN:NAME:Caseflow '
requestBody:
required: true
content:
multipart/form-data: # Media type
schema: # Request payload
$ref: './uploadRequest.yml'
responses:
'200':
description: >-
Response containing the Correspondence package UUID
content:
application/json:
schema:
$ref: './uploadResponse.yml'
'400':
description: Server was unable to understand the request. This may come back as an empty response if the json is malformed or not understood by the server.
content:
application/json:
schema:
oneOf:
- $ref: './vefsErrorCodes.yml#/components/schemas/INVALID_REQUEST'
- $ref: './vefsErrorCodes.yml#/components/schemas/DOES_NOT_CONFORM_TO_SCHEMA'
- $ref: './vefsErrorCodes.yml#/components/schemas/VALIDATE_INVALID_VALUE'
- $ref: './vefsErrorCodes.yml#/components/schemas/DUPLICATE_PROVIDERDATA_KEYS'
'401':
description: API Key does not exist or is not authorized to access the resource.
content:
application/json:
schema:
$ref: './noApiKeyResponse.yml'
'415':
description: Unsupported Media Type. This is common when uploading an unacceptable file type.
content:
application/json:
schema:
oneOf:
- $ref: './vefsErrorCodes.yml#/components/schemas/INVALID_MIMETYPE'
- $ref: './vefsErrorCodes.yml#/components/schemas/WRONG_MIMETYPE_EXTENSION'
'500':
description: >-
There was an error encountered processing the Request. Response
will contain a "messages" element that will provide further
information on the error. Please retry. If problem persists,
please contact support with a copy of the Response.
content:
application/json:
schema:
oneOf:
- $ref: './vefsErrorCodes.yml#/components/schemas/UNABLE_TO_DETERMINE_MIMETYPE'
- $ref: './vefsErrorCodes.yml#/components/schemas/UNABLE_TO_UPLOAD_DATA'
- $ref: './vefsErrorCodes.yml#/components/schemas/UNABLE_TO_PERSIST_DATA'
- $ref: './vefsErrorCodes.yml#/components/schemas/UNABLE_TO_CONVERT'
- $ref: './vefsErrorCodes.yml#/components/schemas/UNKNOWN_ERROR'
- $ref: './vefsErrorCodes.yml#/components/schemas/JSON_DESERIALIZATION'
- $ref: './vefsErrorCodes.yml#/components/schemas/JSON_SERIALIZATION'
'501':
description: This endpoint is not enabled.
content:
application/json:
schema:
$ref: './vefsErrorCodes.yml#/components/schemas/OPERATION_NOT_ENABLED'
Loading

0 comments on commit 02eb203

Please sign in to comment.