Feat/get latest status extensionmethod #270
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Add extension methods for Correspondence and Attachment
Description
Previously there was a lot of duplicate code regarding getting the latest status for correspondence and attachment. This was often done using standard filtering on date. However, in the statusRepository classes there are methods of retrieving them there. As each of these calls are asynchronous, another approach is to add extension methods. Extension methods helps with removing a lot of the duplicate code and is arguably easier to read and comprehend compared.
Additions:
I considered creating extensions for the Status objects instead of the whole correspondence and attachment objects, and possibly returning
CorrespondenceStatus
(as opposed toCorrespondenceStatusEntity
). However after looking at the code, retrieving latest status always uses the correspondence/attachment (meaning they are always available), and latest status is typically used with the actualStatus
, but also the fieldsStatusChanged
andStatusText
Deletions:
As these are not used, they have been temporarily removed. There may come a time where we only want the latest status and no other fields.
Related Issue(s)
Verification
Documentation