SES-116 Small fix on backend

This commit is contained in:
Łukasz Góreczny 2020-12-27 21:17:00 +01:00
parent 9826e57e7f
commit fe5921fa57
5 changed files with 16 additions and 1 deletions

View File

@ -23,7 +23,8 @@ namespace SessionCompanion.Services.Profiles
CreateMap<Character, CharacterBasicStatsViewModel>() CreateMap<Character, CharacterBasicStatsViewModel>()
.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)).ReverseMap(); .ForMember(vm => vm.CurrentHealthPoints, conf => conf.MapFrom(charact => charact.Statistics.CurrentHealthPoints))
.ForMember(vm => vm.Class, conf => conf.MapFrom(charact => charact.Biography.Class.Name)).ReverseMap();
} }
} }
} }

View File

@ -46,6 +46,7 @@ namespace SessionCompanion.Services.Services
{ {
var characters = await Repository.Get(c => charactersId.Contains(c.Id)) var characters = await Repository.Get(c => charactersId.Contains(c.Id))
.Include(x => x.Biography) .Include(x => x.Biography)
.ThenInclude(x => x.Class)
.Include(x => x.Statistics).ToListAsync(); .Include(x => x.Statistics).ToListAsync();
var result = Mapper.Map<IEnumerable<CharacterBasicStatsViewModel>>(characters); var result = Mapper.Map<IEnumerable<CharacterBasicStatsViewModel>>(characters);
return result; return result;

View File

@ -21,5 +21,10 @@
/// Aktualna ilość życia postaci /// Aktualna ilość życia postaci
/// </summary> /// </summary>
public int CurrentHealthPoints { get; set; } public int CurrentHealthPoints { get; set; }
/// <summary>
/// Klasa postaci
/// </summary>
public string Class { get; set; }
} }
} }

View File

@ -100,6 +100,11 @@
Aktualna ilość życia postaci Aktualna ilość życia postaci
</summary> </summary>
</member> </member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterBasicStatsViewModel.Class">
<summary>
Klasa postaci
</summary>
</member>
<member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterForLoginViewModel.Id"> <member name="P:SessionCompanion.ViewModels.CharacterViewModels.CharacterForLoginViewModel.Id">
<summary> <summary>
Identyfikator postaci Identyfikator postaci

View File

@ -72,6 +72,9 @@ namespace SessionCompanion.Controllers
public async Task<Either<List<CharacterBasicStatsViewModel>, ErrorResponse>> GetLoggedUsersCharacters() public async Task<Either<List<CharacterBasicStatsViewModel>, ErrorResponse>> GetLoggedUsersCharacters()
{ {
var connectedCharacters = _sessionHubData.ConnectedCharacters_Prop; var connectedCharacters = _sessionHubData.ConnectedCharacters_Prop;
connectedCharacters.Add("a", 1);
connectedCharacters.Add("s", 2);
connectedCharacters.Add("d", 3);
var characters = await _service.GetBasicCharactersData(connectedCharacters.Values.ToList()); var characters = await _service.GetBasicCharactersData(connectedCharacters.Values.ToList());
return characters.ToList(); return characters.ToList();