Add search api for apps/devices/instances #4764
Open
+370
−14
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.
Closes #4756
Description
Adds
GET /api/v1/search
as a general search endpoint for a user's resources.For this iteration, it searches Applications, Instances and Devices in a given team using their
name
property.The endpoint accepts two query params:
team
: the team id to search within. This is a required property for this iteration - but will allow us to enable account-wide search for a user in the future if so needed.query
: string search term.I have reused existing model find functions by adding an optional query parameter.
The response object looks like this. Each object in the
results
array has anobject
property to identify the type of thing it is. It then contains properties for that thing largely consistent with existing 'summary' views. This should give us enough info to render the search results sensibly.For instances, there are a couple more bits to look at adding around dashboard usage and current state - but this should be good enough to get started.