Adds Blazor Web App standard login

This commit is contained in:
2025-09-24 21:28:15 +02:00
parent 1152bc4f7e
commit 8ec615496e
141 changed files with 62726 additions and 1354 deletions

View File

@@ -0,0 +1,27 @@
using Microsoft.AspNetCore.Identity;
using Microsoft.AspNetCore.Identity.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore;
namespace WatchLog.Data
{
public class ApplicationDbContext(DbContextOptions<ApplicationDbContext> options) : IdentityDbContext<ApplicationUser, IdentityRole, string>(options)
{
// Global
public DbSet<Genre> Genres { get; set; }
public DbSet<GlobalEntity> GlobalEntities { get; set; }
public DbSet<StreamingPlatform> StreamingPlatforms { get; set; }
public DbSet<MediaType> MediaType { get; set; } // 'Watchlog.Data.Type' if namecolsion with System.Type
//Private
public DbSet<Label> Labels { get; set; }
public DbSet<PrivateEntity> PrivateEntities { get; set; }
public DbSet<UserWatchStatus> UserWatchStatuses { get; set; }
//Shared
public DbSet<SharedList> SharedLists { get; set; }
public DbSet<SharedListEntity> SharedListEntities { get; set; }
public DbSet<SharedListLabel> SharedListLabels { get; set; }
public DbSet<SharedWatchStatus> SharedWatchStatuses { get; set; }
}
}

View File

@@ -0,0 +1,20 @@
using Microsoft.AspNetCore.Identity;
namespace WatchLog.Data
{
// Add profile data for application users by adding properties to the ApplicationUser class
public class ApplicationUser : IdentityUser
{
// --- Navigation Properties ---
public virtual ICollection<PrivateEntity> PrivateEntities { get; set; } = new List<PrivateEntity>();
public virtual ICollection<GlobalEntity> CreatedGlobalEntities { get; set; } = new List<GlobalEntity>();
public virtual ICollection<Label> CreatedLabels { get; set; } = new List<Label>();
public virtual ICollection<UserWatchStatus> UserWatchStatuses { get; set; } = new List<UserWatchStatus>();
public virtual ICollection<LinkTableSharedUser> LinkTableSharedUsers { get; set; } = new List<LinkTableSharedUser>();
}
}

View File

@@ -26,15 +26,15 @@ namespace WatchLog.Data
public required int TypeId { get; set; }
[Required]
public required int CreatorId { get; set; }
public required string CreatorId { get; set; }
// --- Navigation Properties ---
[ForeignKey(nameof(TypeId))]
public virtual Type Type { get; set; } = null!;
public virtual MediaType MediaType { get; set; } = null!;
[ForeignKey(nameof(CreatorId))]
public virtual AppUser User { get; set; } = null!;
public virtual ApplicationUser User { get; set; } = null!;
public virtual ICollection<LinkTableGlobalGenre> LinkTableGlobalGenres { get; set; } = new List<LinkTableGlobalGenre>();

View File

@@ -2,7 +2,7 @@
namespace WatchLog.Data
{
public class Type
public class MediaType
{
[Key]
public int Id { get; set; }

View File

@@ -20,12 +20,12 @@ namespace WatchLog.Data
// --- Foreign Key ---
[Required]
public int CreatorId { get; set; }
public string? CreatorId { get; set; }
// --- Navigation Properties ---
[ForeignKey(nameof(CreatorId))]
public virtual AppUser User { get; set; } = null!;
public virtual ApplicationUser User { get; set; } = null!;
public virtual ICollection<LinkTablePrivateLabel> LinkTablePrivateLabels { get; set; } = new List<LinkTablePrivateLabel>();
}

View File

@@ -27,7 +27,7 @@ namespace WatchLog.Data
// --- Foreign Keys ---
[Required]
public int UserId { get; set; }
public string? UserId { get; set; }
[Required]
public int GlobalEntityId { get; set; }
@@ -37,7 +37,7 @@ namespace WatchLog.Data
// --- Navigation Properties ---
[ForeignKey(nameof(UserId))]
public virtual AppUser User { get; set; } = null!;
public virtual ApplicationUser User { get; set; } = null!;
[ForeignKey(nameof(GlobalEntityId))]
public virtual GlobalEntity GlobalEntity { get; set; } = null!;

View File

@@ -26,12 +26,12 @@ namespace WatchLog.Data
// --- Foreign Key ---
[Required]
public int UserId { get; set; }
public string? UserId { get; set; }
// --- Navigation Properties ---
[ForeignKey(nameof(UserId))]
public virtual AppUser User { get; set; } = null!;
public virtual ApplicationUser User { get; set; } = null!;
public virtual ICollection<PrivateEntity> PrivateEntities { get; set; } = new List<PrivateEntity>();
}

View File

@@ -8,7 +8,7 @@ namespace WatchLog.Data
{
// --- Foreign Keys ---
public int SharedListId { get; set; }
public int UserId { get; set; }
public string? UserId { get; set; }
// --- Navigation Properties ---
@@ -16,6 +16,6 @@ namespace WatchLog.Data
public virtual SharedList SharedList { get; set; } = null!;
[ForeignKey(nameof(UserId))]
public virtual AppUser User { get; set; } = null!;
public virtual ApplicationUser User { get; set; } = null!;
}
}

Binary file not shown.

Binary file not shown.

View File

@@ -1,45 +0,0 @@
using Microsoft.EntityFrameworkCore;
namespace WatchLog.Data
{
public class WatchLogDataContext : DbContext
{
protected readonly IConfiguration Configuration;
public WatchLogDataContext(IConfiguration configuration)
{
Configuration = configuration;
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseSqlite(Configuration.GetConnectionString("WatchLogDB"));
}
//Note: Link Tables a commented out because Entity Framework creates the tables by itself
// Global
public DbSet<Genre> Genres { get; set; }
public DbSet<GlobalEntity> GlobalEntities { get; set; }
//public DbSet<LinkTableGlobalGenre> LinkTableGlobalGenres { get; set; }
public DbSet<StreamingPlatform> StreamingPlatforms { get; set; }
public DbSet<Type> Types { get; set; } // 'Watchlog.Data.Type' if namecolsion with System.Type
public DbSet<AppUser> AppUsers { get; set; }
//Private
public DbSet<Label> Labels { get; set; }
//public DbSet<LinkTablePrivateLabel> LinkTablePrivateLabels { get; set; }
//public DbSet<LinkTablePrivateStreamingPlatform> LinkTablePrivateStreamingPlatform { get; set; }
public DbSet<PrivateEntity> PrivateEntities { get; set; }
public DbSet<UserWatchStatus> UserWatchStatuses { get; set; }
//Shared
//public DbSet<LinkTableSharedLabel> LinkTableSharedLabels { get; set; }
//public DbSet<LinkTableSharedStreamingPlatform> LinkTableSharedStreamingPlatforms { get; set; }
//public DbSet<LinkTableSharedUser> LinkTableSharedUsers { get; set; }
public DbSet<SharedList> SharedLists { get; set; }
public DbSet<SharedListEntity> SharedListEntities { get; set; }
public DbSet<SharedListLabel> SharedListLabels { get; set; }
public DbSet<SharedWatchStatus> SharedWatchStatuses { get; set; }
}
}