init
This commit is contained in:
commit
e124a47765
19374 changed files with 9806149 additions and 0 deletions
|
@ -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