Skip to content

Commit

Permalink
fix claim docs
Browse files Browse the repository at this point in the history
  • Loading branch information
aherzberg committed Oct 24, 2024
1 parent a01fbef commit f086b85
Show file tree
Hide file tree
Showing 8 changed files with 50 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,8 @@ def create_events_for_documents(attributes)
tracked_item_id: document['trackedItemId'],
upload_date: document['uploadDate'],
file_type: document['documentTypeLabel'],
filename: document['originalFileName']
filename: document['originalFileName'],
document_id: document['documentId']
)
end
end
Expand Down Expand Up @@ -173,7 +174,8 @@ def create_documents(documents)
# no document type field available
document_type: nil,
filename: document['originalFileName'],
upload_date: document['uploadDate']
upload_date: document['uploadDate'],
document_id: document['documentId']
}
ClaimDocument.new(document_hash)
end
Expand Down
1 change: 1 addition & 0 deletions modules/mobile/app/models/mobile/v0/claim_document.rb
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class ClaimDocument < Common::Resource
attribute :document_type, Types::Nil
attribute :filename, Types::String
attribute :upload_date, Types::Date
attribute :document_id, Types::String
end
end
end
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ class ClaimEventTimeline < Common::Resource
attribute :file_type, Types::String.optional.default(nil)
attribute :document_type, Types::String.optional.default(nil)
attribute :filename, Types::String.optional.default(nil)
attribute :document_id, Types::String.optional.default(nil)
end
end
end
36 changes: 18 additions & 18 deletions modules/mobile/docs/index.html

Large diffs are not rendered by default.

10 changes: 10 additions & 0 deletions modules/mobile/docs/openapi.json
Original file line number Diff line number Diff line change
Expand Up @@ -11519,6 +11519,10 @@
"upload_date": {
"type": "string",
"example": "2023-03-01"
},
"document_id": {
"type": "string",
"example": "{6A6DFA79-4EC9-4E58-9653-25BDCFB06A03}"
}
}
},
Expand Down Expand Up @@ -11602,6 +11606,12 @@
"filename": {
"type": "string",
"example": "7B434B58-477C-4379-816F-05E6D3A10487.pdf"
},
"document_id": {
"type": "string",
"description": "Only used for other_documents_list type event for untracked documents",
"nullable": true,
"example": "{6A6DFA79-4EC9-4E58-9653-25BDCFB06A03}"
}
}
},
Expand Down
3 changes: 3 additions & 0 deletions modules/mobile/docs/schemas/claimDocument.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,6 @@ properties:
upload_date:
type: string
example: '2023-03-01'
document_id:
type: string
example: '{6A6DFA79-4EC9-4E58-9653-25BDCFB06A03}'
7 changes: 6 additions & 1 deletion modules/mobile/docs/schemas/claimEventTimeline.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,4 +57,9 @@ properties:
example: null
filename:
type: string
example: '7B434B58-477C-4379-816F-05E6D3A10487.pdf'
example: '7B434B58-477C-4379-816F-05E6D3A10487.pdf'
document_id:
type: string
description: 'Only used for other_documents_list type event for untracked documents'
nullable: true
example: '{6A6DFA79-4EC9-4E58-9653-25BDCFB06A03}'
Original file line number Diff line number Diff line change
Expand Up @@ -32,15 +32,22 @@
tracked_item_with_docs = response.parsed_body.dig('data', 'attributes', 'eventsTimeline').select do |event|
event['trackedItemId'] == 360_052
end.first
untracked_document = response.parsed_body.dig('data', 'attributes', 'eventsTimeline').select do |event|
event['type'] == 'other_documents_list'
end.first

expect(response).to have_http_status(:ok)
expect(response.body).to match_json_schema('individual_claim', strict: true)

expect(tracked_item_with_docs['documents'].count).to eq(1)
expect(tracked_item_with_docs['uploaded']).to eq(true)
expect(tracked_item_with_docs.dig('documents', 0, 'documentId')).to eq('{883B6CC8-D726-4911-9C65-2EB360E12F52}')

expect(tracked_item_with_no_docs['documents'].count).to eq(0)
expect(tracked_item_with_no_docs['uploaded']).to eq(false)

expect(untracked_document['documentId']).to eq('{6A6DFA79-4EC9-4E58-9653-25BDCFB06A03}')

uploaded_of_events = response.parsed_body.dig('data', 'attributes', 'eventsTimeline').pluck('uploaded').compact
date_of_events = response.parsed_body.dig('data', 'attributes', 'eventsTimeline').pluck('date')

Expand Down

0 comments on commit f086b85

Please sign in to comment.