docs: #284 api added
This commit is contained in:
parent
d391be3369
commit
b2639e5367
@ -1008,7 +1008,6 @@ namespace RMuseum.Controllers
|
||||
[Authorize]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(IEnumerable<GanjoorPoemCorrectionViewModel>))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
[ProducesResponseType((int)HttpStatusCode.NotFound)]
|
||||
public async Task<IActionResult> GetUserCorrections([FromQuery] PagingParameterModel paging)
|
||||
{
|
||||
Guid userId =
|
||||
@ -1025,6 +1024,30 @@ namespace RMuseum.Controllers
|
||||
return Ok(res.Result.Items);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get list of all suggested corrections
|
||||
/// </summary>
|
||||
/// <param name="paging"></param>
|
||||
/// <returns></returns>
|
||||
[HttpGet]
|
||||
[Route("corrections/all")]
|
||||
[Authorize(Policy = RMuseumSecurableItem.GanjoorEntityShortName + ":" + SecurableItem.ModifyOperationShortName)]
|
||||
[ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(IEnumerable<GanjoorPoemCorrectionViewModel>))]
|
||||
[ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))]
|
||||
public async Task<IActionResult> GetAllCorrections([FromQuery] PagingParameterModel paging)
|
||||
{
|
||||
|
||||
var res =
|
||||
await _ganjoorService.GetUserCorrections(Guid.Empty, paging);
|
||||
|
||||
// Paging Header
|
||||
HttpContext.Response.Headers.Add("paging-headers", JsonConvert.SerializeObject(res.Result.PagingMeta));
|
||||
|
||||
if (!string.IsNullOrEmpty(res.ExceptionString))
|
||||
return BadRequest(res.ExceptionString);
|
||||
return Ok(res.Result.Items);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// effective corrections for poem
|
||||
/// </summary>
|
||||
|
||||
@ -1058,6 +1058,13 @@
|
||||
<param name="paging"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.GanjoorController.GetAllCorrections(RSecurityBackend.Models.Generic.PagingParameterModel)">
|
||||
<summary>
|
||||
get list of all suggested corrections
|
||||
</summary>
|
||||
<param name="paging"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
<member name="M:RMuseum.Controllers.GanjoorController.GetPoemEffectiveCorrections(System.Int32,RSecurityBackend.Models.Generic.PagingParameterModel)">
|
||||
<summary>
|
||||
effective corrections for poem
|
||||
@ -10073,9 +10080,9 @@
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.IGanjoorService.GetUserCorrections(System.Guid,RSecurityBackend.Models.Generic.PagingParameterModel)">
|
||||
<summary>
|
||||
get user corrections
|
||||
get user or all corrections
|
||||
</summary>
|
||||
<param name="userId"></param>
|
||||
<param name="userId">if sent empty returns all corrections</param>
|
||||
<param name="paging"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
@ -12574,9 +12581,9 @@
|
||||
</member>
|
||||
<member name="M:RMuseum.Services.Implementation.GanjoorService.GetUserCorrections(System.Guid,RSecurityBackend.Models.Generic.PagingParameterModel)">
|
||||
<summary>
|
||||
get user corrections
|
||||
get user or all corrections
|
||||
</summary>
|
||||
<param name="userId"></param>
|
||||
<param name="userId">if sent empty returns all corrections</param>
|
||||
<param name="paging"></param>
|
||||
<returns></returns>
|
||||
</member>
|
||||
|
||||
@ -182,9 +182,9 @@ namespace RMuseum.Services
|
||||
Task<RServiceResult<GanjoorPoemCorrectionViewModel>> GetLastUnreviewedUserCorrectionForPoem(Guid userId, int poemId);
|
||||
|
||||
/// <summary>
|
||||
/// get user corrections
|
||||
/// get user or all corrections
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="userId">if sent empty returns all corrections</param>
|
||||
/// <param name="paging"></param>
|
||||
/// <returns></returns>
|
||||
Task<RServiceResult<(PaginationMetadata PagingMeta, GanjoorPoemCorrectionViewModel[] Items)>> GetUserCorrections(Guid userId, PagingParameterModel paging);
|
||||
|
||||
@ -1678,16 +1678,16 @@ namespace RMuseum.Services.Implementation
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// get user corrections
|
||||
/// get user or all corrections
|
||||
/// </summary>
|
||||
/// <param name="userId"></param>
|
||||
/// <param name="userId">if sent empty returns all corrections</param>
|
||||
/// <param name="paging"></param>
|
||||
/// <returns></returns>
|
||||
public async Task<RServiceResult<(PaginationMetadata PagingMeta, GanjoorPoemCorrectionViewModel[] Items)>> GetUserCorrections(Guid userId, PagingParameterModel paging)
|
||||
{
|
||||
var source = from dbCorrection in
|
||||
_context.GanjoorPoemCorrections.AsNoTracking().Include(c => c.VerseOrderText).Include(c => c.User)
|
||||
where dbCorrection.UserId == userId
|
||||
where userId == Guid.Empty || dbCorrection.UserId == userId
|
||||
orderby dbCorrection.Id descending
|
||||
select
|
||||
dbCorrection;
|
||||
|
||||
Loading…
Reference in New Issue
Block a user