60 lines
3.7 KiB
C#
60 lines
3.7 KiB
C#
using System;
|
|
using System.Collections.Generic;
|
|
using System.Net;
|
|
using System.Web.Http;
|
|
using Kreta.Ellenorzo.BL.VN.Feljegyzes;
|
|
using Kreta.Ellenorzo.Domain.VN.Feljegyzes;
|
|
using Kreta.Ellenorzo.Dto.VN.Exception;
|
|
using Kreta.Ellenorzo.Dto.VN.Feljegyzes;
|
|
using Kreta.Ellenorzo.Enums;
|
|
using Kreta.Ellenorzo.Web.FilterAttributes;
|
|
using Kreta.Ellenorzo.WebApi.FilterAttributes;
|
|
using Kreta.Ellenorzo.WebApi.VN.Documentation;
|
|
using Kreta.Ellenorzo.WebApi.VN.Logic;
|
|
using Swashbuckle.Examples;
|
|
using Swashbuckle.Swagger.Annotations;
|
|
using static Kreta.Ellenorzo.Dto.VN.Converter.ResponseModelConverter;
|
|
|
|
namespace Kreta.Ellenorzo.WebApi.VN.Controllers
|
|
{
|
|
[ApiKeyAuthorization]
|
|
[IdpAuthorize(FelhasznaloSzerepkor.Tanulo, FelhasznaloSzerepkor.Gondviselo)]
|
|
[RoutePrefix(Constants.RoutePrefix + "/Sajat/Feljegyzesek")]
|
|
[SwaggerResponse(HttpStatusCode.InternalServerError, DescriptionLookUp.IsmeretlenHibaTortentResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
|
|
[SwaggerResponseExample(HttpStatusCode.InternalServerError, typeof(IsmeretlenHibaExample))]
|
|
[SwaggerResponse(HttpStatusCode.Unauthorized, DescriptionLookUp.JogosulatlanTokenLejartResponseLeiras, typeof(string))]
|
|
[SwaggerResponseExample(HttpStatusCode.Unauthorized, typeof(LejartTokenExample))]
|
|
[SwaggerResponse(HttpStatusCode.Forbidden, DescriptionLookUp.HozzaferesMegtagadvaResponseLeiras, typeof(string))]
|
|
[SwaggerResponseExample(HttpStatusCode.Forbidden, typeof(PermissionDeniedExample))]
|
|
[SwaggerResponse(HttpStatusCode.Conflict, DescriptionLookUp.TanevetValtottAzIntezmeny, typeof(EllenorzoExceptionResponseDto))]
|
|
[SwaggerResponseExample(HttpStatusCode.Conflict, typeof(IntezmenyMarTanevetValtottExample))]
|
|
public class FeljegyzesController : ApiController
|
|
{
|
|
/// <summary>
|
|
/// Tanuló tanítási órán tanár által generált feljegyzése
|
|
/// </summary>
|
|
/// <param name="uid">Feljegyzés Uid filter</param>
|
|
[HttpGet, Route("{uid}")]
|
|
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.FeljegyzesResponseLeiras + DescriptionOneNote.Feljegyzesek, typeof(FeljegyzesListResponseDto))]
|
|
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyExampleProvider<FeljegyzesController, FeljegyzesListResponseDto>))]
|
|
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
|
|
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
|
public FeljegyzesListResponseDto GetFeljegyzes(string uid)
|
|
{
|
|
return ((FeljegyzesFacade)Activator.CreateInstance(typeof(FeljegyzesFacade), FelhasznaloLogic.GetFelhasznalo())).GetFeljegyzes(uid);
|
|
}
|
|
|
|
/// <summary>
|
|
/// Tanuló tanítási órán tanár által generált feljegyzései
|
|
/// </summary>
|
|
[HttpGet, Route]
|
|
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.FeljegyzesListaUidVagyUidsFilterResponseLeiras + DescriptionOneNote.Feljegyzesek, typeof(FeljegyzesListResponseDto))]
|
|
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<FeljegyzesController, FeljegyzesListResponseDto>))]
|
|
[SwaggerResponse(HttpStatusCode.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
|
|
[SwaggerResponseExample(HttpStatusCode.BadRequest, typeof(ValidaciosHibaExample<FeljegyzesListRequest, FeljegyzesListRequest>))]
|
|
public HashSet<FeljegyzesListResponseDto> ListFeljegyzes([FromUri] FeljegyzesListRequestDto request)
|
|
{
|
|
return ModelToDto(((FeljegyzesFacade)Activator.CreateInstance(typeof(FeljegyzesFacade), FelhasznaloLogic.GetFelhasznalo())).ListFeljegyzes(request));
|
|
}
|
|
}
|
|
}
|