From ab4dd2a5d3a73bd373d72b1c689d4e47faf885d4 Mon Sep 17 00:00:00 2001 From: Andrew Herzberg Date: Thu, 5 May 2022 11:58:27 -0700 Subject: [PATCH 01/11] Create 2022-05-5-mobile-route-naming-conventions.md --- ...22-05-5-mobile-route-naming-conventions.md | 21 +++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 platform/engineering/request-for-comment/2022-05-5-mobile-route-naming-conventions.md diff --git a/platform/engineering/request-for-comment/2022-05-5-mobile-route-naming-conventions.md b/platform/engineering/request-for-comment/2022-05-5-mobile-route-naming-conventions.md new file mode 100644 index 00000000000..b4fd4785fc6 --- /dev/null +++ b/platform/engineering/request-for-comment/2022-05-5-mobile-route-naming-conventions.md @@ -0,0 +1,21 @@ +# RFC: _title_ + +- Date: _YYYY-MM-DD_ +- Related Issue: _git/zenhub issue if applicable_ + +## Background +_Explain the current state of the feature._ + +## Motivation +_Why do we want to change the current implementation? What problem(s) does the change solve?_ + +## Design +_Explain the proposed changes in enough detail so that a team member with working knowledge +of the project could implement the change themselves. Bonus points if this is easily mappable +to user stories or specs._ + +## Risks +_What are the risks of the proposed changes?_ + +## Alternatives +_What other alternatives solutions were considered, why weren't they chosen?_ From b5eb52e485501734652d03cbd17432aebe712465 Mon Sep 17 00:00:00 2001 From: Andrew Herzberg Date: Thu, 5 May 2022 12:28:33 -0700 Subject: [PATCH 02/11] Update and rename 2022-05-5-mobile-route-naming-conventions.md to 2022-05-05-mobile-route-naming-conventions.md --- ...2-05-05-mobile-route-naming-conventions.md | 115 ++++++++++++++++++ ...22-05-5-mobile-route-naming-conventions.md | 21 ---- 2 files changed, 115 insertions(+), 21 deletions(-) create mode 100644 platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md delete mode 100644 platform/engineering/request-for-comment/2022-05-5-mobile-route-naming-conventions.md diff --git a/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md b/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md new file mode 100644 index 00000000000..d02d49274f5 --- /dev/null +++ b/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md @@ -0,0 +1,115 @@ +# RFC: Mobile Routes naming conventions + +- Date: 2022-05-05 +- Related Issue: https://app.zenhub.com/workspaces/va-mobile---backend-61d75d03a7505500147ec7f6/issues/department-of-veterans-affairs/va-mobile-app/2937 + +## Background +_Explain the current state of the feature._ +Mobile routes currently have some inconsistencies in their naming conventions, such as: +- Sometimes using snake_case over kebab-case (maintenance_windows, message_drafts) +- :ids are after the resource action rather than before (canceling appointments) +- Referring to the same thing with different names (appointments: 'pending' and 'requests') +- Not nesting under parent products (the 'health' and 'benefits' app) + +## Motivation +_Why do we want to change the current implementation? What problem(s) does the change solve?_ +Keeping naming consistent will make using the Mobile API much easier to use and is generally a good practice for maintainability. + +## Design +_Explain the proposed changes in enough detail so that a team member with working knowledge +of the project could implement the change themselves. Bonus points if this is easily mappable +to user stories or specs._ +Version all endpoint that do not meet the naming convention as follows: +``` +namespace :health do + get '/appointment-requests/:appointment_request_id/messages', to: 'appointment_request_messages#index' + get '/appointments', to: 'appointments#index' + put '/appointments/:id/cancel', to: 'appointments#cancel' + get '/appointments/community-care/:service_type/eligibility', to: 'community_care_eligibility#show' + get '/appointments/va/eligibility', to: 'veterans_affairs_eligibility#show' + get '/appointments/facility/eligibility', to: 'facility_eligibility#index' + post '/appointment', to: 'appointments#create' + get '/community-care-providers', to: 'community_care_providers#index' + end + + + namespace :benefits do + get '/appeal/:id', to: 'claims_and_appeals#get_appeal' + get '/claims-and-appeals-overview', to: 'claims_and_appeals#index' + get '/claim/:id', to: 'claims_and_appeals#get_claim' + post '/claim/:id/documents', to: 'claims_and_appeals#upload_document' + post '/claim/:id/documents/multi-image', to: 'claims_and_appeals#upload_multi_image_document' + post '/claim/:id/request-decision', to: 'claims_and_appeals#request_decision' + end + + get '/maintenance-windows', to: 'maintenance_windows#index' + get '/push/:endpoint_sid/prefs', to: 'push_notifications#get_prefs' + put '/push/:endpoint_sid/prefs', to: 'push_notifications#set_pref' + + scope :messaging do + scope :health do + resources :message_drafts, path: 'message-drafts', only: %i[create update], defaults: { format: :json } do + post ':reply_id/reply-draft', on: :collection, action: :create_reply_draft, as: :create_reply + put ':reply_id/reply-draft/:draft_id', on: :collection, action: :update_reply_draft, as: :update_reply + end + end + end +``` +Notes: +- Only endpoints being changed are shown above +- All of these will be versioned from v0 to v1 +- Adding parent products (health, benefits) is adding a namespace so the controllers will be nested in a folder as well. + +For the sake of ease of reviewing all endpoints, see below for all mobile endpoint that will not be changed. +``` +get '/disability-rating', to: 'disability_rating#index' +get '/health/immunizations', to: 'immunizations#index' +get '/health/locations/:id', to: 'locations#show' +get '/letters', to: 'letters#index' +get '/letters/beneficiary', to: 'letters#beneficiary' +post '/letters/:type/download', to: 'letters#download' +get '/messaging/health/messages/signature', to: 'messages#signature' +get '/military-service-history', to: 'military_information#get_service_history' +get '/payment-history', to: 'payment_history#index' +get '/payment-information/benefits', to: 'payment_information#index' +put '/payment-information/benefits', to: 'payment_information#update' +put '/push/register', to: 'push_notifications#register' +post '/push/send', to: 'push_notifications#send_notification' +get '/user', to: 'users#show' +get '/user/logout', to: 'users#logout' +post '/user/addresses', to: 'addresses#create' +put '/user/addresses', to: 'addresses#update' +delete '/user/addresses', to: 'addresses#destroy' +post '/user/addresses/validate', to: 'addresses#validate' +post '/user/emails', to: 'emails#create' +put '/user/emails', to: 'emails#update' +delete '/user/emails', to: 'emails#destroy' +post '/user/phones', to: 'phones#create' +put '/user/phones', to: 'phones#update' +delete '/user/phones', to: 'phones#destroy' + +scope :messaging do + scope :health do + resources :triage_teams, only: [:index], defaults: { format: :json }, path: 'recipients' + + resources :folders, only: %i[index show create destroy], defaults: { format: :json } do + resources :messages, only: [:index], defaults: { format: :json } + end + + resources :messages, only: %i[show create destroy], defaults: { format: :json } do + get :thread, on: :member + get :categories, on: :collection + patch :move, on: :member + post :reply, on: :member + resources :attachments, only: [:show], defaults: { format: :json } + end + end + end +``` +## Risks +_What are the risks of the proposed changes?_ +Must throughly test new endpoints to ensure nothing breaks. + +## Alternatives +_What other alternatives solutions were considered, why weren't they chosen?_ +N/A diff --git a/platform/engineering/request-for-comment/2022-05-5-mobile-route-naming-conventions.md b/platform/engineering/request-for-comment/2022-05-5-mobile-route-naming-conventions.md deleted file mode 100644 index b4fd4785fc6..00000000000 --- a/platform/engineering/request-for-comment/2022-05-5-mobile-route-naming-conventions.md +++ /dev/null @@ -1,21 +0,0 @@ -# RFC: _title_ - -- Date: _YYYY-MM-DD_ -- Related Issue: _git/zenhub issue if applicable_ - -## Background -_Explain the current state of the feature._ - -## Motivation -_Why do we want to change the current implementation? What problem(s) does the change solve?_ - -## Design -_Explain the proposed changes in enough detail so that a team member with working knowledge -of the project could implement the change themselves. Bonus points if this is easily mappable -to user stories or specs._ - -## Risks -_What are the risks of the proposed changes?_ - -## Alternatives -_What other alternatives solutions were considered, why weren't they chosen?_ From 9bf53afc02c77fc1ecec98612ba92d10b6e47cec Mon Sep 17 00:00:00 2001 From: Andrew Herzberg Date: Thu, 5 May 2022 12:31:05 -0700 Subject: [PATCH 03/11] Update 2022-05-05-mobile-route-naming-conventions.md --- ...2-05-05-mobile-route-naming-conventions.md | 81 +++++++++---------- 1 file changed, 40 insertions(+), 41 deletions(-) diff --git a/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md b/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md index d02d49274f5..64b216fce00 100644 --- a/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md +++ b/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md @@ -22,38 +22,37 @@ to user stories or specs._ Version all endpoint that do not meet the naming convention as follows: ``` namespace :health do - get '/appointment-requests/:appointment_request_id/messages', to: 'appointment_request_messages#index' - get '/appointments', to: 'appointments#index' - put '/appointments/:id/cancel', to: 'appointments#cancel' - get '/appointments/community-care/:service_type/eligibility', to: 'community_care_eligibility#show' - get '/appointments/va/eligibility', to: 'veterans_affairs_eligibility#show' - get '/appointments/facility/eligibility', to: 'facility_eligibility#index' - post '/appointment', to: 'appointments#create' - get '/community-care-providers', to: 'community_care_providers#index' - end - + get '/appointment-requests/:appointment_request_id/messages', to: 'appointment_request_messages#index' + get '/appointments', to: 'appointments#index' + put '/appointments/:id/cancel', to: 'appointments#cancel' + get '/appointments/community-care/:service_type/eligibility', to: 'community_care_eligibility#show' + get '/appointments/va/eligibility', to: 'veterans_affairs_eligibility#show' + get '/appointments/facility/eligibility', to: 'facility_eligibility#index' + post '/appointment', to: 'appointments#create' + get '/community-care-providers', to: 'community_care_providers#index' + end - namespace :benefits do - get '/appeal/:id', to: 'claims_and_appeals#get_appeal' - get '/claims-and-appeals-overview', to: 'claims_and_appeals#index' - get '/claim/:id', to: 'claims_and_appeals#get_claim' - post '/claim/:id/documents', to: 'claims_and_appeals#upload_document' - post '/claim/:id/documents/multi-image', to: 'claims_and_appeals#upload_multi_image_document' - post '/claim/:id/request-decision', to: 'claims_and_appeals#request_decision' - end +namespace :benefits do + get '/appeal/:id', to: 'claims_and_appeals#get_appeal' + get '/claims-and-appeals-overview', to: 'claims_and_appeals#index' + get '/claim/:id', to: 'claims_and_appeals#get_claim' + post '/claim/:id/documents', to: 'claims_and_appeals#upload_document' + post '/claim/:id/documents/multi-image', to: 'claims_and_appeals#upload_multi_image_document' + post '/claim/:id/request-decision', to: 'claims_and_appeals#request_decision' + end - get '/maintenance-windows', to: 'maintenance_windows#index' - get '/push/:endpoint_sid/prefs', to: 'push_notifications#get_prefs' - put '/push/:endpoint_sid/prefs', to: 'push_notifications#set_pref' + get '/maintenance-windows', to: 'maintenance_windows#index' + get '/push/:endpoint_sid/prefs', to: 'push_notifications#get_prefs' + put '/push/:endpoint_sid/prefs', to: 'push_notifications#set_pref' - scope :messaging do - scope :health do - resources :message_drafts, path: 'message-drafts', only: %i[create update], defaults: { format: :json } do - post ':reply_id/reply-draft', on: :collection, action: :create_reply_draft, as: :create_reply - put ':reply_id/reply-draft/:draft_id', on: :collection, action: :update_reply_draft, as: :update_reply - end +scope :messaging do + scope :health do + resources :message_drafts, path: 'message-drafts', only: %i[create update], defaults: { format: :json } do + post ':reply_id/reply-draft', on: :collection, action: :create_reply_draft, as: :create_reply + put ':reply_id/reply-draft/:draft_id', on: :collection, action: :update_reply_draft, as: :update_reply end - end + end +end ``` Notes: - Only endpoints being changed are shown above @@ -89,22 +88,22 @@ put '/user/phones', to: 'phones#update' delete '/user/phones', to: 'phones#destroy' scope :messaging do - scope :health do - resources :triage_teams, only: [:index], defaults: { format: :json }, path: 'recipients' + scope :health do + resources :triage_teams, only: [:index], defaults: { format: :json }, path: 'recipients' - resources :folders, only: %i[index show create destroy], defaults: { format: :json } do - resources :messages, only: [:index], defaults: { format: :json } - end + resources :folders, only: %i[index show create destroy], defaults: { format: :json } do + resources :messages, only: [:index], defaults: { format: :json } + end - resources :messages, only: %i[show create destroy], defaults: { format: :json } do - get :thread, on: :member - get :categories, on: :collection - patch :move, on: :member - post :reply, on: :member - resources :attachments, only: [:show], defaults: { format: :json } - end - end + resources :messages, only: %i[show create destroy], defaults: { format: :json } do + get :thread, on: :member + get :categories, on: :collection + patch :move, on: :member + post :reply, on: :member + resources :attachments, only: [:show], defaults: { format: :json } end + end +end ``` ## Risks _What are the risks of the proposed changes?_ From c106d4d0e46a6f33b3e47dceb3d923c91cff465d Mon Sep 17 00:00:00 2001 From: Andrew Herzberg Date: Thu, 5 May 2022 12:32:38 -0700 Subject: [PATCH 04/11] Update 2022-05-05-mobile-route-naming-conventions.md --- .../2022-05-05-mobile-route-naming-conventions.md | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md b/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md index 64b216fce00..234e8c61977 100644 --- a/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md +++ b/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md @@ -105,6 +105,7 @@ scope :messaging do end end ``` +Naming conventions will also be documented on mobile documentation site. ## Risks _What are the risks of the proposed changes?_ Must throughly test new endpoints to ensure nothing breaks. From a2d937efe8cca8ad01ad9a881e2650b639b0f00d Mon Sep 17 00:00:00 2001 From: Andrew Herzberg Date: Fri, 6 May 2022 07:58:09 -0700 Subject: [PATCH 05/11] Update 2022-05-05-mobile-route-naming-conventions.md --- .../2022-05-05-mobile-route-naming-conventions.md | 1 + 1 file changed, 1 insertion(+) diff --git a/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md b/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md index 234e8c61977..d167f994173 100644 --- a/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md +++ b/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md @@ -86,6 +86,7 @@ delete '/user/emails', to: 'emails#destroy' post '/user/phones', to: 'phones#create' put '/user/phones', to: 'phones#update' delete '/user/phones', to: 'phones#destroy' +get '/facilities-info/:sort', to: 'facilities_info#index' scope :messaging do scope :health do From e3bf6a7ab0057e3ec1427a5c2a26f6843ccf9077 Mon Sep 17 00:00:00 2001 From: Andrew Herzberg Date: Fri, 6 May 2022 09:10:27 -0700 Subject: [PATCH 06/11] Update 2022-05-05-mobile-route-naming-conventions.md --- ...2-05-05-mobile-route-naming-conventions.md | 100 ++++++++++++++++-- 1 file changed, 93 insertions(+), 7 deletions(-) diff --git a/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md b/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md index d167f994173..5884bb535e1 100644 --- a/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md +++ b/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md @@ -4,7 +4,6 @@ - Related Issue: https://app.zenhub.com/workspaces/va-mobile---backend-61d75d03a7505500147ec7f6/issues/department-of-veterans-affairs/va-mobile-app/2937 ## Background -_Explain the current state of the feature._ Mobile routes currently have some inconsistencies in their naming conventions, such as: - Sometimes using snake_case over kebab-case (maintenance_windows, message_drafts) - :ids are after the resource action rather than before (canceling appointments) @@ -12,13 +11,9 @@ Mobile routes currently have some inconsistencies in their naming conventions, s - Not nesting under parent products (the 'health' and 'benefits' app) ## Motivation -_Why do we want to change the current implementation? What problem(s) does the change solve?_ Keeping naming consistent will make using the Mobile API much easier to use and is generally a good practice for maintainability. ## Design -_Explain the proposed changes in enough detail so that a team member with working knowledge -of the project could implement the change themselves. Bonus points if this is easily mappable -to user stories or specs._ Version all endpoint that do not meet the naming convention as follows: ``` namespace :health do @@ -106,11 +101,102 @@ scope :messaging do end end ``` + +See below for example of all routes after changes: +``` + + GET / mobile/discovery#welcome + v0 GET /v0/appeal/:id(.:format) mobile/v0/claims_and_appeals#get_appeal + GET /v0/appointment_requests/:appointment_request_id/messages(.:format) mobile/v0/appointment_request_messages#index + v0_appointments GET /v0/appointments(.:format) mobile/v0/appointments#index + PUT /v0/appointments/cancel/:id(.:format) mobile/v0/appointments#cancel + GET /v0/appointments/community_care/eligibility/:service_type(.:format) mobile/v0/community_care_eligibility#show + v0_appointments_va_eligibility GET /v0/appointments/va/eligibility(.:format) mobile/v0/veterans_affairs_eligibility#show + v0_appointments_facility_eligibility GET /v0/appointments/facility/eligibility(.:format) mobile/v0/facility_eligibility#index + v0_appointment POST /v0/appointment(.:format) mobile/v0/appointments#create + v0_claims_and_appeals_overview GET /v0/claims-and-appeals-overview(.:format) mobile/v0/claims_and_appeals#index + GET /v0/claim/:id(.:format) mobile/v0/claims_and_appeals#get_claim + POST /v0/claim/:id/documents(.:format) mobile/v0/claims_and_appeals#upload_document + POST /v0/claim/:id/documents/multi-image(.:format) mobile/v0/claims_and_appeals#upload_multi_image_document + POST /v0/claim/:id/request-decision(.:format) mobile/v0/claims_and_appeals#request_decision + v0_community_care_providers GET /v0/community-care-providers(.:format) mobile/v0/community_care_providers#index + v0_disability_rating GET /v0/disability-rating(.:format) mobile/v0/disability_rating#index + v0_health_immunizations GET /v0/health/immunizations(.:format) mobile/v0/immunizations#index + GET /v0/health/locations/:id(.:format) mobile/v0/locations#show + v0_letters GET /v0/letters(.:format) mobile/v0/letters#index + v0_letters_beneficiary GET /v0/letters/beneficiary(.:format) mobile/v0/letters#beneficiary + POST /v0/letters/:type/download(.:format) mobile/v0/letters#download + v0_maintenance_windows GET /v0/maintenance_windows(.:format) mobile/v0/maintenance_windows#index + v0_messaging_health_messages_signature GET /v0/messaging/health/messages/signature(.:format) mobile/v0/messages#signature + v0_military_service_history GET /v0/military-service-history(.:format) mobile/v0/military_information#get_service_history + v0_payment_history GET /v0/payment-history(.:format) mobile/v0/payment_history#index + v0_payment_information_benefits GET /v0/payment-information/benefits(.:format) mobile/v0/payment_information#index + PUT /v0/payment-information/benefits(.:format) mobile/v0/payment_information#update + v0_push_register PUT /v0/push/register(.:format) mobile/v0/push_notifications#register + GET /v0/push/prefs/:endpoint_sid(.:format) mobile/v0/push_notifications#get_prefs + PUT /v0/push/prefs/:endpoint_sid(.:format) mobile/v0/push_notifications#set_pref + v0_push_send POST /v0/push/send(.:format) mobile/v0/push_notifications#send_notification + v0_user GET /v0/user(.:format) mobile/v0/users#show + v0_user_logout GET /v0/user/logout(.:format) mobile/v0/users#logout + v0_user_addresses POST /v0/user/addresses(.:format) mobile/v0/addresses#create + PUT /v0/user/addresses(.:format) mobile/v0/addresses#update + DELETE /v0/user/addresses(.:format) mobile/v0/addresses#destroy + v0_user_addresses_validate POST /v0/user/addresses/validate(.:format) mobile/v0/addresses#validate + v0_user_emails POST /v0/user/emails(.:format) mobile/v0/emails#create + PUT /v0/user/emails(.:format) mobile/v0/emails#update + DELETE /v0/user/emails(.:format) mobile/v0/emails#destroy + v0_user_phones POST /v0/user/phones(.:format) mobile/v0/phones#create + PUT /v0/user/phones(.:format) mobile/v0/phones#update + DELETE /v0/user/phones(.:format) mobile/v0/phones#destroy + v0_triage_teams GET /v0/messaging/health/recipients(.:format) mobile/v0/triage_teams#index {:format=>:json} + v0_folder_messages GET /v0/messaging/health/folders/:folder_id/messages(.:format) mobile/v0/messages#index {:format=>:json} + v0_folders GET /v0/messaging/health/folders(.:format) mobile/v0/folders#index {:format=>:json} + POST /v0/messaging/health/folders(.:format) mobile/v0/folders#create {:format=>:json} + v0_folder GET /v0/messaging/health/folders/:id(.:format) mobile/v0/folders#show {:format=>:json} + DELETE /v0/messaging/health/folders/:id(.:format) mobile/v0/folders#destroy {:format=>:json} + thread_v0_message GET /v0/messaging/health/messages/:id/thread(.:format) mobile/v0/messages#thread {:format=>:json} + categories_v0_messages GET /v0/messaging/health/messages/categories(.:format) mobile/v0/messages#categories {:format=>:json} + move_v0_message PATCH /v0/messaging/health/messages/:id/move(.:format) mobile/v0/messages#move {:format=>:json} + reply_v0_message POST /v0/messaging/health/messages/:id/reply(.:format) mobile/v0/messages#reply {:format=>:json} + v0_message_attachment GET /v0/messaging/health/messages/:message_id/attachments/:id(.:format) mobile/v0/attachments#show {:format=>:json} + v0_messages POST /v0/messaging/health/messages(.:format) mobile/v0/messages#create {:format=>:json} + v0_message GET /v0/messaging/health/messages/:id(.:format) mobile/v0/messages#show {:format=>:json} + DELETE /v0/messaging/health/messages/:id(.:format) mobile/v0/messages#destroy {:format=>:json} + create_reply_v0_message_drafts POST /v0/messaging/health/message_drafts/:reply_id/replydraft(.:format) mobile/v0/message_drafts#create_reply_draft {:format=>:json} + update_reply_v0_message_drafts PUT /v0/messaging/health/message_drafts/:reply_id/replydraft/:draft_id(.:format) mobile/v0/message_drafts#update_reply_draft {:format=>:json} + v0_message_drafts POST /v0/messaging/health/message_drafts(.:format) mobile/v0/message_drafts#create {:format=>:json} + v0_message_draft PATCH /v0/messaging/health/message_drafts/:id(.:format) mobile/v0/message_drafts#update {:format=>:json} + PUT /v0/messaging/health/message_drafts/:id(.:format) mobile/v0/message_drafts#update {:format=>:json} + v1_health GET /v1/health/appointment-requests/:appointment_request_id/messages(.:format) mobile/v1/health/appointment_request_messages#index + v1_health_appointments GET /v1/health/appointments(.:format) mobile/v1/health/appointments#index + PUT /v1/health/appointments/:id/cancel(.:format) mobile/v1/health/appointments#cancel + GET /v1/health/appointments/community-care/:service_type/eligibility(.:format) mobile/v1/health/community_care_eligibility#show + v1_health_appointments_va_eligibility GET /v1/health/appointments/va/eligibility(.:format) mobile/v1/health/veterans_affairs_eligibility#show +v1_health_appointments_facility_eligibility GET /v1/health/appointments/facility/eligibility(.:format) mobile/v1/health/facility_eligibility#index + v1_health_appointment POST /v1/health/appointment(.:format) mobile/v1/health/appointments#create + v1_health_community_care_providers GET /v1/health/community-care-providers(.:format) mobile/v1/health/community_care_providers#index + v1_health_immunizations GET /v1/health/immunizations(.:format) mobile/v1/health/immunizations#index + v1_benefits GET /v1/benefits/appeal/:id(.:format) mobile/v1/benefits/claims_and_appeals#get_appeal + v1_benefits_claims_and_appeals_overview GET /v1/benefits/claims-and-appeals-overview(.:format) mobile/v1/benefits/claims_and_appeals#index + GET /v1/benefits/claim/:id(.:format) mobile/v1/benefits/claims_and_appeals#get_claim + POST /v1/benefits/claim/:id/documents(.:format) mobile/v1/benefits/claims_and_appeals#upload_document + POST /v1/benefits/claim/:id/documents/multi-image(.:format) mobile/v1/benefits/claims_and_appeals#upload_multi_image_document + POST /v1/benefits/claim/:id/request-decision(.:format) mobile/v1/benefits/claims_and_appeals#request_decision + v1_maintenance_windows GET /v1/maintenance-windows(.:format) mobile/v1/maintenance_windows#index + v1 GET /v1/push/:endpoint_sid/prefs(.:format) mobile/v1/push_notifications#get_prefs + PUT /v1/push/:endpoint_sid/prefs(.:format) mobile/v1/push_notifications#set_pref + v1_user GET /v1/user(.:format) mobile/v1/users#show + GET /v1/facilities-info/:sort(.:format) mobile/v1/facilities_info#index + create_reply_v1_message_drafts POST /v1/messaging/health/message-drafts/:reply_id/reply-draft(.:format) mobile/v1/message_drafts#create_reply_draft {:format=>:json} + update_reply_v1_message_drafts PUT /v1/messaging/health/message-drafts/:reply_id/reply-draft/:draft_id(.:format) mobile/v1/message_drafts#update_reply_draft {:format=>:json} + v1_message_drafts POST /v1/messaging/health/message-drafts(.:format) mobile/v1/message_drafts#create {:format=>:json} + v1_message_draft PATCH /v1/messaging/health/message-drafts/:id(.:format) mobile/v1/message_drafts#update {:format=>:json} + PUT /v1/messaging/health/message-drafts/:id(.:format) mobile/v1/message_drafts#update {:format=>:json} + +``` Naming conventions will also be documented on mobile documentation site. ## Risks -_What are the risks of the proposed changes?_ Must throughly test new endpoints to ensure nothing breaks. ## Alternatives -_What other alternatives solutions were considered, why weren't they chosen?_ N/A From 9dc9eca93cb08f4461601e6207a0f44b543a6f05 Mon Sep 17 00:00:00 2001 From: Andrew Herzberg Date: Fri, 6 May 2022 09:11:34 -0700 Subject: [PATCH 07/11] Update 2022-05-05-mobile-route-naming-conventions.md --- .../2022-05-05-mobile-route-naming-conventions.md | 1 - 1 file changed, 1 deletion(-) diff --git a/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md b/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md index 5884bb535e1..93c0af1b3d4 100644 --- a/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md +++ b/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md @@ -7,7 +7,6 @@ Mobile routes currently have some inconsistencies in their naming conventions, such as: - Sometimes using snake_case over kebab-case (maintenance_windows, message_drafts) - :ids are after the resource action rather than before (canceling appointments) -- Referring to the same thing with different names (appointments: 'pending' and 'requests') - Not nesting under parent products (the 'health' and 'benefits' app) ## Motivation From baf29f5267e80e7d0711dc8b8303605ad1819d70 Mon Sep 17 00:00:00 2001 From: Andrew Herzberg Date: Fri, 6 May 2022 14:47:03 -0700 Subject: [PATCH 08/11] Update 2022-05-05-mobile-route-naming-conventions.md --- ...2-05-05-mobile-route-naming-conventions.md | 142 ++++-------------- 1 file changed, 26 insertions(+), 116 deletions(-) diff --git a/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md b/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md index 93c0af1b3d4..7257dc88f70 100644 --- a/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md +++ b/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md @@ -22,9 +22,29 @@ namespace :health do get '/appointments/community-care/:service_type/eligibility', to: 'community_care_eligibility#show' get '/appointments/va/eligibility', to: 'veterans_affairs_eligibility#show' get '/appointments/facility/eligibility', to: 'facility_eligibility#index' - post '/appointment', to: 'appointments#create' + post '/appointments', to: 'appointments#create' get '/community-care-providers', to: 'community_care_providers#index' + + scope :messaging do + resources :triage_teams, only: [:index], defaults: { format: :json }, path: 'recipients' + + resources :folders, only: %i[index show create destroy], defaults: { format: :json } do + resources :messages, only: [:index], defaults: { format: :json } + end + + resources :messages, only: %i[show create destroy], defaults: { format: :json } do + get :thread, on: :member + get :categories, on: :collection + patch :move, on: :member + post :reply, on: :member + resources :attachments, only: [:show], defaults: { format: :json } + end + resources :message_drafts, path: 'message-drafts', only: %i[create update], defaults: { format: :json } do + post ':reply_id/reply-draft', on: :collection, action: :create_reply_draft, as: :create_reply + put ':reply_id/reply-draft/:draft_id', on: :collection, action: :update_reply_draft, as: :update_reply + end end +end namespace :benefits do get '/appeal/:id', to: 'claims_and_appeals#get_appeal' @@ -33,7 +53,10 @@ namespace :benefits do post '/claim/:id/documents', to: 'claims_and_appeals#upload_document' post '/claim/:id/documents/multi-image', to: 'claims_and_appeals#upload_multi_image_document' post '/claim/:id/request-decision', to: 'claims_and_appeals#request_decision' - end + get '/letters', to: 'letters#index' + get '/letters/beneficiary', to: 'letters#beneficiary' + post '/letters/:type/download', to: 'letters#download' +end get '/maintenance-windows', to: 'maintenance_windows#index' get '/push/:endpoint_sid/prefs', to: 'push_notifications#get_prefs' @@ -41,10 +64,7 @@ namespace :benefits do scope :messaging do scope :health do - resources :message_drafts, path: 'message-drafts', only: %i[create update], defaults: { format: :json } do - post ':reply_id/reply-draft', on: :collection, action: :create_reply_draft, as: :create_reply - put ':reply_id/reply-draft/:draft_id', on: :collection, action: :update_reply_draft, as: :update_reply - end + end end ``` @@ -58,10 +78,6 @@ For the sake of ease of reviewing all endpoints, see below for all mobile endpoi get '/disability-rating', to: 'disability_rating#index' get '/health/immunizations', to: 'immunizations#index' get '/health/locations/:id', to: 'locations#show' -get '/letters', to: 'letters#index' -get '/letters/beneficiary', to: 'letters#beneficiary' -post '/letters/:type/download', to: 'letters#download' -get '/messaging/health/messages/signature', to: 'messages#signature' get '/military-service-history', to: 'military_information#get_service_history' get '/payment-history', to: 'payment_history#index' get '/payment-information/benefits', to: 'payment_information#index' @@ -81,117 +97,11 @@ post '/user/phones', to: 'phones#create' put '/user/phones', to: 'phones#update' delete '/user/phones', to: 'phones#destroy' get '/facilities-info/:sort', to: 'facilities_info#index' - -scope :messaging do - scope :health do - resources :triage_teams, only: [:index], defaults: { format: :json }, path: 'recipients' - - resources :folders, only: %i[index show create destroy], defaults: { format: :json } do - resources :messages, only: [:index], defaults: { format: :json } - end - - resources :messages, only: %i[show create destroy], defaults: { format: :json } do - get :thread, on: :member - get :categories, on: :collection - patch :move, on: :member - post :reply, on: :member - resources :attachments, only: [:show], defaults: { format: :json } - end - end -end ``` See below for example of all routes after changes: ``` - GET / mobile/discovery#welcome - v0 GET /v0/appeal/:id(.:format) mobile/v0/claims_and_appeals#get_appeal - GET /v0/appointment_requests/:appointment_request_id/messages(.:format) mobile/v0/appointment_request_messages#index - v0_appointments GET /v0/appointments(.:format) mobile/v0/appointments#index - PUT /v0/appointments/cancel/:id(.:format) mobile/v0/appointments#cancel - GET /v0/appointments/community_care/eligibility/:service_type(.:format) mobile/v0/community_care_eligibility#show - v0_appointments_va_eligibility GET /v0/appointments/va/eligibility(.:format) mobile/v0/veterans_affairs_eligibility#show - v0_appointments_facility_eligibility GET /v0/appointments/facility/eligibility(.:format) mobile/v0/facility_eligibility#index - v0_appointment POST /v0/appointment(.:format) mobile/v0/appointments#create - v0_claims_and_appeals_overview GET /v0/claims-and-appeals-overview(.:format) mobile/v0/claims_and_appeals#index - GET /v0/claim/:id(.:format) mobile/v0/claims_and_appeals#get_claim - POST /v0/claim/:id/documents(.:format) mobile/v0/claims_and_appeals#upload_document - POST /v0/claim/:id/documents/multi-image(.:format) mobile/v0/claims_and_appeals#upload_multi_image_document - POST /v0/claim/:id/request-decision(.:format) mobile/v0/claims_and_appeals#request_decision - v0_community_care_providers GET /v0/community-care-providers(.:format) mobile/v0/community_care_providers#index - v0_disability_rating GET /v0/disability-rating(.:format) mobile/v0/disability_rating#index - v0_health_immunizations GET /v0/health/immunizations(.:format) mobile/v0/immunizations#index - GET /v0/health/locations/:id(.:format) mobile/v0/locations#show - v0_letters GET /v0/letters(.:format) mobile/v0/letters#index - v0_letters_beneficiary GET /v0/letters/beneficiary(.:format) mobile/v0/letters#beneficiary - POST /v0/letters/:type/download(.:format) mobile/v0/letters#download - v0_maintenance_windows GET /v0/maintenance_windows(.:format) mobile/v0/maintenance_windows#index - v0_messaging_health_messages_signature GET /v0/messaging/health/messages/signature(.:format) mobile/v0/messages#signature - v0_military_service_history GET /v0/military-service-history(.:format) mobile/v0/military_information#get_service_history - v0_payment_history GET /v0/payment-history(.:format) mobile/v0/payment_history#index - v0_payment_information_benefits GET /v0/payment-information/benefits(.:format) mobile/v0/payment_information#index - PUT /v0/payment-information/benefits(.:format) mobile/v0/payment_information#update - v0_push_register PUT /v0/push/register(.:format) mobile/v0/push_notifications#register - GET /v0/push/prefs/:endpoint_sid(.:format) mobile/v0/push_notifications#get_prefs - PUT /v0/push/prefs/:endpoint_sid(.:format) mobile/v0/push_notifications#set_pref - v0_push_send POST /v0/push/send(.:format) mobile/v0/push_notifications#send_notification - v0_user GET /v0/user(.:format) mobile/v0/users#show - v0_user_logout GET /v0/user/logout(.:format) mobile/v0/users#logout - v0_user_addresses POST /v0/user/addresses(.:format) mobile/v0/addresses#create - PUT /v0/user/addresses(.:format) mobile/v0/addresses#update - DELETE /v0/user/addresses(.:format) mobile/v0/addresses#destroy - v0_user_addresses_validate POST /v0/user/addresses/validate(.:format) mobile/v0/addresses#validate - v0_user_emails POST /v0/user/emails(.:format) mobile/v0/emails#create - PUT /v0/user/emails(.:format) mobile/v0/emails#update - DELETE /v0/user/emails(.:format) mobile/v0/emails#destroy - v0_user_phones POST /v0/user/phones(.:format) mobile/v0/phones#create - PUT /v0/user/phones(.:format) mobile/v0/phones#update - DELETE /v0/user/phones(.:format) mobile/v0/phones#destroy - v0_triage_teams GET /v0/messaging/health/recipients(.:format) mobile/v0/triage_teams#index {:format=>:json} - v0_folder_messages GET /v0/messaging/health/folders/:folder_id/messages(.:format) mobile/v0/messages#index {:format=>:json} - v0_folders GET /v0/messaging/health/folders(.:format) mobile/v0/folders#index {:format=>:json} - POST /v0/messaging/health/folders(.:format) mobile/v0/folders#create {:format=>:json} - v0_folder GET /v0/messaging/health/folders/:id(.:format) mobile/v0/folders#show {:format=>:json} - DELETE /v0/messaging/health/folders/:id(.:format) mobile/v0/folders#destroy {:format=>:json} - thread_v0_message GET /v0/messaging/health/messages/:id/thread(.:format) mobile/v0/messages#thread {:format=>:json} - categories_v0_messages GET /v0/messaging/health/messages/categories(.:format) mobile/v0/messages#categories {:format=>:json} - move_v0_message PATCH /v0/messaging/health/messages/:id/move(.:format) mobile/v0/messages#move {:format=>:json} - reply_v0_message POST /v0/messaging/health/messages/:id/reply(.:format) mobile/v0/messages#reply {:format=>:json} - v0_message_attachment GET /v0/messaging/health/messages/:message_id/attachments/:id(.:format) mobile/v0/attachments#show {:format=>:json} - v0_messages POST /v0/messaging/health/messages(.:format) mobile/v0/messages#create {:format=>:json} - v0_message GET /v0/messaging/health/messages/:id(.:format) mobile/v0/messages#show {:format=>:json} - DELETE /v0/messaging/health/messages/:id(.:format) mobile/v0/messages#destroy {:format=>:json} - create_reply_v0_message_drafts POST /v0/messaging/health/message_drafts/:reply_id/replydraft(.:format) mobile/v0/message_drafts#create_reply_draft {:format=>:json} - update_reply_v0_message_drafts PUT /v0/messaging/health/message_drafts/:reply_id/replydraft/:draft_id(.:format) mobile/v0/message_drafts#update_reply_draft {:format=>:json} - v0_message_drafts POST /v0/messaging/health/message_drafts(.:format) mobile/v0/message_drafts#create {:format=>:json} - v0_message_draft PATCH /v0/messaging/health/message_drafts/:id(.:format) mobile/v0/message_drafts#update {:format=>:json} - PUT /v0/messaging/health/message_drafts/:id(.:format) mobile/v0/message_drafts#update {:format=>:json} - v1_health GET /v1/health/appointment-requests/:appointment_request_id/messages(.:format) mobile/v1/health/appointment_request_messages#index - v1_health_appointments GET /v1/health/appointments(.:format) mobile/v1/health/appointments#index - PUT /v1/health/appointments/:id/cancel(.:format) mobile/v1/health/appointments#cancel - GET /v1/health/appointments/community-care/:service_type/eligibility(.:format) mobile/v1/health/community_care_eligibility#show - v1_health_appointments_va_eligibility GET /v1/health/appointments/va/eligibility(.:format) mobile/v1/health/veterans_affairs_eligibility#show -v1_health_appointments_facility_eligibility GET /v1/health/appointments/facility/eligibility(.:format) mobile/v1/health/facility_eligibility#index - v1_health_appointment POST /v1/health/appointment(.:format) mobile/v1/health/appointments#create - v1_health_community_care_providers GET /v1/health/community-care-providers(.:format) mobile/v1/health/community_care_providers#index - v1_health_immunizations GET /v1/health/immunizations(.:format) mobile/v1/health/immunizations#index - v1_benefits GET /v1/benefits/appeal/:id(.:format) mobile/v1/benefits/claims_and_appeals#get_appeal - v1_benefits_claims_and_appeals_overview GET /v1/benefits/claims-and-appeals-overview(.:format) mobile/v1/benefits/claims_and_appeals#index - GET /v1/benefits/claim/:id(.:format) mobile/v1/benefits/claims_and_appeals#get_claim - POST /v1/benefits/claim/:id/documents(.:format) mobile/v1/benefits/claims_and_appeals#upload_document - POST /v1/benefits/claim/:id/documents/multi-image(.:format) mobile/v1/benefits/claims_and_appeals#upload_multi_image_document - POST /v1/benefits/claim/:id/request-decision(.:format) mobile/v1/benefits/claims_and_appeals#request_decision - v1_maintenance_windows GET /v1/maintenance-windows(.:format) mobile/v1/maintenance_windows#index - v1 GET /v1/push/:endpoint_sid/prefs(.:format) mobile/v1/push_notifications#get_prefs - PUT /v1/push/:endpoint_sid/prefs(.:format) mobile/v1/push_notifications#set_pref - v1_user GET /v1/user(.:format) mobile/v1/users#show - GET /v1/facilities-info/:sort(.:format) mobile/v1/facilities_info#index - create_reply_v1_message_drafts POST /v1/messaging/health/message-drafts/:reply_id/reply-draft(.:format) mobile/v1/message_drafts#create_reply_draft {:format=>:json} - update_reply_v1_message_drafts PUT /v1/messaging/health/message-drafts/:reply_id/reply-draft/:draft_id(.:format) mobile/v1/message_drafts#update_reply_draft {:format=>:json} - v1_message_drafts POST /v1/messaging/health/message-drafts(.:format) mobile/v1/message_drafts#create {:format=>:json} - v1_message_draft PATCH /v1/messaging/health/message-drafts/:id(.:format) mobile/v1/message_drafts#update {:format=>:json} - PUT /v1/messaging/health/message-drafts/:id(.:format) mobile/v1/message_drafts#update {:format=>:json} - ``` Naming conventions will also be documented on mobile documentation site. ## Risks From f3433b614e52c7a4cded7089aa4aba6fb883b99c Mon Sep 17 00:00:00 2001 From: Andrew Herzberg Date: Mon, 9 May 2022 16:08:25 -0700 Subject: [PATCH 09/11] Update 2022-05-05-mobile-route-naming-conventions.md --- ...2-05-05-mobile-route-naming-conventions.md | 269 +++++++++++++----- 1 file changed, 191 insertions(+), 78 deletions(-) diff --git a/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md b/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md index 7257dc88f70..6f06dd2e9d0 100644 --- a/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md +++ b/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md @@ -15,95 +15,208 @@ Keeping naming consistent will make using the Mobile API much easier to use and ## Design Version all endpoint that do not meet the naming convention as follows: ``` -namespace :health do - get '/appointment-requests/:appointment_request_id/messages', to: 'appointment_request_messages#index' - get '/appointments', to: 'appointments#index' - put '/appointments/:id/cancel', to: 'appointments#cancel' - get '/appointments/community-care/:service_type/eligibility', to: 'community_care_eligibility#show' - get '/appointments/va/eligibility', to: 'veterans_affairs_eligibility#show' - get '/appointments/facility/eligibility', to: 'facility_eligibility#index' - post '/appointments', to: 'appointments#create' - get '/community-care-providers', to: 'community_care_providers#index' - - scope :messaging do - resources :triage_teams, only: [:index], defaults: { format: :json }, path: 'recipients' - - resources :folders, only: %i[index show create destroy], defaults: { format: :json } do - resources :messages, only: [:index], defaults: { format: :json } - end - - resources :messages, only: %i[show create destroy], defaults: { format: :json } do - get :thread, on: :member - get :categories, on: :collection - patch :move, on: :member - post :reply, on: :member - resources :attachments, only: [:show], defaults: { format: :json } - end - resources :message_drafts, path: 'message-drafts', only: %i[create update], defaults: { format: :json } do - post ':reply_id/reply-draft', on: :collection, action: :create_reply_draft, as: :create_reply - put ':reply_id/reply-draft/:draft_id', on: :collection, action: :update_reply_draft, as: :update_reply - end - end -end - -namespace :benefits do - get '/appeal/:id', to: 'claims_and_appeals#get_appeal' - get '/claims-and-appeals-overview', to: 'claims_and_appeals#index' - get '/claim/:id', to: 'claims_and_appeals#get_claim' - post '/claim/:id/documents', to: 'claims_and_appeals#upload_document' - post '/claim/:id/documents/multi-image', to: 'claims_and_appeals#upload_multi_image_document' - post '/claim/:id/request-decision', to: 'claims_and_appeals#request_decision' - get '/letters', to: 'letters#index' - get '/letters/beneficiary', to: 'letters#beneficiary' - post '/letters/:type/download', to: 'letters#download' -end - - get '/maintenance-windows', to: 'maintenance_windows#index' - get '/push/:endpoint_sid/prefs', to: 'push_notifications#get_prefs' - put '/push/:endpoint_sid/prefs', to: 'push_notifications#set_pref' + maintenance_windows GET /maintenance-windows(.:format) mobile/maintenance_windows#index + v1_health_appointments GET /v1/health/appointments(.:format) mobile/v1/health/appointments/appointments#index + POST /v1/health/appointments(.:format) mobile/v1/health/appointments/appointments#create + GET /v1/health/appointments/requests/:appointment_request_id/messages(.:format) mobile/v1/health/appointments/appointment_request_messages#index + PUT /v1/health/appointments/:id/cancel(.:format) mobile/v1/health/appointments/appointments#cancel +v1_health_appointments_community_care_providers GET /v1/health/appointments/community-care-providers(.:format) mobile/v1/health/appointments/community_care_providers#index + GET /v1/health/appointments/facilities-info/:sort(.:format) mobile/v1/health/appointments/facilities_info#index + GET /v1/health/appointments/eligibility/community-care/:service_type(.:format) mobile/v1/health/appointments/community_care_eligibility#show + v1_health_appointments_va GET /v1/health/appointments/eligibility/va(.:format) mobile/v1/health/appointments/veterans_affairs_eligibility#show + v1_health_appointments_facility GET /v1/health/appointments/eligibility/facility(.:format) mobile/v1/health/appointments/facility_eligibility#index + v1_health_triage_teams GET /v1/health/messaging/recipients(.:format) mobile/v1/health/triage_teams#index {:format=>:json} + v1_health_folder_messages GET /v1/health/messaging/folders/:folder_id/messages(.:format) mobile/v1/health/messages#index {:format=>:json} + v1_health_folders GET /v1/health/messaging/folders(.:format) mobile/v1/health/folders#index {:format=>:json} + POST /v1/health/messaging/folders(.:format) mobile/v1/health/folders#create {:format=>:json} + v1_health_folder GET /v1/health/messaging/folders/:id(.:format) mobile/v1/health/folders#show {:format=>:json} + DELETE /v1/health/messaging/folders/:id(.:format) mobile/v1/health/folders#destroy {:format=>:json} + thread_v1_health_message GET /v1/health/messaging/messages/:id/thread(.:format) mobile/v1/health/messages#thread {:format=>:json} + categories_v1_health_messages GET /v1/health/messaging/messages/categories(.:format) mobile/v1/health/messages#categories {:format=>:json} + move_v1_health_message PATCH /v1/health/messaging/messages/:id/move(.:format) mobile/v1/health/messages#move {:format=>:json} + reply_v1_health_message POST /v1/health/messaging/messages/:id/reply(.:format) mobile/v1/health/messages#reply {:format=>:json} + v1_health_message_attachment GET /v1/health/messaging/messages/:message_id/attachments/:id(.:format) mobile/v1/health/attachments#show {:format=>:json} + v1_health_messages POST /v1/health/messaging/messages(.:format) mobile/v1/health/messages#create {:format=>:json} + v1_health_message GET /v1/health/messaging/messages/:id(.:format) mobile/v1/health/messages#show {:format=>:json} + DELETE /v1/health/messaging/messages/:id(.:format) mobile/v1/health/messages#destroy {:format=>:json} + create_reply_v1_health_message_drafts POST /v1/health/messaging/message-drafts/:reply_id/reply-draft(.:format) mobile/v1/health/message_drafts#create_reply_draft {:format=>:json} + update_reply_v1_health_message_drafts PUT /v1/health/messaging/message-drafts/:reply_id/reply-draft/:draft_id(.:format) mobile/v1/health/message_drafts#update_reply_draft {:format=>:json} + v1_health_message_drafts POST /v1/health/messaging/message-drafts(.:format) mobile/v1/health/message_drafts#create {:format=>:json} + v1_health_message_draft PATCH /v1/health/messaging/message-drafts/:id(.:format) mobile/v1/health/message_drafts#update {:format=>:json} + PUT /v1/health/messaging/message-drafts/:id(.:format) mobile/v1/health/message_drafts#update {:format=>:json} + v1_benefits GET /v1/benefits/appeals/:id(.:format) mobile/v1/benefits/claims_and_appeals#get_appeal + v1_benefits_claims_and_appeals_overview GET /v1/benefits/claims-and-appeals-overview(.:format) mobile/v1/benefits/claims_and_appeals#index + v1_benefits_disability_rating GET /v1/benefits/disability-rating(.:format) mobile/v1/benefits/disability_rating#index + GET /v1/benefits/claims/:id(.:format) mobile/v1/benefits/claims_and_appeals#get_claim + POST /v1/benefits/claims/:id/documents(.:format) mobile/v1/benefits/claims_and_appeals#upload_document + POST /v1/benefits/claims/:id/documents/multi-image(.:format) mobile/v1/benefits/claims_and_appeals#upload_multi_image_document + POST /v1/benefits/claims/:id/request-decision(.:format) mobile/v1/benefits/claims_and_appeals#request_decision + GET /v1/benefits/letters(.:format) mobile/v1/benefits/letters#index + v1_benefits_beneficiary GET /v1/benefits/letters/beneficiary(.:format) mobile/v1/benefits/letters#beneficiary + POST /v1/benefits/letters/:type/download(.:format) mobile/v1/benefits/letters#download + v1_benefits_history GET /v1/benefits/payments/history(.:format) mobile/v1/benefits/payment_history#index + v1_benefits_information GET /v1/benefits/payments/information(.:format) mobile/v1/benefits/payment_information#index + PUT /v1/benefits/payments/information(.:format) mobile/v1/benefits/payment_information#update + v1 GET /v1/push/:endpoint_sid/prefs(.:format) mobile/v1/push_notifications#get_prefs + PUT /v1/push/:endpoint_sid/prefs(.:format) mobile/v1/push_notifications#set_pref + v1_user_military_service_history GET /v1/user/military-service-history(.:format) mobile/v1/military_information#get_service_history -scope :messaging do - scope :health do - - end -end ``` Notes: - Only endpoints being changed are shown above - All of these will be versioned from v0 to v1 - Adding parent products (health, benefits) is adding a namespace so the controllers will be nested in a folder as well. +- Naming conventions will also be documented on mobile documentation site. -For the sake of ease of reviewing all endpoints, see below for all mobile endpoint that will not be changed. -``` -get '/disability-rating', to: 'disability_rating#index' -get '/health/immunizations', to: 'immunizations#index' -get '/health/locations/:id', to: 'locations#show' -get '/military-service-history', to: 'military_information#get_service_history' -get '/payment-history', to: 'payment_history#index' -get '/payment-information/benefits', to: 'payment_information#index' -put '/payment-information/benefits', to: 'payment_information#update' -put '/push/register', to: 'push_notifications#register' -post '/push/send', to: 'push_notifications#send_notification' -get '/user', to: 'users#show' -get '/user/logout', to: 'users#logout' -post '/user/addresses', to: 'addresses#create' -put '/user/addresses', to: 'addresses#update' -delete '/user/addresses', to: 'addresses#destroy' -post '/user/addresses/validate', to: 'addresses#validate' -post '/user/emails', to: 'emails#create' -put '/user/emails', to: 'emails#update' -delete '/user/emails', to: 'emails#destroy' -post '/user/phones', to: 'phones#create' -put '/user/phones', to: 'phones#update' -delete '/user/phones', to: 'phones#destroy' -get '/facilities-info/:sort', to: 'facilities_info#index' +See updated routes file to see implications to controllers: ``` +# frozen_string_literal: true -See below for example of all routes after changes: -``` +Mobile::Engine.routes.draw do + get '/', to: 'discovery#welcome' + get '/maintenance-windows', to: 'maintenance_windows#index' + + namespace :v0 do + get '/appeal/:id', to: 'claims_and_appeals#get_appeal' + get '/appointment_requests/:appointment_request_id/messages', to: 'appointment_request_messages#index' + get '/appointments', to: 'appointments#index' + put '/appointments/cancel/:id', to: 'appointments#cancel' + get '/appointments/community_care/eligibility/:service_type', to: 'community_care_eligibility#show' + get '/appointments/va/eligibility', to: 'veterans_affairs_eligibility#show' + get '/appointments/facility/eligibility', to: 'facility_eligibility#index' + post '/appointment', to: 'appointments#create' + get '/claims-and-appeals-overview', to: 'claims_and_appeals#index' + get '/claim/:id', to: 'claims_and_appeals#get_claim' + post '/claim/:id/documents', to: 'claims_and_appeals#upload_document' + post '/claim/:id/documents/multi-image', to: 'claims_and_appeals#upload_multi_image_document' + post '/claim/:id/request-decision', to: 'claims_and_appeals#request_decision' + get '/community-care-providers', to: 'community_care_providers#index' + get '/disability-rating', to: 'disability_rating#index' + get '/health/immunizations', to: 'immunizations#index' + get '/health/locations/:id', to: 'locations#show' + get '/letters', to: 'letters#index' + get '/letters/beneficiary', to: 'letters#beneficiary' + post '/letters/:type/download', to: 'letters#download' + get '/maintenance_windows', to: 'maintenance_windows#index' + get '/messaging/health/messages/signature', to: 'messages#signature' + get '/military-service-history', to: 'military_information#get_service_history' + get '/payment-history', to: 'payment_history#index' + get '/payment-information/benefits', to: 'payment_information#index' + put '/payment-information/benefits', to: 'payment_information#update' + put '/push/register', to: 'push_notifications#register' + get '/push/prefs/:endpoint_sid', to: 'push_notifications#get_prefs' + put '/push/prefs/:endpoint_sid', to: 'push_notifications#set_pref' + post '/push/send', to: 'push_notifications#send_notification' + get '/user', to: 'users#show' + get '/user/logout', to: 'users#logout' + post '/user/addresses', to: 'addresses#create' + put '/user/addresses', to: 'addresses#update' + delete '/user/addresses', to: 'addresses#destroy' + post '/user/addresses/validate', to: 'addresses#validate' + post '/user/emails', to: 'emails#create' + put '/user/emails', to: 'emails#update' + delete '/user/emails', to: 'emails#destroy' + post '/user/phones', to: 'phones#create' + put '/user/phones', to: 'phones#update' + delete '/user/phones', to: 'phones#destroy' + + scope :messaging do + scope :health do + resources :triage_teams, only: [:index], defaults: { format: :json }, path: 'recipients' + + resources :folders, only: %i[index show create destroy], defaults: { format: :json } do + resources :messages, only: [:index], defaults: { format: :json } + end + + resources :messages, only: %i[show create destroy], defaults: { format: :json } do + get :thread, on: :member + get :categories, on: :collection + patch :move, on: :member + post :reply, on: :member + resources :attachments, only: [:show], defaults: { format: :json } + end + + resources :message_drafts, only: %i[create update], defaults: { format: :json } do + post ':reply_id/replydraft', on: :collection, action: :create_reply_draft, as: :create_reply + put ':reply_id/replydraft/:draft_id', on: :collection, action: :update_reply_draft, as: :update_reply + end + end + end + end + + namespace :v1 do + namespace :health do + namespace :appointments do + get '/', to: 'appointments#index' + post '/', to: 'appointments#create' + get '/requests/:appointment_request_id/messages', to: 'appointment_request_messages#index' + put '/:id/cancel', to: 'appointments#cancel' + get '/community-care-providers', to: 'community_care_providers#index' + get '/facilities-info/:sort', to: 'facilities_info#index' + + scope :eligibility do + get '/community-care/:service_type', to: 'community_care_eligibility#show' + get '/va', to: 'veterans_affairs_eligibility#show' + get '/facility', to: 'facility_eligibility#index' + end + end + + scope :messaging do + resources :triage_teams, only: [:index], defaults: { format: :json }, path: 'recipients' + + resources :folders, only: %i[index show create destroy], defaults: { format: :json } do + resources :messages, only: [:index], defaults: { format: :json } + end + + resources :messages, only: %i[show create destroy], defaults: { format: :json } do + get :thread, on: :member + get :categories, on: :collection + patch :move, on: :member + post :reply, on: :member + resources :attachments, only: [:show], defaults: { format: :json } + end + + resources :message_drafts, path: 'message-drafts', only: %i[create update], defaults: { format: :json } do + post ':reply_id/reply-draft', on: :collection, action: :create_reply_draft, as: :create_reply + put ':reply_id/reply-draft/:draft_id', on: :collection, action: :update_reply_draft, as: :update_reply + end + end + get '/immunizations', to: 'immunizations#index' + end + + namespace :benefits do + get '/appeals/:id', to: 'claims_and_appeals#get_appeal' + get '/claims-and-appeals-overview', to: 'claims_and_appeals#index' + get '/disability-rating', to: 'disability_rating#index' + + scope :claims do + get '/:id', to: 'claims_and_appeals#get_claim' + post '/:id/documents', to: 'claims_and_appeals#upload_document' + post '/:id/documents/multi-image', to: 'claims_and_appeals#upload_multi_image_document' + post '/:id/request-decision', to: 'claims_and_appeals#request_decision' + end + + scope :letters do + get '/', to: 'letters#index' + get '/beneficiary', to: 'letters#beneficiary' + post '/:type/download', to: 'letters#download' + end + + scope :payments do + get '/history', to: 'payment_history#index' + get '/information', to: 'payment_information#index' + put '/information', to: 'payment_information#update' + end + end + + get '/push/:endpoint_sid/prefs', to: 'push_notifications#get_prefs' + put '/push/:endpoint_sid/prefs', to: 'push_notifications#set_pref' + get '/user', to: 'users#show' + get '/user/military-service-history', to: 'military_information#get_service_history' + end +end ``` -Naming conventions will also be documented on mobile documentation site. ## Risks Must throughly test new endpoints to ensure nothing breaks. From fdc8a968484d5748f5a9958bde0bdbd96f2ef5ef Mon Sep 17 00:00:00 2001 From: Andrew Herzberg Date: Tue, 21 Jun 2022 15:11:07 -0700 Subject: [PATCH 10/11] Update 2022-05-05-mobile-route-naming-conventions.md --- .../2022-05-05-mobile-route-naming-conventions.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md b/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md index 6f06dd2e9d0..2bf0bd67b35 100644 --- a/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md +++ b/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md @@ -24,7 +24,7 @@ v1_health_appointments_community_care_providers GET /v1/health/appointments/c GET /v1/health/appointments/facilities-info/:sort(.:format) mobile/v1/health/appointments/facilities_info#index GET /v1/health/appointments/eligibility/community-care/:service_type(.:format) mobile/v1/health/appointments/community_care_eligibility#show v1_health_appointments_va GET /v1/health/appointments/eligibility/va(.:format) mobile/v1/health/appointments/veterans_affairs_eligibility#show - v1_health_appointments_facility GET /v1/health/appointments/eligibility/facility(.:format) mobile/v1/health/appointments/facility_eligibility#index + v1_health_appointments_facilities GET /v1/health/appointments/eligibility/facilities(.:format) mobile/v1/health/appointments/facility_eligibility#index v1_health_triage_teams GET /v1/health/messaging/recipients(.:format) mobile/v1/health/triage_teams#index {:format=>:json} v1_health_folder_messages GET /v1/health/messaging/folders/:folder_id/messages(.:format) mobile/v1/health/messages#index {:format=>:json} v1_health_folders GET /v1/health/messaging/folders(.:format) mobile/v1/health/folders#index {:format=>:json} From f99dd0d0c13a809f7a29bd0aad1afd002bce5072 Mon Sep 17 00:00:00 2001 From: Andrew Herzberg Date: Tue, 21 Jun 2022 15:13:27 -0700 Subject: [PATCH 11/11] Update 2022-05-05-mobile-route-naming-conventions.md --- .../2022-05-05-mobile-route-naming-conventions.md | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md b/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md index 2bf0bd67b35..4b3bd781488 100644 --- a/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md +++ b/platform/engineering/request-for-comment/2022-05-05-mobile-route-naming-conventions.md @@ -119,7 +119,10 @@ Mobile::Engine.routes.draw do post '/user/phones', to: 'phones#create' put '/user/phones', to: 'phones#update' delete '/user/phones', to: 'phones#destroy' - + get '/health/rx/prescriptions', to: 'prescriptions#index' + put '/health/rx/prescriptions/:id/refill', to: 'prescriptions#refill' + get '/health/rx/prescriptions/:id/tracking', to: 'prescriptions#tracking' + scope :messaging do scope :health do resources :triage_teams, only: [:index], defaults: { format: :json }, path: 'recipients'