This repository has been archived by the owner on Oct 17, 2020. It is now read-only.
[Feature] Make Filter structure in Search package more extendible #879
Labels
enhancement
New feature or request
What is the problem?
There is an inherent coupling between Resource and Order structures in Filter and it is quite difficult to extend when we try to add more resources or order by classes. That is., there is a requirement for every Resource to support each Order bys which will not be the case at all times.
When trying to add a new
Resource
:ArrangeResource
. That would mean that we need to implement those methods in all existing structures which implementsOrder
(say CreatedTime ). But, the newly added Resource may not even have any field related to created time.When trying to add a new
Order
:Order
interface (currently hasArrangeShortLinks
,ArrangeUsers
). But, this new Order By is related only to ShortLinks.Your solution
Will have to think through to come up with a more generic solution.
Alternatives considered
For resources not supporting a particular order by, we can throw
NotApplicable
error when the package's client tries to order by the unsupported order by. This will also include validating in NewFilter that the resource and order arrays are compatible with each other.The text was updated successfully, but these errors were encountered: