This commit is contained in:
skidoodle 2024-03-13 00:33:46 +01:00
commit e124a47765
19374 changed files with 9806149 additions and 0 deletions

Binary file not shown.

Binary file not shown.

View file

@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.Linq;
using System.Reflection;
namespace Kreta.Ellenorzo.WebApi.VN.Logic
{
/// <summary>
/// Author: Kovács Kornél (DevKornél) Created On: 2019.06.
/// </summary>
internal static class EnumLogic
{
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance", "CA1811:AvoidUncalledPrivateCode")]
public static IEnumerable<(int Id, string Nev, string Leiras)> GetEnumWithDisplayNameAttribute(Type enumType)
{
foreach (object item in Enum.GetValues(enumType))
{
(int Id, string Nev, string Leiras) returnObject = ((int)item, item.ToString(), null);
FieldInfo fieldInfo = item.GetType().GetField(returnObject.Nev);
if (fieldInfo != null)
{
DisplayAttribute attributes = (DisplayAttribute)fieldInfo.GetCustomAttributes(typeof(DisplayAttribute), false).FirstOrDefault();
if (attributes != null)
{
returnObject.Leiras = attributes.GetName();
}
}
yield return returnObject;
}
}
public static string GetDisplayNameAttribute<T>(T enumValue)
{
string nev = enumValue.ToString();
if (string.IsNullOrWhiteSpace(nev))
{
return null;
}
FieldInfo fieldInfo = typeof(T).GetField(nev);
if (fieldInfo != null)
{
DisplayAttribute attributes = (DisplayAttribute)fieldInfo.GetCustomAttributes(typeof(DisplayAttribute), false).FirstOrDefault();
if (attributes != null)
{
return attributes.GetName();
}
}
return null;
}
}
}

View file

@ -0,0 +1,99 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Linq;
using System.Net.Http;
using System.Security.Claims;
using System.Web;
using Kreta.Ellenorzo.Domain.VN.Common;
using Kreta.Ellenorzo.Enums;
namespace Kreta.Ellenorzo.WebApi.VN.Logic
{
internal static class FelhasznaloLogic
{
public static MobileUser GetFelhasznalo()
{
return HttpContext.Current.Items.Contains("MobileUser")
? (MobileUser)HttpContext.Current.Items["MobileUser"]
: new MobileUser(GetInstituteCode(), GetStudentId(), GetUserName(), GetTutelaryId(), GetRoles(), GetSchoolYearId(), GetApiSecurity(), GetUserIdpUniqueId(), GetStudentIdpUniqueId(), GetInstituteUniqueId());
}
private static string GetInstituteCode()
{
return GetClaims("kreta:institute_code").Single();
}
private static Guid GetInstituteUniqueId()
{
return new Guid(GetClaims("kreta:institute_unique_id").Single());
}
private static ApiSecurity GetApiSecurity()
{
if (bool.Parse(ConfigurationManager.AppSettings["IsApiSecurityEnabled"]))
{
var header = ((HttpRequestMessage)HttpContext.Current.Items["MS_HttpRequestMessage"]).Headers;
return new ApiSecurity(header.Authorization.Parameter, header.First(x => x.Key == "s").Value.First());
}
else
{
return null;
}
}
private static int GetInstituteUserId()
{
var claim = GetClaims("kreta:institute_user_id").Single();
return int.Parse(claim);
}
private static int GetSchoolYearId()
{
var claim = GetClaims("kreta:school_year_id").Single();
return int.Parse(claim);
}
private static int? GetTutelaryId()
=> HasRole(FelhasznaloSzerepkor.Gondviselo) ? GetInstituteUserId() : (int?)null;
private static int GetStudentId()
=> HasRole(FelhasznaloSzerepkor.Gondviselo) ? int.Parse(GetClaims("kreta:student_id").Single()) : GetInstituteUserId();
private static Guid GetUserIdpUniqueId()
{
return new Guid(GetClaims("kreta:institute_user_idp_unique_id").Single());
}
private static Guid GetStudentIdpUniqueId()
=> HasRole(FelhasznaloSzerepkor.Gondviselo) ? new Guid(GetClaims("kreta:student_idp_unique_id").Single()) : GetUserIdpUniqueId();
private static string GetUserName()
{
return GetClaims("kreta:user_name").Single();
}
private static IEnumerable<FelhasznaloSzerepkor> GetRoles()
{
var result = new List<FelhasznaloSzerepkor>();
var roles = GetClaims(ClaimTypes.Role);
foreach (var role in roles)
{
if (Enum.TryParse(role, out FelhasznaloSzerepkor enumValue))
{
result.Add(enumValue);
}
}
return result;
}
private static IEnumerable<string> GetClaims(string type)
{
return ClaimsPrincipal.Current.Claims.Where(x => x.Type == type).Select(x => x.Value);
}
private static bool HasRole(FelhasznaloSzerepkor felhasznaloSzerepkor) => GetRoles().Count(x => x == felhasznaloSzerepkor) == 1;
}
}

View file

@ -0,0 +1,7 @@
namespace Kreta.Ellenorzo.WebApi.VN
{
internal static class Constants
{
public const string RoutePrefix = "V3";
}
}

View file

@ -0,0 +1,40 @@
using System;
using System.Net;
using System.Web.Http;
using Kreta.Ellenorzo.BL.VN.Bejelentes;
using Kreta.Ellenorzo.Dto.VN.Exception;
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;
namespace Kreta.Ellenorzo.WebApi.VN.Controllers
{
[ApiKeyAuthorization]
[IdpAuthorize(FelhasznaloSzerepkor.Tanulo, FelhasznaloSzerepkor.Gondviselo)]
[RoutePrefix(Constants.RoutePrefix)]
[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 BejelentesController : ApiController
{
/// <summary>
/// Covid fertőzöttség bejelentése
/// </summary>
[IdpAuthorize(FelhasznaloSzerepkor.Gondviselo)]
[HttpPost, Route("Bejelentes/Covid")]
[SwaggerResponse(HttpStatusCode.NoContent, DescriptionLookUp.CovidBejelentesResponseLeiras)]
public void CovidBejelentes()
{
((BejelentesFacade)Activator.CreateInstance(typeof(BejelentesFacade), FelhasznaloLogic.GetFelhasznalo())).CovidBejelentes();
}
}
}

View file

@ -0,0 +1,59 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Web.Http;
using Kreta.Ellenorzo.BL.VN.BejelentettSzamonkeres;
using Kreta.Ellenorzo.Domain.VN.BejelentettSzamonkeres;
using Kreta.Ellenorzo.Dto.VN.BejelentettSzamonkeres;
using Kreta.Ellenorzo.Dto.VN.Exception;
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)]
[SwaggerResponse(HttpStatusCode.InternalServerError, DescriptionLookUp.IsmeretlenHibaTortentResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.InternalServerError, typeof(IsmeretlenHibaExample))]
[SwaggerResponse(HttpStatusCode.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.BadRequest, typeof(ValidaciosHibaExample<BejelentettSzamonkeresListRequest, BejelentettSzamonkeresListRequest>))]
[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 BejelentettSzamonkeresController : ApiController
{
/// <summary>
/// Bejelentett számonkérések lekérdezése
/// </summary>
[HttpGet, Route("Sajat/BejelentettSzamonkeresek")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras + DescriptionOneNote.BejelentettSzamonkeresek, typeof(BejelentettSzamonkeresListResponseDto))]
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<BejelentettSzamonkeresController, BejelentettSzamonkeresListResponseDto>))]
public HashSet<BejelentettSzamonkeresListResponseDto> ListBejelentettSzamonkeres([FromUri] BejelentettSzamonkeresListRequestDto request)
{
return ModelToDto(((BejelentettSzamonkeresFacade)Activator.CreateInstance(typeof(BejelentettSzamonkeresFacade), FelhasznaloLogic.GetFelhasznalo())).ListBejelentettSzamonkeres(request));
}
/// <summary>
/// Bejelentett számonkérés lekérdezése uid alapján
/// </summary>
/// <param name="uid">Bejelentett számonkérés Uid filter</param>
[HttpGet, Route("Sajat/BejelentettSzamonkeresek/{uid}")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras + DescriptionOneNote.BejelentettSzamonkeresek, typeof(BejelentettSzamonkeresListResponseDto))]
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
public BejelentettSzamonkeresListResponseDto GetBejelentettSzamonkeres(string uid)
{
return ((BejelentettSzamonkeresFacade)Activator.CreateInstance(typeof(BejelentettSzamonkeresFacade), FelhasznaloLogic.GetFelhasznalo())).GetBejelentettSzamonkeres(uid);
}
}
}

View file

@ -0,0 +1,52 @@
using System;
using System.Net;
using System.Net.Http;
using System.Web.Http;
using Kreta.BusinessLogic.Interfaces;
using Kreta.Ellenorzo.BL.VN.Ora;
using Kreta.Ellenorzo.Domain.VN.UniqueIdentifier;
using Kreta.Ellenorzo.Dto.VN.Exception;
using Kreta.Ellenorzo.Enums;
using Kreta.Ellenorzo.Web.FilterAttributes;
using Kreta.Ellenorzo.WebApi.FilterAttributes;
using Kreta.Ellenorzo.WebApi.VN;
using Kreta.Ellenorzo.WebApi.VN.Documentation;
using Kreta.Ellenorzo.WebApi.VN.Logic;
using Swashbuckle.Examples;
using Swashbuckle.Swagger.Annotations;
namespace Kreta.Ellenorzo.Web.VN.Controllers
{
[ApiKeyAuthorization]
[IdpAuthorize(FelhasznaloSzerepkor.Tanulo, FelhasznaloSzerepkor.Gondviselo)]
[RoutePrefix(Constants.RoutePrefix + "/Sajat")]
[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 CsatolmanyController : ApiController
{
private readonly IFileServiceHelper _fileServiceHelper;
public CsatolmanyController(IFileServiceHelper fileServiceHelper)
{
_fileServiceHelper = fileServiceHelper ?? throw new ArgumentNullException(nameof(fileServiceHelper));
}
/// <summary>
/// Csatolmány lekérdezése
/// </summary>
/// <param name="uid">A csatolmány egyedi azonosítója (Id)</param>
[HttpGet, Route("Csatolmany/{uid}")]
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
public HttpResponseMessage GetCsatolmany(string uid)
{
return ((CsatolmanyFacade)Activator.CreateInstance(typeof(CsatolmanyFacade), FelhasznaloLogic.GetFelhasznalo(), _fileServiceHelper)).GetCsatolmany(new CsatolmanyUid(uid));
}
}
}

View file

@ -0,0 +1,45 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Web.Http;
using Kreta.Ellenorzo.BL.VN.Dummy;
using Kreta.Ellenorzo.Enums;
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;
namespace Kreta.Ellenorzo.WebApi.VN.Controllers
{
[RoutePrefix(Constants.RoutePrefix)]
public class DummyEnumDocumentationController : ApiController
{
private readonly ITraceLogger _logger;
public DummyEnumDocumentationController(ITraceLogger traceLogger)
{
_logger = traceLogger;
}
/// <summary>
/// Nem hívható, technikai endpoint. Rendszerben megtalálható enum értékek lekérdezése.
/// </summary>
[HttpGet, Route("DummyEnum")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.DummyEnumResponseLeiras, typeof(Dictionary<string, string>)), SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyEnumExampleProvider))]
#pragma warning disable S4049 // Properties should be preferred
public Dictionary<string, string> GetDummyEnum() => new Dictionary<string, string>();
#pragma warning restore S4049 // Properties should be preferred
/// <summary>
/// Nem hívható, technikai endpoint. Még el nem készült BE fejlesztések tesztelésére.
/// </summary>
[HttpGet, Route("ListDummy")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListDummyResponseLeiras, typeof(List<object>))]
[IdpAuthorize(FelhasznaloSzerepkor.Tanulo, FelhasznaloSzerepkor.Gondviselo)]
public List<object> ListDummy()
{
return ((DummyFacade)Activator.CreateInstance(typeof(DummyFacade), FelhasznaloLogic.GetFelhasznalo())).ListDummy(_logger);
}
}
}

View file

@ -0,0 +1,129 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Web.Http;
using Kreta.Core.FeatureToggle;
using Kreta.Ellenorzo.BL.VN.Ertekeles;
using Kreta.Ellenorzo.BL.VN.Ertekeles.Atlag.OsztalyAtlag;
using Kreta.Ellenorzo.BL.VN.Ertekeles.Atlag.TantargyiAtlag;
using Kreta.Ellenorzo.Domain.VN.Ertekeles;
using Kreta.Ellenorzo.Domain.VN.Ertekeles.Atlag.OsztalyAtlag;
using Kreta.Ellenorzo.Domain.VN.UniqueIdentifier;
using Kreta.Ellenorzo.Dto.VN.Ertekeles;
using Kreta.Ellenorzo.Dto.VN.Ertekeles.Atlag.OsztalyAtlag;
using Kreta.Ellenorzo.Dto.VN.Ertekeles.Atlag.TantargyiAtlag;
using Kreta.Ellenorzo.Dto.VN.Exception;
using Kreta.Ellenorzo.Enums;
using Kreta.Ellenorzo.Enums.VN;
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)]
[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 ErtekelesController : ApiController
{
private IFeatureContext FeatureContext { get; }
public ErtekelesController(IFeatureContext featureContext)
{
FeatureContext = featureContext ?? throw new ArgumentNullException(nameof(featureContext));
}
/// <summary>
/// Tanuló egy értékelése
/// </summary>
/// <param name="uid">Uid filter</param>
[HttpGet, Route("Sajat/Ertekelesek/{uid}")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ErtekelesResponseLeiras + DescriptionOneNote.Ertekelesek, typeof(ErtekelesListResponseDto))]
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyExampleProviderWithDependencyInjection<ErtekelesController, ErtekelesListResponseDto>))]
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
public ErtekelesListResponseDto GetErtekeles(string uid)
{
return ((ErtekelesFacade)Activator.CreateInstance(typeof(ErtekelesFacade), FelhasznaloLogic.GetFelhasznalo())).GetErtekeles(uid);
}
/// <summary>
/// Tanuló értékelései
/// </summary>
[HttpGet, Route("Sajat/Ertekelesek")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras + DescriptionOneNote.Ertekelesek, typeof(ErtekelesListResponseDto))]
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProviderWithDependencyInjection<ErtekelesController, ErtekelesListResponseDto>))]
[SwaggerResponse(HttpStatusCode.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.BadRequest, typeof(ValidaciosHibaExample<ErtekelesListRequest, ErtekelesListRequest>))]
public HashSet<ErtekelesListResponseDto> ListErtekeles([FromUri] ErtekelesListRequestDto request)
{
return ModelToDto(((ErtekelesFacade)Activator.CreateInstance(typeof(ErtekelesFacade), FelhasznaloLogic.GetFelhasznalo())).ListTanuloErtekeles(request));
}
/// <summary>
/// Tanuló bizonyítvány értékelései
/// </summary>
[HttpGet, Route("Sajat/Ertekelesek/Bizonyitvany")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras + DescriptionOneNote.Ertekelesek, typeof(ErtekelesListResponseDto))]
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProviderWithDependencyInjection<ErtekelesController, ErtekelesListResponseDto>))]
[SwaggerResponse(HttpStatusCode.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.BadRequest, typeof(ValidaciosHibaExample<ErtekelesListRequest, ErtekelesListRequest>))]
public HashSet<ErtekelesListResponseDto> ListBizonyitvany([FromUri] ErtekelesListRequestDto request)
{
return ModelToDto(((ErtekelesFacade)Activator.CreateInstance(typeof(ErtekelesFacade), FelhasznaloLogic.GetFelhasznalo())).ListTanuloErtekeles(request, ErtekelesekTipusEnum.BizonyitvanyErtekelesTipus));
}
/// <summary>
/// Tanuló évközi + egyéb (modulzáró vizsga, pótvizsga...) értékelései
/// </summary>
[HttpGet, Route("Sajat/Ertekelesek/NemBizonyitvany")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras + DescriptionOneNote.Ertekelesek, typeof(ErtekelesListResponseDto))]
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProviderWithDependencyInjection<ErtekelesController, ErtekelesListResponseDto>))]
[SwaggerResponse(HttpStatusCode.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.BadRequest, typeof(ValidaciosHibaExample<ErtekelesListRequest, ErtekelesListRequest>))]
public HashSet<ErtekelesListResponseDto> ListNemBizonyitvanyok([FromUri] ErtekelesListRequestDto request)
{
return ModelToDto(((ErtekelesFacade)Activator.CreateInstance(typeof(ErtekelesFacade), FelhasznaloLogic.GetFelhasznalo())).ListTanuloErtekeles(request, ErtekelesekTipusEnum.NemBizonyitvanyErtekelesTipus));
}
/// <summary>
/// Tanuló összes tanult tantárgyának átlaga
/// </summary>
[HttpGet, Route("Sajat/Ertekelesek/Atlagok/TantargyiAtlagok")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.TantargyiAtlagResponseLeiras + DescriptionOneNote.TantargyiAtlagok, typeof(SajatTantargyiAtlagListResponseDto))]
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProviderWithDependencyInjection<ErtekelesController, SajatTantargyiAtlagListResponseDto>))]
public List<SajatTantargyiAtlagListResponseDto> ListAktualisTanuloTantargyiAtlag([FromUri] SajatTantargyiAtlagListRequestDto request)
{
return ModelToDto(((TantargyiAtlagFacade)Activator.CreateInstance(typeof(TantargyiAtlagFacade), FelhasznaloLogic.GetFelhasznalo(), FeatureContext)).ListAktualisTanuloTantargyiAtlag(request));
}
/// <summary>
/// Tanuló összes tanult tantárgyának átlaga és osztályátlaga
/// </summary>
[HttpGet, Route("Sajat/Ertekelesek/Atlagok/OsztalyAtlagok")]
[SwaggerResponse(HttpStatusCode.OK,
DescriptionLookUp.OsztalyatlagResponseLeiras + DescriptionOneNote.OsztalyAtlagok, typeof(TanuloOsztalyCsoporthozViszonyitottTantargyiAtlagResponseDto))]
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProviderWithDependencyInjection<ErtekelesController, SajatOsztalyAtlagListResponseDto>))]
public HashSet<SajatOsztalyAtlagListResponseDto> ListOsztalyAtlag([FromUri] SajatOsztalyAtlagListRequestDto request)
{
return ModelToDto(((OsztalyAtlagFacade)Activator.CreateInstance(typeof(OsztalyAtlagFacade), FelhasznaloLogic.GetFelhasznalo()))
.ListAktualisTanuloOsztalyAtlag(new OsztalyAtlagListRequest(request.TantargyUid)
{
OktatasiNevelesiFeladatUid = new OktatasiNevelesiFeladatUid(request.OktatasiNevelesiFeladatUid),
IsAtlagNeeded = true
}));
}
}
}

View file

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Web.Http;
using Kreta.Ellenorzo.BL.VN.Faliujsag;
using Kreta.Ellenorzo.Dto.VN.Exception;
using Kreta.Ellenorzo.Dto.VN.Faliujsag;
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")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.FaliujsagResponseLeiras + DescriptionOneNote.Faliujsag, typeof(FaliujsagListResponseDto))]
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<FaliujsagController, FaliujsagListResponseDto>))]
[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.InternalServerError, DescriptionLookUp.IsmeretlenHibaTortentResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.InternalServerError, typeof(IsmeretlenHibaExample))]
[SwaggerResponse(HttpStatusCode.Conflict, DescriptionLookUp.TanevetValtottAzIntezmeny, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.Conflict, typeof(IntezmenyMarTanevetValtottExample))]
public class FaliujsagController : ApiController
{
/// <summary>
/// Tanuló számára megjelenő admin és tanár által rögzített faliújság elemek
/// </summary>
[HttpGet, Route("FaliujsagElemek")]
public HashSet<FaliujsagListResponseDto> ListFaliujsag([FromUri] FaliujsagListRequestDto request)
{
return ModelToDto(((FaliujsagFacade)Activator.CreateInstance(typeof(FaliujsagFacade), FelhasznaloLogic.GetFelhasznalo())).ListFaliujsag(request));
}
}
}

View file

@ -0,0 +1,161 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Web.Http;
using Kreta.Ellenorzo.BL.VN.Felhasznalo;
using Kreta.Ellenorzo.BL.VN.Felhasznalo.Alkalmazott.Tanar.Osztalyfonok;
using Kreta.Ellenorzo.Dto.VN.Exception;
using Kreta.Ellenorzo.Dto.VN.Felhasznalo;
using Kreta.Ellenorzo.Dto.VN.Felhasznalo.Alkalmazott.Tanar.OsztalyFonok;
using Kreta.Ellenorzo.Dto.VN.Felhasznalo.Gondviselo;
using Kreta.Ellenorzo.Dto.VN.Felhasznalo.Tanulo;
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)]
[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 FelhasznaloController : ApiController
{
/// <summary>
/// Tanulóval, gondviselőivel és intézményével kapcsolatos információk és elérhetőségek
/// </summary>
[HttpGet, Route("Sajat/TanuloAdatlap")]
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras + DescriptionLookUp.TanuloTorolveLett, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyExampleProvider<FelhasznaloController, TanuloGetResponseDto>))]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.TanuloAdataiResponseLeiras + DescriptionOneNote.Felhasznalo, typeof(TanuloGetResponseDto))]
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
public TanuloGetResponseDto GetTanuloAdatlap()
{
return ((FelhasznaloFacade)Activator.CreateInstance(typeof(FelhasznaloFacade), FelhasznaloLogic.GetFelhasznalo())).GetTanuloAdatlap();
}
/// <summary>
/// Osztályfőnökök lekérése
/// </summary>
[HttpGet, Route("Felhasznalok/Alkalmazottak/Tanarok/Osztalyfonokok")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras + DescriptionOneNote.Felhasznalo, typeof(OsztalyfonokListResponseDto))]
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<FelhasznaloController, OsztalyfonokListResponseDto>))]
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
public HashSet<OsztalyfonokListResponseDto> GetOsztalyfonokok([FromUri] OsztalyfonokListRequestDto request)
{
return ModelToDto(((OsztalyfonokFacade)Activator.CreateInstance(typeof(OsztalyfonokFacade), FelhasznaloLogic.GetFelhasznalo())).ListOsztalyfonokForTanuloAndGondviselo(request));
}
/// <summary>
/// Bankszámlaszám rögzítése a tanulóhoz.
/// </summary>
[HttpPost, Route("Sajat/Bankszamla")]
[IdpAuthorize(FelhasznaloSzerepkor.Tanulo, FelhasznaloSzerepkor.Gondviselo)]
[SwaggerResponse(HttpStatusCode.NoContent, DescriptionLookUp.BankszamlaRogzitesSikeres)]
[SwaggerRequestExample(typeof(BankszamlaRequestDto), typeof(BankszamlaRequestDto))]
public void PostBankszamla(BankszamlaRequestDto request)
{
((FelhasznaloFacade)Activator.CreateInstance(typeof(FelhasznaloFacade), FelhasznaloLogic.GetFelhasznalo())).SaveBankszamla(request);
}
/// <summary>
/// Tanuló bankszámlaszámának törlése.
/// </summary>
[HttpDelete, Route("Sajat/Bankszamla")]
[IdpAuthorize(FelhasznaloSzerepkor.Tanulo, FelhasznaloSzerepkor.Gondviselo)]
[SwaggerResponse(HttpStatusCode.NoContent, DescriptionLookUp.BankszamlaTorlesSikeres)]
public void DeleteBankszamla()
{
((FelhasznaloFacade)Activator.CreateInstance(typeof(FelhasznaloFacade), FelhasznaloLogic.GetFelhasznalo())).DeleteBankszamla();
}
/// <summary>
/// Elérhetőség rögzítése tanulóhoz vagy gondviselőhöz.
/// </summary>
[HttpPost, Route("Sajat/Elerhetoseg")]
[IdpAuthorize(FelhasznaloSzerepkor.Tanulo, FelhasznaloSzerepkor.Gondviselo)]
[SwaggerResponse(HttpStatusCode.NoContent, DescriptionLookUp.ElerhetosegRogzitesSikeres)]
[SwaggerRequestExample(typeof(ElerhetosegRequestDto), typeof(ElerhetosegRequestDto))]
public void PostElerhetoseg(ElerhetosegRequestDto request)
{
((FelhasznaloFacade)Activator.CreateInstance(typeof(FelhasznaloFacade), FelhasznaloLogic.GetFelhasznalo())).SaveElerhetoseg(request);
}
/// <summary>
/// A gondviselő "Törvényes képviselő" tulajdonságának lekérdezése.
/// </summary>
[HttpGet, Route("Gondviselo/IsTorvenyesKepviselo")]
[IdpAuthorize(FelhasznaloSzerepkor.Gondviselo)]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.IsTorvenyesKepviseloResponseLeiras + DescriptionOneNote.Felhasznalo)]
//[SwaggerResponseExample(HttpStatusCode.OK, typeof(bool))]
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras + DescriptionLookUp.GonviseloTorolveLett, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
public bool IsTorvenyesKepviselo()
{
return ((FelhasznaloFacade)Activator.CreateInstance(typeof(FelhasznaloFacade), FelhasznaloLogic.GetFelhasznalo())).IsTorvenyesKepviselo();
}
/// <summary>
/// Gondviselő 4T adatainak lekérdezése
/// </summary>
[HttpGet, Route("Sajat/GondviseloAdatlap")]
[IdpAuthorize(FelhasznaloSzerepkor.Gondviselo)]
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras + DescriptionLookUp.GonviseloTorolveLett, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyExampleProvider<FelhasznaloController, GondviseloAdatokResponseDto>))]
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.GondviseloAdataiResponseLeiras + DescriptionOneNote.Felhasznalo, typeof(GondviseloAdatokResponseDto))]
public GondviseloAdatokResponseDto GetGondviseloAdatlap()
{
return ((FelhasznaloFacade)Activator.CreateInstance(typeof(FelhasznaloFacade), FelhasznaloLogic.GetFelhasznalo())).GetGondviseloAdatlap();
}
/// <summary>
/// Gondviselő 4T adatainak módosítása
/// </summary>
[HttpPut, Route("Sajat/GondviseloAdatlap")]
[IdpAuthorize(FelhasznaloSzerepkor.Gondviselo)]
[SwaggerResponse(HttpStatusCode.NoContent, DescriptionLookUp.GondviseloAdatokRogziteseSikeres)]
[SwaggerRequestExample(typeof(GondviseloBaseAdatlapRequestDto), typeof(GondviseloBaseAdatlapRequestDto))]
public void PutGondviseloAdatlap(GondviseloBaseAdatlapRequestDto request)
{
((FelhasznaloFacade)Activator.CreateInstance(typeof(FelhasznaloFacade), FelhasznaloLogic.GetFelhasznalo())).UpdateGondviseloAdatlap(request);
}
/// <summary>
/// Gondviselő eszköz igényléshez szükséges adatainak elküldése
/// </summary>
[HttpPost, Route("Sajat/GondviseloEszkozIgenyles")]
[IdpAuthorize(FelhasznaloSzerepkor.Gondviselo)]
[SwaggerResponse(HttpStatusCode.NoContent, DescriptionLookUp.GondviseloEszkozIgenylesAdatokRogziteseSikeres)]
[SwaggerRequestExample(typeof(RegisztracioRequestDto), typeof(RegisztracioRequestDto))]
public void PostGondviseloEszkozIgenyles(RegisztracioRequestDto request)
{
((TargyiEszkozFacade)Activator.CreateInstance(typeof(TargyiEszkozFacade), FelhasznaloLogic.GetFelhasznalo())).SaveGondviseloEszkozIgenyles(request);
}
/// <summary>
/// Napi értesítés összefoglaló lekérdezése
/// </summary>
[HttpGet, Route("Sajat/NapiErtesitesOsszefoglalo")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.NapiErtesitesOsszefoglaloResponseLeiras + DescriptionOneNote.Felhasznalo, typeof(NapiErtesitesOsszefoglaloResponseDto))]
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
public NapiErtesitesOsszefoglaloResponseDto GetNapiErtesitesOsszefoglalo()
{
return ((FelhasznaloFacade)Activator.CreateInstance(typeof(FelhasznaloFacade), FelhasznaloLogic.GetFelhasznalo())).GetNapiErtesitesOsszefoglalo();
}
}
}

View file

@ -0,0 +1,60 @@
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));
}
}
}

View file

@ -0,0 +1,87 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Web.Http;
using Kreta.Ellenorzo.BL.VN.Fogadoora;
using Kreta.Ellenorzo.Domain.VN.Fogadoora;
using Kreta.Ellenorzo.Dto.VN.Exception;
using Kreta.Ellenorzo.Dto.VN.Fogadoora;
using Kreta.Ellenorzo.Dto.VN.Fogadoora.Idopont;
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.Gondviselo)]
[RoutePrefix(Constants.RoutePrefix + "/Sajat/Fogadoorak")]
[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))]
public class FogadooraController : ApiController
{
/// <summary>
/// Fogadóórák időpontjainak lekérdezése gondviselők számára
/// </summary>
[HttpGet, Route]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras + DescriptionOneNote.Fogadoorak, typeof(FogadooraListResponseDto))]
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<FogadooraController, FogadooraListResponseDto>))]
[SwaggerResponse(HttpStatusCode.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.BadRequest, typeof(ValidaciosHibaExample<FogadooraListRequest, FogadooraListRequest>))]
public HashSet<FogadooraListResponseDto> ListFogadoorak([FromUri] FogadooraListRequestDto request)
{
return ModelToDto(((FogadooraFacade)Activator.CreateInstance(typeof(FogadooraFacade), FelhasznaloLogic.GetFelhasznalo())).ListFogadoora(request));
}
/// <summary>
/// Fogadóóra lekérdezése gondviselők számára
/// </summary>
[IdpAuthorize(FelhasznaloSzerepkor.Gondviselo)]
[HttpGet, Route("{uid}")]
[SwaggerResponse(HttpStatusCode.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.BadRequest, typeof(AMuveletNemVegezhetoElTobbszorExample))]
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
public FogadooraResponseDto GetFogadoora(string uid)
{
return ((FogadooraFacade)Activator.CreateInstance(typeof(FogadooraFacade), FelhasznaloLogic.GetFelhasznalo())).GetFogadoora(uid);
}
/// <summary>
/// Jelentkezett fogadóóra időpont lemondás
/// </summary>
/// <param name="uid">Fogadóóra időpont uid-ja</param>
[IdpAuthorize(FelhasznaloSzerepkor.Gondviselo)]
[HttpDelete, Route("Idopontok/Jelentkezesek/{uid}")]
[SwaggerResponse(HttpStatusCode.NoContent, DescriptionLookUp.FogadooraIdopontDeleteResponseLeiras)]
[SwaggerResponse(HttpStatusCode.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.BadRequest, typeof(AMuveletNemVegezhetoElTobbszorExample))]
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
public void DeleteFogadooraIdopontJelentkezes(string uid)
{
((FogadooraFacade)Activator.CreateInstance(typeof(FogadooraFacade), FelhasznaloLogic.GetFelhasznalo())).DeleteFogadooraIdopontJelentkezes(new FogadooraIdopontJelentkezesDeleteRequestDto(uid));
}
/// <summary>
/// Gondviselő fogadóóra-időpont jelentkezés
/// </summary>
/// <param name="uid">Fogadóóra időpont uid-ja</param>
[IdpAuthorize(FelhasznaloSzerepkor.Gondviselo)]
[HttpPost, Route("Idopontok/Jelentkezesek/{uid}")]
[SwaggerResponse(HttpStatusCode.NoContent, DescriptionLookUp.FogadooraIdopontCreateResponseLeiras)]
public void CreateFogadooraIdopontJelentkezes(string uid)
{
((FogadooraFacade)Activator.CreateInstance(typeof(FogadooraFacade), FelhasznaloLogic.GetFelhasznalo())).CreateFogadooraIdopontJelentkezes(new FogadooraIdopontJelentkezesCreateRequestDto(uid));
}
}
}

View file

@ -0,0 +1,62 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Web.Http;
using Kreta.Ellenorzo.BL.VN.HaziFeladat;
using Kreta.Ellenorzo.Domain.VN.HaziFeladat;
using Kreta.Ellenorzo.Dto.VN.Exception;
using Kreta.Ellenorzo.Dto.VN.HaziFeladat;
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")]
[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))]
#pragma warning disable S1200 // Classes should not be coupled to too many other classes (Single Responsibility Principle)
public class HaziFeladatController : ApiController
#pragma warning restore S1200 // Classes should not be coupled to too many other classes (Single Responsibility Principle)
{
/// <summary>
/// Házi feladat entitás lekérdezése
/// </summary>
/// <param name="uid">Házi feladat Uid filter</param>
[HttpGet, Route("HaziFeladatok/{uid}")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras + DescriptionOneNote.HaziFeladatok, typeof(HaziFeladatDetailResponseDto))]
//[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyExampleProvider<HaziFeladatController, HaziFeladatDataListResponseDto>))]
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
public HaziFeladatDetailResponseDto GetHaziFeladat(string uid)
{
return ((HaziFeladatFacade)Activator.CreateInstance(typeof(HaziFeladatFacade), FelhasznaloLogic.GetFelhasznalo())).GetHaziFeladat(uid);
}
/// <summary>
/// Házi feladatok lekérdezése határidő alapján
/// </summary>
[HttpGet, Route("HaziFeladatok")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras + DescriptionOneNote.HaziFeladatok, typeof(HaziFeladatListResponseDto))]
//[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<HaziFeladatController, HaziFeladatListResponseDto>))]
[SwaggerResponse(HttpStatusCode.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.BadRequest, typeof(ValidaciosHibaExample<HaziFeladatListRequest, HaziFeladatListRequest>))]
public HashSet<HaziFeladatListResponseDto> ListHaziFeladat([FromUri] HaziFeladatListRequestDto request)
{
return ModelToDto(((HaziFeladatFacade)Activator.CreateInstance(typeof(HaziFeladatFacade), FelhasznaloLogic.GetFelhasznalo())).ListHaziFeladat(request));
}
}
}

View file

@ -0,0 +1,47 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Web.Http;
using Kreta.Ellenorzo.BL.VN.Intezmeny.Hetirend;
using Kreta.Ellenorzo.Domain.VN.Intezmeny.Hetirend;
using Kreta.Ellenorzo.Dto.VN.Exception;
using Kreta.Ellenorzo.Dto.VN.Intezmeny.Hetirend;
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)]
[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 HetirendController : ApiController
{
/// <summary>
/// Órarendhez tartozó hetirendi elemek
/// </summary>
[HttpGet, Route("Sajat/Intezmenyek/Hetirendek/Orarendi")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras + DescriptionLookUp.HetirendSzoveg + DescriptionOneNote.Hetirend,
typeof(HetirendListResponseDto))]
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<HetirendController, HetirendListResponseDto>))]
[SwaggerResponse(HttpStatusCode.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.BadRequest, typeof(ValidaciosHibaExample<HetirendListRequest, HetirendListRequest>))]
public HashSet<HetirendListResponseDto> ListHetirend([FromUri] HetirendListRequestDto request)
{
return ModelToDto(((HetirendFacade)Activator.CreateInstance(typeof(HetirendFacade), FelhasznaloLogic.GetFelhasznalo())).ListHetirend(request));
}
}
}

View file

@ -0,0 +1,41 @@
using System;
using System.Net;
using System.Web.Http;
using Kreta.Ellenorzo.BL.VN.Intezmeny;
using Kreta.Ellenorzo.Dto.VN.Exception;
using Kreta.Ellenorzo.Dto.VN.Intezmeny;
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;
namespace Kreta.Ellenorzo.WebApi.VN.Controllers
{
[ApiKeyAuthorization]
[IdpAuthorize(FelhasznaloSzerepkor.Tanulo, FelhasznaloSzerepkor.Gondviselo)]
[RoutePrefix(Constants.RoutePrefix)]
[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 IntezmenyController : ApiController
{
/// <summary>
/// Saját intézmény adatai
/// </summary>
[HttpGet, Route("Sajat/Intezmenyek")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.IntezmenyAdatai + DescriptionOneNote.Intezmeny, typeof(IntezmenyListResponseDto))]
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<IntezmenyController, IntezmenyListResponseDto>))]
public IntezmenyListResponseDto GetIntezmeny()
{
return ((IntezmenyFacade)Activator.CreateInstance(typeof(IntezmenyFacade), FelhasznaloLogic.GetFelhasznalo())).GetIntezmeny();
}
}
}

View file

@ -0,0 +1,65 @@
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);
}
}
}

View file

@ -0,0 +1,60 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Web.Http;
using Kreta.Ellenorzo.BL.VN.Mulasztas;
using Kreta.Ellenorzo.Domain.VN.Mulasztas;
using Kreta.Ellenorzo.Dto.VN.Exception;
using Kreta.Ellenorzo.Dto.VN.Mulasztas;
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)]
[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 MulasztasController : ApiController
{
/// <summary>
/// Tanuló mulasztás entitás lekérdezése
/// </summary>
/// <param name="uid">Mulasztás Uid filter</param>
[HttpGet, Route("Sajat/Mulasztasok/{uid}")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.MulasztasResponseLeiras + DescriptionOneNote.Mulasztasok, typeof(MulasztasListResponseDto))]
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyExampleProvider<MulasztasController, MulasztasListResponseDto>))]
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
public MulasztasListResponseDto GetMulasztas(string uid)
{
return ((MulasztasFacade)Activator.CreateInstance(typeof(MulasztasFacade), FelhasznaloLogic.GetFelhasznalo())).GetMulasztas(uid);
}
/// <summary>
/// Tanuló mulasztásai
/// </summary>
[HttpGet, Route("Sajat/Mulasztasok")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras + DescriptionOneNote.Mulasztasok, typeof(MulasztasListResponseDto))]
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<MulasztasController, MulasztasListResponseDto>))]
[SwaggerResponse(HttpStatusCode.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.BadRequest, typeof(ValidaciosHibaExample<MulasztasListRequest, MulasztasListRequest>))]
public HashSet<MulasztasListResponseDto> ListMulasztas([FromUri] MulasztasListRequestDto request)
{
return ModelToDto(((MulasztasFacade)Activator.CreateInstance(typeof(MulasztasFacade), FelhasznaloLogic.GetFelhasznalo())).ListMulasztas(request));
}
}
}

View file

@ -0,0 +1,65 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Web.Http;
using Kreta.Ellenorzo.BL.VN.Orarend;
using Kreta.Ellenorzo.Domain.VN.Orarend;
using Kreta.Ellenorzo.Dto.VN.Exception;
using Kreta.Ellenorzo.Dto.VN.Orarend;
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)]
[SwaggerResponse(HttpStatusCode.InternalServerError, DescriptionLookUp.IsmeretlenHibaTortentResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.InternalServerError, typeof(IsmeretlenHibaExample))]
[SwaggerResponse(HttpStatusCode.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.BadRequest, typeof(ValidaciosHibaExample<OrarendElemListRequest, OrarendElemListRequest>))]
[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 OrarendController : ApiController
{
private readonly ITraceLogger logger;
public OrarendController(ITraceLogger traceLogger)
{
logger = traceLogger;
}
/// <summary>
/// Visszaadja a tanuló órarendi elemeit egy megadott időszakra (tanév rendje eseményeket is)
/// </summary>
[HttpGet, Route("Sajat/OrarendElemek")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras + DescriptionOneNote.Orarend, typeof(OrarendElemListResponseDto))]
//[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<OrarendController, OrarendElemListResponseDto>))]
public HashSet<OrarendElemListResponseDto> ListOrarend([FromUri] OrarendElemListRequestDto request)
{
return ModelToDto(((OrarendFacade)Activator.CreateInstance(typeof(OrarendFacade), FelhasznaloLogic.GetFelhasznalo())).ListOrarend(logger, request));
}
/// <summary>
/// Órarend elem entitás lekérdezése
/// </summary>
[HttpGet, Route("Sajat/OrarendElem")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras + DescriptionOneNote.Orarend, typeof(OrarendElemListResponseDto))]
//[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<OrarendController, OrarendElemListResponseDto>))]
public OrarendElemListResponseDto GetOrarendElem([FromUri] OrarendElemGetRequestDto request)
{
return ((OrarendFacade)Activator.CreateInstance(typeof(OrarendFacade), FelhasznaloLogic.GetFelhasznalo())).GetOrarendElem(logger, request);
}
}
}

View file

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Web.Http;
using Kreta.Ellenorzo.BL.VN.OsztalyCsoport;
using Kreta.Ellenorzo.Dto.VN.Exception;
using Kreta.Ellenorzo.Dto.VN.OsztalyCsoport;
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)]
[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 OsztalyCsoportController : ApiController
{
/// <summary>
/// Osztályok és csoportok, amikbe a tanuló valaha be volt sorolva az aktuális tanévben.
/// </summary>
[HttpGet, Route("Sajat/OsztalyCsoportok")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.OsztalyCsoportLeiras + DescriptionOneNote.OsztalyCsoportok, typeof(TanuloOsztalyCsoportListResponseDto))]
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<OsztalyCsoportController, TanuloOsztalyCsoportListResponseDto>))]
public HashSet<TanuloOsztalyCsoportListResponseDto> ListTanuloOsztalyCsoport()
{
return ModelToDtoForTanulo(((OsztalyCsoportFacade)Activator.CreateInstance(typeof(OsztalyCsoportFacade), FelhasznaloLogic.GetFelhasznalo())).ListTanuloOsztalyCsoport());
}
}
}

View file

@ -0,0 +1,43 @@
using System;
using System.Collections.Generic;
using System.Net;
using System.Web.Http;
using Kreta.Ellenorzo.BL.VN.Intezmeny.TanevRendje;
using Kreta.Ellenorzo.Dto.VN.Exception;
using Kreta.Ellenorzo.Dto.VN.Intezmeny.TanevRendje;
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)]
[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 TanevRendjeController : ApiController
{
/// <summary>
/// Tanulóra vonatkozó tanév rendje elemek
/// </summary>
[HttpGet, Route("Sajat/Intezmenyek/TanevRendjeElemek")]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.TanevRendjeLeiras + DescriptionOneNote.Tanevrendje, typeof(TanevRendjeListResponseDto))]
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<TanevRendjeController, TanevRendjeListResponseDto>))]
public HashSet<TanevRendjeListResponseDto> ListTanevRendje()
{
return ModelToDto(((TanevRendjeFacade)Activator.CreateInstance(typeof(TanevRendjeFacade), FelhasznaloLogic.GetFelhasznalo())).ListTanevRendje());
}
}
}

View file

@ -0,0 +1,70 @@
using System;
using System.Net;
using System.Web.Http;
using Kreta.Ellenorzo.BL.VN.Felhasznalo;
using Kreta.Ellenorzo.Dto.VN.Exception;
using Kreta.Ellenorzo.Dto.VN.Felhasznalo.Gondviselo;
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;
namespace Kreta.Ellenorzo.WebApi.VN.Controllers
{
[ApiKeyAuthorization]
[IdpAuthorize(FelhasznaloSzerepkor.Tanulo, FelhasznaloSzerepkor.Gondviselo)]
[RoutePrefix(Constants.RoutePrefix)]
[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 TargyiEszkozController : ApiController
{
/// <summary>
/// Gondviselő eszköz igényléshez szükséges adatainak elküldése
/// </summary>
[HttpPost, Route("TargyiEszkoz/Regisztracio")]
[IdpAuthorize(FelhasznaloSzerepkor.Gondviselo)]
[SwaggerResponse(HttpStatusCode.NoContent, DescriptionLookUp.GondviseloEszkozIgenylesAdatokRogziteseSikeres)]
[SwaggerRequestExample(typeof(RegisztracioRequestDto), typeof(RegisztracioRequestDto))]
public void PostGondviseloEszkozIgenyles(RegisztracioRequestDto request)
{
((TargyiEszkozFacade)Activator.CreateInstance(typeof(TargyiEszkozFacade), FelhasznaloLogic.GetFelhasznalo())).SaveGondviseloEszkozIgenyles(request);
}
/// <summary>
/// Gondviselő regisztrált-e már
/// </summary>
[HttpGet, Route("TargyiEszkoz/IsRegisztralt")]
[IdpAuthorize(FelhasznaloSzerepkor.Gondviselo)]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.IsRegisztraltResponseLeiras)]
//[SwaggerResponseExample(HttpStatusCode.OK, typeof(bool))]
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras + DescriptionLookUp.GonviseloTorolveLett, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
public bool? IsRegisztralt()
{
return ((TargyiEszkozFacade)Activator.CreateInstance(typeof(TargyiEszkozFacade), FelhasznaloLogic.GetFelhasznalo())).IsRegisztralt();
}
/// <summary>
/// A gondviselőhöz tartozó tanulónak van-e már kiosztott eszköze
/// </summary>
[HttpGet, Route("TargyiEszkoz/IsEszkozKiosztva")]
[IdpAuthorize(FelhasznaloSzerepkor.Tanulo, FelhasznaloSzerepkor.Gondviselo)]
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.IsEszkozKiosztvaResponseLeiras)]
//[SwaggerResponseExample(HttpStatusCode.OK, typeof(bool))]
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras + DescriptionLookUp.GonviseloTorolveLett, typeof(EllenorzoExceptionResponseDto))]
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
public bool IsEszkozKiosztva()
{
return ((TargyiEszkozFacade)Activator.CreateInstance(typeof(TargyiEszkozFacade), FelhasznaloLogic.GetFelhasznalo())).IsEszkozKiosztva();
}
}
}

View file

@ -0,0 +1,16 @@
using Kreta.Core;
using Kreta.Core.Enum;
using Kreta.Ellenorzo.Dto.VN.Exception;
using Swashbuckle.Examples;
namespace Kreta.Ellenorzo.WebApi.VN.Documentation
{
public class AMuveletNemVegezhetoElTobbszorExample : EllenorzoExceptionResponseDto, IExamplesProvider
{
public AMuveletNemVegezhetoElTobbszorExample() : base(BlExceptionType.AMuveletNemVegezhetoElTobbszor, BlExceptionType.AMuveletNemVegezhetoElTobbszor.ToDisplayName())
{
}
public object GetExamples() => new AMuveletNemVegezhetoElTobbszorExample();
}
}

View file

@ -0,0 +1,105 @@
namespace Kreta.Ellenorzo.WebApi.VN.Documentation
{
internal static class DescriptionLookUp
{
public const string ListaUidVagyUidsFilterResponseLeiras = "Filter által elvárt, de nem létező resource esetén kizárólag a létező elemek szerepelnek a response-ban";
public const string TanevRendjeLeiras = "Admin által meghatározott tanulóra vonatkozó tanév rendje elemek (csak saját osztályokra vonatkozó elemek tartoznak bele).<br>";
public const string AktualisOsztalyCsoportLeiras = "Osztályok és csoportok, amibe a tanuló aktuálisan be van sorolva.";
public const string BankszamlaRogzitesSikeres = "A bankszámla rögzítése sikeresen megtörtént!";
public const string BankszamlaTorlesSikeres = "A bankszámla törlése sikeresen megtörtént!";
public const string OsztalyCsoportLeiras = "Osztályok és csoportok, amikbe a tanuló valaha be volt sorolva az aktuális tanévben.";
public const string HetirendSzoveg = "<br> A megadott intervallumba beletartozó(fedik egymást) entitásokkal tér vissza.";
public const string TanuloTorolveLett = " Abban az esetben, ha él a token, de a tanuló már törölve lett.";
public const string GonviseloTorolveLett = " Abban az esetben, ha él a token, de a gonviselo már törölve lett.";
public const string IsmeretlenHibaTortentResponseLeiras = "Ismeretlen hiba történt!";
public const string NincsNevelesOkatatasSzures = "(Nincs nevelés oktatás szűrés)";
public const string ValidaciosHibaTortentResponseLeiras = "Validációs hiba történt!";
public const string JogosulatlanTokenLejartResponseLeiras = "A token lejárt!";
public const string HozzaferesMegtagadvaResponseLeiras = "Hozzáférés megtagadva!";
public const string NemLetezoEntitasResponseLeiras = "Nem létező entitás!";
public const string TantargyiAtlagResponseLeiras = "A tanuló oktatás-nevelési feladat és tantárgyuid szűrő által leszűrt összes tanult tantárgyának az átlaga szerepel a response-ban";
public const string OsztalyatlagResponseLeiras = "A tanuló összes, vagy a Uid szűrő által leszűrt tanult tantárgyának az osztályátlaghoz viszonyított átlaga szerepel a" +
" response-ban, amennyiben engedélyezve van az osztályátlag megjelenítése az adott intézményben.";
public const string DummyEnumResponseLeiras = "A rendszerben megtalálható összes enum érték szerepel a response-ban<br>None elem csak BE számára kell, jelzi," +
" ha az enum nem tudott értéket felvenni";
public const string ListDummyResponseLeiras = "Még el nem készült BE fejlesztések találhatóak a responseban";
public const string FaliujsagResponseLeiras = "A tanuló faliújság bejegyzései, amelyek érvényesek, szerepelnek a response-ban";
public const string TanuloAdataiResponseLeiras = "A tanuló adatai szerepelnek a response-ban";
public const string GondviseloAdataiResponseLeiras = "A gondviselő adatai szerepelnek a response-ban";
public const string IsTorvenyesKepviseloResponseLeiras = "A response tartalmazza, hogy a gondviselő a tanuló törvényes képviselője-e.";
public const string FeljegyzesResponseLeiras = "A tanuló feljegyzése szerepel a response-ban" + NaplozasGyorsFeljegyzes;
public const string FeljegyzesListaUidVagyUidsFilterResponseLeiras = "Filter által elvárt, de nem létező resource esetén kizárólag "
+ "a létező elemek szerepelnek a response-ban" + NaplozasGyorsFeljegyzes;
public const string ErtekelesResponseLeiras = "A tanuló értékelése szerepel a response-ban";
public const string MulasztasResponseLeiras = "A tanuló mulasztása szerepel a response-ban";
public const string KommentCreateResponseLeiras = "Komment mentése sikeresen megtörtént";
public const string KommentDeleteResponseLeiras = "Komment törlése sikeresen megtörtént";
public const string FogadooraIdopontDeleteResponseLeiras = "Fogadóóra időpont lemondása sikeresen megtörtént.";
public const string FogadooraIdopontCreateResponseLeiras = "Fogadóóra időpontra jelentkezés sikeresen megtörtént.";
public const string NincsJogosultsaga = "Nincs jogosultsága";
public const string NaplozasGyorsFeljegyzes = "<br>+ Naplózáskor adható gyorsfeljegyzések. A külön adható" +
" feljegyzések a tanulóhoz kapcsolódnak nem osztálycsoporthoz!";
public const string TanevetValtottAzIntezmeny = "Tanévet váltott az intézmény!";
public const string Rendszermodul = "Rendszermodulok";
public const string IntezmenyAdatai = "Saját intézmény adatai";
public const string Fogadoorak = "Fogadóórák";
public const string CsatolmanyResponseLeiras = "Uid filter és típus által elvárt csatolmány szerepel a response-ban.<br>";
public const string HaziFeladatMegoldottResponseLeiras = "Házi feladat megoldottságának beállítása sikeresen megtörtént";
public const string CovidBejelentesResponseLeiras = "Covid fertőzöttség bejelentése sikeresen megtörtént";
public const string ElerhetosegRogzitesSikeres = "Az elérhetőségek rögzítése sikeresen megtörtént!";
public const string GondviseloAdatokRogziteseSikeres = "A gondviselő adatainak rögzítése sikeresen megtörtént!";
public const string GondviseloEszkozIgenylesAdatokRogziteseSikeres = "A gondviselő adatainak rögzítése sikeresen megtörtént a tanuló eszközének igényléséhez!";
public const string LepEloadasResponseLeiras = "A Lázár Ervin Program által meghirdetett előadások szerepelnek a responseban.";
public const string GondviseloEngedelyezes = "Lázár Ervin Program időpontra az engedélyezés, elutasítás vagy függőbe tétel sikeresen megtörtént.";
public const string IsEszkozKiosztvaResponseLeiras = "A response tartalmazza, hogy van-e már eszköz kiosztva a gondviselőhöz tartozó tanulónak.";
public const string IsRegisztraltResponseLeiras = "True: aktuális gondviselő már regisztrált; False: másik gondviselő már regisztrált; Null: nem regisztrált még senki.";
public const string NapiErtesitesOsszefoglaloResponseLeiras = "A napi értesítés összefoglaló adatai szerepelnek a response-ban";
}
}

View file

@ -0,0 +1,61 @@
namespace Kreta.Ellenorzo.WebApi.VN.Documentation
{
internal static class DescriptionOneNote
{
private const string LinkStart = "onenote:///\\\\egyediz-pc\\Mobil\\Biz.%20Doksik.one#";
private const string DokumentacioSection = "section-id={D298BE59-DAEA-4B0E-8604-D5CAF175D463}&amp;";
private const string ErtekelesekPage = "page-id={4382044B-228A-4FE4-8DEA-0CD9E76F238F}&amp;";
private const string TantargyiAtlagPage = "page-id={A2EE1C38-9066-4AA4-A414-5595C0255186}&amp;";
private const string OsztalyAtlagPage = "page-id={78B8FF95-FD22-4990-BE25-16E01A7CB1E9}&amp;";
private const string BejelentettSzamonkeresekPage = "page-id={36F2A8A1-7989-4C90-B76F-92EF9F53FBA2}&amp;";
private const string FaliujsagPage = "page-id={AFF0642A-5B7A-4AC3-A5FF-E7A21843F4CD}&amp;";
private const string FeljegyzesekPage = "page-id={3FFD4C76-B4F4-4630-857B-601C26350E2F}&amp;";
private const string FelhasznaloPage = "page-id={8AE3F857-3228-42D8-8D16-826B9A63304A}&amp;";
private const string FogadoorakPage = "page-id={2CD86E16-2398-4957-BD97-2C65BB013349}&amp;";
private const string HaziFeladatokPage = "page-id={F5A654B1-2698-47B9-B84C-5F56ABE0EBE9}&amp;";
private const string HetirendPage = "page-id={E87403FC-7AC1-4A5C-B8A7-4BE1AFA47CCB}&amp;";
private const string IntezmenyPage = "page-id={59A3FCE2-08BC-4B07-AA3E-2475C2323B40}&amp;";
private const string MulasztasokPage = "page-id={48D8E2BE-CCE8-4870-9FFA-8937F9525853}&amp;";
private const string OrarendPage = "page-id={64B0C490-1F41-4717-B438-F49F80D35B56}&amp;";
private const string OsztalyCsoportokPage = "page-id={B4443760-7940-4D6E-A144-05D8D3592D15}&amp;";
private const string TanevrendjePage = "page-id={8FE5080E-8B06-4698-A609-36C573E5EF3D}&amp;";
private const string OpenBoardPage = "page-id={EA1EE8FA-B566-4F3C-B4EE-534805D58093}&amp;";
private const string CsatolmanyPage = "page-id={5B9340E0-B9A9-4289-846D-98CED8A3C2EB}&amp;";
public const string Ertekelesek = " [Értékelések](" + LinkStart + "Ertekelesek&amp;" + DokumentacioSection + ErtekelesekPage + "end)";
public const string TantargyiAtlagok = " [Tantárgyi átlagok](" + LinkStart + "Ertekelesek/TantargyiAtlag&amp;" + DokumentacioSection + TantargyiAtlagPage + "end)";
public const string OsztalyAtlagok = " [Osztályátlagok](" + LinkStart + "Ertekelesek/Osztalyatlag&amp;" + DokumentacioSection + OsztalyAtlagPage + "end)";
public const string BejelentettSzamonkeresek = " [Bejelentett számonkérések](" + LinkStart + "Bejelentett%20szamonkeresek&amp;" + DokumentacioSection + BejelentettSzamonkeresekPage + "end)";
public const string Faliujsag = " [Faliújság](" + LinkStart + "Faliujsag&amp;" + DokumentacioSection + FaliujsagPage + "end)";
public const string Feljegyzesek = " [Feljegyzések](" + LinkStart + "Feljegyzesek&amp;" + DokumentacioSection + FeljegyzesekPage + "end)";
public const string Felhasznalo = " [Felhasználó](" + LinkStart + "Felhasznalo&amp;" + DokumentacioSection + FelhasznaloPage + "end)";
public const string Fogadoorak = " [Fogadóórák](" + LinkStart + "Fogadoorak&amp;" + DokumentacioSection + FogadoorakPage + "end)";
public const string HaziFeladatok = " [Házi feladatok](" + LinkStart + "Hazi%20feladatok&amp;" + DokumentacioSection + HaziFeladatokPage + "end)";
public const string Hetirend = " [Hetirend](" + LinkStart + "Hetirend&amp;" + DokumentacioSection + HetirendPage + "end)";
public const string Intezmeny = " [Intézmény](" + LinkStart + "Intezmeny&amp;" + DokumentacioSection + IntezmenyPage + "end)";
public const string Mulasztasok = " [Mulasztások](" + LinkStart + "Mulasztasok&amp;" + DokumentacioSection + MulasztasokPage + "end)";
public const string OpenBoard = " [OpenBoard](" + LinkStart + "Openboard&amp;" + DokumentacioSection + OpenBoardPage + "end)";
public const string Csatolmany = " [Csatolmany](" + LinkStart + "Csatolmany&amp;" + DokumentacioSection + CsatolmanyPage + "end)";
public const string Orarend = " [Órarend](" + LinkStart + "Orarend&amp;" + DokumentacioSection + OrarendPage + "end)";
public const string OsztalyCsoportok = " [Osztályok, Csoportok](" + LinkStart + "Osztalyok,%20Csoportok&amp;" + DokumentacioSection + OsztalyCsoportokPage + "end)";
public const string Tanevrendje = " [Tanév rendje](" + LinkStart + "Tanev%20rendje&amp;" + DokumentacioSection + TanevrendjePage + "end)";
}
}

View file

@ -0,0 +1,96 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Text.RegularExpressions;
using Kreta.Ellenorzo.Dto.VN;
using Kreta.Ellenorzo.Dto.VN.Adatszotar;
using Kreta.Ellenorzo.Dto.VN.Documentation;
using Swashbuckle.Examples;
namespace Kreta.Ellenorzo.WebApi.VN.Documentation
{
/// <summary>
/// Author: Kovács Kornél (DevKornél), Madách Ferenc Created On: 2019.06.
/// </summary>
public class DummyEnumExampleProvider : IExamplesProvider
{
#pragma warning disable S3253 // Constructor and destructor declarations should not be redundant
public DummyEnumExampleProvider()
{
}
#pragma warning restore S3253 // Constructor and destructor declarations should not be redundant
public object GetExamples()
{
IEnumerable<MethodInfo> methodInfos = Assembly.GetExecutingAssembly().GetTypes()
.Where(x => x.Namespace == Constant.WebApiDefaultNamespace)
.SelectMany(y => y.GetMethods());
IEnumerable<string> returnTypeNames = methodInfos.Where(x => x.ReturnType.AssemblyQualifiedName != null && Regex.IsMatch(x.ReturnType.AssemblyQualifiedName, @"(Kreta.*)\=null"))
.Select(x => Regex.Match(x.ReturnType.AssemblyQualifiedName, @"(Kreta.*)\=null").Value);
IEnumerable<string> requestParameterNames = methodInfos.Select(x => x.GetParameters())
.SelectMany(x => x.Select(y => y.ParameterType.AssemblyQualifiedName)
.Where(z => z != null && Regex.IsMatch(z, $@"\w+{Constant.ResponseSuffix}")));
var osztalyokNestedNelkul = returnTypeNames.Union(requestParameterNames).Select(x => Type.GetType(x)).ToList();
var osztalyok = new List<Type>();
foreach (Type item in osztalyokNestedNelkul)
{
GetNestedDtoTypes(osztalyok, item);
}
return ConvertErtekByEnumToDictionary(osztalyokNestedNelkul.Union(osztalyok));
}
private static Dictionary<string, string> ConvertErtekByEnumToDictionary(IEnumerable<Type> osztalyok)
{
var enumokEsErtekeik = new Dictionary<string, string>();
IEnumerable<(string TypeName, string TypeQualifiedName)> query =
from osztaly in osztalyok.Distinct()
from property in osztaly.GetProperties()
where property.PropertyType.Name == typeof(AdatszotarResponseDto<>).Name
let propertyGenericArgument = property.PropertyType.GenericTypeArguments[0]
select (
TypeName: propertyGenericArgument.FullName,
TypeQualifiedName: propertyGenericArgument.AssemblyQualifiedName);
foreach ((string typeName, string typeQualifiedName) in query.ToList())
{
string[] typeNameStringArray = typeName.Split('.');
if (!enumokEsErtekeik.ContainsKey(typeNameStringArray[typeNameStringArray.Length - 1]))
{
var enumErtekek = Type.GetType(typeQualifiedName).GetEnumValues().OfType<Enum>().ToList();
var enumErtekekIndexekkel = new List<(int, Enum)>();
foreach (var ertek in enumErtekek)
{
enumErtekekIndexekkel.Add((Convert.ToInt32(ertek), ertek));
}
enumokEsErtekeik.Add(typeNameStringArray[typeNameStringArray.Length - 1], string.Join(",", enumErtekekIndexekkel));
}
}
return enumokEsErtekeik;
}
private void GetNestedDtoTypes(List<Type> osztalyok, Type type)
{
foreach (PropertyInfo property in type.GetProperties().Where(property => property.PropertyType.FullName.Contains(Constant.ResponseSuffix)
&& !property.PropertyType.FullName.Contains(typeof(DocumentationExampleDto).Name)).Select(property => property))
{
osztalyok.Add(GetNestedType(property));
GetNestedDtoTypes(osztalyok, GetNestedType(property));
}
}
private static Type GetNestedType(PropertyInfo property) => property.PropertyType.FullName.Contains(typeof(AdatszotarResponseDto<>).Name)
? Type.GetType(Regex.Match(property.PropertyType.FullName, @"\[(Kreta.*)\=null").Value.Remove(0, 1))
: Type.GetType(property.PropertyType.AssemblyQualifiedName);
}
}

View file

@ -0,0 +1,63 @@
using System;
using Kreta.Core.FeatureToggle;
using Kreta.Ellenorzo.Dto.VN.Interfaces;
using Kreta.Ellenorzo.WebApi.VN.Documentation.Helper;
using Swashbuckle.Examples;
namespace Kreta.Ellenorzo.WebApi.VN.Documentation
{
/// <summary>
/// Author: Kovács Kornél (DevKornél) Created On: 2019.05.
/// </summary>
internal class DummyExampleProvider<TController, TDto> : IExamplesProvider where TController : new() where TDto : IDtoDocumentation, new()
{
public object GetExamples()
{
object response = ExampleHelper.TryGetExampleFeatureDefaultExampleModel();
if (response != null)
{
return response;
}
TDto dto = new TDto();
object[] parameterArray = dto.Example.RequestParameter == null
? new object[] { }
: new[] { dto.Example.RequestParameter };
ExampleHelper.MockUser(dto.Example.MockUserName);
return new
{
RequestExample = dto.Example.RequestParameter,
RequestExampleUser = dto.Example.MockUserName,
ResponseExample = typeof(TController).GetMethod(dto.Example.MethodName).Invoke(new TController(), parameterArray)
};
}
}
internal class DummyExampleProviderWithDependencyInjection<TController, TDto> : IExamplesProvider where TDto : IDtoDocumentation, new()
{
public object GetExamples()
{
object response = ExampleHelper.TryGetExampleFeatureDefaultExampleModel();
if (response != null)
{
return response;
}
TDto dto = new TDto();
object[] parameterArray = dto.Example.RequestParameter == null
? new object[] { }
: new[] { dto.Example.RequestParameter };
ExampleHelper.MockUser(dto.Example.MockUserName);
return new
{
RequestExample = dto.Example.RequestParameter,
RequestExampleUser = dto.Example.MockUserName,
ResponseExample = typeof(TController).GetMethod(dto.Example.MethodName).Invoke((TController)Activator.CreateInstance(typeof(TController), FeatureContext.Instance), parameterArray)
};
}
}
}

View file

@ -0,0 +1,63 @@
using System;
using Kreta.Core.FeatureToggle;
using Kreta.Ellenorzo.Dto.VN.Interfaces;
using Kreta.Ellenorzo.WebApi.VN.Documentation.Helper;
using Swashbuckle.Examples;
namespace Kreta.Ellenorzo.WebApi.VN.Documentation
{
/// <summary>
/// Author: Kovács Kornél (DevKornél) Created On: 2019.05.
/// </summary>
internal class DummyListExampleProvider<TController, TDto> : IExamplesProvider where TController : new() where TDto : IDtoListDocumentation, new()
{
public object GetExamples()
{
object response = ExampleHelper.TryGetExampleFeatureDefaultExampleModel();
if (response != null)
{
return response;
}
TDto dto = new TDto();
object[] parameterArray = dto.ListExample.RequestParameter == null
? new object[] { }
: new[] { dto.ListExample.RequestParameter };
ExampleHelper.MockUser(dto.ListExample.MockUserName);
return new
{
RequestExample = dto.ListExample.RequestParameter,
RequestExampleUser = dto.ListExample.MockUserName,
ResponseExample = typeof(TController).GetMethod(dto.ListExample.MethodName).Invoke(new TController(), parameterArray)
};
}
}
internal class DummyListExampleProviderWithDependencyInjection<TController, TDto> : IExamplesProvider where TDto : IDtoListDocumentation, new()
{
public object GetExamples()
{
object response = ExampleHelper.TryGetExampleFeatureDefaultExampleModel();
if (response != null)
{
return response;
}
TDto dto = new TDto();
object[] parameterArray = dto.ListExample.RequestParameter == null
? new object[] { }
: new[] { dto.ListExample.RequestParameter };
ExampleHelper.MockUser(dto.ListExample.MockUserName);
return new
{
RequestExample = dto.ListExample.RequestParameter,
RequestExampleUser = dto.ListExample.MockUserName,
ResponseExample = typeof(TController).GetMethod(dto.ListExample.MethodName).Invoke((TController)Activator.CreateInstance(typeof(TController), FeatureContext.Instance), parameterArray)
};
}
}
}

View file

@ -0,0 +1,68 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Web;
using Kreta.Core.Enum;
using Kreta.Core.Exceptions;
using Kreta.Ellenorzo.Domain.VN.Common;
using Kreta.Ellenorzo.Enums;
using Kreta.Ellenorzo.Enums.VN;
namespace Kreta.Ellenorzo.WebApi.VN.Documentation.Helper
{
/// <summary>
/// Author: Kovács Kornél (DevKornél) Created On: 2019.05.
/// Dokumentáció generálásához szükséges segédfüggvények
/// </summary>
internal static class ExampleHelper
{
private static readonly bool s_isExampleValuesEnabled = bool.Parse(ConfigurationManager.AppSettings["IsExampleValuesEnabled"]);
public static void MockUser(MockUserName mockUserName)
{
const string MockUserIntemenyAzonosito = "biatorbagyi";
const int MockUserTanevId = 5963;
const string MockMobileUserHttpContextKey = "MobileUser";
if (HttpContext.Current.Items.Contains(MockMobileUserHttpContextKey))
{
HttpContext.Current.Items.Remove(MockMobileUserHttpContextKey);
}
var mockMobileTanuloIdpUniqueId = new Guid("528f7fe8-f802-4b99-83f9-79afe6d863be");
var mockInstituteUniqueId = new Guid("A88CF92A-8C24-4592-90C8-FB095B26EBDB");
switch (mockUserName)
{
case MockUserName.Antali:
const int User1MockUserTanuloId = 629653;
const string User1MockUserTanuloName = "antali";
HttpContext.Current.Items.Add(MockMobileUserHttpContextKey, new MobileUser(MockUserIntemenyAzonosito, User1MockUserTanuloId, User1MockUserTanuloName, null, new List<FelhasznaloSzerepkor>
{
FelhasznaloSzerepkor.Tanulo
}, MockUserTanevId, null, mockMobileTanuloIdpUniqueId, mockMobileTanuloIdpUniqueId, mockInstituteUniqueId));
break;
case MockUserName.Gondviselo:
const int User2MockUserId = 298269;
const int User2MockUserTanuloId = 629653;
const string User2MockUserTanuloName = "antali";
var mockMobileGondviseloIdpUniqueId = new Guid("bf4adfb1-a2ec-4e5c-9aad-893304ba6cb1");
HttpContext.Current.Items.Add(MockMobileUserHttpContextKey, new MobileUser(MockUserIntemenyAzonosito, User2MockUserTanuloId, User2MockUserTanuloName, User2MockUserId, new List<FelhasznaloSzerepkor>
{
FelhasznaloSzerepkor.Gondviselo
}, MockUserTanevId, null, mockMobileGondviseloIdpUniqueId, mockMobileTanuloIdpUniqueId, mockInstituteUniqueId));
break;
case MockUserName.None:
default:
throw new BlException(BlExceptionType.ElvartErtekNemTalalhato);
}
}
public static object TryGetExampleFeatureDefaultExampleModel()
=> s_isExampleValuesEnabled ? null : new Dictionary<object, object>
{
{
"Figyelmeztetés",
"A példák nincsenek engedélyezve."
}
};
}
}

View file

@ -0,0 +1,16 @@
using Kreta.Core;
using Kreta.Core.Enum;
using Kreta.Ellenorzo.Dto.VN.Exception;
using Swashbuckle.Examples;
namespace Kreta.Ellenorzo.WebApi.VN.Documentation
{
public class IntezmenyMarTanevetValtottExample : EllenorzoExceptionResponseDto, IExamplesProvider
{
public IntezmenyMarTanevetValtottExample() : base(BlExceptionType.IntezmenyMarTanevetValtott, BlExceptionType.IntezmenyMarTanevetValtott.ToDisplayName())
{
}
public object GetExamples() => new IntezmenyMarTanevetValtottExample();
}
}

View file

@ -0,0 +1,16 @@
using Kreta.Core;
using Kreta.Core.Enum;
using Kreta.Ellenorzo.Dto.VN.Exception;
using Swashbuckle.Examples;
namespace Kreta.Ellenorzo.WebApi.VN.Documentation
{
public class IsmeretlenHibaExample : EllenorzoExceptionResponseDto, IExamplesProvider
{
public IsmeretlenHibaExample() : base(BlExceptionType.None, BlExceptionType.None.ToDisplayName())
{
}
public object GetExamples() => new IsmeretlenHibaExample();
}
}

View file

@ -0,0 +1,16 @@
using Kreta.Core;
using Kreta.Core.Enum;
using Kreta.Ellenorzo.Dto.VN.Exception;
using Swashbuckle.Examples;
namespace Kreta.Ellenorzo.WebApi.VN.Documentation
{
public class JogosulatlanExample : EllenorzoExceptionResponseDto, IExamplesProvider
{
public JogosulatlanExample() : base(BlExceptionType.NincsJogosultsag, BlExceptionType.NincsJogosultsag.ToDisplayName())
{
}
public object GetExamples() => new JogosulatlanExample();
}
}

View file

@ -0,0 +1,15 @@
using Swashbuckle.Examples;
namespace Kreta.Ellenorzo.WebApi.VN.Documentation
{
public class LejartTokenExample : IExamplesProvider
{
#pragma warning disable S3253 // Constructor and destructor declarations should not be redundant
public LejartTokenExample()
{
}
#pragma warning restore S3253 // Constructor and destructor declarations should not be redundant
public object GetExamples() => "invalid_grant";
}
}

View file

@ -0,0 +1,16 @@
using Kreta.Core;
using Kreta.Core.Enum;
using Kreta.Ellenorzo.Dto.VN.Exception;
using Swashbuckle.Examples;
namespace Kreta.Ellenorzo.WebApi.VN.Documentation
{
public class NemLetezoEntitasExample : EllenorzoExceptionResponseDto, IExamplesProvider
{
public NemLetezoEntitasExample() : base(BlExceptionType.NemLetezoEntitas, BlExceptionType.NemLetezoEntitas.ToDisplayName())
{
}
public object GetExamples() => new NemLetezoEntitasExample();
}
}

View file

@ -0,0 +1,15 @@
using Swashbuckle.Examples;
namespace Kreta.Ellenorzo.WebApi.VN.Documentation
{
public class PermissionDeniedExample : IExamplesProvider
{
#pragma warning disable S3253 // Constructor and destructor declarations should not be redundant
public PermissionDeniedExample()
{
}
#pragma warning restore S3253 // Constructor and destructor declarations should not be redundant
public object GetExamples() => "permission_denied";
}
}

View file

@ -0,0 +1,30 @@
param ([string]$target)
$allowedUserList= (
'RCINET\madachf',
'RCINET\ersekz',
'RCINET\jakaba',
'RCINET\retinagyt',
'RCINET\egyediz')
$user = Get-WmiObject Win32_ComputerSystem | select username
$isRunEnabled = $TRUE
$isAlwaysRunEnabled = $FALSE
if($isAlwaysRunEnabled -OR ($isRunEnabled -AND ($allowedUserList -Contains $user.username)))
{
Add-Type -AssemblyName "System.Windows.Forms, Version=2.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"
$webResposne = Invoke-WebRequest -Uri "https://biatorbagyi.ekreta.hu/ellenorzo/swagger/docs/V3"
if($webResposne.StatusCode -eq 200)
{
Out-File -FilePath $target\swagger.json -InputObject $webResposne.Content -Force
Write-Host "$target\swagger.json VN kész."
}
else
{
$top = new-Object System.Windows.Forms.Form -property @{Topmost=$true}
[System.Windows.Forms.MessageBox]::Show($top,"Hibás VN Swagger!",'Error',1,'Error')
}
}

View file

@ -0,0 +1,36 @@
using System.Collections.Generic;
using System.Linq;
using Kreta.Core;
using Kreta.Core.Domain;
using Kreta.Core.Enum;
using Kreta.Ellenorzo.Domain.VN.Interfaces;
using Kreta.Ellenorzo.Dto.VN.Exception;
using Swashbuckle.Examples;
namespace Kreta.Ellenorzo.WebApi.VN.Documentation
{
/// <summary>
/// Author: DevKornél Created On: 2019.05.
/// </summary>
public class ValidaciosHibaExample<TModel, TSameModel> : EllenorzoExceptionResponseDto, IExamplesProvider where TModel : class, IModelValidacio<TSameModel>, new() where TSameModel : class
{
public ValidaciosHibaExample() : base(BlExceptionType.ModelValidacio, BlExceptionType.ModelValidacio.ToDisplayName())
{
}
public ValidaciosHibaExample(IEnumerable<DetailedErrorItem> errorList)
: base(BlExceptionType.ModelValidacio, BlExceptionType.ModelValidacio.ToDisplayName(), errorList.ToList())
{
}
public object GetExamples()
{
List<DetailedErrorItem> example = new List<DetailedErrorItem>();
int index = 0;
new List<string>(new TModel().ModelValidaciok.Values).ForEach(x => example.Add(new DetailedErrorItem($"custom_{++index}", x, BlExceptionType.ModelValidacio)));
return new ValidaciosHibaExample<TModel, TSameModel>(example);
}
}
}