-
Notifications
You must be signed in to change notification settings - Fork 61
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[10-10CG] Add paginated facilities endpoint to CG controller #18560
base: master
Are you sure you want to change the base?
Conversation
…or paginated facilities response
…if not provided (valid response from api)
@@ -11,7 +11,7 @@ class CaregiversAssistanceClaimsController < ApplicationController | |||
before_action :load_user, only: :create | |||
|
|||
before_action :record_submission_attempt, only: :create | |||
before_action :initialize_claim | |||
before_action :initialize_claim, only: [:create, :download_pdf] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new facilities
method does not require initializing a claim. These are the only other two exposed routes in this controller. I think this also makes this initialize_claim
logic more obvious.
|
||
resources :caregivers_assistance_claims, only: :create do | ||
collection do | ||
get(:facilities) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Added new facilities
route, and moved the post declaration here. This is functionally the same as before, just easier to read.
@@ -21,7 +21,7 @@ def initialize(body, status) | |||
self.body = body | |||
self.status = status | |||
parsed_body = JSON.parse(body) | |||
self.data = parsed_body['data'] | |||
self.data = parsed_body['data'] || [] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If no facilities are returned, the lighthouse api does not return a data key or object. This handles that scenario by setting it to an empty array.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
💅 This wasn't an issue when we were pulling Facilities for specific States, but definitely comes in to play now. Nice!
@@ -244,4 +245,55 @@ | |||
).to eq(false) | |||
end | |||
end | |||
|
|||
describe '#facilities' do |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As mentioned above, I'd like to eventually move these to request specs.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I deleted these and moved them to the request spec.
@coope93 Please pull master to clear up the CVE |
Summary
data
key being returned by the lighthouse api. This is technically possible if you request a page that is outside of the page range. My forthcomingvets-website
changes will eliminate this issue from the front end, but the endpoint could technically be called with page 5000 for a result set of 1.Related issue(s)
Testing done
Facilities/V1/Client
What areas of the site does it impact?
10-10CG
Acceptance criteria
Requested Feedback
I updated our existing controller spec for this route. I would eventually like to replace that spec with a request spec, but at this moment I didn't want to take on the scope of that work unless someone really wants me to.