SES-80 Added swagger base configuration #18

Merged
s426135 merged 1 commits from SES-80 into master 2020-12-06 17:04:13 +01:00
7 changed files with 155 additions and 176 deletions

View File

@ -13,8 +13,8 @@ namespace SessionCompanion.Services.Profiles
public BiographyProfile() public BiographyProfile()
{ {
CreateMap<BiographyViewModel, Biography>(); CreateMap<BiographyViewModel, Biography>();
CreateMap<Biography, BiographyViewModel>() CreateMap<Biography, BiographyViewModel>();
.ForMember(vm => vm.Languages, conf => conf.MapFrom(bio => bio.Languages.Split(new char[] { ',' }).ToList()));
} }
} }
} }

View File

@ -18,184 +18,12 @@ namespace SessionCompanion.Services.Profiles
CreateMap<Character, CharacterForLoginViewModel>() CreateMap<Character, CharacterForLoginViewModel>()
.ForMember(vm => vm.Name, conf => conf.MapFrom(charact => charact.Biography.Name)) .ForMember(vm => vm.Name, conf => conf.MapFrom(charact => charact.Biography.Name))
.ForMember(vm => vm.Level, conf => conf.MapFrom(charact => charact.Statistics.Level)) .ForMember(vm => vm.Level, conf => conf.MapFrom(charact => charact.Statistics.Level))
.ForMember(vm => vm.ClassName, conf => conf.MapFrom(charact => charact.Biography.Class.Name)); .ForMember(vm => vm.ClassName, conf => conf.MapFrom(charact => charact.Biography.Class.Name)).ReverseMap();
CreateMap<CharacterForLoginViewModel, Character>();
CreateMap<Character, CharacterStatisticsViewModel>()
// Charisma
.ForMember(vm => vm.CanDeception, conf => conf.MapFrom(charact => charact.Charisma.CanDeception))
.ForMember(vm => vm.CanIntimidation, conf => conf.MapFrom(charact => charact.Charisma.CanIntimidation))
.ForMember(vm => vm.CanPerformance, conf => conf.MapFrom(charact => charact.Charisma.CanPerformance))
.ForMember(vm => vm.CanPersuasion, conf => conf.MapFrom(charact => charact.Charisma.CanPersuasion))
.ForMember(vm => vm.CharismaCanSaveThrows, conf => conf.MapFrom(charact => charact.Charisma.CanSaveThrows))
.ForMember(vm => vm.Deception, conf => conf.MapFrom(charact => charact.Charisma.Deception))
.ForMember(vm => vm.Intimidation, conf => conf.MapFrom(charact => charact.Charisma.Intimidation))
.ForMember(vm => vm.CharismaModification, conf => conf.MapFrom(charact => charact.Charisma.Modification))
.ForMember(vm => vm.Performance, conf => conf.MapFrom(charact => charact.Charisma.Performance))
.ForMember(vm => vm.Persuasion, conf => conf.MapFrom(charact => charact.Charisma.Persuasion))
.ForMember(vm => vm.CharismaSavingThrows, conf => conf.MapFrom(charact => charact.Charisma.SavingThrows))
.ForMember(vm => vm.CharismaValue, conf => conf.MapFrom(charact => charact.Charisma.Value))
// Dexterity
.ForMember(vm => vm.DexterityValue, conf => conf.MapFrom(charact => charact.Dexterity.Value))
.ForMember(vm => vm.DexterityModification, conf => conf.MapFrom(charact => charact.Dexterity.Modification))
.ForMember(vm => vm.DexteritySavingThrows, conf => conf.MapFrom(charact => charact.Dexterity.SavingThrows))
.ForMember(vm => vm.DexterityCanSaveThrows, conf => conf.MapFrom(charact => charact.Dexterity.CanSaveThrows))
.ForMember(vm => vm.CanAcrobatics, conf => conf.MapFrom(charact => charact.Dexterity.CanAcrobatics))
.ForMember(vm => vm.Acrobatics, conf => conf.MapFrom(charact => charact.Dexterity.Acrobatics))
.ForMember(vm => vm.SleightOfHand, conf => conf.MapFrom(charact => charact.Dexterity.SleightOfHand))
.ForMember(vm => vm.CanSleightOfHand, conf => conf.MapFrom(charact => charact.Dexterity.CanSleightOfHand))
.ForMember(vm => vm.CanStealth, conf => conf.MapFrom(charact => charact.Dexterity.CanStealth))
.ForMember(vm => vm.Stealth, conf => conf.MapFrom(charact => charact.Dexterity.Stealth))
// Strength
.ForMember(vm => vm.Athletics, conf => conf.MapFrom(charact => charact.Strength.Athletics))
.ForMember(vm => vm.CanAthletics, conf => conf.MapFrom(charact => charact.Strength.CanAthletics))
.ForMember(vm => vm.StrengthCanSaveThrows, conf => conf.MapFrom(charact => charact.Strength.CanSaveThrows))
.ForMember(vm => vm.StrengthModification, conf => conf.MapFrom(charact => charact.Strength.Modification))
.ForMember(vm => vm.StrengthSavingThrows, conf => conf.MapFrom(charact => charact.Strength.SavingThrows))
.ForMember(vm => vm.StrengthValue, conf => conf.MapFrom(charact => charact.Strength.Value))
// Wisdom
.ForMember(vm => vm.AnimalHandling, conf => conf.MapFrom(charact => charact.Wisdom.AnimalHandling))
.ForMember(vm => vm.CanAnimalHandling, conf => conf.MapFrom(charact => charact.Wisdom.CanAnimalHandling))
.ForMember(vm => vm.CanInsight, conf => conf.MapFrom(charact => charact.Wisdom.CanInsight))
.ForMember(vm => vm.CanMedicine, conf => conf.MapFrom(charact => charact.Wisdom.CanMedicine))
.ForMember(vm => vm.CanPerception, conf => conf.MapFrom(charact => charact.Wisdom.CanPerception))
.ForMember(vm => vm.WisdomCanSaveThrows, conf => conf.MapFrom(charact => charact.Wisdom.CanSaveThrows))
.ForMember(vm => vm.CanSurvival, conf => conf.MapFrom(charact => charact.Wisdom.CanSurvival))
.ForMember(vm => vm.Insight, conf => conf.MapFrom(charact => charact.Wisdom.Insight))
.ForMember(vm => vm.Medicine, conf => conf.MapFrom(charact => charact.Wisdom.Medicine))
.ForMember(vm => vm.WisdomModification, conf => conf.MapFrom(charact => charact.Wisdom.Modification))
.ForMember(vm => vm.Perception, conf => conf.MapFrom(charact => charact.Wisdom.Perception))
.ForMember(vm => vm.WisdomSavingThrows, conf => conf.MapFrom(charact => charact.Wisdom.SavingThrows))
.ForMember(vm => vm.Survival, conf => conf.MapFrom(charact => charact.Wisdom.Survival))
.ForMember(vm => vm.WisdomValue, conf => conf.MapFrom(charact => charact.Wisdom.Value))
// Intelligence
.ForMember(vm => vm.Arcana, conf => conf.MapFrom(charact => charact.Intelligence.Arcana))
.ForMember(vm => vm.CanArcana, conf => conf.MapFrom(charact => charact.Intelligence.CanArcana))
.ForMember(vm => vm.CanHistory, conf => conf.MapFrom(charact => charact.Intelligence.CanHistory))
.ForMember(vm => vm.CanInvestigation, conf => conf.MapFrom(charact => charact.Intelligence.CanInvestigation))
.ForMember(vm => vm.CanNature, conf => conf.MapFrom(charact => charact.Intelligence.CanNature))
.ForMember(vm => vm.CanReligion, conf => conf.MapFrom(charact => charact.Intelligence.CanReligion))
.ForMember(vm => vm.IntelligenceCanSaveThrows, conf => conf.MapFrom(charact => charact.Intelligence.CanSaveThrows))
.ForMember(vm => vm.History, conf => conf.MapFrom(charact => charact.Intelligence.History))
.ForMember(vm => vm.Investigation, conf => conf.MapFrom(charact => charact.Intelligence.Investigation))
.ForMember(vm => vm.IntelligenceModification, conf => conf.MapFrom(charact => charact.Intelligence.Modification))
.ForMember(vm => vm.Nature, conf => conf.MapFrom(charact => charact.Intelligence.Nature))
.ForMember(vm => vm.Religion, conf => conf.MapFrom(charact => charact.Intelligence.Religion))
.ForMember(vm => vm.IntelligenceSavingThrows, conf => conf.MapFrom(charact => charact.Intelligence.SavingThrows))
.ForMember(vm => vm.IntelligenceValue, conf => conf.MapFrom(charact => charact.Intelligence.Value))
// Constitution
.ForMember(vm => vm.ConstitutionCanSaveThrows, conf => conf.MapFrom(charact => charact.Constitution.CanSaveThrows))
.ForMember(vm => vm.ConstitutionModification, conf => conf.MapFrom(charact => charact.Constitution.Modification))
.ForMember(vm => vm.ConstitutionSavingThrows, conf => conf.MapFrom(charact => charact.Constitution.SavingThrows))
.ForMember(vm => vm.ConstitutionValue, conf => conf.MapFrom(charact => charact.Constitution.Value));
CreateMap<CharacterStatisticsViewModel, Character>();
CreateMap<Character, CharacterBasicStatsViewModel>() CreateMap<Character, CharacterBasicStatsViewModel>()
.ForMember(vm => vm.Id, conf => conf.MapFrom(charact => charact.Id))
.ForMember(vm => vm.Name, conf => conf.MapFrom(charact => charact.Biography.Name)) .ForMember(vm => vm.Name, conf => conf.MapFrom(charact => charact.Biography.Name))
.ForMember(vm => vm.Level, conf => conf.MapFrom(charact => charact.Statistics.Level)) .ForMember(vm => vm.Level, conf => conf.MapFrom(charact => charact.Statistics.Level))
.ForMember(vm => vm.CurrentHealthPoints, conf => conf.MapFrom(charact => charact.Statistics.CurrentHealthPoints)); .ForMember(vm => vm.CurrentHealthPoints, conf => conf.MapFrom(charact => charact.Statistics.CurrentHealthPoints)).ReverseMap();
CreateMap<CharacterBasicStatsViewModel, Character>();
CreateMap<CharacterEveryStatViewModel, Character>();
CreateMap<Character, CharacterEveryStatViewModel>()
.ForMember(vm => vm.Name, conf => conf.MapFrom(charac => charac.Biography.Name))
.ForMember(vm => vm.Level, conf => conf.MapFrom(charac => charac.Statistics.Level))
.ForMember(vm => vm.CurrentHealthPoints, conf => conf.MapFrom(charac => charac.Statistics.CurrentHealthPoints))
.ForMember(vm => vm.ClassName, conf => conf.MapFrom(charac => charac.Biography.Class.Name))
.ForMember(vm => vm.Name, conf => conf.MapFrom(charac => charac.Biography.Name))
.ForMember(vm => vm.CanDeception, conf => conf.MapFrom(charact => charact.Charisma.CanDeception))
.ForMember(vm => vm.CanIntimidation, conf => conf.MapFrom(charact => charact.Charisma.CanIntimidation))
.ForMember(vm => vm.CanPerformance, conf => conf.MapFrom(charact => charact.Charisma.CanPerformance))
.ForMember(vm => vm.CanPersuasion, conf => conf.MapFrom(charact => charact.Charisma.CanPersuasion))
.ForMember(vm => vm.CharismaCanSaveThrows, conf => conf.MapFrom(charact => charact.Charisma.CanSaveThrows))
.ForMember(vm => vm.Deception, conf => conf.MapFrom(charact => charact.Charisma.Deception))
.ForMember(vm => vm.Intimidation, conf => conf.MapFrom(charact => charact.Charisma.Intimidation))
.ForMember(vm => vm.CharismaModification, conf => conf.MapFrom(charact => charact.Charisma.Modification))
.ForMember(vm => vm.Performance, conf => conf.MapFrom(charact => charact.Charisma.Performance))
.ForMember(vm => vm.Persuasion, conf => conf.MapFrom(charact => charact.Charisma.Persuasion))
.ForMember(vm => vm.CharismaSavingThrows, conf => conf.MapFrom(charact => charact.Charisma.SavingThrows))
.ForMember(vm => vm.CharismaValue, conf => conf.MapFrom(charact => charact.Charisma.Value))
// Dexterity
.ForMember(vm => vm.DexterityValue, conf => conf.MapFrom(charact => charact.Dexterity.Value))
.ForMember(vm => vm.DexterityModification, conf => conf.MapFrom(charact => charact.Dexterity.Modification))
.ForMember(vm => vm.DexteritySavingThrows, conf => conf.MapFrom(charact => charact.Dexterity.SavingThrows))
.ForMember(vm => vm.DexterityCanSaveThrows, conf => conf.MapFrom(charact => charact.Dexterity.CanSaveThrows))
.ForMember(vm => vm.CanAcrobatics, conf => conf.MapFrom(charact => charact.Dexterity.CanAcrobatics))
.ForMember(vm => vm.Acrobatics, conf => conf.MapFrom(charact => charact.Dexterity.Acrobatics))
.ForMember(vm => vm.SleightOfHand, conf => conf.MapFrom(charact => charact.Dexterity.SleightOfHand))
.ForMember(vm => vm.CanSleightOfHand, conf => conf.MapFrom(charact => charact.Dexterity.CanSleightOfHand))
.ForMember(vm => vm.CanStealth, conf => conf.MapFrom(charact => charact.Dexterity.CanStealth))
.ForMember(vm => vm.Stealth, conf => conf.MapFrom(charact => charact.Dexterity.Stealth))
// Strength
.ForMember(vm => vm.Athletics, conf => conf.MapFrom(charact => charact.Strength.Athletics))
.ForMember(vm => vm.CanAthletics, conf => conf.MapFrom(charact => charact.Strength.CanAthletics))
.ForMember(vm => vm.StrengthCanSaveThrows, conf => conf.MapFrom(charact => charact.Strength.CanSaveThrows))
.ForMember(vm => vm.StrengthModification, conf => conf.MapFrom(charact => charact.Strength.Modification))
.ForMember(vm => vm.StrengthSavingThrows, conf => conf.MapFrom(charact => charact.Strength.SavingThrows))
.ForMember(vm => vm.StrengthValue, conf => conf.MapFrom(charact => charact.Strength.Value))
// Wisdom
.ForMember(vm => vm.AnimalHandling, conf => conf.MapFrom(charact => charact.Wisdom.AnimalHandling))
.ForMember(vm => vm.CanAnimalHandling, conf => conf.MapFrom(charact => charact.Wisdom.CanAnimalHandling))
.ForMember(vm => vm.CanInsight, conf => conf.MapFrom(charact => charact.Wisdom.CanInsight))
.ForMember(vm => vm.CanMedicine, conf => conf.MapFrom(charact => charact.Wisdom.CanMedicine))
.ForMember(vm => vm.CanPerception, conf => conf.MapFrom(charact => charact.Wisdom.CanPerception))
.ForMember(vm => vm.WisdomCanSaveThrows, conf => conf.MapFrom(charact => charact.Wisdom.CanSaveThrows))
.ForMember(vm => vm.CanSurvival, conf => conf.MapFrom(charact => charact.Wisdom.CanSurvival))
.ForMember(vm => vm.Insight, conf => conf.MapFrom(charact => charact.Wisdom.Insight))
.ForMember(vm => vm.Medicine, conf => conf.MapFrom(charact => charact.Wisdom.Medicine))
.ForMember(vm => vm.WisdomModification, conf => conf.MapFrom(charact => charact.Wisdom.Modification))
.ForMember(vm => vm.Perception, conf => conf.MapFrom(charact => charact.Wisdom.Perception))
.ForMember(vm => vm.WisdomSavingThrows, conf => conf.MapFrom(charact => charact.Wisdom.SavingThrows))
.ForMember(vm => vm.Survival, conf => conf.MapFrom(charact => charact.Wisdom.Survival))
.ForMember(vm => vm.WisdomValue, conf => conf.MapFrom(charact => charact.Wisdom.Value))
// Intelligence
.ForMember(vm => vm.Arcana, conf => conf.MapFrom(charact => charact.Intelligence.Arcana))
.ForMember(vm => vm.CanArcana, conf => conf.MapFrom(charact => charact.Intelligence.CanArcana))
.ForMember(vm => vm.CanHistory, conf => conf.MapFrom(charact => charact.Intelligence.CanHistory))
.ForMember(vm => vm.CanInvestigation, conf => conf.MapFrom(charact => charact.Intelligence.CanInvestigation))
.ForMember(vm => vm.CanNature, conf => conf.MapFrom(charact => charact.Intelligence.CanNature))
.ForMember(vm => vm.CanReligion, conf => conf.MapFrom(charact => charact.Intelligence.CanReligion))
.ForMember(vm => vm.IntelligenceCanSaveThrows, conf => conf.MapFrom(charact => charact.Intelligence.CanSaveThrows))
.ForMember(vm => vm.History, conf => conf.MapFrom(charact => charact.Intelligence.History))
.ForMember(vm => vm.Investigation, conf => conf.MapFrom(charact => charact.Intelligence.Investigation))
.ForMember(vm => vm.IntelligenceModification, conf => conf.MapFrom(charact => charact.Intelligence.Modification))
.ForMember(vm => vm.Nature, conf => conf.MapFrom(charact => charact.Intelligence.Nature))
.ForMember(vm => vm.Religion, conf => conf.MapFrom(charact => charact.Intelligence.Religion))
.ForMember(vm => vm.IntelligenceSavingThrows, conf => conf.MapFrom(charact => charact.Intelligence.SavingThrows))
.ForMember(vm => vm.IntelligenceValue, conf => conf.MapFrom(charact => charact.Intelligence.Value))
// Constitution
.ForMember(vm => vm.ConstitutionCanSaveThrows, conf => conf.MapFrom(charact => charact.Constitution.CanSaveThrows))
.ForMember(vm => vm.ConstitutionModification, conf => conf.MapFrom(charact => charact.Constitution.Modification))
.ForMember(vm => vm.ConstitutionSavingThrows, conf => conf.MapFrom(charact => charact.Constitution.SavingThrows))
.ForMember(vm => vm.ConstitutionValue, conf => conf.MapFrom(charact => charact.Constitution.Value));
CreateMap<CharacterBioViewModel, Character>();
CreateMap<Character, CharacterBioViewModel>()
.ForMember(vm => vm.CharacterId, conf => conf.MapFrom(charact => charact.Id))
.ForMember(vm => vm.Name, conf => conf.MapFrom(charact => charact.Biography.Name))
.ForMember(vm => vm.Sex, conf => conf.MapFrom(charact => charact.Biography.Sex))
.ForMember(vm => vm.CharacterLanguages, conf => conf.MapFrom(charact => charact.Biography.Languages.Split(new char[] { ';' }).ToList()))
.ForMember(vm => vm.ClassId, conf => conf.MapFrom(charact => charact.Biography.Class.Id))
.ForMember(vm => vm.ClassName, conf => conf.MapFrom(charact => charact.Biography.Class.Name))
.ForMember(vm => vm.Proficiencies, conf => conf.MapFrom(charact => charact.Biography.Class.Proficiencies.Split(new char[] { ';' }).ToList()))
.ForMember(vm => vm.Subclasses, conf => conf.MapFrom(charact => charact.Biography.Class.Subclasses))
.ForMember(vm => vm.Sex, conf => conf.MapFrom(charact => charact.Biography.Sex))
.ForMember(vm => vm.RaceName, conf => conf.MapFrom(charact => charact.Biography.Race.Name))
.ForMember(vm => vm.RaceLanguages, conf => conf.MapFrom(charact => charact.Biography.Race.Language.Split(new char[] { ';' }).ToList()))
.ForMember(vm => vm.Sex, conf => conf.MapFrom(charact => charact.Biography.Sex))
.ForMember(vm => vm.LanguageDescription, conf => conf.MapFrom(charact => charact.Biography.Race.LanguageDescription))
.ForMember(vm => vm.SizeDescription, conf => conf.MapFrom(charact => charact.Biography.Race.SizeDescription))
.ForMember(vm => vm.StartingProficiencies, conf => conf.MapFrom(charact => charact.Biography.Race.StartingProficiencies.Split(new char[] { ';' }).ToList()))
.ForMember(vm => vm.Traits, conf => conf.MapFrom(charact => charact.Biography.Race.Traits.Split(new char[] { ';' }).ToList()))
.ForMember(vm => vm.ExperiencePoints, conf => conf.MapFrom(charact => charact.Statistics.ExperiencePoints))
.ForMember(vm => vm.Level, conf => conf.MapFrom(charact => charact.Statistics.Level))
.ForMember(vm => vm.Speed, conf => conf.MapFrom(charact => charact.Statistics.Speed))
.ForMember(vm => vm.Initiative, conf => conf.MapFrom(charact => charact.Statistics.Initiative));
//.ForMember(vm => vm.Features, conf => conf.MapFrom(charact => charact.Biography.Class.ClassFeatures.Where(x => x.ClassId.Equals(charact.Biography.ClassId)).Select(f => f.Feature)));
} }
} }
} }

View File

@ -4,4 +4,13 @@
<TargetFramework>net5.0</TargetFramework> <TargetFramework>net5.0</TargetFramework>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>SessionCompanion.ViewModels.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="5.6.3" />
</ItemGroup>
</Project> </Project>

View File

@ -0,0 +1,63 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>SessionCompanion.ViewModels</name>
</assembly>
<members>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterBasicStatsViewModel.Id">
<summary>
Identyfikator psotaci
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterBasicStatsViewModel.Name">
<summary>
Nazwa postaci
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterBasicStatsViewModel.Level">
<summary>
Poziom postaci
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterBasicStatsViewModel.CurrentHealthPoints">
<summary>
Aktualna ilość życia postaci
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterForLoginViewModel.Id">
<summary>
Identyfikator psotaci
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterForLoginViewModel.UserId">
<summary>
Id użytkownika do którego przypisana jest postać
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterForLoginViewModel.Name">
<summary>
Nazwa postaci
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterForLoginViewModel.ClassName">
<summary>
Nazwa klasy postaci
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterForLoginViewModel.Level">
<summary>
Poziom postaci
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterViewModel.Id">
<summary>
Identyfikator psotaci
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterViewModel.UserId">
<summary>
Id użytkownika do którego przypisana jest postać
</summary>
</member>
</members>
</doc>

View File

@ -12,6 +12,10 @@
<BuildServerSideRenderer>false</BuildServerSideRenderer> <BuildServerSideRenderer>false</BuildServerSideRenderer>
</PropertyGroup> </PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile>SessionCompanion.xml</DocumentationFile>
</PropertyGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="AutoMapper" Version="10.1.1" /> <PackageReference Include="AutoMapper" Version="10.1.1" />
<PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.0" /> <PackageReference Include="AutoMapper.Extensions.Microsoft.DependencyInjection" Version="8.1.0" />
@ -21,6 +25,8 @@
<PrivateAssets>all</PrivateAssets> <PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference> </PackageReference>
<PackageReference Include="Swashbuckle.AspNetCore" Version="5.6.3" />
<PackageReference Include="Swashbuckle.AspNetCore.SwaggerUI" Version="5.6.3" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>

View File

@ -0,0 +1,47 @@
<?xml version="1.0"?>
<doc>
<assembly>
<name>SessionCompanion</name>
</assembly>
<members>
<member name="M:SessionCompanion.Controllers.CharacterController.Get(System.Int32)">
<summary>
Metoda zwraca postać ze wskazanym identyfikatorem
</summary>
<param name="id">Identyfikator postaci</param>
<returns>ViewModel Postaci</returns>
</member>
<member name="F:SessionCompanion.Hubs.SessionHub.ConnectedCharacters">
<summary>
Lista zalogowanych graczy i identyfikator wybranej postaci
</summary>
</member>
<member name="F:SessionCompanion.Hubs.SessionHub.GameMasterConnected">
<summary>
Status, czy GM został już zalogowany
</summary>
</member>
<member name="M:SessionCompanion.Hubs.SessionHub.OnDisconnectedAsync(System.Exception)">
<summary>
Metoda nadpisuje istniejącą metodę wywoływaną na utratę połączenia.
Ma ona za zadanie usunąć odłączonego gracza z listy zalogowanych.
Pozostałe ekrany zostają powiadomione wiadomością "GoodBye"
</summary>
<param name="exception">Błąd/przyczyna odłączenia</param>
</member>
<member name="M:SessionCompanion.Hubs.SessionHub.GameMasterLogin">
<summary>
Logowanie do Huba dla GM
Wysyła wiadomość "Welcome" do wszystkich zalogowanych użytkoników
</summary>
<returns>Zwraca true - jeśli udało się zalogować, false - jesli ktoś zalogował się już jako GM</returns>
</member>
<member name="M:SessionCompanion.Hubs.SessionHub.PlayerCharacterLogin(System.Int32)">
<summary>
Logowanie do Huba dla Gracza
</summary>
<param name="characterId"> Identyfikator zalogowanego bohatera </param>
<returns>Wysyła wiadomość "Welcome" do wszystkich zalogowanych użytkoników</returns>
</member>
</members>
</doc>

View File

@ -14,6 +14,13 @@ using SessionCompanion.Hubs;
namespace SessionCompanion namespace SessionCompanion
{ {
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Microsoft.OpenApi.Models;
public class Startup public class Startup
{ {
@ -35,6 +42,18 @@ namespace SessionCompanion
services.AddServices(); services.AddServices();
services.AddAutoMapper(typeof(Startup)); services.AddAutoMapper(typeof(Startup));
services.AddSignalR(); services.AddSignalR();
services.AddSwaggerGen(s =>
{
s.SwaggerDoc("v1", new OpenApiInfo { Title = "Dostêpne API", Version = "v1" });
var basePath = AppContext.BaseDirectory;
var xmlPath = Path.Combine(basePath, "SessionCompanion.xml");
s.IncludeXmlComments(xmlPath);
xmlPath = Path.Combine(basePath, "SessionCompanion.ViewModels.xml");
s.IncludeXmlComments(xmlPath);
});
// In production, the Angular files will be served from this directory // In production, the Angular files will be served from this directory
services.AddSpaStaticFiles(configuration => services.AddSpaStaticFiles(configuration =>
{ {
@ -50,6 +69,7 @@ namespace SessionCompanion
{ {
serviceScope.ServiceProvider.GetService<ApplicationDbContext>().Database.Migrate(); serviceScope.ServiceProvider.GetService<ApplicationDbContext>().Database.Migrate();
} }
if (env.IsDevelopment()) if (env.IsDevelopment())
{ {
app.UseDeveloperExceptionPage(); app.UseDeveloperExceptionPage();
@ -84,6 +104,12 @@ namespace SessionCompanion
}); });
}); });
app.UseSwagger();
app.UseSwaggerUI(c =>
{
c.SwaggerEndpoint("/swagger/v1/swagger.json", "SessionCompanion API V1");
});
app.UseSpa(spa => app.UseSpa(spa =>
{ {
// To learn more about options for serving an Angular SPA from ASP.NET Core, // To learn more about options for serving an Angular SPA from ASP.NET Core,