Account info DTO

This commit is contained in:
Mikhail Shabanov committed 2020-09-30 19:30:36 +02:00
1 parent b343e36e0d
commit 5e0369511f
16 files changed
+557 -35

No files matched your search

@@ -4,6 +4,7 @@ using System.Threading.Tasks;
using MongoDB.Driver;
using WotBlitzStatisticsPro.Common;
using WotBlitzStatisticsPro.Common.Dictionaries;
using WotBlitzStatisticsPro.Common.Model;
using WotBlitzStatisticsPro.DataAccess.Model;
namespace WotBlitzStatisticsPro.DataAccess
@@ -101,5 +102,42 @@ namespace WotBlitzStatisticsPro.DataAccess
return collection.ToDictionary(k => k.TankId, v => v.Tier);
}
public async Task<Dictionary<long, IVehiclesDictionary>> GetVehicles(long[] tankIds)
{
var collection = await _database.GetCollection<VehiclesDictionary>(VehiclesCollectionName)
.Find(Builders<VehiclesDictionary>.Filter.In(v => v.TankId, tankIds))
.ToListAsync();
return collection.ToDictionary(k => k.TankId, v => v as IVehiclesDictionary);
}
public async Task<Dictionary<string, string>> GetNations(RequestLanguage language)
{
var collection = await _database.GetCollection<NationDictionary>(NationsCollectionName)
.Find(Builders<NationDictionary>.Filter.Empty)
.Project(n => new
{
nationId = n.NationId,
nationValue = n.NationNames.First(v => v.Language == language).Value
})
.ToListAsync();
return collection.ToDictionary(n => n.nationId, n => n.nationValue);
}
public async Task<Dictionary<string, string>> GetTankTypes(RequestLanguage language)
{
var collection = await _database.GetCollection<VehicleTypeDictionary>(VehicleTypesCollectionName)
.Find(Builders<VehicleTypeDictionary>.Filter.Empty)
.Project(n => new
{
typeId = n.VehicleTypeId,
typeValue = n.VehicleTypeNames.First(v => v.Language == language).Value
})
.ToListAsync();
return collection.ToDictionary(n => n.typeId, n => n.typeValue);
}
}
}
@@ -1,6 +1,7 @@
using System.Collections.Generic;
using System.Threading.Tasks;
using WotBlitzStatisticsPro.Common.Dictionaries;
using WotBlitzStatisticsPro.Common.Model;
namespace WotBlitzStatisticsPro.DataAccess
{
@@ -23,5 +24,11 @@ namespace WotBlitzStatisticsPro.DataAccess
Task<List<ILanguageDictionary>> ReadLanguages();
Task<Dictionary<long, int>> GetTankTires(long[] tankIds);
Task<Dictionary<long, IVehiclesDictionary>> GetVehicles(long[] tankIds);
Task<Dictionary<string, string>> GetNations(RequestLanguage language);
Task<Dictionary<string, string>> GetTankTypes(RequestLanguage language);
}
}
@@ -19,91 +19,90 @@
///<summary>
/// Battles count
///</summary>
public long? Battles { get; set; }
public long Battles { get; set; }
///<summary>
/// Base capture points
///</summary>
public long? CapturePoints { get; set; }
public long CapturePoints { get; set; }
///<summary>
/// Damage dealt
///</summary>
public long? DamageDealt { get; set; }
public long DamageDealt { get; set; }
///<summary>
/// Damage received
///</summary>
public long? DamageReceived { get; set; }
public long DamageReceived { get; set; }
///<summary>
/// Base dropped capture points
///</summary>
public long? DroppedCapturePoints { get; set; }
public long DroppedCapturePoints { get; set; }
///<summary>
/// Frags count
///</summary>
public long? Frags { get; set; }
public long Frags { get; set; }
///<summary>
/// Frags count after 8 tier
///</summary>
public long? Frags8P { get; set; }
public long Frags8P { get; set; }
///<summary>
/// Hits count
///</summary>
public long? Hits { get; set; }
public long Hits { get; set; }
///<summary>
/// Losses count
///</summary>
public long? Losses { get; set; }
public long Losses { get; set; }
///<summary>
/// Max frags per battle
///</summary>
public long? MaxFrags { get; set; }
public long MaxFrags { get; set; }
///<summary>
/// Max XP per battle
///</summary>
public long? MaxXp { get; set; }
public long MaxXp { get; set; }
///<summary>
/// Shots count
///</summary>
public long? Shots { get; set; }
public long Shots { get; set; }
///<summary>
/// Spotted vehicles count
///</summary>
public long? Spotted { get; set; }
public long Spotted { get; set; }
///<summary>
/// Amount of survived battles
///</summary>
public long? SurvivedBattles { get; set; }
public long SurvivedBattles { get; set; }
///<summary>
/// Amount of survived and wined battles
///</summary>
public long? WinAndSurvived { get; set; }
public long WinAndSurvived { get; set; }
///<summary>
/// Wins count
///</summary>
public long? Wins { get; set; }
public long Wins { get; set; }
///<summary>
/// Total experience
///</summary>
public long? Xp { get; set; }
public long Xp { get; set; }
/// <summary>
/// Wn7 coefficient