Now supports saving card groups, this is probably the ugliest code ive ever written but anything to avoid 20 cardgroup properties. we should see if there's a better way, it could probably be a lot cleaner

This commit is contained in:
2021-10-29 00:46:00 -04:00
parent ee4304d729
commit 3051b63e44
14 changed files with 393 additions and 32 deletions

View File

@@ -0,0 +1,97 @@
// <auto-generated />
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("20211029035809_groupid for encoded card group")]
partial class groupidforencodedcardgroup
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "5.0.11");
modelBuilder.Entity("TOOHUCardAPI.Data.Models.EncodedCardGroup", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<int>("CardGroupNumber")
.HasColumnType("INTEGER");
b.Property<string>("EncodedString")
.HasColumnType("TEXT");
b.Property<string>("UserSteamId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserSteamId");
b.ToTable("EncodedCardGroup");
});
modelBuilder.Entity("TOOHUCardAPI.Data.Models.User", b =>
{
b.Property<string>("SteamId")
.HasColumnType("TEXT");
b.Property<bool>("Ban")
.HasColumnType("INTEGER");
b.Property<DateTime>("EndTime")
.HasColumnType("TEXT");
b.Property<DateTime>("KeySaveDate")
.HasColumnType("TEXT");
b.Property<int>("KeyTotal")
.HasColumnType("INTEGER");
b.Property<string>("LevelList")
.HasColumnType("TEXT");
b.Property<int>("MaxTeamWave")
.HasColumnType("INTEGER");
b.Property<int>("MaxWave")
.HasColumnType("INTEGER");
b.Property<int>("PetLevel")
.HasColumnType("INTEGER");
b.Property<int>("Point")
.HasColumnType("INTEGER");
b.Property<bool>("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
}
}
}

View File

@@ -0,0 +1,35 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace TOOHUCardAPI.Migrations
{
public partial class groupidforencodedcardgroup : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<bool>(
name: "Ban",
table: "Users",
type: "INTEGER",
nullable: false,
defaultValue: false);
migrationBuilder.AddColumn<int>(
name: "CardGroupNumber",
table: "EncodedCardGroup",
type: "INTEGER",
nullable: false,
defaultValue: 0);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Ban",
table: "Users");
migrationBuilder.DropColumn(
name: "CardGroupNumber",
table: "EncodedCardGroup");
}
}
}

View File

@@ -0,0 +1,97 @@
// <auto-generated />
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("20211029043842_fix groupkey, they send full string")]
partial class fixgroupkeytheysendfullstring
{
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder
.HasAnnotation("ProductVersion", "5.0.11");
modelBuilder.Entity("TOOHUCardAPI.Data.Models.EncodedCardGroup", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("EncodedString")
.HasColumnType("TEXT");
b.Property<string>("GroupKey")
.HasColumnType("TEXT");
b.Property<string>("UserSteamId")
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserSteamId");
b.ToTable("EncodedCardGroup");
});
modelBuilder.Entity("TOOHUCardAPI.Data.Models.User", b =>
{
b.Property<string>("SteamId")
.HasColumnType("TEXT");
b.Property<bool>("Ban")
.HasColumnType("INTEGER");
b.Property<DateTime>("EndTime")
.HasColumnType("TEXT");
b.Property<DateTime>("KeySaveDate")
.HasColumnType("TEXT");
b.Property<int>("KeyTotal")
.HasColumnType("INTEGER");
b.Property<string>("LevelList")
.HasColumnType("TEXT");
b.Property<int>("MaxTeamWave")
.HasColumnType("INTEGER");
b.Property<int>("MaxWave")
.HasColumnType("INTEGER");
b.Property<int>("PetLevel")
.HasColumnType("INTEGER");
b.Property<int>("Point")
.HasColumnType("INTEGER");
b.Property<bool>("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
}
}
}

View File

@@ -0,0 +1,34 @@
using Microsoft.EntityFrameworkCore.Migrations;
namespace TOOHUCardAPI.Migrations
{
public partial class fixgroupkeytheysendfullstring : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "CardGroupNumber",
table: "EncodedCardGroup");
migrationBuilder.AddColumn<string>(
name: "GroupKey",
table: "EncodedCardGroup",
type: "TEXT",
nullable: true);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "GroupKey",
table: "EncodedCardGroup");
migrationBuilder.AddColumn<int>(
name: "CardGroupNumber",
table: "EncodedCardGroup",
type: "INTEGER",
nullable: false,
defaultValue: 0);
}
}
}

View File

@@ -25,6 +25,9 @@ namespace TOOHUCardAPI.Migrations
b.Property<string>("EncodedString")
.HasColumnType("TEXT");
b.Property<string>("GroupKey")
.HasColumnType("TEXT");
b.Property<string>("UserSteamId")
.HasColumnType("TEXT");
@@ -40,6 +43,9 @@ namespace TOOHUCardAPI.Migrations
b.Property<string>("SteamId")
.HasColumnType("TEXT");
b.Property<bool>("Ban")
.HasColumnType("INTEGER");
b.Property<DateTime>("EndTime")
.HasColumnType("TEXT");