This commit is contained in:
@@ -75,24 +75,26 @@ namespace AyaNova.Api.Controllers
|
||||
/// <param name="ayaType"></param>
|
||||
/// <param name="id"></param>
|
||||
/// <param name="phrase"></param>
|
||||
/// <param name="max"></param>
|
||||
/// <returns>A search result excerpt of object</returns>
|
||||
[HttpGet("Info/{ayaType}/{id}")]
|
||||
public async Task<IActionResult> GetInfo([FromRoute] AyaType ayaType, [FromRoute] long id, [FromQuery] string phrase)
|
||||
public async Task<IActionResult> GetInfo([FromRoute] AyaType ayaType, [FromRoute] long id, [FromQuery] string phrase, [FromQuery] int max = 80)
|
||||
{
|
||||
if (serverState.IsClosed)
|
||||
return StatusCode(503, new ApiErrorResponse(serverState.ApiErrorCode, null, serverState.Reason));
|
||||
|
||||
|
||||
if (!Authorized.HasReadFullRole(HttpContext.Items, ayaType))
|
||||
return StatusCode(403, new ApiNotAuthorizedResponse());
|
||||
|
||||
if (!ModelState.IsValid)
|
||||
return BadRequest(new ApiErrorResponse(ModelState));
|
||||
if(id==0){
|
||||
return NotFound();
|
||||
if (id == 0)
|
||||
{
|
||||
return NotFound();
|
||||
}
|
||||
|
||||
var res = await Search.GetInfoAsync(ct, UserTranslationIdFromContext.Id(HttpContext.Items),
|
||||
UserRolesFromContext.Roles(HttpContext.Items),UserIdFromContext.Id(HttpContext.Items), phrase, ayaType, id);
|
||||
|
||||
var res = await Search.GetInfoAsync(ct, UserTranslationIdFromContext.Id(HttpContext.Items),
|
||||
UserRolesFromContext.Roles(HttpContext.Items), UserIdFromContext.Id(HttpContext.Items), phrase, max, ayaType, id);
|
||||
|
||||
return Ok(ApiOkResponse.Response(res, true));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user