kreta/Kreta.WebApi/Ellenorzo/Kreta.Ellenorzo.WebApi/VN/Controllers/LepController.cs
2024-03-13 00:33:46 +01:00

65 lines
3.3 KiB
C#

using System;
using System.Collections.Generic;
using System.Net;
using System.Web.Http;
using Kreta.Core.Configuratiaton.Interface;
using Kreta.Ellenorzo.BL.VN.Lep;
using Kreta.Ellenorzo.Dto.VN.Exception;
using Kreta.Ellenorzo.Dto.VN.Lep;
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 Kreta.Web.Logging.Abstractions;
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 + "/Lep")]
[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 LepController : ApiController
{
private ILepConfiguration LepConfiguration { get; }
private ITraceLogger Logger { get; }
public LepController(ILepConfiguration lepConfiguration, ITraceLogger logger)
{
LepConfiguration = lepConfiguration ?? throw new ArgumentNullException(nameof(lepConfiguration));
Logger = logger ?? throw new ArgumentNullException(nameof(logger));
}
/// <summary>
/// Lázár Ervin Program előadások lekérdezése
/// </summary>
[HttpGet, Route("Eloadasok")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras, typeof(List<EloadasResponseDto>))]
public List<EloadasResponseDto> GetEloadasok()
{
return ModelToDto(((LepFacade)Activator.CreateInstance(typeof(LepFacade), FelhasznaloLogic.GetFelhasznalo(), LepConfiguration, Logger)).GetEloadasok());
}
/// <summary>
/// Lázár Ervin Program előadás engedélyezése, elutasítása vagy függőbe tétele.
/// </summary>
[HttpPost, Route("Eloadasok/GondviseloEngedelyezes")]
[IdpAuthorize(FelhasznaloSzerepkor.Gondviselo)]
[SwaggerResponse(HttpStatusCode.NoContent, DescriptionLookUp.GondviseloEngedelyezes)]
[SwaggerRequestExample(typeof(GondviseloEngedelyezesRequestDto), typeof(GondviseloEngedelyezesRequestDto))]
public void GondviseloEngedelyezes(GondviseloEngedelyezesRequestDto request)
{
((LepFacade)Activator.CreateInstance(typeof(LepFacade), FelhasznaloLogic.GetFelhasznalo())).GondviseloEngedelyezes(request);
}
}
}