Stores scheduler page display preferences per user

This commit is contained in:
BinaryAlley committed 2026-09-03 14:06:01 -07:00
1 parent ab8ab51397
commit 237be9e2c8
50 files changed
+3144 -60

No files matched your search

@@ -0,0 +1,65 @@
#region ========================================================================= USING =====================================================================================
using Lumina.Application.Common.DataAccess.Entities.Scheduling;
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="SchedulerDisplayPreferencesEntity"/> entity.
/// </summary>
public class SchedulerDisplayPreferencesConfiguration : IEntityTypeConfiguration<SchedulerDisplayPreferencesEntity>
{
/// <summary>
/// Configures the <see cref="SchedulerDisplayPreferencesEntity"/> entity.
/// </summary>
/// <param name="builder">The builder to be used to configure the entity.</param>
public void Configure(EntityTypeBuilder<SchedulerDisplayPreferencesEntity> builder)
{
builder.ToTable("SchedulerDisplayPreferences");
builder.HasKey(preferences => preferences.Id);
builder.Property(preferences => preferences.Id)
.ValueGeneratedNever() // because EF always tries to generate the value for the Id, and because we generate it as part of the aggregate root, we need to tell EF not to generate it
.HasColumnOrder(0);
builder.Property(preferences => preferences.UserId)
.IsRequired()
.HasColumnOrder(1);
builder.Property(preferences => preferences.JobTypeFilter)
.HasConversion<string>()
.HasColumnOrder(2);
builder.Property(preferences => preferences.DisplayTimeSpan)
.IsRequired()
.HasColumnOrder(3);
builder.Property(preferences => preferences.DisplayTimeUnit)
.IsRequired()
.HasConversion<string>()
.HasColumnOrder(4);
// Audit.
builder.Property(preferences => preferences.CreatedOnUtc)
.IsRequired()
.HasColumnOrder(5);
builder.Property(preferences => preferences.CreatedBy)
.IsRequired()
.HasColumnOrder(6);
builder.Property(preferences => preferences.UpdatedOnUtc)
.HasDefaultValue(null)
.HasColumnOrder(7);
builder.Property(preferences => preferences.UpdatedBy)
.HasDefaultValue(null)
.HasColumnOrder(8);
// One user has at most one set of scheduler page display preferences.
builder.HasIndex(preferences => preferences.UserId)
.IsUnique();
}
}
@@ -0,0 +1,47 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Lumina.DataAccess.Common.Migrations
{
/// <inheritdoc />
public partial class AddsSchedulerDisplayPreferences : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "SchedulerDisplayPreferences",
columns: table => new
{
Id = table.Column<Guid>(type: "TEXT", nullable: false),
UserId = table.Column<Guid>(type: "TEXT", nullable: false),
JobTypeFilter = table.Column<string>(type: "TEXT", nullable: true),
DisplayTimeSpan = table.Column<int>(type: "INTEGER", nullable: false),
DisplayTimeUnit = table.Column<string>(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_SchedulerDisplayPreferences", x => x.Id);
});
migrationBuilder.CreateIndex(
name: "IX_SchedulerDisplayPreferences_UserId",
table: "SchedulerDisplayPreferences",
column: "UserId",
unique: true);
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "SchedulerDisplayPreferences");
}
}
}
@@ -1,4 +1,4 @@
// <auto-generated />.
// <auto-generated />
using System;
using Lumina.DataAccess.Core.UoW;
using Microsoft.EntityFrameworkCore;
@@ -1207,6 +1207,53 @@ namespace Lumina.DataAccess.Common.Migrations
b.ToTable("ScheduledJobExecutions", (string)null);
});
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Scheduling.SchedulerDisplayPreferencesEntity", b =>
{
b.Property<Guid>("Id")
.HasColumnType("TEXT")
.HasColumnOrder(0);
b.Property<Guid>("CreatedBy")
.HasColumnType("TEXT")
.HasColumnOrder(6);
b.Property<DateTime>("CreatedOnUtc")
.HasColumnType("TEXT")
.HasColumnOrder(5);
b.Property<int>("DisplayTimeSpan")
.HasColumnType("INTEGER")
.HasColumnOrder(3);
b.Property<string>("DisplayTimeUnit")
.IsRequired()
.HasColumnType("TEXT")
.HasColumnOrder(4);
b.Property<string>("JobTypeFilter")
.HasColumnType("TEXT")
.HasColumnOrder(2);
b.Property<Guid?>("UpdatedBy")
.HasColumnType("TEXT")
.HasColumnOrder(8);
b.Property<DateTime?>("UpdatedOnUtc")
.HasColumnType("TEXT")
.HasColumnOrder(7);
b.Property<Guid>("UserId")
.HasColumnType("TEXT")
.HasColumnOrder(1);
b.HasKey("Id");
b.HasIndex("UserId")
.IsUnique();
b.ToTable("SchedulerDisplayPreferences", (string)null);
});
modelBuilder.Entity("Lumina.Application.Common.DataAccess.Entities.Themes.ThemeEntity", b =>
{
b.Property<Guid>("Id")