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:
2026-02-23 17:54:53 -05:00
parent 534b0cde91
commit 43cdbf9b35
11 changed files with 78 additions and 29 deletions
@@ -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();
}
}
}