Skip to content

Commit

Permalink
MHV-41829: Adjustments made to thread api (#11831)
Browse files Browse the repository at this point in the history
* MHV-41829: Adjustments made to thread api

* MHV-41829: Thread list api query parameters changed
  • Loading branch information
mattwrightva authored Feb 24, 2023
1 parent 0c6e640 commit b52850f
Show file tree
Hide file tree
Showing 10 changed files with 75 additions and 48 deletions.
4 changes: 2 additions & 2 deletions lib/sm/client.rb
Original file line number Diff line number Diff line change
Expand Up @@ -171,10 +171,10 @@ def get_folder_messages(user_uuid, folder_id, use_cache)
#
# @return [Common::Collection]
#
def get_folder_threads(folder_id, page_start, page_end, sort_field, sort_order)
def get_folder_threads(folder_id, page_size, page_number, sort_field, sort_order)
path = "folder/threadlistview/#{folder_id}"

params = "/pageStart/#{page_start}/pageEnd/#{page_end}/sortField/#{sort_field}/sortOrder/#{sort_order}"
params = "?pageSize=#{page_size}&pageNumber=#{page_number}&sortField=#{sort_field}&sortOrder=#{sort_order}"

json = perform(:get, path + params, nil, token_headers).body

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@ class ThreadsController < SMController
def index
resource = client.get_folder_threads(
params[:folder_id].to_s,
params[:page_start],
params[:page_end],
params[:page_size],
params[:page_number],
params[:sort_field],
params[:sort_order]
)
Expand Down
8 changes: 4 additions & 4 deletions modules/my_health/docs/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ paths:
required: true
schema:
type: string
- description: Pagination start numbering
- description: The size of the pagination you want
in: query
name: pageStart,
name: pageSize,
required: true
schema:
type: string
- description: Pagination end numbering (max 100)
- description: The page number to get based on your page size
in: query
name: pageEnd,
name: pageNumber,
required: true
schema:
type: string
Expand Down
12 changes: 6 additions & 6 deletions modules/my_health/docs/openapi_merged.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -134,15 +134,15 @@ paths:
required: true
schema:
type: string
- description: Pagination start numbering
- description: The size of the pagination you want
in: query
name: pageStart,
name: pageSize,
required: true
schema:
type: string
- description: Pagination end numbering (max 100)
- description: The page number to get based on your page size
in: query
name: pageEnd,
name: pageNumber,
required: true
schema:
type: string
Expand Down Expand Up @@ -1200,11 +1200,11 @@ components:
category:
type: string
enum:
- OTHER
- OTHERS
- COVID
- APPOINTMENTS
- MEDICATIONS
- TEST_RESULTS
- TEST_RESULT
- EDUCATION
example: MEDICATIONS
subject:
Expand Down
2 changes: 1 addition & 1 deletion modules/my_health/docs/schemas/SecureMessageThread.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ properties:
example: 123
category:
type: string
enum: [OTHER, COVID, APPOINTMENTS, MEDICATIONS, TEST_RESULTS, EDUCATION]
enum: [OTHERS, COVID, APPOINTMENTS, MEDICATIONS, TEST_RESULT, EDUCATION]
example: MEDICATIONS
subject:
type: string
Expand Down
9 changes: 6 additions & 3 deletions modules/my_health/spec/request/v1/threads_request_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,10 @@
let(:mhv_account_type) { 'Premium' }

context 'not a va patient' do
before { get "/my_health/v1/messaging/folders/#{inbox_id}/threads" }
before do
get "/my_health/v1/messaging/folders/#{inbox_id}/threads",
params: { page_size: '5', page_number: '1', sort_field: 'SENDER_NAME', sort_order: 'ASC' }
end

let(:va_patient) { false }
let(:current_user) do
Expand All @@ -58,7 +61,7 @@
it 'responds to GET #index' do
VCR.use_cassette('sm_client/threads/gets_threads_in_a_folder') do
get "/my_health/v1/messaging/folders/#{inbox_id}/threads",
params: { page_start: '1', page_end: '5', sort_field: 'SENDER_NAME', sort_order: 'ASC' }
params: { page_size: '5', page_number: '1', sort_field: 'SENDER_NAME', sort_order: 'ASC' }
end

expect(response).to be_successful
Expand All @@ -69,7 +72,7 @@
it 'responds to GET #index when camel-inflected' do
VCR.use_cassette('sm_client/threads/gets_threads_in_a_folder_camel') do
get "/my_health/v1/messaging/folders/#{inbox_id}/threads",
params: { page_start: '1', page_end: '5', sort_field: 'SENDER_NAME', sort_order: 'ASC' },
params: { page_size: '5', page_number: '1', sort_field: 'SENDER_NAME', sort_order: 'ASC' },
headers: { 'X-Key-Inflection' => 'camel' }
end

Expand Down
2 changes: 1 addition & 1 deletion spec/support/schemas/message_threads.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"COVID",
"APPOINTMENTS",
"MEDICATIONS",
"TEST_RESULTS",
"TEST_RESULT",
"EDUCATION"
]
},
Expand Down
2 changes: 1 addition & 1 deletion spec/support/schemas_camelized/message_threads.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"COVID",
"APPOINTMENTS",
"MEDICATIONS",
"TEST_RESULTS",
"TEST_RESULT",
"EDUCATION"
]
},
Expand Down

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit b52850f

Please sign in to comment.