-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into Al/APPEALS-36565
- Loading branch information
Showing
12 changed files
with
346 additions
and
12 deletions.
There are no files selected for viewing
85 changes: 85 additions & 0 deletions
85
app/models/serializers/work_queue/appeal_search_serializer.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,85 @@ | ||
# frozen_string_literal: true | ||
|
||
class WorkQueue::AppealSearchSerializer | ||
include FastJsonapi::ObjectSerializer | ||
extend Helpers::AppealHearingHelper | ||
|
||
set_type :appeal | ||
|
||
attribute :contested_claim, &:contested_claim? | ||
|
||
attribute :issues do |object| | ||
object.request_issues.active_or_decided_or_withdrawn.includes(:remand_reasons).map do |issue| | ||
{ | ||
id: issue.id, | ||
program: issue.benefit_type, | ||
description: issue.description, | ||
notes: issue.notes, | ||
diagnostic_code: issue.contested_rating_issue_diagnostic_code, | ||
remand_reasons: issue.remand_reasons, | ||
closed_status: issue.closed_status, | ||
decision_date: issue.decision_date | ||
} | ||
end | ||
end | ||
|
||
attribute :status | ||
|
||
attribute(:hearings) do |object, params| | ||
# For substitution appeals after death dismissal, we need to show hearings from the source appeal | ||
# in addition to those on the new/target appeal; this avoids copying them to new appeal stream | ||
associated_hearings = [] | ||
|
||
if object.separate_appeal_substitution? | ||
associated_hearings = hearings(object.appellant_substitution.source_appeal, params) | ||
end | ||
|
||
associated_hearings + hearings(object, params) | ||
end | ||
|
||
attribute :withdrawn, &:withdrawn? | ||
|
||
attribute :removed, &:removed? | ||
|
||
attribute :overtime, &:overtime? | ||
|
||
attribute :veteran_appellant_deceased, &:veteran_appellant_deceased? | ||
|
||
attribute :assigned_to_location | ||
|
||
attribute :distributed_to_a_judge, &:distributed_to_a_judge? | ||
|
||
attribute :appellant_full_name do |object| | ||
object.claimant&.name | ||
end | ||
|
||
attribute :veteran_death_date | ||
|
||
attribute :veteran_file_number | ||
|
||
attribute :veteran_full_name do |object| | ||
object.veteran ? object.veteran.name.formatted(:readable_full) : "Cannot locate" | ||
end | ||
|
||
attribute :external_id, &:uuid | ||
|
||
attribute :type | ||
attribute :vacate_type | ||
attribute :aod, &:advanced_on_docket? | ||
attribute :docket_name | ||
attribute :docket_number | ||
attribute :docket_range_date | ||
attribute :decision_date | ||
attribute :nod_date, &:receipt_date | ||
attribute :withdrawal_date | ||
|
||
attribute :caseflow_veteran_id do |object| | ||
object.veteran ? object.veteran.id : nil | ||
end | ||
|
||
attribute :docket_switch do |object| | ||
if object.docket_switch | ||
WorkQueue::DocketSwitchSerializer.new(object.docket_switch).serializable_hash[:data][:attributes] | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
100 changes: 100 additions & 0 deletions
100
app/models/serializers/work_queue/legacy_appeal_search_serializer.rb
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
# frozen_string_literal: true | ||
|
||
class WorkQueue::LegacyAppealSearchSerializer | ||
include FastJsonapi::ObjectSerializer | ||
extend Helpers::AppealHearingHelper | ||
|
||
set_type :legacy_appeal | ||
|
||
attribute :assigned_attorney | ||
attribute :assigned_judge | ||
|
||
attribute :issues do |object| | ||
object.issues.map do |issue| | ||
WorkQueue::LegacyIssueSerializer.new(issue).serializable_hash[:data][:attributes] | ||
end | ||
end | ||
|
||
attribute :hearings do |object, params| | ||
hearings(object, params) | ||
end | ||
|
||
attribute :completed_hearing_on_previous_appeal? | ||
|
||
attribute :appellant_is_not_veteran, &:appellant_is_not_veteran | ||
|
||
attribute :appellant_full_name, &:appellant_name | ||
|
||
attribute :appellant_address, &:appellant_address | ||
|
||
attribute :appellant_tz, &:appellant_tz | ||
|
||
attribute :appellant_relationship | ||
attribute :assigned_to_location | ||
attribute :vbms_id, &:sanitized_vbms_id | ||
attribute :veteran_full_name | ||
attribute :veteran_death_date | ||
attribute :veteran_appellant_deceased, &:veteran_appellant_deceased? | ||
# Aliasing the vbms_id to make it clear what we're returning. | ||
attribute :veteran_file_number, &:sanitized_vbms_id | ||
attribute :veteran_participant_id do |object| | ||
object&.veteran&.participant_id | ||
end | ||
attribute :efolder_link do | ||
ENV["CLAIM_EVIDENCE_EFOLDER_BASE_URL"] | ||
end | ||
attribute :external_id, &:vacols_id | ||
attribute :type | ||
attribute :aod | ||
attribute :docket_number | ||
attribute :docket_range_date, &:docket_date | ||
attribute :status | ||
attribute :decision_date | ||
attribute :form9_date | ||
attribute :nod_date | ||
attribute :certification_date | ||
attribute :paper_case, &:paper_case? | ||
attribute :overtime, &:overtime? | ||
attribute :caseflow_veteran_id do |object| | ||
object.veteran ? object.veteran.id : nil | ||
end | ||
|
||
attribute(:available_hearing_locations) { |object| available_hearing_locations(object) } | ||
|
||
attribute :docket_name do | ||
"legacy" | ||
end | ||
|
||
attribute :document_id do |object| | ||
latest_vacols_attorney_case_review(object)&.document_id | ||
end | ||
|
||
attribute :can_edit_document_id do |object, params| | ||
LegacyDocumentIdPolicy.new( | ||
user: params[:user], | ||
case_review: latest_vacols_attorney_case_review(object) | ||
).editable? | ||
end | ||
|
||
attribute :attorney_case_review_id do |object| | ||
latest_vacols_attorney_case_review(object)&.vacols_id | ||
end | ||
|
||
attribute :current_user_email do |_, params| | ||
params[:user]&.email | ||
end | ||
|
||
attribute :current_user_timezone do |_, params| | ||
params[:user]&.timezone | ||
end | ||
|
||
attribute :location_history do |object| | ||
object.location_history.map do |location| | ||
WorkQueue::PriorlocSerializer.new(location).serializable_hash[:data][:attributes] | ||
end | ||
end | ||
|
||
def self.latest_vacols_attorney_case_review(object) | ||
VACOLS::CaseAssignment.latest_task_for_appeal(object.vacols_id) | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.