From 8f1f8a1a93503e2c7d66205e041cd78a96b53ee8 Mon Sep 17 00:00:00 2001 From: Andrew Herzberg Date: Fri, 6 Sep 2024 10:29:09 -0700 Subject: [PATCH] fix model --- .../app/models/mobile/v0/appeals/alert.rb | 28 ----- .../app/models/mobile/v0/appeals/appeal.rb | 104 +++++++++++++++++- .../app/models/mobile/v0/appeals/event.rb | 43 -------- .../app/models/mobile/v0/appeals/issue.rb | 26 ----- .../app/models/mobile/v0/appeals/status.rb | 39 ------- .../spec/requests/mobile/v0/appeal_spec.rb | 2 +- 6 files changed, 99 insertions(+), 143 deletions(-) delete mode 100644 modules/mobile/app/models/mobile/v0/appeals/alert.rb delete mode 100644 modules/mobile/app/models/mobile/v0/appeals/event.rb delete mode 100644 modules/mobile/app/models/mobile/v0/appeals/issue.rb delete mode 100644 modules/mobile/app/models/mobile/v0/appeals/status.rb diff --git a/modules/mobile/app/models/mobile/v0/appeals/alert.rb b/modules/mobile/app/models/mobile/v0/appeals/alert.rb deleted file mode 100644 index ba43a01ef7a..00000000000 --- a/modules/mobile/app/models/mobile/v0/appeals/alert.rb +++ /dev/null @@ -1,28 +0,0 @@ -# frozen_string_literal: true - -require 'common/models/resource' - -module Mobile - module V0 - module Appeals - class Alert < Common::Resource - ALERT_TYPES = Types::String.enum( - 'form9_needed', - 'scheduled_hearing', - 'hearing_no_show', - 'held_for_evidence', - 'cavc_option', - 'ramp_eligible', - 'ramp_ineligible', - 'decision_soon', - 'blocked_by_vso', - 'scheduled_dro_hearing', - 'dro_hearing_no_show' - ) - - attribute :type, ALERT_TYPES - attribute :details, Types::Hash - end - end - end -end diff --git a/modules/mobile/app/models/mobile/v0/appeals/appeal.rb b/modules/mobile/app/models/mobile/v0/appeals/appeal.rb index 1fb8075a6f6..fa45e241788 100644 --- a/modules/mobile/app/models/mobile/v0/appeals/appeal.rb +++ b/modules/mobile/app/models/mobile/v0/appeals/appeal.rb @@ -32,21 +32,113 @@ class Appeal < Common::Resource 'multiple' ) + ALERT_TYPES = Types::String.enum( + 'form9_needed', + 'scheduled_hearing', + 'hearing_no_show', + 'held_for_evidence', + 'cavc_option', + 'ramp_eligible', + 'ramp_ineligible', + 'decision_soon', + 'blocked_by_vso', + 'scheduled_dro_hearing', + 'dro_hearing_no_show' + ) + + EVENT_TYPES = Types::String.enum( + 'claim_decision', + 'nod', + 'soc', + 'form9', + 'ssoc', + 'certified', + 'hearing_held', + 'hearing_no_show', + 'bva_decision', + 'field_grant', + 'withdrawn', + 'ftr', + 'ramp', + 'death', + 'merged', + 'record_designation', + 'reconsideration', + 'vacated', + 'other_close', + 'cavc_decision', + 'ramp_notice', + 'transcript', + 'remand_return', + 'dro_hearing_held', + 'dro_hearing_cancelled', + 'dro_hearing_no_show' + ) + + LAST_ACTION_TYPES = Types::String.enum( + 'field_grant', + 'withdrawn', + 'allowed', + 'denied', + 'remand', + 'cavc_remand' + ) + + STATUS_TYPES = Types::String.enum( + 'scheduled_hearing', + 'pending_hearing_scheduling', + 'on_docket', + 'pending_certification_ssoc', + 'pending_certification', + 'pending_form9', + 'pending_soc', + 'stayed', + 'at_vso', + 'bva_development', + 'decision_in_progress', + 'bva_decision', + 'field_grant', + 'withdrawn', + 'ftr', + 'ramp', + 'death', + 'reconsideration', + 'other_close', + 'remand_ssoc', + 'remand', + 'merged' + ) + attribute :id, Types::String attribute :appealIds, Types::Array.of(Types::String) attribute :active, Types::Bool - attribute :alerts, Types::Array.of(Appeals::Alert) + attribute :alerts, Types::Array do + attribute :type, ALERT_TYPES + attribute :details, Types::Hash + end attribute :aod, Types::Bool.optional attribute :aoj, AOJ_TYPES attribute :description, Types::String - attribute :docket, Appeals::Docket.optional - attribute :events, Types::Array.of(Appeals::Event) - attribute :evidence, Types::Array.of(Appeals::Evidence).optional + attribute :docket, Docket.optional + attribute :events, Types::Array do + attribute :type, EVENT_TYPES + attribute :date, Types::Date + end + attribute :evidence, Types::Array.of(Evidence).optional attribute :incompleteHistory, Types::Bool - attribute :issues, Types::Array.of(Appeals::Issue) + attribute :issues, Types::Array do + attribute :active, Types::Bool + attribute :lastAction, LAST_ACTION_TYPES.optional + attribute :description, Types::String + attribute :diagnosticCode, Types::String.optional + attribute :date, Types::Date + end attribute :location, LOCATION_TYPES attribute :programArea, PROGRAM_AREA_TYPES - attribute :status, Appeals::Status + attribute :status do + attribute :type, STATUS_TYPES + attribute :details, Types::Hash + end attribute :type, Types::String attribute :updated, Types::DateTime end diff --git a/modules/mobile/app/models/mobile/v0/appeals/event.rb b/modules/mobile/app/models/mobile/v0/appeals/event.rb deleted file mode 100644 index 7165bd5fcad..00000000000 --- a/modules/mobile/app/models/mobile/v0/appeals/event.rb +++ /dev/null @@ -1,43 +0,0 @@ -# frozen_string_literal: true - -require 'common/models/resource' - -module Mobile - module V0 - module Appeals - class Event < Common::Resource - EVENT_TYPES = Types::String.enum( - 'claim_decision', - 'nod', - 'soc', - 'form9', - 'ssoc', - 'certified', - 'hearing_held', - 'hearing_no_show', - 'bva_decision', - 'field_grant', - 'withdrawn', - 'ftr', - 'ramp', - 'death', - 'merged', - 'record_designation', - 'reconsideration', - 'vacated', - 'other_close', - 'cavc_decision', - 'ramp_notice', - 'transcript', - 'remand_return', - 'dro_hearing_held', - 'dro_hearing_cancelled', - 'dro_hearing_no_show' - ) - - attribute :type, EVENT_TYPES - attribute :date, Types::Date - end - end - end -end diff --git a/modules/mobile/app/models/mobile/v0/appeals/issue.rb b/modules/mobile/app/models/mobile/v0/appeals/issue.rb deleted file mode 100644 index 63d7728dfb5..00000000000 --- a/modules/mobile/app/models/mobile/v0/appeals/issue.rb +++ /dev/null @@ -1,26 +0,0 @@ -# frozen_string_literal: true - -require 'common/models/resource' - -module Mobile - module V0 - module Appeals - class Issue < Common::Resource - LAST_ACTION_TYPES = Types::String.enum( - 'field_grant', - 'withdrawn', - 'allowed', - 'denied', - 'remand', - 'cavc_remand' - ) - - attribute :active, Types::Bool - attribute :lastAction, LAST_ACTION_TYPES.optional - attribute :description, Types::String - attribute :diagnosticCode, Types::String.optional - attribute :date, Types::Date - end - end - end -end diff --git a/modules/mobile/app/models/mobile/v0/appeals/status.rb b/modules/mobile/app/models/mobile/v0/appeals/status.rb deleted file mode 100644 index d8211c74426..00000000000 --- a/modules/mobile/app/models/mobile/v0/appeals/status.rb +++ /dev/null @@ -1,39 +0,0 @@ -# frozen_string_literal: true - -require 'common/models/resource' - -module Mobile - module V0 - module Appeals - class Status < Common::Resource - STATUS_TYPES = Types::String.enum( - 'scheduled_hearing', - 'pending_hearing_scheduling', - 'on_docket', - 'pending_certification_ssoc', - 'pending_certification', - 'pending_form9', - 'pending_soc', - 'stayed', - 'at_vso', - 'bva_development', - 'decision_in_progress', - 'bva_decision', - 'field_grant', - 'withdrawn', - 'ftr', - 'ramp', - 'death', - 'reconsideration', - 'other_close', - 'remand_ssoc', - 'remand', - 'merged' - ) - - attribute :type, STATUS_TYPES - attribute :details, Types::Hash - end - end - end -end diff --git a/modules/mobile/spec/requests/mobile/v0/appeal_spec.rb b/modules/mobile/spec/requests/mobile/v0/appeal_spec.rb index a1111c330f0..69285c79764 100644 --- a/modules/mobile/spec/requests/mobile/v0/appeal_spec.rb +++ b/modules/mobile/spec/requests/mobile/v0/appeal_spec.rb @@ -79,7 +79,7 @@ end end - it 'and attempting to access a nonexistant appeal returns a 404 wtih an error' do + it 'and attempting to access a nonexistent appeal returns a 404 with an error' do VCR.use_cassette('caseflow/appeals') do get '/mobile/v0/appeal/1234567', headers: sis_headers expect(response).to have_http_status(:not_found)