From aa6867022144c8e371e184179519a6eb8f4f3b5b Mon Sep 17 00:00:00 2001 From: littlefoot Date: Sun, 31 Oct 2021 02:57:30 -0400 Subject: [PATCH] Added support for savemaxpower --- .../Controllers/MethodBasedController.cs | 4 +- .../Controllers/PlayerBaseDataController.cs | 4 - .../Controllers/PlayerDataController.cs | 12 +- TOOHUCardAPI/DTO/CardEncodingUtil.cs | 5 + TOOHUCardAPI/DTO/GameConfigResponse.cs | 2 +- .../PlayerData/PlayerDataGetResponseObject.cs | 1 + .../PlayerDataSavePowerMaxTotalRequest.cs | 7 + TOOHUCardAPI/Data/Models/User.cs | 1 + TOOHUCardAPI/Data/Services/StoreService.cs | 8 + .../20211031065641_maxpower stuff.Designer.cs | 1020 +++++++++++++++++ .../20211031065641_maxpower stuff.cs | 24 + .../Migrations/AppDbContextModelSnapshot.cs | 3 + 12 files changed, 1080 insertions(+), 11 deletions(-) create mode 100644 TOOHUCardAPI/DTO/PlayerData/PlayerDataSavePowerMaxTotalRequest.cs create mode 100644 TOOHUCardAPI/Migrations/20211031065641_maxpower stuff.Designer.cs create mode 100644 TOOHUCardAPI/Migrations/20211031065641_maxpower stuff.cs diff --git a/TOOHUCardAPI/Controllers/MethodBasedController.cs b/TOOHUCardAPI/Controllers/MethodBasedController.cs index 8099666..6127d47 100644 --- a/TOOHUCardAPI/Controllers/MethodBasedController.cs +++ b/TOOHUCardAPI/Controllers/MethodBasedController.cs @@ -35,8 +35,8 @@ namespace TOOHUCardAPI.Controllers return Ok(e.response); } } - - protected Task InvokeEndpointHandlerForMethod(object _this, string method, string body) + + private Task InvokeEndpointHandlerForMethod(object _this, string method, string body) { MethodMap registeredEndpointHandlers = GetMethodMapForType(); if (registeredEndpointHandlers.ContainsKey(method)) diff --git a/TOOHUCardAPI/Controllers/PlayerBaseDataController.cs b/TOOHUCardAPI/Controllers/PlayerBaseDataController.cs index 280a7e5..44a442c 100644 --- a/TOOHUCardAPI/Controllers/PlayerBaseDataController.cs +++ b/TOOHUCardAPI/Controllers/PlayerBaseDataController.cs @@ -31,10 +31,6 @@ namespace TOOHUCardAPI.Controllers public async Task Get(string id) { User user = await _userRepository.GetUser(id); - if (user == null) - { - return BadRequest("Invalid user id specified"); - } return Ok(_mapper.Map(user)); } diff --git a/TOOHUCardAPI/Controllers/PlayerDataController.cs b/TOOHUCardAPI/Controllers/PlayerDataController.cs index 7872dce..87fa986 100644 --- a/TOOHUCardAPI/Controllers/PlayerDataController.cs +++ b/TOOHUCardAPI/Controllers/PlayerDataController.cs @@ -39,6 +39,14 @@ namespace TOOHUCardAPI.Controllers _storeService = storeService; } + private async Task SavePowerMax(string body) + { + PlayerDataSavePowerMaxTotalRequest request = + JsonConvert.DeserializeObject(body); + await _storeService.ChangePowerMaxTotal(request.SteamId, request.Op == "add" ? 1 : -1); + return Ok(new OkResponse()); + } + [EndpointHandler("save_card_level")] private async Task SaveCardLevel(string body) { @@ -97,10 +105,6 @@ namespace TOOHUCardAPI.Controllers PlayerDataSaveCardGroupRequest request = JsonConvert.DeserializeObject(body); User user = await _userRepository.GetUser(request.SteamId); - if (user == null) - { - throw new InvalidUserException(); - } EncodedCardGroup group = user.EncodedCardGroups.FirstOrDefault(group => group.GroupKey == request.GroupKey) ?? new EncodedCardGroup() { diff --git a/TOOHUCardAPI/DTO/CardEncodingUtil.cs b/TOOHUCardAPI/DTO/CardEncodingUtil.cs index 82caac4..5d7149f 100644 --- a/TOOHUCardAPI/DTO/CardEncodingUtil.cs +++ b/TOOHUCardAPI/DTO/CardEncodingUtil.cs @@ -1,3 +1,4 @@ +using System; using System.Collections; using System.Collections.Generic; using System.Linq; @@ -10,6 +11,10 @@ namespace TOOHUCardAPI.DTO { public static string EncodeLevelList(this IEnumerable cardLevels) { + if (cardLevels == null) + { + return string.Empty; + } return cardLevels.Select(cl => $"{cl.CardItemCode.Substring(6)}{cl.Level}").Aggregate(new StringBuilder(), (ret, current) => { diff --git a/TOOHUCardAPI/DTO/GameConfigResponse.cs b/TOOHUCardAPI/DTO/GameConfigResponse.cs index 1197dcc..232c092 100644 --- a/TOOHUCardAPI/DTO/GameConfigResponse.cs +++ b/TOOHUCardAPI/DTO/GameConfigResponse.cs @@ -28,7 +28,7 @@ namespace TOOHUCardAPI.DTO [JsonProperty("luck_crit")] public float LuckCrit { get; set; } [JsonProperty("new_card_list")] public string NewCardList { get; set; } = string.Empty; [JsonProperty("open_day_list")] public string OpenDayList { get; set; } = string.Empty; - [JsonProperty("is_open_day")] public int IsOpenDay { get; set; } + [JsonProperty("is_open_day")] public int IsOpenDay { get; set; } = 1; [JsonProperty("server_time")] public string ServerTime { get; set; } = string.Empty; } diff --git a/TOOHUCardAPI/DTO/PlayerData/PlayerDataGetResponseObject.cs b/TOOHUCardAPI/DTO/PlayerData/PlayerDataGetResponseObject.cs index 935ef05..ea3464f 100644 --- a/TOOHUCardAPI/DTO/PlayerData/PlayerDataGetResponseObject.cs +++ b/TOOHUCardAPI/DTO/PlayerData/PlayerDataGetResponseObject.cs @@ -34,6 +34,7 @@ namespace TOOHUCardAPI.DTO.PlayerData [JsonProperty("level_list")] public string LevelList { get; set; } = string.Empty; [JsonProperty("is_first_win")]public int IsFirstWin { get; set; } [JsonProperty("key_use_count")] public int KeyUseCount { get; set; } + [JsonProperty("power_max_total")] public int PowerMaxTotal { get; set; } public Dictionary ToDynamicProperties() { diff --git a/TOOHUCardAPI/DTO/PlayerData/PlayerDataSavePowerMaxTotalRequest.cs b/TOOHUCardAPI/DTO/PlayerData/PlayerDataSavePowerMaxTotalRequest.cs new file mode 100644 index 0000000..f739164 --- /dev/null +++ b/TOOHUCardAPI/DTO/PlayerData/PlayerDataSavePowerMaxTotalRequest.cs @@ -0,0 +1,7 @@ +namespace TOOHUCardAPI.DTO.PlayerData +{ + public class PlayerDataSavePowerMaxTotalRequest : AbstractPlayerTargetedRequest + { + public string Op { get; set; } + } +} \ No newline at end of file diff --git a/TOOHUCardAPI/Data/Models/User.cs b/TOOHUCardAPI/Data/Models/User.cs index d14d399..5da2859 100644 --- a/TOOHUCardAPI/Data/Models/User.cs +++ b/TOOHUCardAPI/Data/Models/User.cs @@ -19,6 +19,7 @@ namespace TOOHUCardAPI.Data.Models public bool Ban { get; set; } public int Point { get; set; } public DateTime LastFirstWin { get; set; } + public int PowerMaxTotal { get; set; } public List EncodedCardGroups { get; set; } public List CardLevels { get; set; } } diff --git a/TOOHUCardAPI/Data/Services/StoreService.cs b/TOOHUCardAPI/Data/Services/StoreService.cs index 87c089c..15f7913 100644 --- a/TOOHUCardAPI/Data/Services/StoreService.cs +++ b/TOOHUCardAPI/Data/Services/StoreService.cs @@ -29,6 +29,14 @@ namespace TOOHUCardAPI.Data.Services _logger.LogInformation($"User with steamid {user.SteamId} was given {points} points. New total: {user.Point}"); } + public async Task ChangePowerMaxTotal(string steamId, int amt) + { + User user = await _userRepository.GetUser(steamId); + user.PowerMaxTotal = Math.Clamp(user.PowerMaxTotal + amt, 0, int.MaxValue); + await _userRepository.UpdateUser(user); + return user.PowerMaxTotal; + } + public async Task LevelUpCard(string steamId, string itemName, int levelIncrease) { User user = await _userRepository.GetUser(steamId); diff --git a/TOOHUCardAPI/Migrations/20211031065641_maxpower stuff.Designer.cs b/TOOHUCardAPI/Migrations/20211031065641_maxpower stuff.Designer.cs new file mode 100644 index 0000000..1df5c20 --- /dev/null +++ b/TOOHUCardAPI/Migrations/20211031065641_maxpower stuff.Designer.cs @@ -0,0 +1,1020 @@ +// +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("20211031065641_maxpower stuff")] + partial class maxpowerstuff + { + 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("PowerMaxTotal") + .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/20211031065641_maxpower stuff.cs b/TOOHUCardAPI/Migrations/20211031065641_maxpower stuff.cs new file mode 100644 index 0000000..cfaa40a --- /dev/null +++ b/TOOHUCardAPI/Migrations/20211031065641_maxpower stuff.cs @@ -0,0 +1,24 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace TOOHUCardAPI.Migrations +{ + public partial class maxpowerstuff : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "PowerMaxTotal", + table: "Users", + type: "INTEGER", + nullable: false, + defaultValue: 0); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "PowerMaxTotal", + table: "Users"); + } + } +} diff --git a/TOOHUCardAPI/Migrations/AppDbContextModelSnapshot.cs b/TOOHUCardAPI/Migrations/AppDbContextModelSnapshot.cs index a9a1572..73506ae 100644 --- a/TOOHUCardAPI/Migrations/AppDbContextModelSnapshot.cs +++ b/TOOHUCardAPI/Migrations/AppDbContextModelSnapshot.cs @@ -971,6 +971,9 @@ namespace TOOHUCardAPI.Migrations b.Property("Point") .HasColumnType("INTEGER"); + b.Property("PowerMaxTotal") + .HasColumnType("INTEGER"); + b.Property("Vip") .HasColumnType("INTEGER");