[backend/masto-client] Add account search endpoint
This commit is contained in:
parent
cca1ee70bf
commit
69e88537bd
1 changed files with 17 additions and 0 deletions
|
@ -50,6 +50,23 @@ public class SearchController(
|
||||||
return Ok(result);
|
return Ok(result);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
[HttpGet("/api/v1/accounts/search")]
|
||||||
|
[Authorize("read:accounts")]
|
||||||
|
[LinkPagination(20, 40)]
|
||||||
|
[ProducesResponseType(StatusCodes.Status200OK, Type = typeof(List<AccountEntity>))]
|
||||||
|
[ProducesResponseType(StatusCodes.Status404NotFound, Type = typeof(MastodonErrorResponse))]
|
||||||
|
public async Task<IActionResult> SearchAccounts(
|
||||||
|
SearchSchemas.SearchRequest search, MastodonPaginationQuery pagination
|
||||||
|
)
|
||||||
|
{
|
||||||
|
if (search.Query == null)
|
||||||
|
throw GracefulException.BadRequest("Query is missing or invalid");
|
||||||
|
|
||||||
|
var result = await SearchUsersAsync(search, pagination);
|
||||||
|
|
||||||
|
return Ok(result);
|
||||||
|
}
|
||||||
|
|
||||||
[SuppressMessage("ReSharper", "EntityFramework.UnsupportedServerSideFunctionCall",
|
[SuppressMessage("ReSharper", "EntityFramework.UnsupportedServerSideFunctionCall",
|
||||||
Justification = "Inspection doesn't know about the Projectable attribute")]
|
Justification = "Inspection doesn't know about the Projectable attribute")]
|
||||||
private async Task<List<AccountEntity>> SearchUsersAsync(
|
private async Task<List<AccountEntity>> SearchUsersAsync(
|
||||||
|
|
Loading…
Add table
Reference in a new issue