aboutsummaryrefslogtreecommitdiffstats
path: root/src/slskd/Core/Search/Controllers/SearchesController.cs
diff options
context:
space:
mode:
authorJP Dillingham <jpdillingham@gmail.com>2021-05-29 16:55:42 -0500
committerJP Dillingham <jpdillingham@gmail.com>2021-05-29 16:55:42 -0500
commit599ebb1a2b02620d2f97da067ce9eb78ca032f46 (patch)
tree323a4090f6137d6ac6a0f6982bb7c9bd9bf6f5b9 /src/slskd/Core/Search/Controllers/SearchesController.cs
parentb65ff5de2206daad4aac6ca9b6ac9dbf5bc2fbd9 (diff)
downloadslskd-599ebb1a2b02620d2f97da067ce9eb78ca032f46.tar.gz
add find parameter to omit responses
Diffstat (limited to 'src/slskd/Core/Search/Controllers/SearchesController.cs')
-rw-r--r--src/slskd/Core/Search/Controllers/SearchesController.cs9
1 files changed, 5 insertions, 4 deletions
diff --git a/src/slskd/Core/Search/Controllers/SearchesController.cs b/src/slskd/Core/Search/Controllers/SearchesController.cs
index a027feed..18bdba15 100644
--- a/src/slskd/Core/Search/Controllers/SearchesController.cs
+++ b/src/slskd/Core/Search/Controllers/SearchesController.cs
@@ -83,14 +83,15 @@ namespace slskd.Search
/// Gets the state of the search corresponding to the specified <paramref name="id"/>.
/// </summary>
/// <param name="id">The unique id of the search.</param>
+ /// <param name="includeResponses">A value indicating whether to include search responses in the response.</param>
/// <returns></returns>
/// <response code="200">The request completed successfully.</response>
/// <response code="404">A matching search was not found.</response>
[HttpGet("{id}")]
[Authorize]
- public async Task<IActionResult> GetById([FromRoute]Guid id)
+ public async Task<IActionResult> GetById([FromRoute]Guid id, [FromQuery]bool includeResponses = false)
{
- var search = await Searches.FindAsync(search => search.Id == id);
+ var search = await Searches.FindAsync(search => search.Id == id, includeResponses);
if (search == default)
{
@@ -109,7 +110,7 @@ namespace slskd.Search
/// <response code="404">A matching search was not found.</response>
[HttpGet("{id}/responses")]
[Authorize]
- public async Task<IActionResult> GetByIdWithResponses([FromRoute] Guid id)
+ public async Task<IActionResult> GetResponsesById([FromRoute] Guid id)
{
var search = await Searches.FindAsync(search => search.Id == id, includeResponses: true);
@@ -118,7 +119,7 @@ namespace slskd.Search
return NotFound();
}
- return Ok(search);
+ return Ok(search.Responses);
}
/// <summary>