mirror of
https://github.com/DrMboga/WotBlitzStatisticsBlazor.git
synced 2026-10-21 10:27:18 +02:00
Dictionaries DB structure refactored
This commit is contained in:
1 parent
9b80314b92
commit
6c10c6c654
25 files changed
+251
-117
No files matched your search
+14
-14
@@ -5,72 +5,72 @@ namespace WotBlitzStatisticsPro.Common.Dictionaries
|
||||
/// <summary>
|
||||
/// Achievement dictionary item
|
||||
/// </summary>
|
||||
public class AchievementDictionary
|
||||
public interface IAchievementDictionary
|
||||
{
|
||||
/// <summary>
|
||||
/// id
|
||||
/// </summary>
|
||||
public string AchievementId { get; set; }
|
||||
string AchievementId { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Achievement condition
|
||||
///</summary>
|
||||
public List<LocalizableString> Condition { get; set; }
|
||||
List<LocalizableString> Condition { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Achievement description
|
||||
///</summary>
|
||||
public List<LocalizableString> Description { get; set; }
|
||||
List<LocalizableString> Description { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Historical info
|
||||
///</summary>
|
||||
public List<LocalizableString> HeroInfo { get; set; }
|
||||
List<LocalizableString> HeroInfo { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Image link
|
||||
///</summary>
|
||||
public string Image { get; set; }
|
||||
string Image { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Image 180x180px link
|
||||
///</summary>
|
||||
public string ImageBig { get; set; }
|
||||
string ImageBig { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Achievement name
|
||||
///</summary>
|
||||
public List<LocalizableString> Name { get; set; }
|
||||
List<LocalizableString> Name { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Sort order
|
||||
///</summary>
|
||||
public long? Order { get; set; }
|
||||
long? Order { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Is outdated achievement
|
||||
///</summary>
|
||||
public bool Outdated { get; set; }
|
||||
bool Outdated { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Achievement section
|
||||
///</summary>
|
||||
public string SectionId { get; set; }
|
||||
string SectionId { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Achievement section order
|
||||
///</summary>
|
||||
public long? SectionOrder { get; set; }
|
||||
long? SectionOrder { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Achievement Type
|
||||
///</summary>
|
||||
public string Type { get; set; }
|
||||
string Type { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Achievement options
|
||||
///</summary>
|
||||
public List<AchievementOption> Options { get; set; }
|
||||
List<AchievementOption> Options { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
+4
-4
@@ -5,22 +5,22 @@ namespace WotBlitzStatisticsPro.Common.Dictionaries
|
||||
/// <summary>
|
||||
/// Achievement section dictionary item.
|
||||
/// </summary>
|
||||
public class AchievementSectionDictionary
|
||||
public interface IAchievementSectionDictionary
|
||||
{
|
||||
/// <summary>
|
||||
/// Achievement section id
|
||||
/// </summary>
|
||||
public string AchievementSectionId { get; set; }
|
||||
string AchievementSectionId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Section order
|
||||
/// </summary>
|
||||
public int Order { get; set; }
|
||||
int Order { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Localized section names
|
||||
/// </summary>
|
||||
public List<LocalizableString> AchievementSectionNames { get; set; }
|
||||
List<LocalizableString> AchievementSectionNames { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -5,16 +5,16 @@ namespace WotBlitzStatisticsPro.Common.Dictionaries
|
||||
/// <summary>
|
||||
/// Clan role dictionary item
|
||||
/// </summary>
|
||||
public class ClanRoleDictionary
|
||||
public interface IClanRoleDictionary
|
||||
{
|
||||
/// <summary>
|
||||
/// Clan role id
|
||||
/// </summary>
|
||||
public string ClanRoleId { get; set; }
|
||||
string ClanRoleId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Localized clan role names
|
||||
/// </summary>
|
||||
public List<LocalizableString> ClanRoleNames { get; set; }
|
||||
List<LocalizableString> ClanRoleNames { get; set; }
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -3,17 +3,17 @@
|
||||
/// <summary>
|
||||
/// Languages available
|
||||
/// </summary>
|
||||
public class LanguageDictionary
|
||||
public interface ILanguageDictionary
|
||||
{
|
||||
/// <summary>
|
||||
/// Language id
|
||||
/// </summary>
|
||||
public string LanguageId { get; set; }
|
||||
string LanguageId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Language
|
||||
/// </summary>
|
||||
public string LanguageName { get; set; }
|
||||
string LanguageName { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -5,16 +5,16 @@ namespace WotBlitzStatisticsPro.Common.Dictionaries
|
||||
/// <summary>
|
||||
/// Tanks nations dictionary item
|
||||
/// </summary>
|
||||
public class NationDictionary
|
||||
public interface INationDictionary
|
||||
{
|
||||
/// <summary>
|
||||
/// Nation id
|
||||
/// </summary>
|
||||
public string NationId { get; set; }
|
||||
string NationId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Nation
|
||||
/// </summary>
|
||||
public List<LocalizableString> NationNames { get; set; }
|
||||
List<LocalizableString> NationNames { get; set; }
|
||||
}
|
||||
}
|
||||
+3
-3
@@ -5,17 +5,17 @@ namespace WotBlitzStatisticsPro.Common.Dictionaries
|
||||
/// <summary>
|
||||
/// Vehicle type dictionary item
|
||||
/// </summary>
|
||||
public class VehicleTypeDictionary
|
||||
public interface IVehicleTypeDictionary
|
||||
{
|
||||
/// <summary>
|
||||
/// Vehicle type id
|
||||
/// </summary>
|
||||
public string VehicleTypeId { get; set; }
|
||||
string VehicleTypeId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Vehicle type localized name
|
||||
/// </summary>
|
||||
public List<LocalizableString> VehicleTypeNames { get; set; }
|
||||
List<LocalizableString> VehicleTypeNames { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
+18
-18
@@ -5,92 +5,92 @@ namespace WotBlitzStatisticsPro.Common.Dictionaries
|
||||
/// <summary>
|
||||
/// Vehicle dictionary item
|
||||
/// </summary>
|
||||
public class VehiclesDictionary
|
||||
public interface IVehiclesDictionary
|
||||
{
|
||||
///<summary>
|
||||
/// VehicleId
|
||||
///</summary>
|
||||
public long TankId { get; set; }
|
||||
long TankId { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Vehicle name
|
||||
///</summary>
|
||||
public List<LocalizableString> Name { get; set; }
|
||||
List<LocalizableString> Name { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Vehicle description
|
||||
///</summary>
|
||||
public List<LocalizableString> Description { get; set; }
|
||||
List<LocalizableString> Description { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Is vehicle premium
|
||||
///</summary>
|
||||
public bool IsPremium { get; set; }
|
||||
bool IsPremium { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Vehicle type id
|
||||
///</summary>
|
||||
public string TypeId { get; set; }
|
||||
string TypeId { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Vehicle nationId
|
||||
///</summary>
|
||||
public string NationId { get; set; }
|
||||
string NationId { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Vehicle tier
|
||||
///</summary>
|
||||
public int Tier { get; set; }
|
||||
int Tier { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Vehicle preview image
|
||||
/// </summary>
|
||||
public string PreviewImage { get; set; }
|
||||
string PreviewImage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Vehicle normal image
|
||||
/// </summary>
|
||||
public string NormalImage { get; set; }
|
||||
string NormalImage { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Vehicle price in credits
|
||||
/// </summary>
|
||||
public decimal PriceCredit { get; set; }
|
||||
decimal PriceCredit { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Vehicle price in gold
|
||||
/// </summary>
|
||||
public decimal PriceGold { get; set; }
|
||||
decimal PriceGold { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Ids of nex tanks and their cost in XP
|
||||
/// </summary>
|
||||
public List<VehiclePriceInXp> NexTanksInTree { get; set; }
|
||||
List<VehiclePriceInXp> NexTanksInTree { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Price in XP for parent vehicle as key
|
||||
///</summary>
|
||||
public List<VehiclePriceInXp> PriceXp { get; set; }
|
||||
List<VehiclePriceInXp> PriceXp { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Engines id list
|
||||
///</summary>
|
||||
public int[] Engines { get; set; }
|
||||
int[] Engines { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// Guns id list
|
||||
///</summary>
|
||||
public int[] Guns { get; set; }
|
||||
int[] Guns { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// List of compatible suspensions
|
||||
///</summary>
|
||||
public int[] Suspensions { get; set; }
|
||||
int[] Suspensions { get; set; }
|
||||
|
||||
///<summary>
|
||||
/// List of compatible turrets ids
|
||||
///</summary>
|
||||
public int[] Turrets { get; set; }
|
||||
int[] Turrets { get; set; }
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,10 @@
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using MongoDB.Driver;
|
||||
using WotBlitzStatisticsPro.Common;
|
||||
using WotBlitzStatisticsPro.Common.Dictionaries;
|
||||
using WotBlitzStatisticsPro.DataAccess.Model;
|
||||
|
||||
namespace WotBlitzStatisticsPro.DataAccess
|
||||
{
|
||||
@@ -24,63 +26,70 @@ namespace WotBlitzStatisticsPro.DataAccess
|
||||
_database = client.GetDatabase(settings.DatabaseName);
|
||||
}
|
||||
|
||||
public async Task UpdateLanguages(List<LanguageDictionary> languages)
|
||||
public async Task UpdateLanguages(List<ILanguageDictionary> languages)
|
||||
{
|
||||
var dbLanguages = _database.GetCollection<LanguageDictionary>(LanguagesCollectionName);
|
||||
var dbLanguages = _database.GetCollection<ILanguageDictionary>(LanguagesCollectionName);
|
||||
|
||||
await dbLanguages.DeleteManyAsync(Builders<LanguageDictionary>.Filter.Empty);
|
||||
await dbLanguages.DeleteManyAsync(Builders<ILanguageDictionary>.Filter.Empty);
|
||||
await dbLanguages.InsertManyAsync(languages);
|
||||
}
|
||||
|
||||
public async Task UpdateNations(List<NationDictionary> nations)
|
||||
public async Task UpdateNations(List<INationDictionary> nations)
|
||||
{
|
||||
var dbNations = _database.GetCollection<NationDictionary>(NationsCollectionName);
|
||||
var dbNations = _database.GetCollection<INationDictionary>(NationsCollectionName);
|
||||
|
||||
await dbNations.DeleteManyAsync(Builders<NationDictionary>.Filter.Empty);
|
||||
await dbNations.DeleteManyAsync(Builders<INationDictionary>.Filter.Empty);
|
||||
await dbNations.InsertManyAsync(nations);
|
||||
}
|
||||
|
||||
public async Task UpdateVehicleTypes(List<VehicleTypeDictionary> vehicleTypes)
|
||||
public async Task UpdateVehicleTypes(List<IVehicleTypeDictionary> vehicleTypes)
|
||||
{
|
||||
var dbVehicleTypes = _database.GetCollection<VehicleTypeDictionary>(VehicleTypesCollectionName);
|
||||
var dbVehicleTypes = _database.GetCollection<IVehicleTypeDictionary>(VehicleTypesCollectionName);
|
||||
|
||||
await dbVehicleTypes.DeleteManyAsync(Builders<VehicleTypeDictionary>.Filter.Empty);
|
||||
await dbVehicleTypes.DeleteManyAsync(Builders<IVehicleTypeDictionary>.Filter.Empty);
|
||||
await dbVehicleTypes.InsertManyAsync(vehicleTypes);
|
||||
}
|
||||
|
||||
public async Task UpdateClanRoles(List<ClanRoleDictionary> clanRoles)
|
||||
public async Task UpdateClanRoles(List<IClanRoleDictionary> clanRoles)
|
||||
{
|
||||
var dbClanRoles = _database.GetCollection<ClanRoleDictionary>(ClanRolesCollectionName);
|
||||
var dbClanRoles = _database.GetCollection<IClanRoleDictionary>(ClanRolesCollectionName);
|
||||
|
||||
await dbClanRoles.DeleteManyAsync(Builders<ClanRoleDictionary>.Filter.Empty);
|
||||
await dbClanRoles.DeleteManyAsync(Builders<IClanRoleDictionary>.Filter.Empty);
|
||||
await dbClanRoles.InsertManyAsync(clanRoles);
|
||||
}
|
||||
|
||||
public async Task UpdateAchievementsSections(List<AchievementSectionDictionary> achievementSections)
|
||||
public async Task UpdateAchievementsSections(List<IAchievementSectionDictionary> achievementSections)
|
||||
{
|
||||
var dbAchievementSections =
|
||||
_database.GetCollection<AchievementSectionDictionary>(AchievementsSectionsCollectionName);
|
||||
_database.GetCollection<IAchievementSectionDictionary>(AchievementsSectionsCollectionName);
|
||||
|
||||
await dbAchievementSections.DeleteManyAsync(Builders<AchievementSectionDictionary>.Filter.Empty);
|
||||
await dbAchievementSections.DeleteManyAsync(Builders<IAchievementSectionDictionary>.Filter.Empty);
|
||||
await dbAchievementSections.InsertManyAsync(achievementSections);
|
||||
}
|
||||
|
||||
public async Task UpdateAchievements(List<AchievementDictionary> achievementDictionary)
|
||||
public async Task UpdateAchievements(List<IAchievementDictionary> achievementDictionary)
|
||||
{
|
||||
var dbAchievementSections =
|
||||
_database.GetCollection<AchievementDictionary>(AchievementsCollectionName);
|
||||
_database.GetCollection<IAchievementDictionary>(AchievementsCollectionName);
|
||||
|
||||
await dbAchievementSections.DeleteManyAsync(Builders<AchievementDictionary>.Filter.Empty);
|
||||
await dbAchievementSections.DeleteManyAsync(Builders<IAchievementDictionary>.Filter.Empty);
|
||||
await dbAchievementSections.InsertManyAsync(achievementDictionary);
|
||||
}
|
||||
|
||||
public async Task UpdateVehicles(List<VehiclesDictionary> vehiclesDictionary)
|
||||
public async Task UpdateVehicles(List<IVehiclesDictionary> vehiclesDictionary)
|
||||
{
|
||||
var dbVehicles =
|
||||
_database.GetCollection<VehiclesDictionary>(VehiclesCollectionName);
|
||||
_database.GetCollection<IVehiclesDictionary>(VehiclesCollectionName);
|
||||
|
||||
await dbVehicles.DeleteManyAsync(Builders<VehiclesDictionary>.Filter.Empty);
|
||||
await dbVehicles.DeleteManyAsync(Builders<IVehiclesDictionary>.Filter.Empty);
|
||||
await dbVehicles.InsertManyAsync(vehiclesDictionary);
|
||||
}
|
||||
|
||||
public async Task<List<ILanguageDictionary>> ReadLanguages()
|
||||
{
|
||||
var collection = await _database.GetCollection<ILanguageDictionary>(LanguagesCollectionName)
|
||||
.FindAsync(Builders<ILanguageDictionary>.Filter.Empty);
|
||||
return collection.ToList();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -6,18 +6,20 @@ namespace WotBlitzStatisticsPro.DataAccess
|
||||
{
|
||||
public interface IDictionariesDataAccessor
|
||||
{
|
||||
Task UpdateLanguages(List<LanguageDictionary> languages);
|
||||
Task UpdateLanguages(List<ILanguageDictionary> languages);
|
||||
|
||||
Task UpdateNations(List<NationDictionary> nations);
|
||||
Task UpdateNations(List<INationDictionary> nations);
|
||||
|
||||
Task UpdateVehicleTypes(List<VehicleTypeDictionary> vehicleTypes);
|
||||
Task UpdateVehicleTypes(List<IVehicleTypeDictionary> vehicleTypes);
|
||||
|
||||
Task UpdateClanRoles(List<ClanRoleDictionary> clanRoles);
|
||||
Task UpdateClanRoles(List<IClanRoleDictionary> clanRoles);
|
||||
|
||||
Task UpdateAchievementsSections(List<AchievementSectionDictionary> achievementSections);
|
||||
Task UpdateAchievementsSections(List<IAchievementSectionDictionary> achievementSections);
|
||||
|
||||
Task UpdateAchievements(List<AchievementDictionary> achievementDictionary);
|
||||
Task UpdateAchievements(List<IAchievementDictionary> achievementDictionary);
|
||||
|
||||
Task UpdateVehicles(List<VehiclesDictionary> vehiclesDictionary);
|
||||
Task UpdateVehicles(List<IVehiclesDictionary> vehiclesDictionary);
|
||||
|
||||
Task<List<ILanguageDictionary>> ReadLanguages();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
using System.Collections.Generic;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using WotBlitzStatisticsPro.Common.Dictionaries;
|
||||
|
||||
namespace WotBlitzStatisticsPro.DataAccess.Model
|
||||
{
|
||||
public class AchievementDictionary : IAchievementDictionary
|
||||
{
|
||||
[BsonId]
|
||||
public string AchievementId { get; set; }
|
||||
public List<LocalizableString> Condition { get; set; }
|
||||
public List<LocalizableString> Description { get; set; }
|
||||
public List<LocalizableString> HeroInfo { get; set; }
|
||||
public string Image { get; set; }
|
||||
public string ImageBig { get; set; }
|
||||
public List<LocalizableString> Name { get; set; }
|
||||
public long? Order { get; set; }
|
||||
public bool Outdated { get; set; }
|
||||
public string SectionId { get; set; }
|
||||
public long? SectionOrder { get; set; }
|
||||
public string Type { get; set; }
|
||||
public List<AchievementOption> Options { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
using System.Collections.Generic;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using WotBlitzStatisticsPro.Common.Dictionaries;
|
||||
|
||||
namespace WotBlitzStatisticsPro.DataAccess.Model
|
||||
{
|
||||
public class AchievementSectionDictionary: IAchievementSectionDictionary
|
||||
{
|
||||
[BsonId]
|
||||
public string AchievementSectionId { get; set; }
|
||||
public int Order { get; set; }
|
||||
public List<LocalizableString> AchievementSectionNames { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using WotBlitzStatisticsPro.Common.Dictionaries;
|
||||
|
||||
namespace WotBlitzStatisticsPro.DataAccess.Model
|
||||
{
|
||||
public class ClanRoleDictionary : IClanRoleDictionary
|
||||
{
|
||||
[BsonId]
|
||||
public string ClanRoleId { get; set; }
|
||||
public List<LocalizableString> ClanRoleNames { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using WotBlitzStatisticsPro.Common.Dictionaries;
|
||||
|
||||
namespace WotBlitzStatisticsPro.DataAccess.Model
|
||||
{
|
||||
public class LanguageDictionary: ILanguageDictionary
|
||||
{
|
||||
[BsonId]
|
||||
public string LanguageId { get; set; }
|
||||
|
||||
public string LanguageName { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using WotBlitzStatisticsPro.Common.Dictionaries;
|
||||
|
||||
namespace WotBlitzStatisticsPro.DataAccess.Model
|
||||
{
|
||||
public class NationDictionary : INationDictionary
|
||||
{
|
||||
[BsonId]
|
||||
public string NationId { get; set; }
|
||||
public List<LocalizableString> NationNames { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
using System.Collections.Generic;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using WotBlitzStatisticsPro.Common.Dictionaries;
|
||||
|
||||
namespace WotBlitzStatisticsPro.DataAccess.Model
|
||||
{
|
||||
public class VehicleTypeDictionary : IVehicleTypeDictionary
|
||||
{
|
||||
[BsonId]
|
||||
public string VehicleTypeId { get; set; }
|
||||
public List<LocalizableString> VehicleTypeNames { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,28 @@
|
||||
using System.Collections.Generic;
|
||||
using MongoDB.Bson.Serialization.Attributes;
|
||||
using WotBlitzStatisticsPro.Common.Dictionaries;
|
||||
|
||||
namespace WotBlitzStatisticsPro.DataAccess.Model
|
||||
{
|
||||
public class VehiclesDictionary : IVehiclesDictionary
|
||||
{
|
||||
[BsonId]
|
||||
public long TankId { get; set; }
|
||||
public List<LocalizableString> Name { get; set; }
|
||||
public List<LocalizableString> Description { get; set; }
|
||||
public bool IsPremium { get; set; }
|
||||
public string TypeId { get; set; }
|
||||
public string NationId { get; set; }
|
||||
public int Tier { get; set; }
|
||||
public string PreviewImage { get; set; }
|
||||
public string NormalImage { get; set; }
|
||||
public decimal PriceCredit { get; set; }
|
||||
public decimal PriceGold { get; set; }
|
||||
public List<VehiclePriceInXp> NexTanksInTree { get; set; }
|
||||
public List<VehiclePriceInXp> PriceXp { get; set; }
|
||||
public int[] Engines { get; set; }
|
||||
public int[] Guns { get; set; }
|
||||
public int[] Suspensions { get; set; }
|
||||
public int[] Turrets { get; set; }
|
||||
}
|
||||
}
|
||||
@@ -6,6 +6,7 @@ using AutoMapper;
|
||||
using WotBlitzStatisticsPro.Common.Dictionaries;
|
||||
using WotBlitzStatisticsPro.Common.Model;
|
||||
using WotBlitzStatisticsPro.DataAccess;
|
||||
using WotBlitzStatisticsPro.DataAccess.Model;
|
||||
using WotBlitzStatisticsPro.WgApiClient;
|
||||
using WotBlitzStatisticsPro.WgApiClient.Model;
|
||||
|
||||
@@ -43,11 +44,11 @@ namespace WotBlitzStatisticsPro.Logic.Dictionaries
|
||||
};
|
||||
}
|
||||
|
||||
private async Task<List<AchievementDictionary>> GetAndMapAchievementsDictionary()
|
||||
private async Task<List<IAchievementDictionary>> GetAndMapAchievementsDictionary()
|
||||
{
|
||||
var defaultRealmType = RealmType.Eu;
|
||||
|
||||
var achievements = new List<AchievementDictionary>();
|
||||
var achievements = new List<IAchievementDictionary>();
|
||||
|
||||
foreach (var requestLanguage in (RequestLanguage[])Enum.GetValues(typeof(RequestLanguage)))
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ using AutoMapper;
|
||||
using WotBlitzStatisticsPro.Common.Dictionaries;
|
||||
using WotBlitzStatisticsPro.Common.Model;
|
||||
using WotBlitzStatisticsPro.DataAccess;
|
||||
using WotBlitzStatisticsPro.DataAccess.Model;
|
||||
using WotBlitzStatisticsPro.WgApiClient;
|
||||
using WotBlitzStatisticsPro.WgApiClient.Model;
|
||||
|
||||
@@ -56,19 +57,19 @@ namespace WotBlitzStatisticsPro.Logic.Dictionaries
|
||||
}
|
||||
|
||||
private async Task<(
|
||||
List<LanguageDictionary>,
|
||||
List<NationDictionary>,
|
||||
List<VehicleTypeDictionary>,
|
||||
List<ClanRoleDictionary>,
|
||||
List<AchievementSectionDictionary>)> GetAndMapDictionaries()
|
||||
List<ILanguageDictionary>,
|
||||
List<INationDictionary>,
|
||||
List<IVehicleTypeDictionary>,
|
||||
List<IClanRoleDictionary>,
|
||||
List<IAchievementSectionDictionary>)> GetAndMapDictionaries()
|
||||
{
|
||||
var defaultRealmType = RealmType.Eu;
|
||||
|
||||
List<LanguageDictionary> languages = null;
|
||||
var nations = new List<NationDictionary>();
|
||||
var vehicleTypes = new List<VehicleTypeDictionary>();
|
||||
var clanRoles = new List<ClanRoleDictionary>();
|
||||
var achievementsSections = new List<AchievementSectionDictionary>();
|
||||
List<ILanguageDictionary> languages = null;
|
||||
var nations = new List<INationDictionary>();
|
||||
var vehicleTypes = new List<IVehicleTypeDictionary>();
|
||||
var clanRoles = new List<IClanRoleDictionary>();
|
||||
var achievementsSections = new List<IAchievementSectionDictionary>();
|
||||
|
||||
foreach (var requestLanguage in (RequestLanguage[])Enum.GetValues(typeof(RequestLanguage)))
|
||||
{
|
||||
@@ -79,7 +80,7 @@ namespace WotBlitzStatisticsPro.Logic.Dictionaries
|
||||
{
|
||||
languages =
|
||||
_mapper.Map<Dictionary<string, string>, List<LanguageDictionary>>(wotEncyclopediaInfoResponse
|
||||
.Languages);
|
||||
.Languages).Cast<ILanguageDictionary>().ToList();
|
||||
}
|
||||
|
||||
MapVehicleNations(requestLanguage, wotEncyclopediaInfoResponse.VehicleNations, nations);
|
||||
@@ -94,7 +95,7 @@ namespace WotBlitzStatisticsPro.Logic.Dictionaries
|
||||
private void MapVehicleNations(
|
||||
RequestLanguage requestLanguage,
|
||||
Dictionary<string, string> sourceDictionary,
|
||||
List<NationDictionary> destinationDictionary)
|
||||
List<INationDictionary> destinationDictionary)
|
||||
{
|
||||
foreach (var source in sourceDictionary)
|
||||
{
|
||||
@@ -116,7 +117,7 @@ namespace WotBlitzStatisticsPro.Logic.Dictionaries
|
||||
private void MapVehicleTypes(
|
||||
RequestLanguage requestLanguage,
|
||||
Dictionary<string, string> sourceDictionary,
|
||||
List<VehicleTypeDictionary> destinationDictionary)
|
||||
List<IVehicleTypeDictionary> destinationDictionary)
|
||||
{
|
||||
foreach (var source in sourceDictionary)
|
||||
{
|
||||
@@ -138,7 +139,7 @@ namespace WotBlitzStatisticsPro.Logic.Dictionaries
|
||||
private void MapClanRoles(
|
||||
RequestLanguage requestLanguage,
|
||||
Dictionary<string, string> sourceDictionary,
|
||||
List<ClanRoleDictionary> destinationDictionary)
|
||||
List<IClanRoleDictionary> destinationDictionary)
|
||||
{
|
||||
foreach (var source in sourceDictionary)
|
||||
{
|
||||
@@ -160,7 +161,7 @@ namespace WotBlitzStatisticsPro.Logic.Dictionaries
|
||||
private void MapAchievementsSections(
|
||||
RequestLanguage requestLanguage,
|
||||
Dictionary<string, WotEncyclopediaInfoAchievementSection> sourceSections,
|
||||
List<AchievementSectionDictionary> destinationDictionary)
|
||||
List<IAchievementSectionDictionary> destinationDictionary)
|
||||
{
|
||||
foreach (var section in sourceSections)
|
||||
{
|
||||
|
||||
@@ -6,6 +6,7 @@ using AutoMapper;
|
||||
using WotBlitzStatisticsPro.Common.Dictionaries;
|
||||
using WotBlitzStatisticsPro.Common.Model;
|
||||
using WotBlitzStatisticsPro.DataAccess;
|
||||
using WotBlitzStatisticsPro.DataAccess.Model;
|
||||
using WotBlitzStatisticsPro.WgApiClient;
|
||||
using WotBlitzStatisticsPro.WgApiClient.Model;
|
||||
|
||||
@@ -45,11 +46,11 @@ namespace WotBlitzStatisticsPro.Logic.Dictionaries
|
||||
|
||||
}
|
||||
|
||||
private async Task<List<VehiclesDictionary>> GetAndMapVehiclesDictionary()
|
||||
private async Task<List<IVehiclesDictionary>> GetAndMapVehiclesDictionary()
|
||||
{
|
||||
var defaultRealmType = RealmType.Eu;
|
||||
|
||||
var vehicles = new List<VehiclesDictionary>();
|
||||
var vehicles = new List<IVehiclesDictionary>();
|
||||
|
||||
foreach (var requestLanguage in (RequestLanguage[]) Enum.GetValues(typeof(RequestLanguage)))
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using AutoMapper;
|
||||
using WotBlitzStatisticsPro.Common.Dictionaries;
|
||||
using WotBlitzStatisticsPro.DataAccess.Model;
|
||||
using WotBlitzStatisticsPro.WgApiClient.Model;
|
||||
|
||||
namespace WotBlitzStatisticsPro.Logic.Mappers
|
||||
|
||||
@@ -1,6 +1,6 @@
|
||||
using System.Collections.Generic;
|
||||
using AutoMapper;
|
||||
using WotBlitzStatisticsPro.Common.Dictionaries;
|
||||
using WotBlitzStatisticsPro.DataAccess.Model;
|
||||
|
||||
namespace WotBlitzStatisticsPro.Logic.Mappers
|
||||
{
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
using System.Collections.Generic;
|
||||
using AutoMapper;
|
||||
using WotBlitzStatisticsPro.Common.Dictionaries;
|
||||
using WotBlitzStatisticsPro.DataAccess.Model;
|
||||
using WotBlitzStatisticsPro.WgApiClient.Model;
|
||||
|
||||
namespace WotBlitzStatisticsPro.Logic.Mappers
|
||||
|
||||
@@ -80,10 +80,10 @@ namespace WotBlitzStatisticsPro.Tests.DictionariesTests
|
||||
[Test]
|
||||
public async Task ShouldSaveAppropriateAchievementsDictionary()
|
||||
{
|
||||
List<AchievementDictionary> targetAchievementDictionaries = null;
|
||||
List<IAchievementDictionary> targetAchievementDictionaries = null;
|
||||
_dataAccessorMock
|
||||
.Setup(d => d.UpdateAchievements(It.IsAny<List<AchievementDictionary>>()))
|
||||
.Callback((List<AchievementDictionary> dictionary) => targetAchievementDictionaries = dictionary);
|
||||
.Setup(d => d.UpdateAchievements(It.IsAny<List<IAchievementDictionary>>()))
|
||||
.Callback((List<IAchievementDictionary> dictionary) => targetAchievementDictionaries = dictionary);
|
||||
|
||||
await _achievementDictionariesUpdater.Update();
|
||||
|
||||
|
||||
@@ -82,10 +82,10 @@ namespace WotBlitzStatisticsPro.Tests.DictionariesTests
|
||||
[Test]
|
||||
public async Task ShouldSaveAppropriateLanguagesDictionary()
|
||||
{
|
||||
List<LanguageDictionary> languageDictionary = null;
|
||||
List<ILanguageDictionary> languageDictionary = null;
|
||||
_dataAccessorMock
|
||||
.Setup(d => d.UpdateLanguages(It.IsAny<List<LanguageDictionary>>()))
|
||||
.Callback((List<LanguageDictionary> dictionary) => languageDictionary = dictionary);
|
||||
.Setup(d => d.UpdateLanguages(It.IsAny<List<ILanguageDictionary>>()))
|
||||
.Callback((List<ILanguageDictionary> dictionary) => languageDictionary = dictionary);
|
||||
|
||||
await _staticDictionariesUpdater.Update();
|
||||
|
||||
@@ -104,10 +104,10 @@ namespace WotBlitzStatisticsPro.Tests.DictionariesTests
|
||||
[Test]
|
||||
public async Task ShouldSaveAppropriateNationsDictionary()
|
||||
{
|
||||
List<NationDictionary> nations = null;
|
||||
List<INationDictionary> nations = null;
|
||||
_dataAccessorMock
|
||||
.Setup(d => d.UpdateNations(It.IsAny<List<NationDictionary>>()))
|
||||
.Callback((List<NationDictionary> dictionary) => nations = dictionary);
|
||||
.Setup(d => d.UpdateNations(It.IsAny<List<INationDictionary>>()))
|
||||
.Callback((List<INationDictionary> dictionary) => nations = dictionary);
|
||||
|
||||
await _staticDictionariesUpdater.Update();
|
||||
|
||||
@@ -132,10 +132,10 @@ namespace WotBlitzStatisticsPro.Tests.DictionariesTests
|
||||
[Test]
|
||||
public async Task ShouldSaveAppropriateVehicleTypesDictionary()
|
||||
{
|
||||
List<VehicleTypeDictionary> vehicleTypes = null;
|
||||
List<IVehicleTypeDictionary> vehicleTypes = null;
|
||||
_dataAccessorMock
|
||||
.Setup(d => d.UpdateVehicleTypes(It.IsAny<List<VehicleTypeDictionary>>()))
|
||||
.Callback((List<VehicleTypeDictionary> dictionary) => vehicleTypes = dictionary);
|
||||
.Setup(d => d.UpdateVehicleTypes(It.IsAny<List<IVehicleTypeDictionary>>()))
|
||||
.Callback((List<IVehicleTypeDictionary> dictionary) => vehicleTypes = dictionary);
|
||||
|
||||
await _staticDictionariesUpdater.Update();
|
||||
|
||||
@@ -160,10 +160,10 @@ namespace WotBlitzStatisticsPro.Tests.DictionariesTests
|
||||
[Test]
|
||||
public async Task ShouldSaveAppropriateClanRolesDictionary()
|
||||
{
|
||||
List<ClanRoleDictionary> clanRoles = null;
|
||||
List<IClanRoleDictionary> clanRoles = null;
|
||||
_dataAccessorMock
|
||||
.Setup(d => d.UpdateClanRoles(It.IsAny<List<ClanRoleDictionary>>()))
|
||||
.Callback((List<ClanRoleDictionary> dictionary) => clanRoles = dictionary);
|
||||
.Setup(d => d.UpdateClanRoles(It.IsAny<List<IClanRoleDictionary>>()))
|
||||
.Callback((List<IClanRoleDictionary> dictionary) => clanRoles = dictionary);
|
||||
|
||||
await _staticDictionariesUpdater.Update();
|
||||
|
||||
@@ -188,10 +188,10 @@ namespace WotBlitzStatisticsPro.Tests.DictionariesTests
|
||||
[Test]
|
||||
public async Task ShouldSaveAppropriateAchievementsSectionsDictionary()
|
||||
{
|
||||
List<AchievementSectionDictionary> achievementsSections = null;
|
||||
List<IAchievementSectionDictionary> achievementsSections = null;
|
||||
_dataAccessorMock
|
||||
.Setup(d => d.UpdateAchievementsSections(It.IsAny<List<AchievementSectionDictionary>>()))
|
||||
.Callback((List<AchievementSectionDictionary> dictionary) => achievementsSections = dictionary);
|
||||
.Setup(d => d.UpdateAchievementsSections(It.IsAny<List<IAchievementSectionDictionary>>()))
|
||||
.Callback((List<IAchievementSectionDictionary> dictionary) => achievementsSections = dictionary);
|
||||
|
||||
await _staticDictionariesUpdater.Update();
|
||||
|
||||
|
||||
@@ -80,10 +80,10 @@ namespace WotBlitzStatisticsPro.Tests.DictionariesTests
|
||||
[Test]
|
||||
public async Task ShouldSaveAppropriateVehiclesDictionary()
|
||||
{
|
||||
List<VehiclesDictionary> targetVehicleDictionary = null;
|
||||
List<IVehiclesDictionary> targetVehicleDictionary = null;
|
||||
_dataAccessorMock
|
||||
.Setup(d => d.UpdateVehicles(It.IsAny<List<VehiclesDictionary>>()))
|
||||
.Callback((List<VehiclesDictionary> dictionary) => targetVehicleDictionary = dictionary);
|
||||
.Setup(d => d.UpdateVehicles(It.IsAny<List<IVehiclesDictionary>>()))
|
||||
.Callback((List<IVehiclesDictionary> dictionary) => targetVehicleDictionary = dictionary);
|
||||
|
||||
await _vehiclesDictionariesUpdater.Update();
|
||||
|
||||
|
||||
Reference in new issue
Block a user