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

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);
}
}
}