mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-11-26 15:43:44 +01:00
Account info step
This commit is contained in:
1 parent
414a8c188f
commit
50ecb57591
7 files changed
+205
-25
No files matched your search
@@ -0,0 +1,120 @@
|
|||||||
|
namespace WotBlitzStatisticsPro.DataAccess.Model.Accounts
|
||||||
|
{
|
||||||
|
public class AccountInfoHistory
|
||||||
|
{
|
||||||
|
///<summary>
|
||||||
|
/// Player account identifier
|
||||||
|
///</summary>
|
||||||
|
public long AccountId { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Last battle time
|
||||||
|
///</summary>
|
||||||
|
public int LastBattleTime { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Battles count
|
||||||
|
///</summary>
|
||||||
|
public long? Battles { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Capture points
|
||||||
|
///</summary>
|
||||||
|
public long? CapturePoints { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Total damage amount
|
||||||
|
///</summary>
|
||||||
|
public long? DamageDealt { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Total amount of received damage
|
||||||
|
///</summary>
|
||||||
|
public long? DamageReceived { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Dropped capture points
|
||||||
|
///</summary>
|
||||||
|
public long? DroppedCapturePoints { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Total amount of frags
|
||||||
|
///</summary>
|
||||||
|
public long? Frags { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Total amount of fras grater ten 8 lvl
|
||||||
|
///</summary>
|
||||||
|
public long? Frags8P { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Total amount of hits
|
||||||
|
///</summary>
|
||||||
|
public long? Hits { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Total amount of losses
|
||||||
|
///</summary>
|
||||||
|
public long? Losses { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Max frags per battle
|
||||||
|
///</summary>
|
||||||
|
public long? MaxFrags { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Tank id, which kills max frags per battle
|
||||||
|
///</summary>
|
||||||
|
public long? MaxFragsTankId { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Max experience per battle
|
||||||
|
///</summary>
|
||||||
|
public long? MaxXp { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Tank Id which created max experiense per battle
|
||||||
|
///</summary>
|
||||||
|
public long? MaxXpTankId { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Total shots count
|
||||||
|
///</summary>
|
||||||
|
public long? Shots { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Total count of spotted vehicles
|
||||||
|
///</summary>
|
||||||
|
public long? Spotted { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Total count of survived battles
|
||||||
|
///</summary>
|
||||||
|
public long? SurvivedBattles { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Total count of suvived and winned battles
|
||||||
|
///</summary>
|
||||||
|
public long? WinAndSurvived { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Total wins count
|
||||||
|
///</summary>
|
||||||
|
public long? Wins { get; set; }
|
||||||
|
|
||||||
|
///<summary>
|
||||||
|
/// Total amount of experience
|
||||||
|
///</summary>
|
||||||
|
public long? Xp { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Average tier
|
||||||
|
/// </summary>
|
||||||
|
public double AvgTier { get; set; }
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Wn7 coefficient
|
||||||
|
/// </summary>
|
||||||
|
public double Wn7 { get; set; }
|
||||||
|
}
|
||||||
|
}
|
||||||
+5
@@ -1,4 +1,5 @@
|
|||||||
using WotBlitzStatisticsPro.Common.Model;
|
using WotBlitzStatisticsPro.Common.Model;
|
||||||
|
using WotBlitzStatisticsPro.DataAccess.Model.Accounts;
|
||||||
|
|
||||||
namespace WotBlitzStatisticsPro.Logic.AccountInformationPipeline
|
namespace WotBlitzStatisticsPro.Logic.AccountInformationPipeline
|
||||||
{
|
{
|
||||||
@@ -19,5 +20,9 @@ namespace WotBlitzStatisticsPro.Logic.AccountInformationPipeline
|
|||||||
public RealmType RealmType { get; }
|
public RealmType RealmType { get; }
|
||||||
public RequestLanguage RequestLanguage { get; }
|
public RequestLanguage RequestLanguage { get; }
|
||||||
|
|
||||||
|
public AccountInfo AccountInfo { get; set; }
|
||||||
|
|
||||||
|
public AccountInfoHistory AccountInfoHistory { get; set; }
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
+29
-2
@@ -1,14 +1,41 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
|
using AutoMapper;
|
||||||
|
using WotBlitzStatisticsPro.DataAccess.Model.Accounts;
|
||||||
using WotBlitzStatisticsPro.Logic.Pipeline;
|
using WotBlitzStatisticsPro.Logic.Pipeline;
|
||||||
|
using WotBlitzStatisticsPro.WgApiClient;
|
||||||
|
using WotBlitzStatisticsPro.WgApiClient.Model;
|
||||||
|
|
||||||
namespace WotBlitzStatisticsPro.Logic.AccountInformationPipeline.Operations
|
namespace WotBlitzStatisticsPro.Logic.AccountInformationPipeline.Operations
|
||||||
{
|
{
|
||||||
public class GetAccountInfoOperation: IOperation<AccountInformationPipelineContext>
|
public class GetAccountInfoOperation: IOperation<AccountInformationPipelineContext>
|
||||||
{
|
{
|
||||||
public Task Invoke(AccountInformationPipelineContext context, Func<AccountInformationPipelineContext, Task> next)
|
private readonly IWargamingApiClient _wargamingApi;
|
||||||
|
private readonly IMapper _mapper;
|
||||||
|
|
||||||
|
public GetAccountInfoOperation(
|
||||||
|
IWargamingApiClient wargamingApi,
|
||||||
|
IMapper mapper)
|
||||||
{
|
{
|
||||||
return next.Invoke(context);
|
_wargamingApi = wargamingApi;
|
||||||
|
_mapper = mapper;
|
||||||
|
}
|
||||||
|
|
||||||
|
public async Task Invoke(AccountInformationPipelineContext context, Func<AccountInformationPipelineContext, Task> next)
|
||||||
|
{
|
||||||
|
var accountInfo = await
|
||||||
|
_wargamingApi.GetPlayerAccountInfo(context.AccountId, context.RealmType, context.RequestLanguage);
|
||||||
|
|
||||||
|
// Store info to AccountInfo and in AccountInfoHistory
|
||||||
|
context.AccountInfo = _mapper.Map<WotAccountInfo, AccountInfo>(accountInfo);
|
||||||
|
context.AccountInfo.Realm = context.RealmType;
|
||||||
|
|
||||||
|
context.AccountInfoHistory =
|
||||||
|
_mapper.Map<WotAccountFullStatistics, AccountInfoHistory>(accountInfo.Statistics.All);
|
||||||
|
context.AccountInfoHistory.AccountId = context.AccountId;
|
||||||
|
context.AccountInfoHistory.LastBattleTime = context.AccountInfo.LastBattleTime;
|
||||||
|
|
||||||
|
await next.Invoke(context);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using WotBlitzStatisticsPro.DataAccess.Model.Accounts;
|
||||||
|
using WotBlitzStatisticsPro.WgApiClient.Model;
|
||||||
|
|
||||||
|
namespace WotBlitzStatisticsPro.Logic.Mappers
|
||||||
|
{
|
||||||
|
public class AccountInfoProfile : Profile
|
||||||
|
{
|
||||||
|
public AccountInfoProfile()
|
||||||
|
{
|
||||||
|
CreateMap<WotAccountInfo, AccountInfo>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
using AutoMapper;
|
||||||
|
using WotBlitzStatisticsPro.DataAccess.Model.Accounts;
|
||||||
|
using WotBlitzStatisticsPro.WgApiClient.Model;
|
||||||
|
|
||||||
|
namespace WotBlitzStatisticsPro.Logic.Mappers
|
||||||
|
{
|
||||||
|
public class AccountInfoStatisticsProfile : Profile
|
||||||
|
{
|
||||||
|
public AccountInfoStatisticsProfile()
|
||||||
|
{
|
||||||
|
CreateMap<WotAccountFullStatistics, AccountInfoHistory>();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,114 +8,114 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
|||||||
/// Battles count
|
/// Battles count
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("battles")]
|
[JsonProperty("battles")]
|
||||||
public long? Battles { get; set; }
|
public long Battles { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Capture points
|
/// Capture points
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("capture_points")]
|
[JsonProperty("capture_points")]
|
||||||
public long? CapturePoints { get; set; }
|
public long CapturePoints { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Total damage amount
|
/// Total damage amount
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("damage_dealt")]
|
[JsonProperty("damage_dealt")]
|
||||||
public long? DamageDealt { get; set; }
|
public long DamageDealt { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Total amount of received damage
|
/// Total amount of received damage
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("damage_received")]
|
[JsonProperty("damage_received")]
|
||||||
public long? DamageReceived { get; set; }
|
public long DamageReceived { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Dropped capture points
|
/// Dropped capture points
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("dropped_capture_points")]
|
[JsonProperty("dropped_capture_points")]
|
||||||
public long? DroppedCapturePoints { get; set; }
|
public long DroppedCapturePoints { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Total amount of frags
|
/// Total amount of frags
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("frags")]
|
[JsonProperty("frags")]
|
||||||
public long? Frags { get; set; }
|
public long Frags { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Total amount of fras grater ten 8 lvl
|
/// Total amount of fras grater ten 8 lvl
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("frags8p")]
|
[JsonProperty("frags8p")]
|
||||||
public long? Frags8P { get; set; }
|
public long Frags8P { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Total amount of hits
|
/// Total amount of hits
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("hits")]
|
[JsonProperty("hits")]
|
||||||
public long? Hits { get; set; }
|
public long Hits { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Total amount of losses
|
/// Total amount of losses
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("losses")]
|
[JsonProperty("losses")]
|
||||||
public long? Losses { get; set; }
|
public long Losses { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Max frags per battle
|
/// Max frags per battle
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("max_frags")]
|
[JsonProperty("max_frags")]
|
||||||
public long? MaxFrags { get; set; }
|
public long MaxFrags { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Tank id, which kills max frags per battle
|
/// Tank id, which kills max frags per battle
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("max_frags_tank_id")]
|
[JsonProperty("max_frags_tank_id")]
|
||||||
public long? MaxFragsTankId { get; set; }
|
public long MaxFragsTankId { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Max experience per battle
|
/// Max experience per battle
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("max_xp")]
|
[JsonProperty("max_xp")]
|
||||||
public long? MaxXp { get; set; }
|
public long MaxXp { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Tank Id which created max experiense per battle
|
/// Tank Id which created max experiense per battle
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("max_xp_tank_id")]
|
[JsonProperty("max_xp_tank_id")]
|
||||||
public long? MaxXpTankId { get; set; }
|
public long MaxXpTankId { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Total shots count
|
/// Total shots count
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("shots")]
|
[JsonProperty("shots")]
|
||||||
public long? Shots { get; set; }
|
public long Shots { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Total count of spotted vehicles
|
/// Total count of spotted vehicles
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("spotted")]
|
[JsonProperty("spotted")]
|
||||||
public long? Spotted { get; set; }
|
public long Spotted { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Total count of survived battles
|
/// Total count of survived battles
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("survived_battles")]
|
[JsonProperty("survived_battles")]
|
||||||
public long? SurvivedBattles { get; set; }
|
public long SurvivedBattles { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Total count of suvived and winned battles
|
/// Total count of suvived and winned battles
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("win_and_survived")]
|
[JsonProperty("win_and_survived")]
|
||||||
public long? WinAndSurvived { get; set; }
|
public long WinAndSurvived { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Total wins count
|
/// Total wins count
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("wins")]
|
[JsonProperty("wins")]
|
||||||
public long? Wins { get; set; }
|
public long Wins { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Total amount of experience
|
/// Total amount of experience
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("xp")]
|
[JsonProperty("xp")]
|
||||||
public long? Xp { get; set; }
|
public long Xp { get; set; }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -8,19 +8,19 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
|||||||
/// Player account identifier
|
/// Player account identifier
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("account_id")]
|
[JsonProperty("account_id")]
|
||||||
public long? AccountId { get; set; }
|
public long AccountId { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Account creation date
|
/// Account creation date
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("created_at")]
|
[JsonProperty("created_at")]
|
||||||
public int? CreatedAt { get; set; }
|
public int CreatedAt { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Last battle time
|
/// Last battle time
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("last_battle_time")]
|
[JsonProperty("last_battle_time")]
|
||||||
public int? LastBattleTime { get; set; }
|
public int LastBattleTime { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Player's nick
|
/// Player's nick
|
||||||
@@ -32,7 +32,7 @@ namespace WotBlitzStatisticsPro.WgApiClient.Model
|
|||||||
/// Player information update date
|
/// Player information update date
|
||||||
///</summary>
|
///</summary>
|
||||||
[JsonProperty("updated_at")]
|
[JsonProperty("updated_at")]
|
||||||
public int? UpdatedAt { get; set; }
|
public int UpdatedAt { get; set; }
|
||||||
|
|
||||||
///<summary>
|
///<summary>
|
||||||
/// Private account data
|
/// Private account data
|
||||||
|
|||||||
Reference in new issue
Block a user