init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -0,0 +1,69 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Security.Claims;
|
||||
using System.Web;
|
||||
using Kreta.Naplo.Domain.V3.Common;
|
||||
using Kreta.Naplo.Domain.V3.Enum;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Common.Logic
|
||||
{
|
||||
internal static class FelhasznaloLogic
|
||||
{
|
||||
public static MobileUser GetFelhasznalo()
|
||||
{
|
||||
return HttpContext.Current.Items.Contains("MobileUser")
|
||||
? (MobileUser)HttpContext.Current.Items["MobileUser"]
|
||||
: new MobileUser(GetInstituteCode(), GetInstituteUserId(), GetUserName(), GetRoles(), GetSchoolYearId(), GetUserIdpUniqueId(), GetInstituteUniqueId());
|
||||
}
|
||||
|
||||
public static string GetInstituteCode()
|
||||
{
|
||||
return GetClaims("kreta:institute_code").Single();
|
||||
}
|
||||
|
||||
private static Guid GetInstituteUniqueId()
|
||||
{
|
||||
return new Guid(GetClaims("kreta:institute_unique_id").Single());
|
||||
}
|
||||
|
||||
public static int GetInstituteUserId()
|
||||
{
|
||||
var claim = GetClaims("kreta:institute_user_id").Single();
|
||||
return int.Parse(claim);
|
||||
}
|
||||
|
||||
public static int GetSchoolYearId()
|
||||
{
|
||||
var claim = GetClaims("kreta:school_year_id").Single();
|
||||
return int.Parse(claim);
|
||||
}
|
||||
|
||||
private static Guid GetUserIdpUniqueId()
|
||||
{
|
||||
return new Guid(GetClaims("kreta:institute_user_idp_unique_id").Single());
|
||||
}
|
||||
|
||||
private static string GetUserName()
|
||||
{
|
||||
return GetClaims("kreta:user_name").Single();
|
||||
}
|
||||
|
||||
public static IEnumerable<FelhasznaloSzerepkor> GetRoles()
|
||||
{
|
||||
var roles = GetClaims(ClaimTypes.Role);
|
||||
foreach (var role in roles)
|
||||
{
|
||||
if (Enum.TryParse(role, out FelhasznaloSzerepkor enumValue))
|
||||
{
|
||||
yield return enumValue;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private static IEnumerable<string> GetClaims(string type)
|
||||
{
|
||||
return ClaimsPrincipal.Current.Claims.Where(x => x.Type == type).Select(x => x.Value);
|
||||
}
|
||||
}
|
||||
}
|
7
Kreta.WebApi/Naplo/Kreta.Naplo.WebApi/V3/Constants.cs
Normal file
7
Kreta.WebApi/Naplo/Kreta.Naplo.WebApi/V3/Constants.cs
Normal file
|
@ -0,0 +1,7 @@
|
|||
namespace Kreta.Naplo.WebApi.V3
|
||||
{
|
||||
internal static class Constants
|
||||
{
|
||||
public const string RoutePrefix = "V3";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,34 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Web.Http;
|
||||
using Kreta.Naplo.BusinessLogic.V3.Dummy;
|
||||
using Kreta.Naplo.Domain.V3.Enum;
|
||||
using Kreta.Naplo.WebApi.FilterAttributes;
|
||||
using Kreta.Naplo.WebApi.V3.Common.Logic;
|
||||
using Kreta.Naplo.WebApi.V3.Documentation;
|
||||
using Kreta.Web.Logging.Abstractions;
|
||||
using Swashbuckle.Swagger.Annotations;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Controllers
|
||||
{
|
||||
[ApiKeyAuthorization]
|
||||
[IdpAuthorize(FelhasznaloSzerepkor.Tanar)]
|
||||
[RoutePrefix(Constants.RoutePrefix + "/Dummy")]
|
||||
public class DummyController : ApiController
|
||||
{
|
||||
private ITraceLogger TraceLogger { get; }
|
||||
|
||||
public DummyController(ITraceLogger traceLogger)
|
||||
{
|
||||
TraceLogger = traceLogger ?? throw new ArgumentNullException(nameof(traceLogger));
|
||||
}
|
||||
|
||||
[HttpGet, Route("TraceLoggerDummy")]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.TraceDummyResponseLeiras, typeof(List<object>))]
|
||||
public List<object> TraceLoggerDummy()
|
||||
{
|
||||
return ((DummyFacade)Activator.CreateInstance(typeof(DummyFacade), FelhasznaloLogic.GetFelhasznalo(), TraceLogger)).TraceLoggerDummy();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Web.Http;
|
||||
using Kreta.Naplo.BusinessLogic.V3.Enum;
|
||||
using Kreta.Naplo.Domain.V3.Enum;
|
||||
using Kreta.Naplo.Dto.V3.Enum;
|
||||
using Kreta.Naplo.Dto.V3.Exception;
|
||||
using Kreta.Naplo.WebApi.FilterAttributes;
|
||||
using Kreta.Naplo.WebApi.V3.Common.Logic;
|
||||
using Kreta.Naplo.WebApi.V3.Documentation;
|
||||
using Swashbuckle.Examples;
|
||||
using Swashbuckle.Swagger.Annotations;
|
||||
using static Kreta.Naplo.Dto.V3.Converter.ResponseModelConverter;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Controllers
|
||||
{
|
||||
[ApiKeyAuthorization]
|
||||
[IdpAuthorize(FelhasznaloSzerepkor.Tanar)]
|
||||
[RoutePrefix(Constants.RoutePrefix + "/Enum")]
|
||||
[SwaggerResponse(HttpStatusCode.InternalServerError, DescriptionLookUp.IsmeretlenHibaTortentResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[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.RequestTimeout, DescriptionLookUp.KeresTullepteMaxFutasiIdot, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.RequestTimeout, typeof(TimeOutExample))]
|
||||
[SwaggerResponse(HttpStatusCode.Conflict, DescriptionLookUp.TanevetValtottAzIntezmeny, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.Conflict, typeof(IntezmenyMarTanevetValtottExample))]
|
||||
public class EnumController : ApiController
|
||||
{
|
||||
[HttpGet, Route("NaploEnum")]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.EnumResponseLeiras, typeof(EnumResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyExampleProvider<EnumController, EnumResponseDto>))]
|
||||
public List<EnumResponseDto> GetNaploEnum([FromUri] EnumRequestDto request)
|
||||
{
|
||||
return ModelToDto(((EnumFacade)Activator.CreateInstance(typeof(EnumFacade), FelhasznaloLogic.GetFelhasznalo())).GetNaploEnum(request));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,102 @@
|
|||
using System;
|
||||
using System.Net;
|
||||
using System.Net.Http;
|
||||
using System.Web.Http;
|
||||
using Kreta.BusinessLogic.Interfaces;
|
||||
using Kreta.Client.CoreApi;
|
||||
using Kreta.Naplo.BusinessLogic.V3.HaziFeladat;
|
||||
using Kreta.Naplo.Domain.V3.Enum;
|
||||
using Kreta.Naplo.Dto.V3.Exception;
|
||||
using Kreta.Naplo.Dto.V3.HaziFeladat;
|
||||
using Kreta.Naplo.WebApi.FilterAttributes;
|
||||
using Kreta.Naplo.WebApi.V3.Common.Logic;
|
||||
using Kreta.Naplo.WebApi.V3.Documentation;
|
||||
using Swashbuckle.Examples;
|
||||
using Swashbuckle.Swagger.Annotations;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Controllers
|
||||
{
|
||||
[ApiKeyAuthorization]
|
||||
[IdpAuthorize(FelhasznaloSzerepkor.Tanar)]
|
||||
[RoutePrefix(Constants.RoutePrefix)]
|
||||
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
||||
[SwaggerResponse(HttpStatusCode.InternalServerError, DescriptionLookUp.IsmeretlenHibaTortentResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[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.RequestTimeout, DescriptionLookUp.KeresTullepteMaxFutasiIdot, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.RequestTimeout, typeof(TimeOutExample))]
|
||||
[SwaggerResponse(HttpStatusCode.Conflict, DescriptionLookUp.TanevetValtottAzIntezmeny, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.Conflict, typeof(IntezmenyMarTanevetValtottExample))]
|
||||
public class HaziFeladatController : ApiController
|
||||
{
|
||||
private readonly IFileServiceHelper _fileServiceHelper;
|
||||
|
||||
private readonly ICoreApiClient _coreApiClient;
|
||||
|
||||
public HaziFeladatController(IFileServiceHelper fileServiceHelper, ICoreApiClient coreApiClient)
|
||||
{
|
||||
_fileServiceHelper = fileServiceHelper ?? throw new ArgumentNullException(nameof(fileServiceHelper));
|
||||
_coreApiClient = coreApiClient ?? throw new ArgumentNullException(nameof(coreApiClient));
|
||||
}
|
||||
|
||||
[HttpGet, Route("HaziFeladat/{id}")]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras, typeof(HaziFeladatResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyExampleProviderWithDependencyInjection<HaziFeladatController, HaziFeladatResponseDto>))]
|
||||
public HaziFeladatResponseDto GetHaziFeladat(int id)
|
||||
{
|
||||
return ((HaziFeladatFacade)Activator.CreateInstance(typeof(HaziFeladatFacade), FelhasznaloLogic.GetFelhasznalo())).GetHaziFeladat(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Házi feladat rögzítése
|
||||
/// </summary>
|
||||
[HttpPost, Route("HaziFeladat")]
|
||||
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras + DescriptionLookUp.HaziFeladatRogziteseSikertelenAzOraMarNemLetezikAKivalasztottNapon, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.HaziFeladatMenteseSikeres, typeof(int))]
|
||||
public int SaveHaziFeladat(HaziFeladatCreateRequestDto request)
|
||||
{
|
||||
return ((HaziFeladatFacade)Activator.CreateInstance(typeof(HaziFeladatFacade), FelhasznaloLogic.GetFelhasznalo(), _fileServiceHelper, _coreApiClient)).SaveHaziFeladat(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Házi feladat módosítása
|
||||
/// </summary>
|
||||
[HttpPut, Route("HaziFeladat/{id}")]
|
||||
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras + DescriptionLookUp.HaziFeladatModositasaSikertelenAHaziFeladatNemLetezik, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.HaziFeladatMenteseSikeres, typeof(void))]
|
||||
public void UpdateHaziFeladat([FromUri] int id, [FromBody] HaziFeladatUpdateRequestDto request)
|
||||
{
|
||||
((HaziFeladatFacade)Activator.CreateInstance(typeof(HaziFeladatFacade), FelhasznaloLogic.GetFelhasznalo(), _fileServiceHelper, _coreApiClient)).UpdateHaziFeladat(id, request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Házi feladat törlése
|
||||
/// </summary>
|
||||
[HttpDelete, Route("HaziFeladat/{id}")]
|
||||
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras + DescriptionLookUp.HaziFeladatTorleseSikertelenAHaziFeladatNemLetezik, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.HaziFeladatTorleseSikeres, typeof(void))]
|
||||
public void DeleteHaziFeladat([FromUri] int id)
|
||||
{
|
||||
((HaziFeladatFacade)Activator.CreateInstance(typeof(HaziFeladatFacade), FelhasznaloLogic.GetFelhasznalo(), _coreApiClient)).DeleteHaziFeladat(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Házi feladat csatolmány törlése
|
||||
/// </summary>
|
||||
[HttpDelete, Route("HaziFeladat/Csatolmany/{id}")]
|
||||
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
||||
[SwaggerResponse(HttpStatusCode.NoContent, DescriptionLookUp.HaziFeladatCsatolmanyTorlesSikeres, typeof(void))]
|
||||
public void HaziFeladatCsatolmanyTorles(int id)
|
||||
{
|
||||
((HaziFeladatFacade)Activator.CreateInstance(typeof(HaziFeladatFacade), FelhasznaloLogic.GetFelhasznalo(), _fileServiceHelper)).HaziFeladatCsatolmanyTorles(id);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,61 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Web.Http;
|
||||
using Kreta.Naplo.BusinessLogic.V3.Igazolas;
|
||||
using Kreta.Naplo.Domain.V3.Enum;
|
||||
using Kreta.Naplo.Dto.V3.Exception;
|
||||
using Kreta.Naplo.Dto.V3.Igazolas;
|
||||
using Kreta.Naplo.WebApi.FilterAttributes;
|
||||
using Kreta.Naplo.WebApi.V3.Common.Logic;
|
||||
using Kreta.Naplo.WebApi.V3.Documentation;
|
||||
using Swashbuckle.Examples;
|
||||
using Swashbuckle.Swagger.Annotations;
|
||||
using static Kreta.Naplo.Dto.V3.Converter.ResponseModelConverter;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Controllers
|
||||
{
|
||||
[ApiKeyAuthorization]
|
||||
[IdpAuthorize(FelhasznaloSzerepkor.Tanar)]
|
||||
[RoutePrefix(Constants.RoutePrefix)]
|
||||
[SwaggerResponse(HttpStatusCode.InternalServerError, DescriptionLookUp.IsmeretlenHibaTortentResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[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.RequestTimeout, DescriptionLookUp.KeresTullepteMaxFutasiIdot, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.RequestTimeout, typeof(TimeOutExample))]
|
||||
[SwaggerResponse(HttpStatusCode.Conflict, DescriptionLookUp.TanevetValtottAzIntezmeny, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.Conflict, typeof(IntezmenyMarTanevetValtottExample))]
|
||||
public class IgazolasController : ApiController
|
||||
{
|
||||
[HttpGet, Route("Igazolas")]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.IgazolasResponseLeiras, typeof(IgazolasResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<IgazolasController, IgazolasResponseDto>))]
|
||||
public IEnumerable<IgazolasResponseDto> GetIgazolas([FromUri] int tanuloId)
|
||||
{
|
||||
return ModelToDto(((IgazolasFacade)Activator.CreateInstance(typeof(IgazolasFacade), FelhasznaloLogic.GetFelhasznalo())).GetIgazolas(tanuloId));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Igazolás rögzítése
|
||||
/// </summary>
|
||||
[HttpPost, Route("Igazolas")]
|
||||
[SwaggerResponse(HttpStatusCode.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.IgazolasMenteseSikeres, typeof(void))]
|
||||
public void CreateIgazolas(IgazolasCreateRequestDto request)
|
||||
{
|
||||
((IgazolasFacade)Activator.CreateInstance(typeof(IgazolasFacade), FelhasznaloLogic.GetFelhasznalo())).CreateIgazolas(request);
|
||||
}
|
||||
|
||||
[HttpDelete, Route("Igazolas/{id}")]
|
||||
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.IgazolasTorlesSikeres)]
|
||||
public void DeleteIgazolas([FromUri] int id)
|
||||
{
|
||||
((IgazolasFacade)Activator.CreateInstance(typeof(IgazolasFacade), FelhasznaloLogic.GetFelhasznalo())).DeleteIgazolas(id);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Web.Http;
|
||||
using Kreta.Naplo.BusinessLogic.V3.Iskolaor;
|
||||
using Kreta.Naplo.Domain.V3.Enum;
|
||||
using Kreta.Naplo.Dto.V3.Exception;
|
||||
using Kreta.Naplo.Dto.V3.Iskolaor;
|
||||
using Kreta.Naplo.WebApi.FilterAttributes;
|
||||
using Kreta.Naplo.WebApi.V3.Common.Logic;
|
||||
using Kreta.Naplo.WebApi.V3.Documentation;
|
||||
using Swashbuckle.Examples;
|
||||
using Swashbuckle.Swagger.Annotations;
|
||||
using static Kreta.Naplo.Dto.V3.Converter.ResponseModelConverter;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Controllers
|
||||
{
|
||||
[ApiKeyAuthorization]
|
||||
[IdpAuthorize(FelhasznaloSzerepkor.Tanar)]
|
||||
[RoutePrefix(Constants.RoutePrefix)]
|
||||
[SwaggerResponse(HttpStatusCode.InternalServerError, DescriptionLookUp.IsmeretlenHibaTortentResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[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.RequestTimeout, DescriptionLookUp.KeresTullepteMaxFutasiIdot, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.RequestTimeout, typeof(TimeOutExample))]
|
||||
[SwaggerResponse(HttpStatusCode.Conflict, DescriptionLookUp.TanevetValtottAzIntezmeny, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.Conflict, typeof(IntezmenyMarTanevetValtottExample))]
|
||||
public class IskolaorController : ApiController
|
||||
{
|
||||
[HttpGet, Route("Iskolaor")]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.IskolaorResponseLeiras, typeof(IskolaorResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyExampleProvider<IskolaorController, IskolaorResponseDto>))]
|
||||
public List<IskolaorResponseDto> GetIskolaorList()
|
||||
{
|
||||
return ModelToDto(((IskolaorFacade)Activator.CreateInstance(typeof(IskolaorFacade), FelhasznaloLogic.GetFelhasznalo())).ListIskolaor());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Web.Http;
|
||||
using Kreta.Naplo.BusinessLogic.V3.Ora;
|
||||
using Kreta.Naplo.Domain.V3.Enum;
|
||||
using Kreta.Naplo.Dto.V3.Exception;
|
||||
using Kreta.Naplo.Dto.V3.Ora;
|
||||
using Kreta.Naplo.WebApi.FilterAttributes;
|
||||
using Kreta.Naplo.WebApi.V3.Common.Logic;
|
||||
using Kreta.Naplo.WebApi.V3.Documentation;
|
||||
using Swashbuckle.Examples;
|
||||
using Swashbuckle.Swagger.Annotations;
|
||||
using static Kreta.Naplo.Dto.V3.Converter.ResponseModelConverter;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Controllers
|
||||
{
|
||||
[ApiKeyAuthorization]
|
||||
[IdpAuthorize(FelhasznaloSzerepkor.Tanar)]
|
||||
[RoutePrefix(Constants.RoutePrefix + "/Ora")]
|
||||
[SwaggerResponse(HttpStatusCode.InternalServerError, DescriptionLookUp.IsmeretlenHibaTortentResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[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.RequestTimeout, DescriptionLookUp.KeresTullepteMaxFutasiIdot, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.RequestTimeout, typeof(TimeOutExample))]
|
||||
[SwaggerResponse(HttpStatusCode.Conflict, DescriptionLookUp.TanevetValtottAzIntezmeny, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.Conflict, typeof(IntezmenyMarTanevetValtottExample))]
|
||||
public class OraController : ApiController
|
||||
{
|
||||
[HttpGet, Route("Feljegyzes")]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.OraFeljegyzesResponseLeiras, typeof(OraFeljegyzesResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyExampleProvider<OraController, OraFeljegyzesResponseDto>))]
|
||||
public List<OraFeljegyzesResponseDto> GetOraFeljegyzesek([FromUri] OraFeljegyzesRequestDto request)
|
||||
{
|
||||
return ModelToDto(((OraFacade)Activator.CreateInstance(typeof(OraFacade), FelhasznaloLogic.GetFelhasznalo())).GetOraFeljegyzesek(request));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,149 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Web.Http;
|
||||
using Kreta.BusinessLogic.Interfaces;
|
||||
using Kreta.Client.CoreApi;
|
||||
using Kreta.Naplo.BusinessLogic.V3.Orarend;
|
||||
using Kreta.Naplo.Domain.V3.Enum;
|
||||
using Kreta.Naplo.Domain.V3.Orarend;
|
||||
using Kreta.Naplo.Dto.V3.Exception;
|
||||
using Kreta.Naplo.Dto.V3.Orarend;
|
||||
using Kreta.Naplo.Dto.V3.OsztalyCsoport;
|
||||
using Kreta.Naplo.WebApi.FilterAttributes;
|
||||
using Kreta.Naplo.WebApi.V3.Common.Logic;
|
||||
using Kreta.Naplo.WebApi.V3.Documentation;
|
||||
using Swashbuckle.Examples;
|
||||
using Swashbuckle.Swagger.Annotations;
|
||||
using static Kreta.Naplo.Dto.V3.Converter.ResponseModelConverter;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Controllers
|
||||
{
|
||||
[ApiKeyAuthorization]
|
||||
[IdpAuthorize(FelhasznaloSzerepkor.Tanar)]
|
||||
[RoutePrefix(Constants.RoutePrefix + "/Orarend")]
|
||||
[SwaggerResponse(HttpStatusCode.InternalServerError, DescriptionLookUp.IsmeretlenHibaTortentResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[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.RequestTimeout, DescriptionLookUp.KeresTullepteMaxFutasiIdot, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.RequestTimeout, typeof(TimeOutExample))]
|
||||
[SwaggerResponse(HttpStatusCode.Conflict, DescriptionLookUp.TanevetValtottAzIntezmeny, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.Conflict, typeof(IntezmenyMarTanevetValtottExample))]
|
||||
public class OrarendController : ApiController
|
||||
{
|
||||
private readonly IFileServiceHelper _fileServiceHelper;
|
||||
|
||||
private readonly ICoreApiClient _coreApiClient;
|
||||
|
||||
public OrarendController(IFileServiceHelper fileServiceHelper, ICoreApiClient coreApiClient)
|
||||
{
|
||||
_fileServiceHelper = fileServiceHelper ?? throw new ArgumentNullException(nameof(fileServiceHelper));
|
||||
_coreApiClient = coreApiClient ?? throw new ArgumentNullException(nameof(coreApiClient));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Órarend lekérdezése
|
||||
/// </summary>
|
||||
[HttpGet, Route("")]
|
||||
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras + DescriptionLookUp.OraTorolveLett, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras, typeof(OrarendElemResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProviderWithDependencyInjection<OrarendController, OrarendElemResponseDto>))]
|
||||
public HashSet<OrarendElemResponseDto> GetOrarend([FromUri] OrarendRequestDto request)
|
||||
{
|
||||
return ModelToDto(((OrarendFacade)Activator.CreateInstance(typeof(OrarendFacade), FelhasznaloLogic.GetFelhasznalo())).GetOrarend(request));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Órarend elem entitás lekérdezése
|
||||
/// </summary>
|
||||
[HttpGet, Route("OrarendElem")]
|
||||
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras + DescriptionLookUp.OraTorolveLett, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras, typeof(OrarendElemResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyExampleProviderWithDependencyInjection<OrarendController, OrarendElemResponseDto>))]
|
||||
public OrarendElemResponseDto GetOrarendElem([FromUri] OrarendElemRequestDto request)
|
||||
{
|
||||
return ((OrarendFacade)Activator.CreateInstance(typeof(OrarendFacade), FelhasznaloLogic.GetFelhasznalo())).GetOrarendElem(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Óra naplózása
|
||||
/// </summary>
|
||||
[HttpPost, Route("OraNaplozas")]
|
||||
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras + DescriptionLookUp.NaplozasSikertelenAzOraMarNemLetezikAKivalasztottNapon, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.OraNaplozasaSikeres)]
|
||||
public string OraNaplozas(OraNaplozasRequestDto request)
|
||||
{
|
||||
return ((OrarendFacade)Activator.CreateInstance(typeof(OrarendFacade), FelhasznaloLogic.GetFelhasznalo(), _fileServiceHelper, _coreApiClient)).OraNaplozas(request);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Óra naplózási adatok törlése
|
||||
/// </summary>
|
||||
[HttpDelete, Route("OraNaplozas")]
|
||||
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras + DescriptionLookUp.OraTorolveLett, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.OraNaplozasTorlesSikeres)]
|
||||
public string OraNaplozasTorles([FromUri] OraNaplozasTorlesRequestDto request)
|
||||
{
|
||||
return ((OrarendFacade)Activator.CreateInstance(typeof(OrarendFacade), FelhasznaloLogic.GetFelhasznalo())).OraNaplozasTorles(request);
|
||||
}
|
||||
|
||||
[HttpGet, Route("Jelenlet")]
|
||||
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras + DescriptionLookUp.OraTorolveLett, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.TanuloJelenletResponseLeiras, typeof(TanuloJelenletResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProviderWithDependencyInjection<OrarendController, TanuloJelenletResponseDto>))]
|
||||
public IEnumerable<TanuloJelenletResponseDto> GetJelenlet([FromUri] TanuloJelenletRequestDto request)
|
||||
{
|
||||
return ModelToDto(((OrarendFacade)Activator.CreateInstance(typeof(OrarendFacade), FelhasznaloLogic.GetFelhasznalo())).GetTanuloJelenlet(request));
|
||||
}
|
||||
|
||||
[HttpGet, Route("Hetirend")]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras + DescriptionLookUp.HetirendSzoveg, typeof(HetirendListResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProviderWithDependencyInjection<OrarendController, HetirendListResponseDto>))]
|
||||
[SwaggerResponse(HttpStatusCode.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.BadRequest, typeof(ValidaciosHibaExample<HetirendListRequest, HetirendListRequest>))]
|
||||
public IEnumerable<HetirendListResponseDto> ListHetirend([FromUri] HetirendListRequestDto request)
|
||||
{
|
||||
return ModelToDto(((OrarendFacade)Activator.CreateInstance(typeof(OrarendFacade), FelhasznaloLogic.GetFelhasznalo())).ListHetirend(request));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bejelentett számonkérés lekérdezése
|
||||
/// </summary>
|
||||
/// <param name="id">Számonkérés id</param>
|
||||
[HttpGet, Route("BejelentettSzamonkeres/{id}")]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.ListaUidVagyUidsFilterResponseLeiras, typeof(BejelentettSzamonkeresekResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyExampleProviderWithDependencyInjection<OrarendController, BejelentettSzamonkeresekResponseDto>))]
|
||||
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
||||
public BejelentettSzamonkeresekResponseDto GetBejelentettSzamonkeres([FromUri] int id)
|
||||
{
|
||||
return ((OrarendFacade)Activator.CreateInstance(typeof(OrarendFacade), FelhasznaloLogic.GetFelhasznalo())).GetBejelentettSzamonkeres(id);
|
||||
}
|
||||
|
||||
|
||||
[HttpDelete, Route("BejelentettSzamonkeres/{id}")]
|
||||
[SwaggerResponse(HttpStatusCode.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponse(HttpStatusCode.NoContent, DescriptionLookUp.SzamonkeresTorleseSikeres)]
|
||||
public void DeleteBejelentettSzamonkeres([FromUri] int id)
|
||||
{
|
||||
((OrarendFacade)Activator.CreateInstance(typeof(OrarendFacade), FelhasznaloLogic.GetFelhasznalo())).DeleteBejelentettSzamonkeres(id);
|
||||
}
|
||||
|
||||
[HttpPost, Route("BejelentettSzamonkeres")]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.SzamonkeresRogzitesSikeres)]
|
||||
[SwaggerResponse(HttpStatusCode.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerRequestExample(typeof(SzamonkeresRequestDto), typeof(SzamonkeresRequestDto))]
|
||||
public void PostSzamonkeres(SzamonkeresRequestDto request)
|
||||
{
|
||||
((OrarendFacade)Activator.CreateInstance(typeof(OrarendFacade), FelhasznaloLogic.GetFelhasznalo())).PostSzamonkeres(request);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,129 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Web.Http;
|
||||
using Kreta.Naplo.BusinessLogic.V3.OsztalyCsoport;
|
||||
using Kreta.Naplo.Domain.V3.Enum;
|
||||
using Kreta.Naplo.Dto.V3.Converter;
|
||||
using Kreta.Naplo.Dto.V3.Exception;
|
||||
using Kreta.Naplo.Dto.V3.OsztalyCsoport;
|
||||
using Kreta.Naplo.WebApi.FilterAttributes;
|
||||
using Kreta.Naplo.WebApi.V3.Common.Logic;
|
||||
using Kreta.Naplo.WebApi.V3.Documentation;
|
||||
using Swashbuckle.Examples;
|
||||
using Swashbuckle.Swagger.Annotations;
|
||||
using static Kreta.Naplo.Dto.V3.Converter.ResponseModelConverter;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Controllers
|
||||
{
|
||||
[ApiKeyAuthorization]
|
||||
[IdpAuthorize(FelhasznaloSzerepkor.Tanar)]
|
||||
[RoutePrefix(Constants.RoutePrefix + "/OsztalyCsoport")]
|
||||
[SwaggerResponse(HttpStatusCode.InternalServerError, DescriptionLookUp.IsmeretlenHibaTortentResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[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.RequestTimeout, DescriptionLookUp.KeresTullepteMaxFutasiIdot, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.RequestTimeout, typeof(TimeOutExample))]
|
||||
[SwaggerResponse(HttpStatusCode.Conflict, DescriptionLookUp.TanevetValtottAzIntezmeny, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.Conflict, typeof(IntezmenyMarTanevetValtottExample))]
|
||||
public class OsztalyCsoportController : ApiController
|
||||
{
|
||||
[HttpGet, Route("Ertekeles")]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.TanuloErtekeleseiResponseLeiras, typeof(OsztalyCsoportErtekelesekResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<OsztalyCsoportController, OsztalyCsoportErtekelesekResponseDto>))]
|
||||
public HashSet<OsztalyCsoportErtekelesekResponseDto> GetTanuloErtekelesek([FromUri] OsztalyCsoportErtekelesekRequestDto request)
|
||||
{
|
||||
return ModelToDto(((OsztalyCsoportFacade)Activator.CreateInstance(typeof(OsztalyCsoportFacade), FelhasznaloLogic.GetFelhasznalo())).GetOsztalyCsoportErtekelesek(request));
|
||||
}
|
||||
|
||||
[HttpPost, Route("Ertekeles")]
|
||||
[SwaggerResponse(HttpStatusCode.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponse(HttpStatusCode.NoContent, DescriptionLookUp.ErtekelesRogzitesSikeres)]
|
||||
[SwaggerRequestExample(typeof(OsztalyCsoportErtekelesRequestDto), typeof(OsztalyCsoportErtekelesRequestDto))]
|
||||
public void CreateOsztalyCsoportErtekeles(List<OsztalyCsoportErtekelesRequestDto> request)
|
||||
{
|
||||
((OsztalyCsoportFacade)Activator.CreateInstance(typeof(OsztalyCsoportFacade), FelhasznaloLogic.GetFelhasznalo())).CreateOsztalyCsoportErtekeles(RequestModelConverter.DtoToModel(request));
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Mondatbank lekérdezése
|
||||
/// </summary>
|
||||
[HttpGet, Route("Ertekeles/Mondatbank")]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.MondatbankResponseLeiras, typeof(MondatbankResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<OsztalyCsoportController, MondatbankResponseDto>))]
|
||||
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
||||
public IEnumerable<MondatbankResponseDto> GetMondatbank([FromUri] MondatbankRequestDto request)
|
||||
{
|
||||
return ModelToDto(((OsztalyCsoportFacade)Activator.CreateInstance(typeof(OsztalyCsoportFacade), FelhasznaloLogic.GetFelhasznalo())).GetMondatbank(request));
|
||||
}
|
||||
|
||||
[HttpGet, Route("Tanulok")]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.OsztalyCsoportTanuloiResponseLeiras, typeof(OsztalyCsoportTanuloResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<OsztalyCsoportController, OsztalyCsoportTanuloResponseDto>))]
|
||||
public IEnumerable<OsztalyCsoportTanuloResponseDto> GetOsztalyCsoportTanuloi([FromUri] OsztalyCsoportTanuloRequestDto request)
|
||||
{
|
||||
return ModelToDto(((OsztalyCsoportFacade)Activator.CreateInstance(typeof(OsztalyCsoportFacade), FelhasznaloLogic.GetFelhasznalo())).GetOsztalyCsoportTanuloi(request));
|
||||
}
|
||||
|
||||
[HttpGet, Route("Tanulok/{id}")]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.OsztalyCsoportTanuloAdatokResponseLeiras, typeof(OsztalyCsoportTanuloAdatokResponseDto))]
|
||||
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
||||
public OsztalyCsoportTanuloAdatokResponseDto GetOsztalyCsoportTanuloAdatok([FromUri] int id)
|
||||
{
|
||||
return ((OsztalyCsoportFacade)Activator.CreateInstance(typeof(OsztalyCsoportFacade), FelhasznaloLogic.GetFelhasznalo())).GetOsztalyCsoportTanuloAdatok(id);
|
||||
}
|
||||
|
||||
[HttpGet, Route("")]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.OsztalyCsoportResponseLeiras, typeof(OsztalyokCsoportokResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<OsztalyCsoportController, OsztalyokCsoportokResponseDto>))]
|
||||
public IEnumerable<OsztalyokCsoportokResponseDto> GetOsztalyokCsoportok()
|
||||
{
|
||||
return ModelToDto(((OsztalyCsoportFacade)Activator.CreateInstance(typeof(OsztalyCsoportFacade), FelhasznaloLogic.GetFelhasznalo())).GetOsztalyokCsoportok());
|
||||
}
|
||||
|
||||
[HttpGet, Route("Tanulok/Ertekeles")]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.TanuloErtekeleseiResponseLeiras, typeof(TanuloErtekelesekResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<OsztalyCsoportController, TanuloErtekelesekResponseDto>))]
|
||||
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
||||
public IEnumerable<TanuloErtekelesekResponseDto> GetTanuloErtekelesei([FromUri] TanuloErtekelesekRequestDto request)
|
||||
{
|
||||
return ModelToDto(((OsztalyCsoportFacade)Activator.CreateInstance(typeof(OsztalyCsoportFacade), FelhasznaloLogic.GetFelhasznalo())).GetTanuloErtekelesei(request));
|
||||
}
|
||||
|
||||
[HttpPut, Route("Tanulok/Ertekeles/{id}")]
|
||||
[SwaggerResponse(HttpStatusCode.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.TanuloErtekelesMentesSikeres, typeof(TanuloErtekelesMentesRequestDto))]
|
||||
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
public void TanuloErtekelesMentes([FromUri] int id, [FromBody] TanuloErtekelesMentesRequestDto request)
|
||||
{
|
||||
((OsztalyCsoportFacade)Activator.CreateInstance(typeof(OsztalyCsoportFacade), FelhasznaloLogic.GetFelhasznalo())).TanuloErtekelesMentes(id, request);
|
||||
}
|
||||
|
||||
[HttpDelete, Route("Tanulok/Ertekeles/{id}")]
|
||||
[SwaggerResponse(HttpStatusCode.BadRequest, DescriptionLookUp.ValidaciosHibaTortentResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponse(HttpStatusCode.NoContent, DescriptionLookUp.ErtekelesTorleseSikeres)]
|
||||
public void DeleteOsztalyCsoportErtekeles([FromUri] int id)
|
||||
{
|
||||
((OsztalyCsoportFacade)Activator.CreateInstance(typeof(OsztalyCsoportFacade), FelhasznaloLogic.GetFelhasznalo())).DeleteOsztalyCsoportErtekeles(id);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Bejelentett számonkérések lekérdezése
|
||||
/// </summary>
|
||||
[HttpGet, Route("BejelentettSzamonkeres")]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.BejelentettSzamonkeresResponseLeiras, typeof(BejelentettSzamonkeresekResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProviderWithDependencyInjection<OsztalyCsoportController, BejelentettSzamonkeresekResponseDto>))]
|
||||
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
||||
public IEnumerable<BejelentettSzamonkeresekResponseDto> GetBejelentettSzamonkeresek([FromUri] BejelentettSzamonkeresekRequestDto request)
|
||||
{
|
||||
return ModelToDto(((OsztalyCsoportFacade)Activator.CreateInstance(typeof(OsztalyCsoportFacade), FelhasznaloLogic.GetFelhasznalo())).GetBejelentettSzamonkeresek(request));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,66 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Web.Http;
|
||||
using Kreta.Naplo.BusinessLogic.V3.Tanar;
|
||||
using Kreta.Naplo.Domain.V3.Enum;
|
||||
using Kreta.Naplo.Dto.V3.Exception;
|
||||
using Kreta.Naplo.Dto.V3.Tanar;
|
||||
using Kreta.Naplo.WebApi.FilterAttributes;
|
||||
using Kreta.Naplo.WebApi.V3.Common.Logic;
|
||||
using Kreta.Naplo.WebApi.V3.Documentation;
|
||||
using Swashbuckle.Examples;
|
||||
using Swashbuckle.Swagger.Annotations;
|
||||
using static Kreta.Naplo.Dto.V3.Converter.ResponseModelConverter;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Controllers
|
||||
{
|
||||
[ApiKeyAuthorization]
|
||||
[IdpAuthorize(FelhasznaloSzerepkor.Tanar)]
|
||||
[RoutePrefix(Constants.RoutePrefix + "/Tanar")]
|
||||
[SwaggerResponse(HttpStatusCode.InternalServerError, DescriptionLookUp.IsmeretlenHibaTortentResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[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.RequestTimeout, DescriptionLookUp.KeresTullepteMaxFutasiIdot, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.RequestTimeout, typeof(TimeOutExample))]
|
||||
[SwaggerResponse(HttpStatusCode.Conflict, DescriptionLookUp.TanevetValtottAzIntezmeny, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.Conflict, typeof(IntezmenyMarTanevetValtottExample))]
|
||||
public class TanarController : ApiController
|
||||
{
|
||||
[HttpGet, Route("Profil")]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.TanarAdataiResponseLeiras, typeof(ProfilResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyExampleProvider<TanarController, ProfilResponseDto>))]
|
||||
public ProfilResponseDto GetProfil()
|
||||
{
|
||||
return ((TanarFacade)Activator.CreateInstance(typeof(TanarFacade), FelhasznaloLogic.GetFelhasznalo())).GetProfil();
|
||||
}
|
||||
|
||||
[HttpGet, Route("Beallitasok")]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.TanarBeallitasokResponseLeiras, typeof(BeallitasokResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyExampleProvider<TanarController, BeallitasokResponseDto>))]
|
||||
public BeallitasokResponseDto GetBeallitasok()
|
||||
{
|
||||
return ((TanarFacade)Activator.CreateInstance(typeof(TanarFacade), FelhasznaloLogic.GetFelhasznalo())).GetBeallitasok();
|
||||
}
|
||||
|
||||
[HttpPost, Route("Beallitasok")]
|
||||
[SwaggerResponse(HttpStatusCode.NoContent, DescriptionLookUp.BeallitasRogzitesSikeres)]
|
||||
[SwaggerRequestExample(typeof(BeallitasokRequestDto), typeof(BeallitasokRequestDto))]
|
||||
public void PostBeallitasok(BeallitasokRequestDto request)
|
||||
{
|
||||
((TanarFacade)Activator.CreateInstance(typeof(TanarFacade), FelhasznaloLogic.GetFelhasznalo())).PostBeallitasok(request);
|
||||
}
|
||||
|
||||
[HttpGet, Route("Tantargyfelosztas")]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.TanarTantargyFelosztasai, typeof(TantargyFelosztasResponseDto))]
|
||||
[SwaggerResponse(HttpStatusCode.NotFound, DescriptionLookUp.NemLetezoEntitasResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.NotFound, typeof(NemLetezoEntitasExample))]
|
||||
public IEnumerable<TantargyFelosztasResponseDto> GetOsztalyCsoportTantargyak()
|
||||
{
|
||||
return ModelToDto(((TanarFacade)Activator.CreateInstance(typeof(TanarFacade), FelhasznaloLogic.GetFelhasznalo())).GetTantargyFelosztas());
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Net;
|
||||
using System.Web.Http;
|
||||
using Kreta.Naplo.BusinessLogic.V3.Tanmenet;
|
||||
using Kreta.Naplo.Domain.V3.Enum;
|
||||
using Kreta.Naplo.Dto.V3.Exception;
|
||||
using Kreta.Naplo.Dto.V3.Tanmenet;
|
||||
using Kreta.Naplo.WebApi.FilterAttributes;
|
||||
using Kreta.Naplo.WebApi.V3.Common.Logic;
|
||||
using Kreta.Naplo.WebApi.V3.Documentation;
|
||||
using Swashbuckle.Examples;
|
||||
using Swashbuckle.Swagger.Annotations;
|
||||
using static Kreta.Naplo.Dto.V3.Converter.ResponseModelConverter;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Controllers
|
||||
{
|
||||
[ApiKeyAuthorization]
|
||||
[IdpAuthorize(FelhasznaloSzerepkor.Tanar)]
|
||||
[RoutePrefix(Constants.RoutePrefix)]
|
||||
[SwaggerResponse(HttpStatusCode.InternalServerError, DescriptionLookUp.IsmeretlenHibaTortentResponseLeiras, typeof(NaploExceptionResponseDto))]
|
||||
[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.RequestTimeout, DescriptionLookUp.KeresTullepteMaxFutasiIdot, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.RequestTimeout, typeof(TimeOutExample))]
|
||||
[SwaggerResponse(HttpStatusCode.Conflict, DescriptionLookUp.TanevetValtottAzIntezmeny, typeof(NaploExceptionResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.Conflict, typeof(IntezmenyMarTanevetValtottExample))]
|
||||
public class TanmenetController : ApiController
|
||||
{
|
||||
[HttpGet, Route("Tanmenet")]
|
||||
[SwaggerResponse(HttpStatusCode.OK, DescriptionLookUp.TanmenetResponseLeiras, typeof(TanmenetItemListResponseDto))]
|
||||
[SwaggerResponseExample(HttpStatusCode.OK, typeof(DummyListExampleProvider<TanmenetController, TanmenetItemListResponseDto>))]
|
||||
public IEnumerable<TanmenetItemListResponseDto> ListTanmenet([FromUri] TanmenetRequestDto request)
|
||||
{
|
||||
return ModelToDto(((TanmenetFacade)Activator.CreateInstance(typeof(TanmenetFacade), FelhasznaloLogic.GetFelhasznalo())).ListTanmenet(request));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using Kreta.Core;
|
||||
using Kreta.Core.Enum;
|
||||
using Kreta.Naplo.Dto.V3.Exception;
|
||||
using Swashbuckle.Examples;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Documentation
|
||||
{
|
||||
public class AMuveletNemVegezhetoElTobbszorExample : NaploExceptionResponseDto, IExamplesProvider
|
||||
{
|
||||
public AMuveletNemVegezhetoElTobbszorExample() : base(BlExceptionType.AMuveletNemVegezhetoElTobbszor, BlExceptionType.AMuveletNemVegezhetoElTobbszor.ToDisplayName())
|
||||
{
|
||||
}
|
||||
|
||||
public object GetExamples() => new AMuveletNemVegezhetoElTobbszorExample();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,112 @@
|
|||
namespace Kreta.Naplo.WebApi.V3.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 TanarAdataiResponseLeiras = "A tanár adatai szerepelnek a response-ban";
|
||||
|
||||
public const string TanarTorolveLett = " Abban az esetben, ha él a token, de a tanár már törölve lett.";
|
||||
|
||||
public const string FelhasznaloTorolveLett = " Abban az esetben, ha él a token, de a felhasználó már törölve lett.";
|
||||
|
||||
public const string OraTorolveLett = " Az óra 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 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 NincsJogosultsaga = "Nincs jogosultsága";
|
||||
|
||||
public const string KeresTullepteMaxFutasiIdot = "A kérés túllépte a maximálisan megengedett futási időt!";
|
||||
|
||||
public const string TanevetValtottAzIntezmeny = "Tanévet váltott az intézmény!";
|
||||
|
||||
public const string TanmenetResponseLeiras = "Tanmenetek szerepelnek a responseban.";
|
||||
|
||||
public const string Rendszermodul = "Rendszermodulok";
|
||||
|
||||
public const string IntezmenyAdatai = "Saját intézmény adatai";
|
||||
|
||||
public const string IskolaorResponseLeiras = "Az iskolaőrök adatai szerepelnek a response-ban.";
|
||||
|
||||
public const string JelszoValtoztatasSikeres = "A jelszó változtatása sikeresen megtörtént!";
|
||||
|
||||
public const string LepEloadasResponseLeiras = "A Lázár Ervin Program által meghirdetett előadások szerepelnek a responseban.";
|
||||
|
||||
public const string TraceDummyResponseLeiras = "TraceLogger dummy";
|
||||
|
||||
public const string ErtekelesRogzitesSikeres = "Az értékelés rögzítése sikeresen megtörtént!";
|
||||
|
||||
public const string EnumResponseLeiras = "Az enum adatai szerepelnek a response-ban";
|
||||
|
||||
public const string OraFeljegyzesResponseLeiras = "Az órán naplózott feljegyzések szerepelnek a response-ban.";
|
||||
|
||||
public const string TanuloErtekeleseiResponseLeiras = "A tanuló értékelései szerepelnek a response-ban";
|
||||
|
||||
public const string OraNaplozasaSikeres = "Az óra naplózása sikeresen megtörtént! A response-ban visszaadjuk a naplózott óra új id-ját. (TanitasiOra)";
|
||||
|
||||
public const string TanuloJelenletResponseLeiras = "Tanulók jelenlét adatai szerepelnek a response-ban";
|
||||
|
||||
public const string NaplozasSikertelenAzOraMarNemLetezikAKivalasztottNapon = "Naplózás sikertelen: az óra már nem létezik a kiválasztott napon!";
|
||||
|
||||
public const string OsztalyCsoportTanuloiResponseLeiras = "Az osztályhoz/csoporthoz tartozó tanulók adatai szerepelnek a response-ban";
|
||||
|
||||
public const string TanarBeallitasokResponseLeiras = "A tanár beállításai szerepelnek a response-ban";
|
||||
|
||||
public const string BeallitasRogzitesSikeres = "A beállítás rögzítése sikeresen megtörtént!";
|
||||
|
||||
public const string HaziFeladatRogziteseSikertelenAzOraMarNemLetezikAKivalasztottNapon = "; Házi feladat rögzítése sikertelen: az óra már nem létezik a kiválasztott napon!";
|
||||
|
||||
public const string HaziFeladatMenteseSikeres = "Házi feladat mentése sikeresen megtörtént!";
|
||||
|
||||
public const string HaziFeladatModositasaSikertelenAHaziFeladatNemLetezik = " Házi feladat módosítása sikertelen: a házi feladat nem létezik!";
|
||||
|
||||
public const string OraNaplozasTorlesSikeres = "Az óra naplózási adatok törlése sikeresen megtörtént! A response-ban visszaadjuk a törölt naplózás órájának id-ját. (OrarendiOra)";
|
||||
|
||||
public const string ErtekelesTorleseSikeres = "Az értékelés törlése sikeresen megtörtént!";
|
||||
|
||||
public const string HetirendSzoveg = "A megadott intervallumba beletartozó (fedik egymást) entitásokkal tér vissza.";
|
||||
|
||||
public const string HaziFeladatTorleseSikertelenAHaziFeladatNemLetezik = "Házi feladat törlése sikertelen: a házi feladat nem létezik!";
|
||||
|
||||
public const string HaziFeladatTorleseSikeres = "Házi feladat törlése sikeresen megtörtént!";
|
||||
|
||||
public const string HaziFeladatCsatolmanyTorlesSikeres = "A házi feladat csatolmány törlése sikeresen megtörtént!";
|
||||
|
||||
public const string OsztalyCsoportTanuloAdatokResponseLeiras = "Az osztályhoz/csoporthoz tartozó tanuló adatai szerepelnek a response-ban";
|
||||
|
||||
public const string MondatbankResponseLeiras = "A mondatbankhoz tartozó adatok szerepelnek a response-ban";
|
||||
|
||||
public const string TanarTantargyFelosztasai = "A tanár osztálycsoportjaihoz tartozó tantárgyak szerepelnek a response-ban";
|
||||
|
||||
public const string IgazolasResponseLeiras = "Tanulóhoz rögzített igazolások adatai szerepelnek a response-ban.";
|
||||
|
||||
public const string IgazolasTorlesSikeres = "Az igazolás törlése sikeresen megtörtént!";
|
||||
|
||||
public const string OsztalyCsoportResponseLeiras = "Az intézményben található osztályok/csoportok adatai szerepelnek a response-ban.";
|
||||
|
||||
public const string IgazolasMenteseSikeres = "Igazolás mentése sikeresen megtörtént!";
|
||||
|
||||
public const string BejelentettSzamonkeresResponseLeiras = "A bejelentett számonkérések listája szerepel a response-ban.";
|
||||
|
||||
public const string TanuloErtekelesMentesSikeres = "Értékelés mentése sikeresen megtörtént!";
|
||||
|
||||
public const string SzamonkeresTorleseSikeres = "A számonkérés törlése sikeresen megtörtént!";
|
||||
|
||||
public const string SzamonkeresRogzitesSikeres = "A számonkérés rögzítése sikeresen megtörtént!";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,62 @@
|
|||
using System;
|
||||
using Kreta.BusinessLogic.Interfaces;
|
||||
using Kreta.Client.CoreApi;
|
||||
using Kreta.Naplo.Dto.V3.Interfaces;
|
||||
using Kreta.Naplo.WebApi.V3.Documentation.Helper;
|
||||
using Kreta.Naplo.WebApi.V3.Documentation.MockServices;
|
||||
using Swashbuckle.Examples;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Documentation
|
||||
{
|
||||
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()
|
||||
{
|
||||
private readonly IFileServiceHelper _fileServiceHelper = new FileServiceHelperMock();
|
||||
|
||||
private readonly ICoreApiClient _coreApiClient = new CoreApiClientMock();
|
||||
|
||||
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), _fileServiceHelper, _coreApiClient), parameterArray)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
using System;
|
||||
using Kreta.BusinessLogic.Interfaces;
|
||||
using Kreta.Client.CoreApi;
|
||||
using Kreta.Naplo.Dto.V3.Interfaces;
|
||||
using Kreta.Naplo.WebApi.V3.Documentation.Helper;
|
||||
using Kreta.Naplo.WebApi.V3.Documentation.MockServices;
|
||||
using Swashbuckle.Examples;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Documentation
|
||||
{
|
||||
|
||||
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()
|
||||
{
|
||||
private readonly IFileServiceHelper _fileServiceHelper = new FileServiceHelperMock();
|
||||
|
||||
private readonly ICoreApiClient _coreApiClient = new CoreApiClientMock();
|
||||
|
||||
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), _fileServiceHelper, _coreApiClient), parameterArray)
|
||||
};
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,58 @@
|
|||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Configuration;
|
||||
using System.Web;
|
||||
using Kreta.Core.Enum;
|
||||
using Kreta.Core.Exceptions;
|
||||
using Kreta.Naplo.Domain.V3.Common;
|
||||
using Kreta.Naplo.Domain.V3.Enum;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Documentation.Helper
|
||||
{
|
||||
internal static class ExampleHelper
|
||||
{
|
||||
private static readonly bool s_isExampleValuesEnabled = bool.Parse(ConfigurationManager.AppSettings["IsExampleValuesEnabled"]);
|
||||
|
||||
public static void MockUser(MockUserName mockUserName)
|
||||
{
|
||||
const string MockMobileUserHttpContextKey = "MobileUser";
|
||||
|
||||
if (HttpContext.Current.Items.Contains(MockMobileUserHttpContextKey))
|
||||
{
|
||||
HttpContext.Current.Items.Remove(MockMobileUserHttpContextKey);
|
||||
}
|
||||
|
||||
const string MockUserIntemenyAzonosito = "biatorbagyi";
|
||||
const int MockUserTanevId = 5963;
|
||||
const string MockTanarUserName = "farkase";
|
||||
const int MockTanarUserId = 629608;
|
||||
var mockMobileTanarIdpUniqueId = new Guid("bf37a8ca-8c59-4030-b6e1-4c1f5e80da48");
|
||||
var mockInstituteUniqueId = new Guid("a88cf92a-8c24-4592-90c8-fb095b26ebdb");
|
||||
|
||||
switch (mockUserName)
|
||||
{
|
||||
case MockUserName.Farkase:
|
||||
HttpContext.Current.Items.Add(MockMobileUserHttpContextKey, new MobileUser(MockUserIntemenyAzonosito,
|
||||
MockTanarUserId,
|
||||
MockTanarUserName,
|
||||
new List<FelhasznaloSzerepkor> { FelhasznaloSzerepkor.Tanar },
|
||||
MockUserTanevId,
|
||||
mockMobileTanarIdpUniqueId,
|
||||
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."
|
||||
}
|
||||
};
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using Kreta.Core;
|
||||
using Kreta.Core.Enum;
|
||||
using Kreta.Naplo.Dto.V3.Exception;
|
||||
using Swashbuckle.Examples;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Documentation
|
||||
{
|
||||
public class IntezmenyMarTanevetValtottExample : NaploExceptionResponseDto, IExamplesProvider
|
||||
{
|
||||
public IntezmenyMarTanevetValtottExample() : base(BlExceptionType.IntezmenyMarTanevetValtott, BlExceptionType.IntezmenyMarTanevetValtott.ToDisplayName())
|
||||
{
|
||||
}
|
||||
|
||||
public object GetExamples() => new IntezmenyMarTanevetValtottExample();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using Kreta.Core;
|
||||
using Kreta.Core.Enum;
|
||||
using Kreta.Naplo.Dto.V3.Exception;
|
||||
using Swashbuckle.Examples;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Documentation
|
||||
{
|
||||
public class IsmeretlenHibaExample : NaploExceptionResponseDto, IExamplesProvider
|
||||
{
|
||||
public IsmeretlenHibaExample() : base(BlExceptionType.None, BlExceptionType.None.ToDisplayName())
|
||||
{
|
||||
}
|
||||
|
||||
public object GetExamples() => new IsmeretlenHibaExample();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using Kreta.Core;
|
||||
using Kreta.Core.Enum;
|
||||
using Kreta.Naplo.Dto.V3.Exception;
|
||||
using Swashbuckle.Examples;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Documentation
|
||||
{
|
||||
public class JogosulatlanExample : NaploExceptionResponseDto, IExamplesProvider
|
||||
{
|
||||
public JogosulatlanExample() : base(BlExceptionType.NincsJogosultsag, BlExceptionType.NincsJogosultsag.ToDisplayName())
|
||||
{
|
||||
}
|
||||
|
||||
public object GetExamples() => new JogosulatlanExample();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using Swashbuckle.Examples;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.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";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,41 @@
|
|||
using System.Collections.Generic;
|
||||
using Kreta.Client.CoreApi;
|
||||
using Kreta.Client.CoreApi.Request;
|
||||
using Kreta.Client.CoreApi.Response;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Documentation.MockServices
|
||||
{
|
||||
|
||||
internal class CoreApiClientMock : ICoreApiClient
|
||||
{
|
||||
public DKTFeladatInsertResponse DKTFeladatInsert(DKTFeladatInsertRequest request, int alkalmazottId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public DKTFeladatResponse DKTFeladatUpdate(DKTFeladatUpdateRequest request, int alkalmazottId)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public DKTFeladatResponse DKTFeladatDelete(DKTFeladatDeleteRequest request)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public EszkozIgenylesCreateResponse EszkozIgenylesInsert(EszkozIgenylesCreateDto request, string intezmenyGuid, int tanevSorszam)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public CoreApiResponse EszkozIgenylesUpdate(EszkozIgenylesUpdateDto request, string intezmenyGuid, int tanevSorszam)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<EszkozIgenylesDto> EszkozIgenylesGet(string intezmenyGuid, int tanevSorszam)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,35 @@
|
|||
using Kreta.BusinessLogic.Interfaces;
|
||||
using Kreta.Client.FileService.Request;
|
||||
using Kreta.Client.FileService.Response;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Documentation.MockServices
|
||||
{
|
||||
|
||||
internal class FileServiceHelperMock : IFileServiceHelper
|
||||
{
|
||||
public FileUploadResponse Upload(IFileUploadRequest fileUploadRequest)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public string GetUrl(string intezmenyAzonosito, GetUrlRequest fileDownloadRequest)
|
||||
{
|
||||
return "";
|
||||
}
|
||||
|
||||
public GetFileResponse GetFile(string intezmenyAzonosito, GetUrlRequest fileDownloadRequest)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
|
||||
public bool Delete(string intezmenyAzonosito, FileDeleteRequest fileDeleteRequest)
|
||||
{
|
||||
return true;
|
||||
}
|
||||
|
||||
public FileFinalizeResponseV3 Veglegesites(FileFinalizeRequestV3 fileVeglegesitesRequest)
|
||||
{
|
||||
return new FileFinalizeResponseV3();
|
||||
}
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using Kreta.Core;
|
||||
using Kreta.Core.Enum;
|
||||
using Kreta.Naplo.Dto.V3.Exception;
|
||||
using Swashbuckle.Examples;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Documentation
|
||||
{
|
||||
public class NemLetezoEntitasExample : NaploExceptionResponseDto, IExamplesProvider
|
||||
{
|
||||
public NemLetezoEntitasExample() : base(BlExceptionType.NemLetezoEntitas, BlExceptionType.NemLetezoEntitas.ToDisplayName())
|
||||
{
|
||||
}
|
||||
|
||||
public object GetExamples() => new NemLetezoEntitasExample();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,15 @@
|
|||
using Swashbuckle.Examples;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.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";
|
||||
}
|
||||
}
|
|
@ -0,0 +1,16 @@
|
|||
using Kreta.Core;
|
||||
using Kreta.Core.Enum;
|
||||
using Kreta.Naplo.Dto.V3.Exception;
|
||||
using Swashbuckle.Examples;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Documentation
|
||||
{
|
||||
public class TimeOutExample : NaploExceptionResponseDto, IExamplesProvider
|
||||
{
|
||||
public TimeOutExample() : base(BlExceptionType.TimeOut, BlExceptionType.TimeOut.ToDisplayName())
|
||||
{
|
||||
}
|
||||
|
||||
public object GetExamples() => new TimeOutExample();
|
||||
}
|
||||
}
|
|
@ -0,0 +1,36 @@
|
|||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Kreta.Core;
|
||||
using Kreta.Core.Domain;
|
||||
using Kreta.Core.Enum;
|
||||
using Kreta.Naplo.Domain.V3.Interfaces;
|
||||
using Kreta.Naplo.Dto.V3.Exception;
|
||||
using Swashbuckle.Examples;
|
||||
|
||||
namespace Kreta.Naplo.WebApi.V3.Documentation
|
||||
{
|
||||
/// <summary>
|
||||
/// Author: DevKornél Created On: 2019.05.
|
||||
/// </summary>
|
||||
public class ValidaciosHibaExample<TModel, TSameModel> : NaploExceptionResponseDto, 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);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue