Refactor startup user creation and add HomeSection config
Refactored user initialization to always ensure at least one user exists at startup. If no users are present, a default admin user (admin/jellyfin) is created automatically. Updated StartupController endpoints to handle cases where no user exists. Simplified UserManager.InitializeAsync logic. Added HomeSectionConfiguration for EF Core entity mapping. Includes minor project and assembly info updates.
This commit is contained in:
Binary file not shown.
Binary file not shown.
+1
-1
@@ -14,7 +14,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("Jellyfin.CodeAnalysis")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f833f0ceebcaa4ac5d8972494fbe574ff6b0036b")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+534b0cde918839aca165b7bd2b1c7df761aca82c")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("Jellyfin.CodeAnalysis")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("Jellyfin.CodeAnalysis")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
+1
-1
@@ -1 +1 @@
|
||||
ec635030130ae48b7e69fa591520d48e411bcd6177f6760b1e8b737bdcf85112
|
||||
16d1d32a5e6e4b7472006b4665d10d7735bf11c7602c8304312d34d2b63afa7f
|
||||
|
||||
Binary file not shown.
Binary file not shown.
+37
@@ -0,0 +1,37 @@
|
||||
// <copyright file="HomeSectionConfiguration.cs" company="PlaceholderCompany">
|
||||
// Copyright (c) PlaceholderCompany. All rights reserved.
|
||||
// </copyright>
|
||||
|
||||
namespace Jellyfin.Database.Implementations.ModelConfiguration
|
||||
{
|
||||
using System;
|
||||
using Jellyfin.Database.Implementations.Entities;
|
||||
using Microsoft.EntityFrameworkCore;
|
||||
using Microsoft.EntityFrameworkCore.Metadata.Builders;
|
||||
|
||||
/// <summary>
|
||||
/// FluentAPI configuration for the HomeSection entity.
|
||||
/// </summary>
|
||||
public class HomeSectionConfiguration : IEntityTypeConfiguration<HomeSection>
|
||||
{
|
||||
/// <inheritdoc/>
|
||||
public void Configure(EntityTypeBuilder<HomeSection> builder)
|
||||
{
|
||||
ArgumentNullException.ThrowIfNull(builder);
|
||||
|
||||
// Explicitly set table name to singular to match the migration
|
||||
builder.ToTable("HomeSection", "displaypreferences");
|
||||
|
||||
builder.HasKey(e => e.Id);
|
||||
|
||||
builder.Property(e => e.Order)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(e => e.Type)
|
||||
.IsRequired();
|
||||
|
||||
builder.Property(e => e.DisplayPreferencesId)
|
||||
.IsRequired();
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user