Adds the server-side theme repository and reworks the web theme engine onto it

This commit is contained in:
BinaryAlley committed 2026-08-19 22:50:07 -07:00
1 parent 85928f7c3c
commit bf8faba24d
136 files changed
+6942 -1197

No files matched your search

@@ -0,0 +1,100 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.Themes;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata.Builders;
using System;
#endregion
namespace Lumina.DataAccess.Common.Configuration;
/// <summary>
/// Configures the entity mapping for the <see cref="ThemeEntity"/> entity.
/// </summary>
public class ThemeConfiguration : IEntityTypeConfiguration<ThemeEntity>
{
/// <summary>
/// Configures the <see cref="ThemeEntity"/> entity.
/// </summary>
/// <param name="builder">The builder to be used to configure the entity.</param>
public void Configure(EntityTypeBuilder<ThemeEntity> builder)
{
builder.ToTable("Themes");
builder.HasKey(theme => theme.Id);
builder.Property(theme => theme.Id)
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the install, we need to tell EF not to generate it
.HasColumnOrder(0);
// the manifest id is the business key used by the clients, so it must be unique
builder.HasIndex(theme => theme.ThemeId)
.IsUnique();
builder.Property(theme => theme.ThemeId)
.IsRequired()
.HasMaxLength(64)
.HasColumnOrder(1);
builder.Property(theme => theme.Name)
.IsRequired()
.HasMaxLength(80)
.HasColumnOrder(2);
builder.Property(theme => theme.Description)
.IsRequired()
.HasMaxLength(300)
.HasColumnOrder(3);
builder.Property(theme => theme.Author)
.IsRequired()
.HasMaxLength(80)
.HasColumnOrder(4);
builder.Property(theme => theme.Version)
.IsRequired()
.HasMaxLength(40)
.HasColumnOrder(5);
builder.Property(theme => theme.PreviewPath)
.HasMaxLength(240)
.HasDefaultValue(null)
.HasColumnOrder(6);
builder.Property(theme => theme.InstallSource)
.IsRequired()
.HasConversion<string>()
.HasColumnOrder(7);
// at most one theme can be current: the filtered unique index guarantees it at the database level, since every row that is not current has a null value here, and nulls are allowed to repeat
builder.HasIndex(theme => theme.IsCurrent)
.IsUnique()
.HasFilter("IsCurrent = 1");
builder.Property(theme => theme.IsCurrent)
.HasDefaultValue(null)
.HasColumnOrder(8);
builder.Property(theme => theme.IsDeleted)
.HasDefaultValue(false)
.HasColumnOrder(9);
builder.Property(theme => theme.InstalledAtUtc)
.IsRequired()
.HasColumnOrder(10);
// audit
builder.Property(theme => theme.CreatedOnUtc)
.IsRequired()
.HasColumnOrder(11);
builder.Property(theme => theme.CreatedBy)
.IsRequired()
.HasColumnOrder(12);
builder.Property(theme => theme.UpdatedOnUtc)
.HasDefaultValue(null)
.HasColumnOrder(13);
builder.Property(theme => theme.UpdatedBy)
.HasDefaultValue(null)
.HasColumnOrder(14);
}
}
File diff suppressed because it is too large. Load diff
@@ -0,0 +1,60 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Lumina.DataAccess.Common.Migrations
{
/// <inheritdoc />
public partial class AddsThemesTable : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Themes",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
ThemeId = table.Column<string>(type: "TEXT", maxLength: 64, nullable: false),
Name = table.Column<string>(type: "TEXT", maxLength: 80, nullable: false),
Description = table.Column<string>(type: "TEXT", maxLength: 300, nullable: false),
Author = table.Column<string>(type: "TEXT", maxLength: 80, nullable: false),
Version = table.Column<string>(type: "TEXT", maxLength: 40, nullable: false),
PreviewPath = table.Column<string>(type: "TEXT", maxLength: 240, nullable: true),
InstallSource = table.Column<string>(type: "TEXT", nullable: false),
IsCurrent = table.Column<bool>(type: "INTEGER", nullable: true),
IsDeleted = table.Column<bool>(type: "INTEGER", nullable: false, defaultValue: false),
InstalledAtUtc = table.Column<DateTime>(type: "TEXT", nullable: false),
CreatedOnUtc = table.Column<DateTime>(type: "TEXT", nullable: false),
CreatedBy = table.Column<Guid>(type: "TEXT", nullable: false),
UpdatedOnUtc = table.Column<DateTime>(type: "TEXT", nullable: true),
UpdatedBy = table.Column<Guid>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_Themes", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_Themes_IsCurrent",
table: "Themes",
column: "IsCurrent",
unique: true,
filter: "IsCurrent = 1");
migrationBuilder.CreateIndex(
name: "IX_Themes_ThemeId",
table: "Themes",
column: "ThemeId",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "Themes");
}
}
}
@@ -15,7 +15,7 @@ namespace Lumina.DataAccess.Common.Migrations
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.0");
modelBuilder.HasAnnotation("ProductVersion", "10.0.11");
modelBuilder.Entity("BookGenres", b =>
{
@@ -809,6 +809,94 @@ namespace Lumina.DataAccess.Common.Migrations
b.ToTable("Plugins", (string)null);
});
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Themes.ThemeEntity", b =>
{
b.Property<Guid>("Id")
.HasColumnType("TEXT")
.HasColumnOrder(0);
b.Property<string>("Author")
.IsRequired()
.HasMaxLength(80)
.HasColumnType("TEXT")
.HasColumnOrder(4);
b.Property<Guid>("CreatedBy")
.HasColumnType("TEXT")
.HasColumnOrder(12);
b.Property<DateTime>("CreatedOnUtc")
.HasColumnType("TEXT")
.HasColumnOrder(11);
b.Property<string>("Description")
.IsRequired()
.HasMaxLength(300)
.HasColumnType("TEXT")
.HasColumnOrder(3);
b.Property<string>("InstallSource")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnOrder(7);
b.Property<DateTime>("InstalledAtUtc")
.HasColumnType("TEXT")
.HasColumnOrder(10);
b.Property<bool?>("IsCurrent")
.HasColumnType("INTEGER")
.HasColumnOrder(8);
b.Property<bool>("IsDeleted")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER")
.HasDefaultValue(false)
.HasColumnOrder(9);
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(80)
.HasColumnType("TEXT")
.HasColumnOrder(2);
b.Property<string>("PreviewPath")
.HasMaxLength(240)
.HasColumnType("TEXT")
.HasColumnOrder(6);
b.Property<string>("ThemeId")
.IsRequired()
.HasMaxLength(64)
.HasColumnType("TEXT")
.HasColumnOrder(1);
b.Property<Guid?>("UpdatedBy")
.HasColumnType("TEXT")
.HasColumnOrder(14);
b.Property<DateTime?>("UpdatedOnUtc")
.HasColumnType("TEXT")
.HasColumnOrder(13);
b.Property<string>("Version")
.IsRequired()
.HasMaxLength(40)
.HasColumnType("TEXT")
.HasColumnOrder(5);
b.HasKey("Id");
b.HasIndex("IsCurrent")
.IsUnique()
.HasFilter("IsCurrent = 1");
b.HasIndex("ThemeId")
.IsUnique();
b.ToTable("Themes", (string)null);
});
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.UsersManagement.UserEntity", b =>
{
b.Property<Guid>("Id")