diff --git a/TOOHUCardAPI/Controllers/MethodBasedController.cs b/TOOHUCardAPI/Controllers/MethodBasedController.cs index 0e8b21d..8099666 100644 --- a/TOOHUCardAPI/Controllers/MethodBasedController.cs +++ b/TOOHUCardAPI/Controllers/MethodBasedController.cs @@ -4,15 +4,37 @@ using System.Linq; using System.Reflection; using System.Threading.Tasks; using Microsoft.AspNetCore.Mvc; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; using TOOHUCardAPI.Data; - +using TOOHUCardAPI.Data.Services; using MethodMap = System.Collections.Generic.Dictionary; namespace TOOHUCardAPI.Controllers { - public class MethodBasedController : ControllerBase + public class MethodBasedController : ControllerBase { public delegate Task EndpointHandler(string requestBody); - private static Dictionary MethodMapByType = new Dictionary(); + + /** + * The game uses a single endpoint for player data. + * The object they send has a method field that's used to decide what's being done + * So let's use a single entry point and redirect based on that + */ + [HttpPost] + public async Task EntryPoint([FromBody] object bodyObj) + { + string body = JsonConvert.SerializeObject(bodyObj); + JObject request = JObject.Parse(body); + string method = request["method"].ToString(); + try + { + return await InvokeEndpointHandlerForMethod(this, method, body); + } + catch (TooHooException e) + { + return Ok(e.response); + } + } protected Task InvokeEndpointHandlerForMethod(object _this, string method, string body) { @@ -27,11 +49,12 @@ namespace TOOHUCardAPI.Controllers private MethodMap GetMethodMapForType() { - if (!MethodMapByType.ContainsKey(typeof(T))) + var methodMapByType = MethodMapService.MethodMapByType; + if (!methodMapByType.ContainsKey(typeof(T))) { - MethodMapByType[typeof(T)] = RegisterEndpointHandlers(); + methodMapByType[typeof(T)] = RegisterEndpointHandlers(); } - return MethodMapByType[typeof(T)]; + return methodMapByType[typeof(T)]; } private static MethodMap RegisterEndpointHandlers() @@ -51,6 +74,8 @@ namespace TOOHUCardAPI.Controllers } } + + public class MissingEndpointHandlerException : Exception { public MissingEndpointHandlerException(string method) : base($"Handler for [{method}] is either missing or incorrectly setup.") diff --git a/TOOHUCardAPI/Controllers/PlayerBaseDataController.cs b/TOOHUCardAPI/Controllers/PlayerBaseDataController.cs index f6cbdab..280a7e5 100644 --- a/TOOHUCardAPI/Controllers/PlayerBaseDataController.cs +++ b/TOOHUCardAPI/Controllers/PlayerBaseDataController.cs @@ -14,7 +14,7 @@ namespace TOOHUCardAPI.Controllers { [Route("api/[controller]")] [ApiController] - public class PlayerBaseDataController : MethodBasedController + public class PlayerBaseDataController : ControllerBase { private readonly ILogger _logger; private readonly UserRepository _userRepository; @@ -30,7 +30,7 @@ namespace TOOHUCardAPI.Controllers [HttpGet] public async Task Get(string id) { - User user = _userRepository.GetUser(id); + User user = await _userRepository.GetUser(id); if (user == null) { return BadRequest("Invalid user id specified"); diff --git a/TOOHUCardAPI/Controllers/PlayerDataController.cs b/TOOHUCardAPI/Controllers/PlayerDataController.cs index 6b4de0e..7872dce 100644 --- a/TOOHUCardAPI/Controllers/PlayerDataController.cs +++ b/TOOHUCardAPI/Controllers/PlayerDataController.cs @@ -24,7 +24,7 @@ namespace TOOHUCardAPI.Controllers { [Route("api/[controller]")] [ApiController] - public class PlayerDataController : MethodBasedController + public class PlayerDataController : MethodBasedController { private readonly ILogger _logger; private readonly UserRepository _userRepository; @@ -39,25 +39,15 @@ namespace TOOHUCardAPI.Controllers _storeService = storeService; } - /** - * The game uses a single endpoint for player data. - * The object they send has a method field that's used to decide what's being done - * So let's use a single entry point and redirect based on that - */ - [HttpPost] - public async Task EntryPoint([FromBody] object bodyObj) + [EndpointHandler("save_card_level")] + private async Task SaveCardLevel(string body) { - string body = JsonConvert.SerializeObject(bodyObj); - JObject request = JObject.Parse(body); - string method = request["method"].ToString(); - try + PlayerDataSaveCardLevelRequest request = JsonConvert.DeserializeObject(body); + int totalCost = await _storeService.LevelUpCard(request.SteamId, request.CardItemCode, request.LevelIncrease); + return Ok(new PlayerDataSaveCardLevelResponse { - return await InvokeEndpointHandlerForMethod(this, method, body); - } - catch (TooHooException e) - { - return Ok(e.response); - } + TotalCost = totalCost + }); } [EndpointHandler("day_first_win")] @@ -76,7 +66,7 @@ namespace TOOHUCardAPI.Controllers private async Task SaveKeyCount(string body) { PlayerDataSaveKeyCountRequest request = JsonConvert.DeserializeObject(body); - User user = _userRepository.GetUser(request.SteamId); + User user = await _userRepository.GetUser(request.SteamId); if (user == null) { throw new InvalidUserException(); @@ -84,7 +74,7 @@ namespace TOOHUCardAPI.Controllers user.KeyTotal = request.KeyTotal; user.KeyUseCount = request.KeyUseCount; - _userRepository.UpdateUser(user); + await _userRepository.UpdateUser(user); return Ok(new OkResponse()); } @@ -106,7 +96,7 @@ namespace TOOHUCardAPI.Controllers { PlayerDataSaveCardGroupRequest request = JsonConvert.DeserializeObject(body); - User user = _userRepository.GetUser(request.SteamId); + User user = await _userRepository.GetUser(request.SteamId); if (user == null) { throw new InvalidUserException(); @@ -118,15 +108,15 @@ namespace TOOHUCardAPI.Controllers }; group.EncodedString = request.GroupData; user.EncodedCardGroups = user.EncodedCardGroups.Where(group2 => group.Id != group2.Id).Append(group).ToList(); - _userRepository.UpdateUser(user); - return Ok(new PlayerDataSaveCardGroupResponseObject()); + await _userRepository.UpdateUser(user); + return Ok(new OkResponse()); } [EndpointHandler("get")] private async Task Get(string body) { PlayerDataGetRequestObject requestObject = JsonConvert.DeserializeObject(body); - IEnumerable users = requestObject.Ids.Values.Select(val => _userRepository.GetOrCreateUser(val)); + IEnumerable users = await Task.WhenAll(requestObject.Ids.Values.Select(val => _userRepository.GetOrCreateUser(val))); IEnumerable queriedUserSteamIds = requestObject.Ids.Select(i => i.Value); IEnumerable responsePlayers = users .Where(user => queriedUserSteamIds.Contains(user.SteamId)) diff --git a/TOOHUCardAPI/Controllers/RankDataController.cs b/TOOHUCardAPI/Controllers/RankDataController.cs index 20cacbb..e0f605d 100644 --- a/TOOHUCardAPI/Controllers/RankDataController.cs +++ b/TOOHUCardAPI/Controllers/RankDataController.cs @@ -9,7 +9,10 @@ namespace TOOHUCardAPI.Controllers { [Route("api/[controller]")] [ApiController] - public class RankDataController : ControllerBase + public class RankDataController : MethodBasedController { + public RankDataController() + { + } } } \ No newline at end of file diff --git a/TOOHUCardAPI/DTO/AbstractPlayerTargetedRequest.cs b/TOOHUCardAPI/DTO/AbstractPlayerTargetedRequest.cs index ddc9b2e..7497b63 100644 --- a/TOOHUCardAPI/DTO/AbstractPlayerTargetedRequest.cs +++ b/TOOHUCardAPI/DTO/AbstractPlayerTargetedRequest.cs @@ -3,5 +3,6 @@ namespace TOOHUCardAPI.DTO public abstract class AbstractPlayerTargetedRequest : AbstractRequest { public string SteamId { get; set; } + public string UserId { get; set; } } } \ No newline at end of file diff --git a/TOOHUCardAPI/DTO/AbstractResponse.cs b/TOOHUCardAPI/DTO/AbstractResponse.cs index 731fb5a..c3cd56c 100644 --- a/TOOHUCardAPI/DTO/AbstractResponse.cs +++ b/TOOHUCardAPI/DTO/AbstractResponse.cs @@ -5,23 +5,10 @@ namespace TOOHUCardAPI.DTO { public abstract class AbstractResponse { - public static string SUCCESS_CODE = "0000"; [JsonProperty("code")] - public string Code { get; set; } = SUCCESS_CODE; + public abstract string Code { get; } [JsonProperty("msg")] - public string Message { get; set; } = string.Empty; - } - - public class InvalidUserResponse : AbstractResponse - { - public InvalidUserResponse() - { - Code = "0001"; - Message = "Invalid user"; - } - } - - public class OkResponse : AbstractResponse - { + public abstract string Message { get; } } + } \ No newline at end of file diff --git a/TOOHUCardAPI/DTO/GenericResponses.cs b/TOOHUCardAPI/DTO/GenericResponses.cs new file mode 100644 index 0000000..f7a7929 --- /dev/null +++ b/TOOHUCardAPI/DTO/GenericResponses.cs @@ -0,0 +1,39 @@ +namespace TOOHUCardAPI.DTO +{ + public class InvalidUserResponse : AbstractResponse + { + public override string Code => "0001"; + + public override string Message => "Invalid User"; + } + + public class OkResponse : AbstractResponse + { + public override string Code => "0000"; + + public override string Message => string.Empty; + } + + public class InsufficientPointsResponse : AbstractResponse + { + public override string Code => "0002"; + + public override string Message => "Insufficient points"; + + } + + public class NotFirstWinResponse : AbstractResponse + { + public override string Code => "0003"; + + public override string Message => "Not a first win"; + + } + + public class InvalidCardResponse : AbstractResponse + { + public override string Code => "0004"; + + public override string Message => "Invalid card"; + } +} \ No newline at end of file diff --git a/TOOHUCardAPI/DTO/PlayerBaseDataResponse.cs b/TOOHUCardAPI/DTO/PlayerBaseDataResponse.cs index 87bcb3d..0882450 100644 --- a/TOOHUCardAPI/DTO/PlayerBaseDataResponse.cs +++ b/TOOHUCardAPI/DTO/PlayerBaseDataResponse.cs @@ -2,7 +2,7 @@ using Newtonsoft.Json; namespace TOOHUCardAPI.DTO { - public class PlayerBaseDataResponse: AbstractResponse + public class PlayerBaseDataResponse: OkResponse { [JsonProperty("steamid")] public string SteamId { get; set; } diff --git a/TOOHUCardAPI/DTO/PlayerData/PlayerDataBuyMagicKeyRequest.cs b/TOOHUCardAPI/DTO/PlayerData/PlayerDataBuyMagicKeyRequest.cs index c41f974..923a04a 100644 --- a/TOOHUCardAPI/DTO/PlayerData/PlayerDataBuyMagicKeyRequest.cs +++ b/TOOHUCardAPI/DTO/PlayerData/PlayerDataBuyMagicKeyRequest.cs @@ -2,7 +2,6 @@ namespace TOOHUCardAPI.DTO.PlayerData { public class PlayerDataBuyMagicKeyRequest : AbstractPlayerTargetedRequest { - public string UserId { get; set; } public int Count { get; set; } } } \ No newline at end of file diff --git a/TOOHUCardAPI/DTO/PlayerData/PlayerDataBuyMagicKeyResponse.cs b/TOOHUCardAPI/DTO/PlayerData/PlayerDataBuyMagicKeyResponse.cs index 947afd3..1ca08e9 100644 --- a/TOOHUCardAPI/DTO/PlayerData/PlayerDataBuyMagicKeyResponse.cs +++ b/TOOHUCardAPI/DTO/PlayerData/PlayerDataBuyMagicKeyResponse.cs @@ -2,7 +2,7 @@ using Newtonsoft.Json; namespace TOOHUCardAPI.DTO.PlayerData { - public class PlayerDataBuyMagicKeyResponse : AbstractResponse + public class PlayerDataBuyMagicKeyResponse : OkResponse { [JsonProperty("cost_point")] public int TotalCost { get; set; } diff --git a/TOOHUCardAPI/DTO/PlayerData/PlayerDataFirstWinResponse.cs b/TOOHUCardAPI/DTO/PlayerData/PlayerDataFirstWinResponse.cs index 800c31c..23686b7 100644 --- a/TOOHUCardAPI/DTO/PlayerData/PlayerDataFirstWinResponse.cs +++ b/TOOHUCardAPI/DTO/PlayerData/PlayerDataFirstWinResponse.cs @@ -2,7 +2,7 @@ using Newtonsoft.Json; namespace TOOHUCardAPI.DTO.PlayerData { - public class PlayerDataFirstWinResponse : AbstractResponse + public class PlayerDataFirstWinResponse : OkResponse { [JsonProperty("bonus_point")] public int BonusPoints { get; set; } diff --git a/TOOHUCardAPI/DTO/PlayerData/PlayerDataGetResponseObject.cs b/TOOHUCardAPI/DTO/PlayerData/PlayerDataGetResponseObject.cs index 05052e5..df1a62d 100644 --- a/TOOHUCardAPI/DTO/PlayerData/PlayerDataGetResponseObject.cs +++ b/TOOHUCardAPI/DTO/PlayerData/PlayerDataGetResponseObject.cs @@ -8,7 +8,7 @@ using TOOHUCardAPI.Data.Models; namespace TOOHUCardAPI.DTO.PlayerData { - public class PlayerDataGetResponseObject: AbstractResponse + public class PlayerDataGetResponseObject: OkResponse { // Instead of using a defined object, use a dictionary so we can add the necessary cardgroup items. I dont want to make 20 of them in the class [JsonProperty("bo")] @@ -19,7 +19,7 @@ namespace TOOHUCardAPI.DTO.PlayerData * Fields pulled from the game code * Looking up Gamerules.Playerdata */ - public class PlayerDataGetResponseObjectPlayer: AbstractResponse + public class PlayerDataGetResponseObjectPlayer: OkResponse { [JsonProperty("steamid")] public string SteamId { get; set; } diff --git a/TOOHUCardAPI/DTO/PlayerData/PlayerDataSaveCardGroupRequest.cs b/TOOHUCardAPI/DTO/PlayerData/PlayerDataSaveCardGroupRequest.cs index 730b6a2..f0cc31b 100644 --- a/TOOHUCardAPI/DTO/PlayerData/PlayerDataSaveCardGroupRequest.cs +++ b/TOOHUCardAPI/DTO/PlayerData/PlayerDataSaveCardGroupRequest.cs @@ -4,7 +4,6 @@ namespace TOOHUCardAPI.DTO.PlayerData { public class PlayerDataSaveCardGroupRequest: AbstractPlayerTargetedRequest { - public string UserId { get; set; } [JsonProperty("group_key")] public string GroupKey { get; set; } [JsonProperty("group_data")] diff --git a/TOOHUCardAPI/DTO/PlayerData/PlayerDataSaveCardGroupResponse.cs b/TOOHUCardAPI/DTO/PlayerData/PlayerDataSaveCardGroupResponse.cs deleted file mode 100644 index f637564..0000000 --- a/TOOHUCardAPI/DTO/PlayerData/PlayerDataSaveCardGroupResponse.cs +++ /dev/null @@ -1,7 +0,0 @@ -namespace TOOHUCardAPI.DTO.PlayerData -{ - public class PlayerDataSaveCardGroupResponseObject : AbstractResponse - { - - } -} \ No newline at end of file diff --git a/TOOHUCardAPI/DTO/PlayerData/PlayerDataSaveCardLevelRequest.cs b/TOOHUCardAPI/DTO/PlayerData/PlayerDataSaveCardLevelRequest.cs new file mode 100644 index 0000000..044d918 --- /dev/null +++ b/TOOHUCardAPI/DTO/PlayerData/PlayerDataSaveCardLevelRequest.cs @@ -0,0 +1,12 @@ +using Newtonsoft.Json; + +namespace TOOHUCardAPI.DTO.PlayerData +{ + public class PlayerDataSaveCardLevelRequest : AbstractPlayerTargetedRequest + { + [JsonProperty("card")] + public string CardItemCode { get; set; } + [JsonProperty("level")] + public int LevelIncrease { get; set; } + } +} \ No newline at end of file diff --git a/TOOHUCardAPI/DTO/PlayerData/PlayerDataSaveCardLevelResponse.cs b/TOOHUCardAPI/DTO/PlayerData/PlayerDataSaveCardLevelResponse.cs new file mode 100644 index 0000000..e06417d --- /dev/null +++ b/TOOHUCardAPI/DTO/PlayerData/PlayerDataSaveCardLevelResponse.cs @@ -0,0 +1,10 @@ +using Newtonsoft.Json; + +namespace TOOHUCardAPI.DTO.PlayerData +{ + public class PlayerDataSaveCardLevelResponse : OkResponse + { + [JsonProperty("cost_point")] + public int TotalCost { get; set; } + } +} \ No newline at end of file diff --git a/TOOHUCardAPI/DTO/PlayerData/PlayerDataSaveKeyCountRequest.cs b/TOOHUCardAPI/DTO/PlayerData/PlayerDataSaveKeyCountRequest.cs index 0508c02..726081b 100644 --- a/TOOHUCardAPI/DTO/PlayerData/PlayerDataSaveKeyCountRequest.cs +++ b/TOOHUCardAPI/DTO/PlayerData/PlayerDataSaveKeyCountRequest.cs @@ -4,7 +4,6 @@ namespace TOOHUCardAPI.DTO.PlayerData { public class PlayerDataSaveKeyCountRequest: AbstractPlayerTargetedRequest { - public string UserId { get; set; } [JsonProperty("key_total")]public int KeyTotal { get; set; } [JsonProperty("key_use_count")]public int KeyUseCount { get; set; } } diff --git a/TOOHUCardAPI/Data/AppDbContext.cs b/TOOHUCardAPI/Data/AppDbContext.cs index 9912070..e0b11d8 100644 --- a/TOOHUCardAPI/Data/AppDbContext.cs +++ b/TOOHUCardAPI/Data/AppDbContext.cs @@ -1,5 +1,10 @@ +using System.Collections; +using System.Collections.Generic; using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata; using TOOHUCardAPI.Data.Models; +using TOOHUCardAPI.Data.Models.ModelBuilders; +using TOOHUCardAPI.Data.Seeders; namespace TOOHUCardAPI.Data { @@ -8,6 +13,16 @@ namespace TOOHUCardAPI.Data public DbSet Users { get; set; } public DbSet Cards { get; set; } + private readonly IEnumerable _seeders = new List + { + new CardSeeder() + }; + + private readonly IEnumerable _modelBuilders = new List + { + new CardLevelModelBuilder() + }; + public AppDbContext(DbContextOptions options) : base(options) { } @@ -15,7 +30,14 @@ namespace TOOHUCardAPI.Data protected override void OnModelCreating(ModelBuilder modelBuilder) { base.OnModelCreating(modelBuilder); - + foreach (var builder in _modelBuilders) + { + builder.BuildModel(modelBuilder); + } + foreach (var seeder in _seeders) + { + seeder.SeedData(modelBuilder); + } } protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) diff --git a/TOOHUCardAPI/Data/Exceptions.cs b/TOOHUCardAPI/Data/Exceptions.cs index 6c51449..4a899e4 100644 --- a/TOOHUCardAPI/Data/Exceptions.cs +++ b/TOOHUCardAPI/Data/Exceptions.cs @@ -22,4 +22,9 @@ namespace TOOHUCardAPI.Data { public override AbstractResponse response => new NotFirstWinResponse(); } + + public class InvalidCardException : TooHooException + { + public override AbstractResponse response => new InvalidCardResponse(); + } } \ No newline at end of file diff --git a/TOOHUCardAPI/Data/Models/Card.cs b/TOOHUCardAPI/Data/Models/Card.cs index 125e026..6a86ebf 100644 --- a/TOOHUCardAPI/Data/Models/Card.cs +++ b/TOOHUCardAPI/Data/Models/Card.cs @@ -8,7 +8,7 @@ namespace TOOHUCardAPI.Data.Models [Key] public string ItemCode { get; set; } public string CardName { get; set; } - public Rarity Rarity { get; set; } + public Rarity Quality { get; set; } public bool HasVoice { get; set; } public bool HasPortrait { get; set; } } diff --git a/TOOHUCardAPI/Data/Models/CardLevel.cs b/TOOHUCardAPI/Data/Models/CardLevel.cs new file mode 100644 index 0000000..c8dac6b --- /dev/null +++ b/TOOHUCardAPI/Data/Models/CardLevel.cs @@ -0,0 +1,10 @@ +namespace TOOHUCardAPI.Data.Models +{ + public class CardLevel + { + public string UserSteamId { get; set; } + public string CardItemCode { get; set; } + public Card Card { get; set; } + public int Level { get; set; } + } +} \ No newline at end of file diff --git a/TOOHUCardAPI/Data/Models/ModelBuilders/CardLevelModelBuilder.cs b/TOOHUCardAPI/Data/Models/ModelBuilders/CardLevelModelBuilder.cs new file mode 100644 index 0000000..ca6d8ee --- /dev/null +++ b/TOOHUCardAPI/Data/Models/ModelBuilders/CardLevelModelBuilder.cs @@ -0,0 +1,15 @@ +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Metadata.Builders; + +namespace TOOHUCardAPI.Data.Models.ModelBuilders +{ + public class CardLevelModelBuilder : IModelBuilder + { + public ModelBuilder BuildModel(ModelBuilder builder) + { + EntityTypeBuilder cardLevelBuilder = builder.Entity(); + cardLevelBuilder.HasKey(cl => new {cl.UserSteamId, cl.CardItemCode}); + return builder; + } + } +} \ No newline at end of file diff --git a/TOOHUCardAPI/Data/Models/ModelBuilders/IModelBuilder.cs b/TOOHUCardAPI/Data/Models/ModelBuilders/IModelBuilder.cs new file mode 100644 index 0000000..3565220 --- /dev/null +++ b/TOOHUCardAPI/Data/Models/ModelBuilders/IModelBuilder.cs @@ -0,0 +1,9 @@ +using Microsoft.EntityFrameworkCore; + +namespace TOOHUCardAPI.Data.Models.ModelBuilders +{ + public interface IModelBuilder + { + public ModelBuilder BuildModel(ModelBuilder builder); + } +} \ No newline at end of file diff --git a/TOOHUCardAPI/Data/Models/User.cs b/TOOHUCardAPI/Data/Models/User.cs index 8d51ea3..d14d399 100644 --- a/TOOHUCardAPI/Data/Models/User.cs +++ b/TOOHUCardAPI/Data/Models/User.cs @@ -19,7 +19,7 @@ namespace TOOHUCardAPI.Data.Models public bool Ban { get; set; } public int Point { get; set; } public DateTime LastFirstWin { get; set; } - public string LevelList { get; set; } public List EncodedCardGroups { get; set; } + public List CardLevels { get; set; } } } \ No newline at end of file diff --git a/TOOHUCardAPI/Data/Repositories/CardRepository.cs b/TOOHUCardAPI/Data/Repositories/CardRepository.cs new file mode 100644 index 0000000..5688a8c --- /dev/null +++ b/TOOHUCardAPI/Data/Repositories/CardRepository.cs @@ -0,0 +1,27 @@ +using System.Threading.Tasks; +using Microsoft.EntityFrameworkCore; +using TOOHUCardAPI.Data.Models; + +namespace TOOHUCardAPI.Data.Repositories +{ + public class CardRepository + { + private readonly AppDbContext _context; + + public CardRepository(AppDbContext context) + { + _context = context; + } + + public async Task GetCardByItemCode(string itemCode, bool allowNull = false) + { + Card card = await _context.Cards.FirstOrDefaultAsync(card => card.ItemCode == itemCode); + if (card == null && !allowNull) + { + throw new InvalidCardException(); + } + + return card; + } + } +} \ No newline at end of file diff --git a/TOOHUCardAPI/Data/Repositories/UserRepository.cs b/TOOHUCardAPI/Data/Repositories/UserRepository.cs index 53cb834..d7771b9 100644 --- a/TOOHUCardAPI/Data/Repositories/UserRepository.cs +++ b/TOOHUCardAPI/Data/Repositories/UserRepository.cs @@ -1,6 +1,7 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading.Tasks; using AutoMapper; using Microsoft.EntityFrameworkCore; using TOOHUCardAPI.Data.Models; @@ -20,46 +21,56 @@ namespace TOOHUCardAPI.Data.Repositories private IQueryable GetAllUsersQuery() { - return _appDbContext.Users.Include(u => u.EncodedCardGroups).AsQueryable(); + return _appDbContext.Users + .Include(u => u.EncodedCardGroups) + .Include(u => u.CardLevels) + .ThenInclude(cl => cl.Card) + .AsSingleQuery() + .AsQueryable(); } - public User GetUser(string steamId) + public async Task GetUser(string steamId, bool allowNull = false) { - return GetAllUsersQuery().FirstOrDefault(user => user.SteamId.Equals(steamId)); + User user = await GetAllUsersQuery().FirstOrDefaultAsync(user => user.SteamId.Equals(steamId)); + if (user == null && !allowNull) + { + throw new InvalidUserException(); + } + + return user; } - public User CreateUser(string steamId) + public async Task CreateUser(string steamId) { User user = new User() { SteamId = steamId, Vip = true, EndTime = DateTime.MaxValue, - LevelList = string.Empty, PetLevel = 1, EncodedCardGroups = new List() }; - _appDbContext.Users.Add(user); - _appDbContext.SaveChanges(); + await _appDbContext.Users.AddAsync(user); + await _appDbContext.SaveChangesAsync(); return user; } - public User UpdateUser(User user) + public async Task UpdateUser(User user) { var trackedUser = GetAllUsersQuery().FirstOrDefault(u => u.SteamId == user.SteamId); if (trackedUser == default) { - return trackedUser; + return null; } _appDbContext.Update(user); - _appDbContext.SaveChanges(); + await _appDbContext.SaveChangesAsync(); return user; } - public User GetOrCreateUser(string steamId) + public async Task GetOrCreateUser(string steamId) { - User user = GetUser(steamId) ?? CreateUser(steamId); + User user = await GetUser(steamId, true) ?? await CreateUser(steamId); return user; } } diff --git a/TOOHUCardAPI/Data/SeedData/CardData.json b/TOOHUCardAPI/Data/SeedData/CardData.json new file mode 100644 index 0000000..dce879b --- /dev/null +++ b/TOOHUCardAPI/Data/SeedData/CardData.json @@ -0,0 +1,604 @@ +{ + "item_0026": { + "quality": 3, + "cardname": "rin", + "hasVoice": true, + "hasPortrait": true + }, + "item_0043": { + "quality": 2, + "cardname": "hatate", + "hasVoice": true, + "hasPortrait": true + }, + "item_0014": { + "quality": 2, + "cardname": "merlin", + "hasVoice": true, + "hasPortrait": true + }, + "item_0007": { + "quality": 1, + "cardname": "hanadayousei", + "hasVoice": false, + "hasPortrait": false + }, + "item_2002": { + "quality": 4, + "cardname": "item_2002", + "hasVoice": false, + "hasPortrait": false + }, + "item_0055": { + "quality": 3, + "cardname": "suika", + "hasVoice": true, + "hasPortrait": true + }, + "item_0002": { + "quality": 2, + "cardname": "nazrin", + "hasVoice": true, + "hasPortrait": true + }, + "item_0061": { + "quality": 3, + "cardname": "keine", + "hasVoice": false, + "hasPortrait": true + }, + "item_0069": { + "quality": 2, + "cardname": "toramaru", + "hasVoice": false, + "hasPortrait": true + }, + "item_0042": { + "quality": 3, + "cardname": "aya", + "hasVoice": false, + "hasPortrait": true + }, + "item_1011": { "quality": 1, "cardname": "BonusEgg" }, + "item_0015": { + "quality": 2, + "cardname": "rumia", + "hasVoice": true, + "hasPortrait": true + }, + "item_0030": { + "quality": 4, + "cardname": "remilia", + "hasVoice": false, + "hasPortrait": true + }, + "item_0028": { + "quality": 4, + "cardname": "reimu", + "hasVoice": true, + "hasPortrait": true + }, + "item_0045": { + "quality": 3, + "cardname": "kagerou", + "hasVoice": false, + "hasPortrait": true + }, + "item_0019": { + "quality": 3, + "cardname": "marisa", + "hasVoice": true, + "hasPortrait": true + }, + "item_0075": { + "quality": 3, + "cardname": "clownpiece", + "hasVoice": false, + "hasPortrait": true + }, + "item_0050": { + "quality": 3, + "cardname": "nue", + "hasVoice": false, + "hasPortrait": true + }, + "item_0044": { + "quality": 2, + "cardname": "momiji", + "hasVoice": true, + "hasPortrait": true + }, + "item_0011": { + "quality": 2, + "cardname": "letty", + "hasVoice": true, + "hasPortrait": true + }, + "item_1003": { "quality": 1, "cardname": "BonusEgg" }, + "item_0022": { + "quality": 3, + "cardname": "sakuya", + "hasVoice": true, + "hasPortrait": true + }, + "item_0003": { + "quality": 2, + "cardname": "minoriko", + "hasVoice": true, + "hasPortrait": true + }, + "item_2022": { + "quality": 3, + "cardname": "item_2022", + "hasVoice": false, + "hasPortrait": false + }, + "item_2020": { + "quality": 4, + "cardname": "item_2020", + "hasVoice": false, + "hasPortrait": false + }, + "item_2016": { + "quality": 3, + "cardname": "item_2016", + "hasVoice": false, + "hasPortrait": false + }, + "item_2018": { + "quality": 2, + "cardname": "item_2018", + "hasVoice": false, + "hasPortrait": false + }, + "item_2006": { + "quality": 2, + "cardname": "item_2006", + "hasVoice": false, + "hasPortrait": false + }, + "item_2019": { + "quality": 2, + "cardname": "item_2019", + "hasVoice": false, + "hasPortrait": false + }, + "item_2015": { + "quality": 3, + "cardname": "item_2015", + "hasVoice": false, + "hasPortrait": false + }, + "item_2014": { + "quality": 4, + "cardname": "item_2014", + "hasVoice": false, + "hasPortrait": false + }, + "item_0009": { + "quality": 2, + "cardname": "cirno", + "hasVoice": false, + "hasPortrait": true + }, + "item_0038": { + "quality": 2, + "cardname": "chen", + "hasVoice": false, + "hasPortrait": true + }, + "item_0074": { + "quality": 4, + "cardname": "hecatia", + "hasVoice": false, + "hasPortrait": true + }, + "item_0080": { + "quality": 4, + "cardname": "shinki", + "hasVoice": false, + "hasPortrait": true + }, + "item_0051": { + "quality": 4, + "cardname": "byakuren", + "hasVoice": false, + "hasPortrait": true + }, + "item_1012": { "quality": 2, "cardname": "BonusEgg" }, + "item_0029": { + "quality": 4, + "cardname": "daiyousei", + "hasVoice": true, + "hasPortrait": true + }, + "item_0073": { + "quality": 4, + "cardname": "junko", + "hasVoice": false, + "hasPortrait": true + }, + "item_0063": { + "quality": 2, + "cardname": "kisume", + "hasVoice": false, + "hasPortrait": true + }, + "item_2007": { + "quality": 2, + "cardname": "item_2007", + "hasVoice": false, + "hasPortrait": false + }, + "item_0025": { + "quality": 3, + "cardname": "youmu", + "hasVoice": true, + "hasPortrait": true + }, + "item_0004": { + "quality": 1, + "cardname": "mugiyousei", + "hasVoice": false, + "hasPortrait": false + }, + "item_0096": { + "quality": 3, + "cardname": "seiga", + "hasVoice": false, + "hasPortrait": true + }, + "item_0034": { + "quality": 2, + "cardname": "meirin", + "hasVoice": false, + "hasPortrait": true + }, + "item_2011": { + "quality": 3, + "cardname": "item_2011", + "hasVoice": false, + "hasPortrait": false + }, + "item_2010": { + "quality": 3, + "cardname": "item_2010", + "hasVoice": false, + "hasPortrait": false + }, + "item_2008": { + "quality": 2, + "cardname": "item_2008", + "hasVoice": false, + "hasPortrait": false + }, + "item_0036": { + "quality": 4, + "cardname": "yukari", + "hasVoice": false, + "hasPortrait": true + }, + "item_0018": { + "quality": 2, + "cardname": "mystia", + "hasVoice": true, + "hasPortrait": true + }, + "item_2009": { + "quality": 3, + "cardname": "item_2009", + "hasVoice": false, + "hasPortrait": false + }, + "item_0046": { + "quality": 3, + "cardname": "sanae", + "hasVoice": false, + "hasPortrait": true + }, + "item_2017": { + "quality": 3, + "cardname": "item_2017", + "hasVoice": false, + "hasPortrait": false + }, + "item_2005": { + "quality": 2, + "cardname": "item_2005", + "hasVoice": false, + "hasPortrait": false + }, + "item_0052": { + "quality": 4, + "cardname": "miko", + "hasVoice": true, + "hasPortrait": true + }, + "item_0023": { + "quality": 3, + "cardname": "reisen", + "hasVoice": true, + "hasPortrait": true + }, + "item_0049": { + "quality": 3, + "cardname": "minamitsu", + "hasVoice": true, + "hasPortrait": true + }, + "item_2004": { + "quality": 2, + "cardname": "item_2004", + "hasVoice": false, + "hasPortrait": false + }, + "item_2003": { + "quality": 3, + "cardname": "item_2003", + "hasVoice": false, + "hasPortrait": false + }, + "item_0056": { + "quality": 2, + "cardname": "star", + "hasVoice": true, + "hasPortrait": true + }, + "item_0006": { + "quality": 1, + "cardname": "hourainingyou", + "hasVoice": false, + "hasPortrait": false + }, + "item_0057": { + "quality": 2, + "cardname": "sunny", + "hasVoice": true, + "hasPortrait": true + }, + "item_0095": { + "quality": 3, + "cardname": "futo", + "hasVoice": false, + "hasPortrait": true + }, + "item_2001": { + "quality": 3, + "cardname": "item_2001", + "hasVoice": false, + "hasPortrait": false + }, + "item_1013": { "quality": 3, "cardname": "BonusEgg" }, + "item_0097": { + "quality": 2, + "cardname": "yoshika", + "hasVoice": false, + "hasPortrait": true + }, + "item_0027": { + "quality": 3, + "cardname": "utsuho", + "hasVoice": false, + "hasPortrait": true + }, + "item_0068": { + "quality": 4, + "cardname": "komachi", + "hasVoice": false, + "hasPortrait": true + }, + "item_0047": { + "quality": 4, + "cardname": "kanako", + "hasVoice": true, + "hasPortrait": true + }, + "item_0058": { + "quality": 2, + "cardname": "luna", + "hasVoice": true, + "hasPortrait": true + }, + "item_2013": { + "quality": 4, + "cardname": "item_2013", + "hasVoice": false, + "hasPortrait": false + }, + "item_0024": { + "quality": 3, + "cardname": "yuyuko", + "hasVoice": true, + "hasPortrait": true + }, + "item_0093": { + "quality": 2, + "cardname": "kyouko", + "hasVoice": true, + "hasPortrait": true + }, + "item_0005": { + "quality": 1, + "cardname": "shanghainingyou", + "hasVoice": false, + "hasPortrait": false + }, + "item_1006": { "quality": 4, "cardname": "BonusEgg" }, + "item_0064": { + "quality": 4, + "cardname": "shikieiki", + "hasVoice": false, + "hasPortrait": true + }, + "item_0092": { + "quality": 2, + "cardname": "medicine", + "hasVoice": true, + "hasPortrait": true + }, + "item_0017": { + "quality": 2, + "cardname": "iku", + "hasVoice": false, + "hasPortrait": true + }, + "item_0013": { + "quality": 2, + "cardname": "lunasa", + "hasVoice": true, + "hasPortrait": true + }, + "item_0091": { + "quality": 2, + "cardname": "hina", + "hasVoice": false, + "hasPortrait": true + }, + "item_1004": { "quality": 2, "cardname": "BonusEgg" }, + "item_0040": { + "quality": 3, + "cardname": "mokou", + "hasVoice": true, + "hasPortrait": true + }, + "item_0088": { + "quality": 2, + "cardname": "sizuha", + "hasVoice": true, + "hasPortrait": true + }, + "item_2012": { + "quality": 4, + "cardname": "item_2012", + "hasVoice": false, + "hasPortrait": false + }, + "item_0010": { + "quality": 2, + "cardname": "kogasa", + "hasVoice": true, + "hasPortrait": true + }, + "item_0062": { + "quality": 2, + "cardname": "inaba", + "hasVoice": false, + "hasPortrait": true + }, + "item_0001": { + "quality": 2, + "cardname": "lily", + "hasVoice": false, + "hasPortrait": true + }, + "item_1005": { "quality": 3, "cardname": "BonusEgg" }, + "item_0060": { + "quality": 2, + "cardname": "wriggle", + "hasVoice": false, + "hasPortrait": true + }, + "item_0059": { + "quality": 3, + "cardname": "alice", + "hasVoice": true, + "hasPortrait": true + }, + "item_0054": { + "quality": 3, + "cardname": "yuugi", + "hasVoice": true, + "hasPortrait": true + }, + "item_0032": { + "quality": 4, + "cardname": "flandre", + "hasVoice": true, + "hasPortrait": true + }, + "item_0033": { + "quality": 2, + "cardname": "koakuma", + "hasVoice": true, + "hasPortrait": true + }, + "item_0041": { + "quality": 3, + "cardname": "kaguya", + "hasVoice": true, + "hasPortrait": true + }, + "item_0039": { + "quality": 4, + "cardname": "eirin", + "hasVoice": true, + "hasPortrait": true + }, + "item_0037": { + "quality": 3, + "cardname": "ran", + "hasVoice": true, + "hasPortrait": true + }, + "item_0035": { + "quality": 4, + "cardname": "yuuka", + "hasVoice": true, + "hasPortrait": true + }, + "item_0048": { + "quality": 3, + "cardname": "suwako", + "hasVoice": false, + "hasPortrait": true + }, + "item_0016": { + "quality": 2, + "cardname": "satori", + "hasVoice": true, + "hasPortrait": true + }, + "item_0053": { + "quality": 3, + "cardname": "kokoro", + "hasVoice": true, + "hasPortrait": true + }, + "item_0008": { + "quality": 1, + "cardname": "maidyousei", + "hasVoice": false, + "hasPortrait": false + }, + "item_0012": { + "quality": 2, + "cardname": "lyrica", + "hasVoice": true, + "hasPortrait": true + }, + "item_0031": { + "quality": 4, + "cardname": "koishi", + "hasVoice": true, + "hasPortrait": true + }, + "item_0094": { + "quality": 3, + "cardname": "soga", + "hasVoice": true, + "hasPortrait": true + }, + "item_0021": { + "quality": 3, + "cardname": "patchouli", + "hasVoice": true, + "hasPortrait": true + }, + "item_0020": { + "quality": 3, + "cardname": "tenshi", + "hasVoice": false, + "hasPortrait": true + }, + "item_1014": { "quality": 4, "cardname": "BonusEgg" } +} diff --git a/TOOHUCardAPI/Data/Seeders/CardSeeder.cs b/TOOHUCardAPI/Data/Seeders/CardSeeder.cs new file mode 100644 index 0000000..9d4065e --- /dev/null +++ b/TOOHUCardAPI/Data/Seeders/CardSeeder.cs @@ -0,0 +1,25 @@ +using System.Linq; +using Microsoft.EntityFrameworkCore; +using Newtonsoft.Json; +using Newtonsoft.Json.Linq; +using TOOHUCardAPI.Data.Models; + +namespace TOOHUCardAPI.Data.Seeders +{ + public class CardSeeder : ISeeder + { + public ModelBuilder SeedData(ModelBuilder builder) + { + var dataFile = System.IO.File.ReadAllText(ISeeder.SeedDataDirectory + @"CardData.json"); + JObject jsonifiedData = JObject.Parse(dataFile); + var cardObjects = jsonifiedData.Properties().Select(i => + { + var obj = i.Value.ToObject(); + obj["ItemCode"] = i.Name; + return obj; + }).Select(obj => obj.ToObject()); + builder.Entity().HasData(cardObjects); + return builder; + } + } +} \ No newline at end of file diff --git a/TOOHUCardAPI/Data/Seeders/ISeeder.cs b/TOOHUCardAPI/Data/Seeders/ISeeder.cs new file mode 100644 index 0000000..57f52dc --- /dev/null +++ b/TOOHUCardAPI/Data/Seeders/ISeeder.cs @@ -0,0 +1,10 @@ +using Microsoft.EntityFrameworkCore; + +namespace TOOHUCardAPI.Data.Seeders +{ + public interface ISeeder + { + public static string SeedDataDirectory = @"Data/SeedData/"; + public ModelBuilder SeedData(ModelBuilder builder); + } +} \ No newline at end of file diff --git a/TOOHUCardAPI/Data/Services/MethodMapService.cs b/TOOHUCardAPI/Data/Services/MethodMapService.cs new file mode 100644 index 0000000..1653812 --- /dev/null +++ b/TOOHUCardAPI/Data/Services/MethodMapService.cs @@ -0,0 +1,11 @@ +using System; +using System.Collections.Generic; + +using MethodMap = System.Collections.Generic.Dictionary; +namespace TOOHUCardAPI.Data.Services +{ + public class MethodMapService + { + public static readonly Dictionary MethodMapByType = new(); + } +} \ No newline at end of file diff --git a/TOOHUCardAPI/Data/Services/StoreService.cs b/TOOHUCardAPI/Data/Services/StoreService.cs index ffb798c..87c089c 100644 --- a/TOOHUCardAPI/Data/Services/StoreService.cs +++ b/TOOHUCardAPI/Data/Services/StoreService.cs @@ -1,6 +1,8 @@ using System; +using System.Linq; using System.Threading.Tasks; using Microsoft.Extensions.Logging; +using TOOHUCardAPI.Data.Enums; using TOOHUCardAPI.Data.Models; using TOOHUCardAPI.Data.Repositories; using TOOHUCardAPI.DTO; @@ -11,77 +13,80 @@ namespace TOOHUCardAPI.Data.Services { private readonly ILogger _logger; private readonly UserRepository _userRepository; + private readonly CardRepository _cardRepository; - public StoreService(ILogger logger, UserRepository userRepository) + public StoreService(ILogger logger, UserRepository userRepository, CardRepository cardRepository) { _logger = logger; _userRepository = userRepository; + _cardRepository = cardRepository; } - private void AddPoints(int points, User user) + private async Task AddPoints(int points, User user) { user.Point = Math.Max(0, user.Point + points); - _userRepository.UpdateUser(user); + await _userRepository.UpdateUser(user); _logger.LogInformation($"User with steamid {user.SteamId} was given {points} points. New total: {user.Point}"); } + public async Task LevelUpCard(string steamId, string itemName, int levelIncrease) + { + User user = await _userRepository.GetUser(steamId); + Card card = await _cardRepository.GetCardByItemCode(itemName); + CardLevel userCardLevel = user.CardLevels.Find(cl => cl.Card.ItemCode == itemName) ?? new CardLevel() + { + Card = card, + Level = 0 + }; + int totalCost = + (card.Quality == Rarity.NORMAL ? AppSettings.PointsPerLevelNormal : AppSettings.PointsPerLevel) * + levelIncrease; + if (user.Point < totalCost) + { + throw new InsufficientPointsException(); + } + if (!user.CardLevels.Contains(userCardLevel)) + { + user.CardLevels.Add(userCardLevel); + } + await AddPoints(-totalCost, user); + userCardLevel.Level += levelIncrease; + await _userRepository.UpdateUser(user); + _logger.LogInformation($"User with steamid {user.SteamId} leveled up card {card.CardName} to level {userCardLevel.Level}"); + return totalCost; + } + public async Task PurchaseMagicKey(int amt, string steamId) { int totalCost = AppSettings.PointsPerKey * amt; amt = Math.Clamp(amt, 0, AppSettings.MaxKeyPurchaseAmount); - User user = _userRepository.GetUser(steamId); - if (user == null) - { - throw new InvalidUserException(); - } + User user = await _userRepository.GetUser(steamId); if (user.Point < totalCost) { throw new InsufficientPointsException(); } - AddPoints(-totalCost, user); + await AddPoints(-totalCost, user); user.KeyTotal += amt; - _userRepository.UpdateUser(user); + await _userRepository.UpdateUser(user); _logger.LogInformation($"User with steamid {user.SteamId} purchased {amt} keys for {totalCost} points. New point value is {user.Point}"); return totalCost; } public async Task GiveFirstWinBonus(string steamId) { - User user = _userRepository.GetUser(steamId); - if (user == null) - { - throw new InvalidUserException(); - } + User user = await _userRepository.GetUser(steamId); if (user.LastFirstWin.AddDays(1) > DateTime.Now) { throw new NotFirstWinException(); } - AddPoints(AppSettings.FirstWinBonusPoints, user); + await AddPoints(AppSettings.FirstWinBonusPoints, user); user.LastFirstWin = DateTime.Now; - _userRepository.UpdateUser(user); + await _userRepository.UpdateUser(user); _logger.LogInformation($"User with steamid {user.SteamId} received first win of the day bonus, earning {AppSettings.FirstWinBonusPoints} points. New value: {user.Point}"); return AppSettings.FirstWinBonusPoints; } } - public class InsufficientPointsResponse : AbstractResponse - { - public InsufficientPointsResponse() - { - Code = "0002"; - Message = "Insufficient points"; - } - } - - public class NotFirstWinResponse : AbstractResponse - { - public NotFirstWinResponse() - { - Code = "0003"; - Message = "Not first win of the day"; - } - } - } \ No newline at end of file diff --git a/TOOHUCardAPI/Migrations/20211030200856_more fields and seeder.Designer.cs b/TOOHUCardAPI/Migrations/20211030200856_more fields and seeder.Designer.cs new file mode 100644 index 0000000..d0e5926 --- /dev/null +++ b/TOOHUCardAPI/Migrations/20211030200856_more fields and seeder.Designer.cs @@ -0,0 +1,983 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using TOOHUCardAPI.Data; + +namespace TOOHUCardAPI.Migrations +{ + [DbContext(typeof(AppDbContext))] + [Migration("20211030200856_more fields and seeder")] + partial class morefieldsandseeder + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.11"); + + modelBuilder.Entity("TOOHUCardAPI.Data.Models.Card", b => + { + b.Property("ItemCode") + .HasColumnType("TEXT"); + + b.Property("CardName") + .HasColumnType("TEXT"); + + b.Property("HasPortrait") + .HasColumnType("INTEGER"); + + b.Property("HasVoice") + .HasColumnType("INTEGER"); + + b.Property("Quality") + .HasColumnType("INTEGER"); + + b.HasKey("ItemCode"); + + b.ToTable("Cards"); + + b.HasData( + new + { + ItemCode = "item_0026", + CardName = "rin", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0043", + CardName = "hatate", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0014", + CardName = "merlin", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0007", + CardName = "hanadayousei", + HasPortrait = false, + HasVoice = false, + Quality = 1 + }, + new + { + ItemCode = "item_2002", + CardName = "item_2002", + HasPortrait = false, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0055", + CardName = "suika", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0002", + CardName = "nazrin", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0061", + CardName = "keine", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0069", + CardName = "toramaru", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0042", + CardName = "aya", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_1011", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 1 + }, + new + { + ItemCode = "item_0015", + CardName = "rumia", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0030", + CardName = "remilia", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0028", + CardName = "reimu", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0045", + CardName = "kagerou", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0019", + CardName = "marisa", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0075", + CardName = "clownpiece", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0050", + CardName = "nue", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0044", + CardName = "momiji", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0011", + CardName = "letty", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_1003", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 1 + }, + new + { + ItemCode = "item_0022", + CardName = "sakuya", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0003", + CardName = "minoriko", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_2022", + CardName = "item_2022", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2020", + CardName = "item_2020", + HasPortrait = false, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_2016", + CardName = "item_2016", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2018", + CardName = "item_2018", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_2006", + CardName = "item_2006", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_2019", + CardName = "item_2019", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_2015", + CardName = "item_2015", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2014", + CardName = "item_2014", + HasPortrait = false, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0009", + CardName = "cirno", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0038", + CardName = "chen", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0074", + CardName = "hecatia", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0080", + CardName = "shinki", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0051", + CardName = "byakuren", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_1012", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0029", + CardName = "daiyousei", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0073", + CardName = "junko", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0063", + CardName = "kisume", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_2007", + CardName = "item_2007", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0025", + CardName = "youmu", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0004", + CardName = "mugiyousei", + HasPortrait = false, + HasVoice = false, + Quality = 1 + }, + new + { + ItemCode = "item_0096", + CardName = "seiga", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0034", + CardName = "meirin", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_2011", + CardName = "item_2011", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2010", + CardName = "item_2010", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2008", + CardName = "item_2008", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0036", + CardName = "yukari", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0018", + CardName = "mystia", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_2009", + CardName = "item_2009", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0046", + CardName = "sanae", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2017", + CardName = "item_2017", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2005", + CardName = "item_2005", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0052", + CardName = "miko", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0023", + CardName = "reisen", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0049", + CardName = "minamitsu", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_2004", + CardName = "item_2004", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_2003", + CardName = "item_2003", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0056", + CardName = "star", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0006", + CardName = "hourainingyou", + HasPortrait = false, + HasVoice = false, + Quality = 1 + }, + new + { + ItemCode = "item_0057", + CardName = "sunny", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0095", + CardName = "futo", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2001", + CardName = "item_2001", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_1013", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0097", + CardName = "yoshika", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0027", + CardName = "utsuho", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0068", + CardName = "komachi", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0047", + CardName = "kanako", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0058", + CardName = "luna", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_2013", + CardName = "item_2013", + HasPortrait = false, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0024", + CardName = "yuyuko", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0093", + CardName = "kyouko", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0005", + CardName = "shanghainingyou", + HasPortrait = false, + HasVoice = false, + Quality = 1 + }, + new + { + ItemCode = "item_1006", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0064", + CardName = "shikieiki", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0092", + CardName = "medicine", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0017", + CardName = "iku", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0013", + CardName = "lunasa", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0091", + CardName = "hina", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_1004", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0040", + CardName = "mokou", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0088", + CardName = "sizuha", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_2012", + CardName = "item_2012", + HasPortrait = false, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0010", + CardName = "kogasa", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0062", + CardName = "inaba", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0001", + CardName = "lily", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_1005", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0060", + CardName = "wriggle", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0059", + CardName = "alice", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0054", + CardName = "yuugi", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0032", + CardName = "flandre", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0033", + CardName = "koakuma", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0041", + CardName = "kaguya", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0039", + CardName = "eirin", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0037", + CardName = "ran", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0035", + CardName = "yuuka", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0048", + CardName = "suwako", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0016", + CardName = "satori", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0053", + CardName = "kokoro", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0008", + CardName = "maidyousei", + HasPortrait = false, + HasVoice = false, + Quality = 1 + }, + new + { + ItemCode = "item_0012", + CardName = "lyrica", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0031", + CardName = "koishi", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0094", + CardName = "soga", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0021", + CardName = "patchouli", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0020", + CardName = "tenshi", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_1014", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 4 + }); + }); + + modelBuilder.Entity("TOOHUCardAPI.Data.Models.EncodedCardGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("EncodedString") + .HasColumnType("TEXT"); + + b.Property("GroupKey") + .HasColumnType("TEXT"); + + b.Property("UserSteamId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserSteamId"); + + b.ToTable("EncodedCardGroup"); + }); + + modelBuilder.Entity("TOOHUCardAPI.Data.Models.User", b => + { + b.Property("SteamId") + .HasColumnType("TEXT"); + + b.Property("Ban") + .HasColumnType("INTEGER"); + + b.Property("EndTime") + .HasColumnType("TEXT"); + + b.Property("KeySaveDate") + .HasColumnType("TEXT"); + + b.Property("KeyTotal") + .HasColumnType("INTEGER"); + + b.Property("KeyUseCount") + .HasColumnType("INTEGER"); + + b.Property("LastFirstWin") + .HasColumnType("TEXT"); + + b.Property("LevelList") + .HasColumnType("TEXT"); + + b.Property("MaxTeamWave") + .HasColumnType("INTEGER"); + + b.Property("MaxWave") + .HasColumnType("INTEGER"); + + b.Property("PetLevel") + .HasColumnType("INTEGER"); + + b.Property("Point") + .HasColumnType("INTEGER"); + + b.Property("Vip") + .HasColumnType("INTEGER"); + + b.HasKey("SteamId"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("TOOHUCardAPI.Data.Models.EncodedCardGroup", b => + { + b.HasOne("TOOHUCardAPI.Data.Models.User", null) + .WithMany("EncodedCardGroups") + .HasForeignKey("UserSteamId"); + }); + + modelBuilder.Entity("TOOHUCardAPI.Data.Models.User", b => + { + b.Navigation("EncodedCardGroups"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/TOOHUCardAPI/Migrations/20211030200856_more fields and seeder.cs b/TOOHUCardAPI/Migrations/20211030200856_more fields and seeder.cs new file mode 100644 index 0000000..c75306f --- /dev/null +++ b/TOOHUCardAPI/Migrations/20211030200856_more fields and seeder.cs @@ -0,0 +1,566 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace TOOHUCardAPI.Migrations +{ + public partial class morefieldsandseeder : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Cards", + columns: table => new + { + ItemCode = table.Column(type: "TEXT", nullable: false), + CardName = table.Column(type: "TEXT", nullable: true), + Quality = table.Column(type: "INTEGER", nullable: false), + HasVoice = table.Column(type: "INTEGER", nullable: false), + HasPortrait = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Cards", x => x.ItemCode); + }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0026", "rin", true, true, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0017", "iku", true, false, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0092", "medicine", true, true, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0064", "shikieiki", true, false, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_1006", "BonusEgg", false, false, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0005", "shanghainingyou", false, false, 1 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0093", "kyouko", true, true, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0024", "yuyuko", true, true, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_2013", "item_2013", false, false, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0058", "luna", true, true, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0047", "kanako", true, true, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0068", "komachi", true, false, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0027", "utsuho", true, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0097", "yoshika", true, false, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_1013", "BonusEgg", false, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_2001", "item_2001", false, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0095", "futo", true, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0057", "sunny", true, true, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0006", "hourainingyou", false, false, 1 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0056", "star", true, true, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_2003", "item_2003", false, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_2004", "item_2004", false, false, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0049", "minamitsu", true, true, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0023", "reisen", true, true, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0013", "lunasa", true, true, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0052", "miko", true, true, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0091", "hina", true, false, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0040", "mokou", true, true, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0021", "patchouli", true, true, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0094", "soga", true, true, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0031", "koishi", true, true, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0012", "lyrica", true, true, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0008", "maidyousei", false, false, 1 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0053", "kokoro", true, true, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0016", "satori", true, true, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0048", "suwako", true, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0035", "yuuka", true, true, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0037", "ran", true, true, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0039", "eirin", true, true, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0041", "kaguya", true, true, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0033", "koakuma", true, true, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0032", "flandre", true, true, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0054", "yuugi", true, true, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0059", "alice", true, true, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0060", "wriggle", true, false, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_1005", "BonusEgg", false, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0001", "lily", true, false, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0062", "inaba", true, false, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0010", "kogasa", true, true, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_2012", "item_2012", false, false, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0088", "sizuha", true, true, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_1004", "BonusEgg", false, false, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0020", "tenshi", true, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_2005", "item_2005", false, false, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0046", "sanae", true, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_2022", "item_2022", false, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0003", "minoriko", true, true, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0022", "sakuya", true, true, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_1003", "BonusEgg", false, false, 1 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0011", "letty", true, true, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0044", "momiji", true, true, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0050", "nue", true, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0075", "clownpiece", true, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0019", "marisa", true, true, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0045", "kagerou", true, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0028", "reimu", true, true, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0030", "remilia", true, false, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0015", "rumia", true, true, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_1011", "BonusEgg", false, false, 1 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0042", "aya", true, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0069", "toramaru", true, false, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0061", "keine", true, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0002", "nazrin", true, true, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0055", "suika", true, true, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_2002", "item_2002", false, false, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0007", "hanadayousei", false, false, 1 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0014", "merlin", true, true, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0043", "hatate", true, true, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_2020", "item_2020", false, false, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_2017", "item_2017", false, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_2016", "item_2016", false, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_2006", "item_2006", false, false, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_2009", "item_2009", false, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0018", "mystia", true, true, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0036", "yukari", true, false, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_2008", "item_2008", false, false, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_2010", "item_2010", false, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_2011", "item_2011", false, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0034", "meirin", true, false, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0096", "seiga", true, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0004", "mugiyousei", false, false, 1 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0025", "youmu", true, true, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_2007", "item_2007", false, false, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0063", "kisume", true, false, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0073", "junko", true, false, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0029", "daiyousei", true, true, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_1012", "BonusEgg", false, false, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0051", "byakuren", true, false, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0080", "shinki", true, false, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0074", "hecatia", true, false, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0038", "chen", true, false, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_0009", "cirno", true, false, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_2014", "item_2014", false, false, 4 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_2015", "item_2015", false, false, 3 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_2019", "item_2019", false, false, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_2018", "item_2018", false, false, 2 }); + + migrationBuilder.InsertData( + table: "Cards", + columns: new[] { "ItemCode", "CardName", "HasPortrait", "HasVoice", "Quality" }, + values: new object[] { "item_1014", "BonusEgg", false, false, 4 }); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Cards"); + } + } +} diff --git a/TOOHUCardAPI/Migrations/20211031004851_cardlevel.Designer.cs b/TOOHUCardAPI/Migrations/20211031004851_cardlevel.Designer.cs new file mode 100644 index 0000000..0817349 --- /dev/null +++ b/TOOHUCardAPI/Migrations/20211031004851_cardlevel.Designer.cs @@ -0,0 +1,1017 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using TOOHUCardAPI.Data; + +namespace TOOHUCardAPI.Migrations +{ + [DbContext(typeof(AppDbContext))] + [Migration("20211031004851_cardlevel")] + partial class cardlevel + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "5.0.11"); + + modelBuilder.Entity("TOOHUCardAPI.Data.Models.Card", b => + { + b.Property("ItemCode") + .HasColumnType("TEXT"); + + b.Property("CardName") + .HasColumnType("TEXT"); + + b.Property("HasPortrait") + .HasColumnType("INTEGER"); + + b.Property("HasVoice") + .HasColumnType("INTEGER"); + + b.Property("Quality") + .HasColumnType("INTEGER"); + + b.HasKey("ItemCode"); + + b.ToTable("Cards"); + + b.HasData( + new + { + ItemCode = "item_0026", + CardName = "rin", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0043", + CardName = "hatate", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0014", + CardName = "merlin", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0007", + CardName = "hanadayousei", + HasPortrait = false, + HasVoice = false, + Quality = 1 + }, + new + { + ItemCode = "item_2002", + CardName = "item_2002", + HasPortrait = false, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0055", + CardName = "suika", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0002", + CardName = "nazrin", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0061", + CardName = "keine", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0069", + CardName = "toramaru", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0042", + CardName = "aya", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_1011", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 1 + }, + new + { + ItemCode = "item_0015", + CardName = "rumia", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0030", + CardName = "remilia", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0028", + CardName = "reimu", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0045", + CardName = "kagerou", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0019", + CardName = "marisa", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0075", + CardName = "clownpiece", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0050", + CardName = "nue", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0044", + CardName = "momiji", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0011", + CardName = "letty", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_1003", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 1 + }, + new + { + ItemCode = "item_0022", + CardName = "sakuya", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0003", + CardName = "minoriko", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_2022", + CardName = "item_2022", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2020", + CardName = "item_2020", + HasPortrait = false, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_2016", + CardName = "item_2016", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2018", + CardName = "item_2018", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_2006", + CardName = "item_2006", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_2019", + CardName = "item_2019", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_2015", + CardName = "item_2015", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2014", + CardName = "item_2014", + HasPortrait = false, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0009", + CardName = "cirno", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0038", + CardName = "chen", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0074", + CardName = "hecatia", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0080", + CardName = "shinki", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0051", + CardName = "byakuren", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_1012", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0029", + CardName = "daiyousei", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0073", + CardName = "junko", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0063", + CardName = "kisume", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_2007", + CardName = "item_2007", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0025", + CardName = "youmu", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0004", + CardName = "mugiyousei", + HasPortrait = false, + HasVoice = false, + Quality = 1 + }, + new + { + ItemCode = "item_0096", + CardName = "seiga", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0034", + CardName = "meirin", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_2011", + CardName = "item_2011", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2010", + CardName = "item_2010", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2008", + CardName = "item_2008", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0036", + CardName = "yukari", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0018", + CardName = "mystia", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_2009", + CardName = "item_2009", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0046", + CardName = "sanae", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2017", + CardName = "item_2017", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2005", + CardName = "item_2005", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0052", + CardName = "miko", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0023", + CardName = "reisen", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0049", + CardName = "minamitsu", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_2004", + CardName = "item_2004", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_2003", + CardName = "item_2003", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0056", + CardName = "star", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0006", + CardName = "hourainingyou", + HasPortrait = false, + HasVoice = false, + Quality = 1 + }, + new + { + ItemCode = "item_0057", + CardName = "sunny", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0095", + CardName = "futo", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2001", + CardName = "item_2001", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_1013", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0097", + CardName = "yoshika", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0027", + CardName = "utsuho", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0068", + CardName = "komachi", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0047", + CardName = "kanako", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0058", + CardName = "luna", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_2013", + CardName = "item_2013", + HasPortrait = false, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0024", + CardName = "yuyuko", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0093", + CardName = "kyouko", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0005", + CardName = "shanghainingyou", + HasPortrait = false, + HasVoice = false, + Quality = 1 + }, + new + { + ItemCode = "item_1006", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0064", + CardName = "shikieiki", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0092", + CardName = "medicine", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0017", + CardName = "iku", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0013", + CardName = "lunasa", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0091", + CardName = "hina", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_1004", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0040", + CardName = "mokou", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0088", + CardName = "sizuha", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_2012", + CardName = "item_2012", + HasPortrait = false, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0010", + CardName = "kogasa", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0062", + CardName = "inaba", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0001", + CardName = "lily", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_1005", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0060", + CardName = "wriggle", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0059", + CardName = "alice", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0054", + CardName = "yuugi", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0032", + CardName = "flandre", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0033", + CardName = "koakuma", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0041", + CardName = "kaguya", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0039", + CardName = "eirin", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0037", + CardName = "ran", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0035", + CardName = "yuuka", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0048", + CardName = "suwako", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0016", + CardName = "satori", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0053", + CardName = "kokoro", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0008", + CardName = "maidyousei", + HasPortrait = false, + HasVoice = false, + Quality = 1 + }, + new + { + ItemCode = "item_0012", + CardName = "lyrica", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0031", + CardName = "koishi", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0094", + CardName = "soga", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0021", + CardName = "patchouli", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0020", + CardName = "tenshi", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_1014", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 4 + }); + }); + + modelBuilder.Entity("TOOHUCardAPI.Data.Models.CardLevel", b => + { + b.Property("UserSteamId") + .HasColumnType("TEXT"); + + b.Property("CardItemCode") + .HasColumnType("TEXT"); + + b.Property("Level") + .HasColumnType("INTEGER"); + + b.HasKey("UserSteamId", "CardItemCode"); + + b.HasIndex("CardItemCode"); + + b.ToTable("CardLevel"); + }); + + modelBuilder.Entity("TOOHUCardAPI.Data.Models.EncodedCardGroup", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("INTEGER"); + + b.Property("EncodedString") + .HasColumnType("TEXT"); + + b.Property("GroupKey") + .HasColumnType("TEXT"); + + b.Property("UserSteamId") + .HasColumnType("TEXT"); + + b.HasKey("Id"); + + b.HasIndex("UserSteamId"); + + b.ToTable("EncodedCardGroup"); + }); + + modelBuilder.Entity("TOOHUCardAPI.Data.Models.User", b => + { + b.Property("SteamId") + .HasColumnType("TEXT"); + + b.Property("Ban") + .HasColumnType("INTEGER"); + + b.Property("EndTime") + .HasColumnType("TEXT"); + + b.Property("KeySaveDate") + .HasColumnType("TEXT"); + + b.Property("KeyTotal") + .HasColumnType("INTEGER"); + + b.Property("KeyUseCount") + .HasColumnType("INTEGER"); + + b.Property("LastFirstWin") + .HasColumnType("TEXT"); + + b.Property("MaxTeamWave") + .HasColumnType("INTEGER"); + + b.Property("MaxWave") + .HasColumnType("INTEGER"); + + b.Property("PetLevel") + .HasColumnType("INTEGER"); + + b.Property("Point") + .HasColumnType("INTEGER"); + + b.Property("Vip") + .HasColumnType("INTEGER"); + + b.HasKey("SteamId"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("TOOHUCardAPI.Data.Models.CardLevel", b => + { + b.HasOne("TOOHUCardAPI.Data.Models.Card", "Card") + .WithMany() + .HasForeignKey("CardItemCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("TOOHUCardAPI.Data.Models.User", null) + .WithMany("CardLevels") + .HasForeignKey("UserSteamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Card"); + }); + + modelBuilder.Entity("TOOHUCardAPI.Data.Models.EncodedCardGroup", b => + { + b.HasOne("TOOHUCardAPI.Data.Models.User", null) + .WithMany("EncodedCardGroups") + .HasForeignKey("UserSteamId"); + }); + + modelBuilder.Entity("TOOHUCardAPI.Data.Models.User", b => + { + b.Navigation("CardLevels"); + + b.Navigation("EncodedCardGroups"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/TOOHUCardAPI/Migrations/20211031004851_cardlevel.cs b/TOOHUCardAPI/Migrations/20211031004851_cardlevel.cs new file mode 100644 index 0000000..e37ca30 --- /dev/null +++ b/TOOHUCardAPI/Migrations/20211031004851_cardlevel.cs @@ -0,0 +1,56 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace TOOHUCardAPI.Migrations +{ + public partial class cardlevel : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "LevelList", + table: "Users"); + + migrationBuilder.CreateTable( + name: "CardLevel", + columns: table => new + { + UserSteamId = table.Column(type: "TEXT", nullable: false), + CardItemCode = table.Column(type: "TEXT", nullable: false), + Level = table.Column(type: "INTEGER", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CardLevel", x => new { x.UserSteamId, x.CardItemCode }); + table.ForeignKey( + name: "FK_CardLevel_Cards_CardItemCode", + column: x => x.CardItemCode, + principalTable: "Cards", + principalColumn: "ItemCode", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_CardLevel_Users_UserSteamId", + column: x => x.UserSteamId, + principalTable: "Users", + principalColumn: "SteamId", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_CardLevel_CardItemCode", + table: "CardLevel", + column: "CardItemCode"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "CardLevel"); + + migrationBuilder.AddColumn( + name: "LevelList", + table: "Users", + type: "TEXT", + nullable: true); + } + } +} diff --git a/TOOHUCardAPI/Migrations/AppDbContextModelSnapshot.cs b/TOOHUCardAPI/Migrations/AppDbContextModelSnapshot.cs index 1dd395b..a9a1572 100644 --- a/TOOHUCardAPI/Migrations/AppDbContextModelSnapshot.cs +++ b/TOOHUCardAPI/Migrations/AppDbContextModelSnapshot.cs @@ -16,6 +16,904 @@ namespace TOOHUCardAPI.Migrations modelBuilder .HasAnnotation("ProductVersion", "5.0.11"); + modelBuilder.Entity("TOOHUCardAPI.Data.Models.Card", b => + { + b.Property("ItemCode") + .HasColumnType("TEXT"); + + b.Property("CardName") + .HasColumnType("TEXT"); + + b.Property("HasPortrait") + .HasColumnType("INTEGER"); + + b.Property("HasVoice") + .HasColumnType("INTEGER"); + + b.Property("Quality") + .HasColumnType("INTEGER"); + + b.HasKey("ItemCode"); + + b.ToTable("Cards"); + + b.HasData( + new + { + ItemCode = "item_0026", + CardName = "rin", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0043", + CardName = "hatate", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0014", + CardName = "merlin", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0007", + CardName = "hanadayousei", + HasPortrait = false, + HasVoice = false, + Quality = 1 + }, + new + { + ItemCode = "item_2002", + CardName = "item_2002", + HasPortrait = false, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0055", + CardName = "suika", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0002", + CardName = "nazrin", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0061", + CardName = "keine", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0069", + CardName = "toramaru", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0042", + CardName = "aya", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_1011", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 1 + }, + new + { + ItemCode = "item_0015", + CardName = "rumia", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0030", + CardName = "remilia", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0028", + CardName = "reimu", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0045", + CardName = "kagerou", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0019", + CardName = "marisa", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0075", + CardName = "clownpiece", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0050", + CardName = "nue", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0044", + CardName = "momiji", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0011", + CardName = "letty", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_1003", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 1 + }, + new + { + ItemCode = "item_0022", + CardName = "sakuya", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0003", + CardName = "minoriko", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_2022", + CardName = "item_2022", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2020", + CardName = "item_2020", + HasPortrait = false, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_2016", + CardName = "item_2016", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2018", + CardName = "item_2018", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_2006", + CardName = "item_2006", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_2019", + CardName = "item_2019", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_2015", + CardName = "item_2015", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2014", + CardName = "item_2014", + HasPortrait = false, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0009", + CardName = "cirno", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0038", + CardName = "chen", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0074", + CardName = "hecatia", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0080", + CardName = "shinki", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0051", + CardName = "byakuren", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_1012", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0029", + CardName = "daiyousei", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0073", + CardName = "junko", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0063", + CardName = "kisume", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_2007", + CardName = "item_2007", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0025", + CardName = "youmu", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0004", + CardName = "mugiyousei", + HasPortrait = false, + HasVoice = false, + Quality = 1 + }, + new + { + ItemCode = "item_0096", + CardName = "seiga", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0034", + CardName = "meirin", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_2011", + CardName = "item_2011", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2010", + CardName = "item_2010", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2008", + CardName = "item_2008", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0036", + CardName = "yukari", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0018", + CardName = "mystia", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_2009", + CardName = "item_2009", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0046", + CardName = "sanae", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2017", + CardName = "item_2017", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2005", + CardName = "item_2005", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0052", + CardName = "miko", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0023", + CardName = "reisen", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0049", + CardName = "minamitsu", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_2004", + CardName = "item_2004", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_2003", + CardName = "item_2003", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0056", + CardName = "star", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0006", + CardName = "hourainingyou", + HasPortrait = false, + HasVoice = false, + Quality = 1 + }, + new + { + ItemCode = "item_0057", + CardName = "sunny", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0095", + CardName = "futo", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_2001", + CardName = "item_2001", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_1013", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0097", + CardName = "yoshika", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0027", + CardName = "utsuho", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0068", + CardName = "komachi", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0047", + CardName = "kanako", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0058", + CardName = "luna", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_2013", + CardName = "item_2013", + HasPortrait = false, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0024", + CardName = "yuyuko", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0093", + CardName = "kyouko", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0005", + CardName = "shanghainingyou", + HasPortrait = false, + HasVoice = false, + Quality = 1 + }, + new + { + ItemCode = "item_1006", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0064", + CardName = "shikieiki", + HasPortrait = true, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0092", + CardName = "medicine", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0017", + CardName = "iku", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0013", + CardName = "lunasa", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0091", + CardName = "hina", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_1004", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0040", + CardName = "mokou", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0088", + CardName = "sizuha", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_2012", + CardName = "item_2012", + HasPortrait = false, + HasVoice = false, + Quality = 4 + }, + new + { + ItemCode = "item_0010", + CardName = "kogasa", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0062", + CardName = "inaba", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0001", + CardName = "lily", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_1005", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0060", + CardName = "wriggle", + HasPortrait = true, + HasVoice = false, + Quality = 2 + }, + new + { + ItemCode = "item_0059", + CardName = "alice", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0054", + CardName = "yuugi", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0032", + CardName = "flandre", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0033", + CardName = "koakuma", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0041", + CardName = "kaguya", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0039", + CardName = "eirin", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0037", + CardName = "ran", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0035", + CardName = "yuuka", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0048", + CardName = "suwako", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_0016", + CardName = "satori", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0053", + CardName = "kokoro", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0008", + CardName = "maidyousei", + HasPortrait = false, + HasVoice = false, + Quality = 1 + }, + new + { + ItemCode = "item_0012", + CardName = "lyrica", + HasPortrait = true, + HasVoice = true, + Quality = 2 + }, + new + { + ItemCode = "item_0031", + CardName = "koishi", + HasPortrait = true, + HasVoice = true, + Quality = 4 + }, + new + { + ItemCode = "item_0094", + CardName = "soga", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0021", + CardName = "patchouli", + HasPortrait = true, + HasVoice = true, + Quality = 3 + }, + new + { + ItemCode = "item_0020", + CardName = "tenshi", + HasPortrait = true, + HasVoice = false, + Quality = 3 + }, + new + { + ItemCode = "item_1014", + CardName = "BonusEgg", + HasPortrait = false, + HasVoice = false, + Quality = 4 + }); + }); + + modelBuilder.Entity("TOOHUCardAPI.Data.Models.CardLevel", b => + { + b.Property("UserSteamId") + .HasColumnType("TEXT"); + + b.Property("CardItemCode") + .HasColumnType("TEXT"); + + b.Property("Level") + .HasColumnType("INTEGER"); + + b.HasKey("UserSteamId", "CardItemCode"); + + b.HasIndex("CardItemCode"); + + b.ToTable("CardLevel"); + }); + modelBuilder.Entity("TOOHUCardAPI.Data.Models.EncodedCardGroup", b => { b.Property("Id") @@ -61,9 +959,6 @@ namespace TOOHUCardAPI.Migrations b.Property("LastFirstWin") .HasColumnType("TEXT"); - b.Property("LevelList") - .HasColumnType("TEXT"); - b.Property("MaxTeamWave") .HasColumnType("INTEGER"); @@ -84,6 +979,23 @@ namespace TOOHUCardAPI.Migrations b.ToTable("Users"); }); + modelBuilder.Entity("TOOHUCardAPI.Data.Models.CardLevel", b => + { + b.HasOne("TOOHUCardAPI.Data.Models.Card", "Card") + .WithMany() + .HasForeignKey("CardItemCode") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("TOOHUCardAPI.Data.Models.User", null) + .WithMany("CardLevels") + .HasForeignKey("UserSteamId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Card"); + }); + modelBuilder.Entity("TOOHUCardAPI.Data.Models.EncodedCardGroup", b => { b.HasOne("TOOHUCardAPI.Data.Models.User", null) @@ -93,6 +1005,8 @@ namespace TOOHUCardAPI.Migrations modelBuilder.Entity("TOOHUCardAPI.Data.Models.User", b => { + b.Navigation("CardLevels"); + b.Navigation("EncodedCardGroups"); }); #pragma warning restore 612, 618 diff --git a/TOOHUCardAPI/Startup.cs b/TOOHUCardAPI/Startup.cs index 2986605..5cb10b4 100644 --- a/TOOHUCardAPI/Startup.cs +++ b/TOOHUCardAPI/Startup.cs @@ -38,6 +38,7 @@ namespace TOOHUCardAPI }); services.AddScoped(); services.AddScoped(); + services.AddScoped(); services.AddAutoMapper(typeof(AutomapProfile)); services.AddSwaggerGen(c => {