add controllers docs
This commit is contained in:
parent
bfcba0beb7
commit
fb3320fe18
4 changed files with 55 additions and 0 deletions
|
|
@ -10,6 +10,7 @@ using SurveyLib.Core.Services;
|
|||
|
||||
namespace SurveyBackend.Controllers;
|
||||
|
||||
/// <inheritdoc />
|
||||
[ApiController]
|
||||
[Route("api/surveys")]
|
||||
public class SurveyController : ControllerBase
|
||||
|
|
@ -17,12 +18,18 @@ public class SurveyController : ControllerBase
|
|||
private readonly ISurveyService _surveyService;
|
||||
private readonly IUserContext _userContext;
|
||||
|
||||
/// <inheritdoc />
|
||||
public SurveyController(ISurveyService surveyService, IUserContext userContext)
|
||||
{
|
||||
_surveyService = surveyService;
|
||||
_userContext = userContext;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получить ВСЕ опросы
|
||||
/// </summary>
|
||||
/// <remarks>Возвращает массив вообще всех опросов</remarks>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpGet]
|
||||
[ProducesResponseType(typeof(List<OutputSurveyDto>), StatusCodes.Status200OK)]
|
||||
|
|
@ -33,6 +40,12 @@ public class SurveyController : ControllerBase
|
|||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получить опрос по ID
|
||||
/// </summary>
|
||||
/// <remarks>А что тут говорить то</remarks>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[AllowAnonymous]
|
||||
[HttpGet("{id}")]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
|
|
@ -44,6 +57,12 @@ public class SurveyController : ControllerBase
|
|||
return Ok(result);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Добавить новый опрос
|
||||
/// </summary>
|
||||
/// <remarks></remarks>
|
||||
/// <param name="dto"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize]
|
||||
[HttpPost]
|
||||
[ProducesResponseType(StatusCodes.Status201Created)]
|
||||
|
|
@ -56,6 +75,12 @@ public class SurveyController : ControllerBase
|
|||
return Created();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Удалить опрос по ID
|
||||
/// </summary>
|
||||
/// <remarks>Опрос должен быть создан тобой чтоб его удалить</remarks>
|
||||
/// <param name="id"></param>
|
||||
/// <returns></returns>
|
||||
[Authorize]
|
||||
[HttpDelete("{id}")]
|
||||
[ProducesResponseType(StatusCodes.Status404NotFound)]
|
||||
|
|
@ -67,6 +92,11 @@ public class SurveyController : ControllerBase
|
|||
return Ok();
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Получить МОИ опроса
|
||||
/// </summary>
|
||||
/// <remarks>Возвращает только опросы созданные нынешним юзером</remarks>
|
||||
/// <returns></returns>
|
||||
[Authorize]
|
||||
[HttpGet("my")]
|
||||
[ProducesResponseType(StatusCodes.Status401Unauthorized)]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue