From 5a543b434065501a56a3178188c9d091633e0971 Mon Sep 17 00:00:00 2001 From: Hamid Reza Mohammadi Date: Sun, 30 Jan 2022 19:01:33 +0330 Subject: [PATCH] docs: #275 api/poetspecs/unpublished/next GET API --- ...GanjoorPoetSuggestedSpecLinesController.cs | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/RMuseum/Controllers/GanjoorPoetSuggestedSpecLinesController.cs b/RMuseum/Controllers/GanjoorPoetSuggestedSpecLinesController.cs index 5baa6cc6..9179d218 100644 --- a/RMuseum/Controllers/GanjoorPoetSuggestedSpecLinesController.cs +++ b/RMuseum/Controllers/GanjoorPoetSuggestedSpecLinesController.cs @@ -1,5 +1,6 @@ using Microsoft.AspNetCore.Authorization; using Microsoft.AspNetCore.Mvc; +using RMuseum.Models.Auth.Memory; using RMuseum.Models.Ganjoor.ViewModels; using RMuseum.Services; using System.Net; @@ -28,6 +29,27 @@ namespace RMuseum.Controllers return Ok(res.Result); } + /// + /// return the next unpublished suggested line for poets + /// + /// + /// + + [HttpGet("unpublished/next")] + [Authorize(Policy = RMuseumSecurableItem.GanjoorEntityShortName + ":" + RMuseumSecurableItem.ModeratePoetPhotos)] + [ProducesResponseType((int)HttpStatusCode.OK, Type = typeof(GanjoorPoetSuggestedSpecLineViewModel))] + [ProducesResponseType((int)HttpStatusCode.BadRequest, Type = typeof(string))] + [ProducesResponseType((int)HttpStatusCode.NotFound)] + public async Task GetNextUnmoderatedPoetSuggestedSpecLineAsync(int skip) + { + var res = await _ganjoorService.GetNextUnmoderatedPoetSuggestedSpecLineAsync(skip); + if (!string.IsNullOrEmpty(res.ExceptionString)) + return BadRequest(res.ExceptionString); + if (res.Result == null) + return NotFound(); + return Ok(res.Result); + } + ///