Testing more garbage encryption
This commit is contained in:
12
SVSim.Database/Enums/SocialAccountType.cs
Normal file
12
SVSim.Database/Enums/SocialAccountType.cs
Normal file
@@ -0,0 +1,12 @@
|
||||
namespace SVSim.Database.Enums;
|
||||
|
||||
public enum SocialAccountType
|
||||
{
|
||||
None,
|
||||
GooglePlay,
|
||||
GameCenter,
|
||||
Facebook,
|
||||
Dmm,
|
||||
Steam,
|
||||
AppleId
|
||||
}
|
||||
171
SVSim.Database/Migrations/20240907191709_Initial.Designer.cs
generated
Normal file
171
SVSim.Database/Migrations/20240907191709_Initial.Designer.cs
generated
Normal file
@@ -0,0 +1,171 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using SVSim.Database;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SVSim.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(SVSimDbContext))]
|
||||
[Migration("20240907191709_Initial")]
|
||||
partial class Initial
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.8");
|
||||
|
||||
modelBuilder.Entity("DCGEngine.Database.Models.CardEntry", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("Attack")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime?>("DateCreated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("DateUpdated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int?>("Defense")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
.IsRequired()
|
||||
.HasMaxLength(21)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("InternalName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int?>("PrimaryResourceCost")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<long?>("ShadowverseDeckEntryId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ShadowverseDeckEntryId");
|
||||
|
||||
b.ToTable("CardEntry");
|
||||
|
||||
b.HasDiscriminator().HasValue("CardEntry");
|
||||
|
||||
b.UseTphMappingStrategy();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.ShadowverseDeckEntry", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime?>("DateCreated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("DateUpdated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("InternalName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ShadowverseDeckEntry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.SocialAccountConnection", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<ulong>("AccountId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("AccountType")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime?>("DateCreated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("DateUpdated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<ulong>("ViewerId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ViewerId");
|
||||
|
||||
b.ToTable("SocialAccountConnection");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.Viewer", b =>
|
||||
{
|
||||
b.Property<ulong>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime?>("DateCreated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("DateUpdated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("DisplayName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<ulong>("ShortUdid")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Viewer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.ShadowverseCardEntry", b =>
|
||||
{
|
||||
b.HasBaseType("DCGEngine.Database.Models.CardEntry");
|
||||
|
||||
b.HasDiscriminator().HasValue("ShadowverseCardEntry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DCGEngine.Database.Models.CardEntry", b =>
|
||||
{
|
||||
b.HasOne("SVSim.Database.Models.ShadowverseDeckEntry", null)
|
||||
.WithMany("Cards")
|
||||
.HasForeignKey("ShadowverseDeckEntryId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.SocialAccountConnection", b =>
|
||||
{
|
||||
b.HasOne("SVSim.Database.Models.Viewer", "Viewer")
|
||||
.WithMany()
|
||||
.HasForeignKey("ViewerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Viewer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.ShadowverseDeckEntry", b =>
|
||||
{
|
||||
b.Navigation("Cards");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
118
SVSim.Database/Migrations/20240907191709_Initial.cs
Normal file
118
SVSim.Database/Migrations/20240907191709_Initial.cs
Normal file
@@ -0,0 +1,118 @@
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore.Migrations;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SVSim.Database.Migrations
|
||||
{
|
||||
/// <inheritdoc />
|
||||
public partial class Initial : Migration
|
||||
{
|
||||
/// <inheritdoc />
|
||||
protected override void Up(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.CreateTable(
|
||||
name: "ShadowverseDeckEntry",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
DateCreated = table.Column<DateTime>(type: "TEXT", nullable: true),
|
||||
DateUpdated = table.Column<DateTime>(type: "TEXT", nullable: true),
|
||||
InternalName = table.Column<string>(type: "TEXT", nullable: false)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_ShadowverseDeckEntry", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "Viewer",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<ulong>(type: "INTEGER", nullable: false)
|
||||
.Annotation("Sqlite:Autoincrement", true),
|
||||
DisplayName = table.Column<string>(type: "TEXT", nullable: false),
|
||||
ShortUdid = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||
DateCreated = table.Column<DateTime>(type: "TEXT", nullable: true),
|
||||
DateUpdated = table.Column<DateTime>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_Viewer", x => x.Id);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "CardEntry",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<long>(type: "INTEGER", nullable: false),
|
||||
InternalName = table.Column<string>(type: "TEXT", nullable: false),
|
||||
Attack = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
Defense = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
PrimaryResourceCost = table.Column<int>(type: "INTEGER", nullable: true),
|
||||
Discriminator = table.Column<string>(type: "TEXT", maxLength: 21, nullable: false),
|
||||
ShadowverseDeckEntryId = table.Column<long>(type: "INTEGER", nullable: true),
|
||||
DateCreated = table.Column<DateTime>(type: "TEXT", nullable: true),
|
||||
DateUpdated = table.Column<DateTime>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_CardEntry", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_CardEntry_ShadowverseDeckEntry_ShadowverseDeckEntryId",
|
||||
column: x => x.ShadowverseDeckEntryId,
|
||||
principalTable: "ShadowverseDeckEntry",
|
||||
principalColumn: "Id");
|
||||
});
|
||||
|
||||
migrationBuilder.CreateTable(
|
||||
name: "SocialAccountConnection",
|
||||
columns: table => new
|
||||
{
|
||||
Id = table.Column<Guid>(type: "TEXT", nullable: false),
|
||||
AccountType = table.Column<int>(type: "INTEGER", nullable: false),
|
||||
AccountId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||
ViewerId = table.Column<ulong>(type: "INTEGER", nullable: false),
|
||||
DateCreated = table.Column<DateTime>(type: "TEXT", nullable: true),
|
||||
DateUpdated = table.Column<DateTime>(type: "TEXT", nullable: true)
|
||||
},
|
||||
constraints: table =>
|
||||
{
|
||||
table.PrimaryKey("PK_SocialAccountConnection", x => x.Id);
|
||||
table.ForeignKey(
|
||||
name: "FK_SocialAccountConnection_Viewer_ViewerId",
|
||||
column: x => x.ViewerId,
|
||||
principalTable: "Viewer",
|
||||
principalColumn: "Id",
|
||||
onDelete: ReferentialAction.Cascade);
|
||||
});
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_CardEntry_ShadowverseDeckEntryId",
|
||||
table: "CardEntry",
|
||||
column: "ShadowverseDeckEntryId");
|
||||
|
||||
migrationBuilder.CreateIndex(
|
||||
name: "IX_SocialAccountConnection_ViewerId",
|
||||
table: "SocialAccountConnection",
|
||||
column: "ViewerId");
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void Down(MigrationBuilder migrationBuilder)
|
||||
{
|
||||
migrationBuilder.DropTable(
|
||||
name: "CardEntry");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "SocialAccountConnection");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "ShadowverseDeckEntry");
|
||||
|
||||
migrationBuilder.DropTable(
|
||||
name: "Viewer");
|
||||
}
|
||||
}
|
||||
}
|
||||
168
SVSim.Database/Migrations/SVSimDbContextModelSnapshot.cs
Normal file
168
SVSim.Database/Migrations/SVSimDbContextModelSnapshot.cs
Normal file
@@ -0,0 +1,168 @@
|
||||
// <auto-generated />
|
||||
using System;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Infrastructure;
|
||||
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
|
||||
using SVSim.Database;
|
||||
|
||||
#nullable disable
|
||||
|
||||
namespace SVSim.Database.Migrations
|
||||
{
|
||||
[DbContext(typeof(SVSimDbContext))]
|
||||
partial class SVSimDbContextModelSnapshot : ModelSnapshot
|
||||
{
|
||||
protected override void BuildModel(ModelBuilder modelBuilder)
|
||||
{
|
||||
#pragma warning disable 612, 618
|
||||
modelBuilder.HasAnnotation("ProductVersion", "8.0.8");
|
||||
|
||||
modelBuilder.Entity("DCGEngine.Database.Models.CardEntry", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int?>("Attack")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime?>("DateCreated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("DateUpdated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int?>("Defense")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<string>("Discriminator")
|
||||
.IsRequired()
|
||||
.HasMaxLength(21)
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("InternalName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<int?>("PrimaryResourceCost")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<long?>("ShadowverseDeckEntryId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ShadowverseDeckEntryId");
|
||||
|
||||
b.ToTable("CardEntry");
|
||||
|
||||
b.HasDiscriminator().HasValue("CardEntry");
|
||||
|
||||
b.UseTphMappingStrategy();
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.ShadowverseDeckEntry", b =>
|
||||
{
|
||||
b.Property<long>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime?>("DateCreated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("DateUpdated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("InternalName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("ShadowverseDeckEntry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.SocialAccountConnection", b =>
|
||||
{
|
||||
b.Property<Guid>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<ulong>("AccountId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<int>("AccountType")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime?>("DateCreated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("DateUpdated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<ulong>("ViewerId")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.HasIndex("ViewerId");
|
||||
|
||||
b.ToTable("SocialAccountConnection");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.Viewer", b =>
|
||||
{
|
||||
b.Property<ulong>("Id")
|
||||
.ValueGeneratedOnAdd()
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.Property<DateTime?>("DateCreated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<DateTime?>("DateUpdated")
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<string>("DisplayName")
|
||||
.IsRequired()
|
||||
.HasColumnType("TEXT");
|
||||
|
||||
b.Property<ulong>("ShortUdid")
|
||||
.HasColumnType("INTEGER");
|
||||
|
||||
b.HasKey("Id");
|
||||
|
||||
b.ToTable("Viewer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.ShadowverseCardEntry", b =>
|
||||
{
|
||||
b.HasBaseType("DCGEngine.Database.Models.CardEntry");
|
||||
|
||||
b.HasDiscriminator().HasValue("ShadowverseCardEntry");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("DCGEngine.Database.Models.CardEntry", b =>
|
||||
{
|
||||
b.HasOne("SVSim.Database.Models.ShadowverseDeckEntry", null)
|
||||
.WithMany("Cards")
|
||||
.HasForeignKey("ShadowverseDeckEntryId");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.SocialAccountConnection", b =>
|
||||
{
|
||||
b.HasOne("SVSim.Database.Models.Viewer", "Viewer")
|
||||
.WithMany()
|
||||
.HasForeignKey("ViewerId")
|
||||
.OnDelete(DeleteBehavior.Cascade)
|
||||
.IsRequired();
|
||||
|
||||
b.Navigation("Viewer");
|
||||
});
|
||||
|
||||
modelBuilder.Entity("SVSim.Database.Models.ShadowverseDeckEntry", b =>
|
||||
{
|
||||
b.Navigation("Cards");
|
||||
});
|
||||
#pragma warning restore 612, 618
|
||||
}
|
||||
}
|
||||
}
|
||||
25
SVSim.Database/Models/SocialAccountConnection.cs
Normal file
25
SVSim.Database/Models/SocialAccountConnection.cs
Normal file
@@ -0,0 +1,25 @@
|
||||
using DCGEngine.Database.Models;
|
||||
using SVSim.Database.Enums;
|
||||
|
||||
namespace SVSim.Database.Models;
|
||||
|
||||
/// <summary>
|
||||
/// A connection between a social account (ie facebook) and a viewer.
|
||||
/// </summary>
|
||||
public class SocialAccountConnection : BaseEntity<Guid>
|
||||
{
|
||||
/// <summary>
|
||||
/// The type of the social account.
|
||||
/// </summary>
|
||||
public SocialAccountType AccountType { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The identifier of the social account.
|
||||
/// </summary>
|
||||
public ulong AccountId { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// The viewer connected.
|
||||
/// </summary>
|
||||
public Viewer Viewer { get; set; }
|
||||
}
|
||||
@@ -1,15 +0,0 @@
|
||||
using DCGEngine.Database.Models;
|
||||
|
||||
namespace SVSim.Database.Models;
|
||||
|
||||
/// <summary>
|
||||
/// A user within the game system.
|
||||
/// </summary>
|
||||
public class User : BaseEntity<long>
|
||||
{
|
||||
public string ViewerId { get; set; }
|
||||
public ulong SteamId { get; set; }
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
|
||||
}
|
||||
19
SVSim.Database/Models/Viewer.cs
Normal file
19
SVSim.Database/Models/Viewer.cs
Normal file
@@ -0,0 +1,19 @@
|
||||
using DCGEngine.Database.Models;
|
||||
|
||||
namespace SVSim.Database.Models;
|
||||
|
||||
/// <summary>
|
||||
/// A user within the game system.
|
||||
/// </summary>
|
||||
public class Viewer : BaseEntity<ulong>
|
||||
{
|
||||
/// <summary>
|
||||
/// This user's name displayed in game.
|
||||
/// </summary>
|
||||
public string DisplayName { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// This user's short identifier.
|
||||
/// </summary>
|
||||
public ulong ShortUdid { get; set; }
|
||||
}
|
||||
8
SVSim.Database/Repositories/Viewer/IViewerRepository.cs
Normal file
8
SVSim.Database/Repositories/Viewer/IViewerRepository.cs
Normal file
@@ -0,0 +1,8 @@
|
||||
using SVSim.Database.Enums;
|
||||
|
||||
namespace SVSim.Database.Repositories.Viewer;
|
||||
|
||||
public interface IViewerRepository
|
||||
{
|
||||
Task<Models.Viewer?> GetViewerBySocialConnection(SocialAccountType accountType, ulong socialId);
|
||||
}
|
||||
24
SVSim.Database/Repositories/Viewer/ViewerRepository.cs
Normal file
24
SVSim.Database/Repositories/Viewer/ViewerRepository.cs
Normal file
@@ -0,0 +1,24 @@
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using SVSim.Database.Enums;
|
||||
using SVSim.Database.Models;
|
||||
|
||||
namespace SVSim.Database.Repositories.Viewer;
|
||||
|
||||
public class ViewerRepository : IViewerRepository
|
||||
{
|
||||
protected readonly SVSimDbContext _dbContext;
|
||||
|
||||
public ViewerRepository(SVSimDbContext dbContext)
|
||||
{
|
||||
_dbContext = dbContext;
|
||||
}
|
||||
|
||||
public async Task<Models.Viewer?> GetViewerBySocialConnection(SocialAccountType accountType, ulong socialId)
|
||||
{
|
||||
return _dbContext.Set<SocialAccountConnection>()
|
||||
.AsNoTracking()
|
||||
.Include(sac => sac.Viewer)
|
||||
.FirstOrDefault(sac => sac.AccountType == accountType && sac.AccountId == socialId)
|
||||
?.Viewer;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user