14 Commits

Author SHA1 Message Date
d0f91fd0e1 Merge pull request 'feat: Rework first account to be register is admin and no Standard users get created' (#37) from ReworkedRegisterAndStandardAdminUser into main
All checks were successful
Build Docker Linux ARM64 / build-docker-linux-arm64 (push) Successful in 9m15s
Reviewed-on: #37
2026-01-04 18:00:21 +01:00
f1a68296ec Merge branch 'main' into ReworkedRegisterAndStandardAdminUser 2026-01-04 18:00:05 +01:00
c5a3ba2b40 feat: Rework first account to be register is admin and no Standard users get created 2026-01-04 17:58:26 +01:00
67b559e6d7 Merge pull request '.gitea/workflows/linux_arm64_docker.yaml aktualisiert' (#34) from WrongDockerImageNameForWorkflow into main
All checks were successful
Build Docker Linux ARM64 / build-docker-linux-arm64 (push) Successful in 3m59s
Reviewed-on: #34
2026-01-03 20:13:00 +01:00
3c10721c4e .gitea/workflows/linux_arm64_docker.yaml aktualisiert 2026-01-03 20:12:48 +01:00
eec7f40e72 Merge pull request 'fix: fixed the Issue with long Names and adapted the count of Entity in a row' (#33) from SomeCSSReworks into main
Some checks failed
Build Docker Linux ARM64 / build-docker-linux-arm64 (push) Failing after 5m55s
Reviewed-on: #33
2025-12-27 23:00:00 +01:00
899a36a49c Merge branch 'main' into SomeCSSReworks 2025-12-27 22:59:47 +01:00
8e607ee180 Merge pull request '.gitea/workflows/linux_arm64_docker.yaml aktualisiert' (#32) from RemovedUnnecessaryImageCopy into main
Some checks failed
Build Docker Linux ARM64 / build-docker-linux-arm64 (push) Has been cancelled
Reviewed-on: #32
2025-12-27 22:57:56 +01:00
87e6132f34 .gitea/workflows/linux_arm64_docker.yaml aktualisiert 2025-12-27 22:57:34 +01:00
dd845f4be6 fix: fixed the Issue with long Names and adapted the count of Entity in a row 2025-12-27 22:52:34 +01:00
6ca8fe7bdc Merge pull request '.gitea/workflows/linux_arm64_docker.yaml aktualisiert' (#30) from UpdateMainPushWorkflowForARM64Docker into main
All checks were successful
Build Docker Linux ARM64 / build-docker-linux-arm64 (push) Successful in 9m4s
Reviewed-on: #30
2025-12-27 22:45:14 +01:00
56bcd712f1 .gitea/workflows/linux_arm64_docker.yaml aktualisiert 2025-12-27 22:44:59 +01:00
4e3eca0650 Merge pull request 'Added Adventure Genre to StartUp Actions' (#28) from AddAdventureGenre into main
Reviewed-on: #28
2025-12-27 00:37:30 +01:00
2160c9abbc Added Adventure Genre to StartUp Actions 2025-12-27 00:36:36 +01:00
24 changed files with 3326 additions and 177 deletions

View File

@@ -3,7 +3,7 @@ name: Build Docker Linux ARM64
on: on:
push: push:
branches: branches:
#- main - main
jobs: jobs:
build-docker-linux-arm64: build-docker-linux-arm64:
@@ -18,11 +18,19 @@ jobs:
- name: Setup Docker Buildx - name: Setup Docker Buildx
uses: docker/setup-buildx-action@v3 uses: docker/setup-buildx-action@v3
- name: Get Repository Name
id: get_repo
run: |
echo "REPO_LC=${GITHUB_REPOSITORY,,}" >> $GITHUB_ENV
- name: Build Linux ARM64 Docker Image - name: Build Linux ARM64 Docker Image
run: docker build -t couchlog-linux-arm64 . run: |
docker build \
-t gitea.penry.de/${{ env.REPO_LC }}:latest \
.
- name: Save Docker Image to Tar - name: Save Docker Image to Tar
run: docker save -o CouchLog-Linux-ARM64-Docker-Image.tar couchlog-linux-arm64 run: docker save -o CouchLog-Linux-ARM64-Docker-Image.tar gitea.penry.de/${{ env.REPO_LC }}:latest
- name: Upload Artifact - name: Upload Artifact
uses: actions/upload-artifact@v3 uses: actions/upload-artifact@v3
@@ -30,4 +38,4 @@ jobs:
name: CouchLog-Linux-ARM64-Docker-Image name: CouchLog-Linux-ARM64-Docker-Image
path: CouchLog-Linux-ARM64-Docker-Image.tar path: CouchLog-Linux-ARM64-Docker-Image.tar
if-no-files-found: error if-no-files-found: error
retention-days: 1 retention-days: 5

2
.gitignore vendored
View File

@@ -2,5 +2,7 @@
bin bin
Debug Debug
/CouchLog/Data/CouchLog.db /CouchLog/Data/CouchLog.db
/CouchLog/Data/CouchLog.db-shm
/CouchLog/Data/CouchLog.db-wal
#Migrations #Migrations
obj obj

4
CouchLog/.editorconfig Normal file
View File

@@ -0,0 +1,4 @@
[*.cs]
# IDE0130: Namespace does not match folder structure
dotnet_diagnostic.IDE0130.severity = none

View File

@@ -10,10 +10,10 @@
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@inject IUserStore<ApplicationUser> UserStore @inject IUserStore<ApplicationUser> UserStore
@inject SignInManager<ApplicationUser> SignInManager @inject SignInManager<ApplicationUser> SignInManager
@inject IEmailSender<ApplicationUser> EmailSender
@inject ILogger<Register> Logger @inject ILogger<Register> Logger
@inject NavigationManager NavigationManager @inject NavigationManager NavigationManager
@inject IdentityRedirectManager RedirectManager @inject IdentityRedirectManager RedirectManager
@inject ApplicationDbContext CouchLogDB
<PageTitle>Register</PageTitle> <PageTitle>Register</PageTitle>
@@ -28,9 +28,9 @@
<hr /> <hr />
<ValidationSummary class="text-danger" role="alert" /> <ValidationSummary class="text-danger" role="alert" />
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<InputText @bind-Value="Input.Email" id="Input.Email" class="form-control" autocomplete="username" aria-required="true" placeholder="name@example.com" /> <InputText @bind-Value="Input.Username" id="Input.Username" class="form-control" autocomplete="username" aria-required="true" placeholder="NewUsername" />
<label for="Input.Email">Email</label> <label for="Input.Username">Username</label>
<ValidationMessage For="() => Input.Email" class="text-danger" /> <ValidationMessage For="() => Input.Username" class="text-danger" />
</div> </div>
<div class="form-floating mb-3"> <div class="form-floating mb-3">
<InputText type="password" @bind-Value="Input.Password" id="Input.Password" class="form-control" autocomplete="new-password" aria-required="true" placeholder="password" /> <InputText type="password" @bind-Value="Input.Password" id="Input.Password" class="form-control" autocomplete="new-password" aria-required="true" placeholder="password" />
@@ -67,11 +67,19 @@
public async Task RegisterUser(EditContext editContext) public async Task RegisterUser(EditContext editContext)
{ {
if(!CouchLogDB.AccountsSettings.First().IsRegistrationAllowed)
{
identityErrors = new[]
{
new IdentityError { Description = "Registration is deactivated" }
};
return;
}
var user = CreateUser(); var user = CreateUser();
await UserStore.SetUserNameAsync(user, Input.Email, CancellationToken.None); await UserStore.SetUserNameAsync(user, Input.Username, CancellationToken.None);
var emailStore = GetEmailStore(); user.EmailConfirmed = true;
await emailStore.SetEmailAsync(user, Input.Email, CancellationToken.None);
var result = await UserManager.CreateAsync(user, Input.Password); var result = await UserManager.CreateAsync(user, Input.Password);
if (!result.Succeeded) if (!result.Succeeded)
@@ -80,23 +88,24 @@
return; return;
} }
Logger.LogInformation("User created a new account with password."); if(CouchLogDB.CouchLogState.Count() == 0)
var userId = await UserManager.GetUserIdAsync(user);
var code = await UserManager.GenerateEmailConfirmationTokenAsync(user);
code = WebEncoders.Base64UrlEncode(Encoding.UTF8.GetBytes(code));
var callbackUrl = NavigationManager.GetUriWithQueryParameters(
NavigationManager.ToAbsoluteUri("Account/ConfirmEmail").AbsoluteUri,
new Dictionary<string, object?> { ["userId"] = userId, ["code"] = code, ["returnUrl"] = ReturnUrl });
await EmailSender.SendConfirmationLinkAsync(user, Input.Email, HtmlEncoder.Default.Encode(callbackUrl));
if (UserManager.Options.SignIn.RequireConfirmedAccount)
{ {
RedirectManager.RedirectTo( await UserManager.AddToRoleAsync(user, "Admin");
"Account/RegisterConfirmation", await CouchLogDB.CouchLogState.AddAsync(new CouchLogState
new() { ["email"] = Input.Email, ["returnUrl"] = ReturnUrl }); {
Id = 1,
InitializationDate = DateTime.Now,
IsInitialized = true
});
} }
else
{
await UserManager.AddToRoleAsync(user, "User");
}
await CouchLogDB.SaveChangesAsync();
Logger.LogInformation("User created a new account with password.");
await SignInManager.SignInAsync(user, isPersistent: false); await SignInManager.SignInAsync(user, isPersistent: false);
RedirectManager.RedirectTo(ReturnUrl); RedirectManager.RedirectTo(ReturnUrl);
@@ -127,9 +136,8 @@
private sealed class InputModel private sealed class InputModel
{ {
[Required] [Required]
[EmailAddress] [Display(Name = "Username")]
[Display(Name = "Email")] public string Username { get; set; } = "";
public string Email { get; set; } = "";
[Required] [Required]
[StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)] [StringLength(100, ErrorMessage = "The {0} must be at least {2} and at max {1} characters long.", MinimumLength = 6)]

View File

@@ -0,0 +1,51 @@
@page "/AdminSettings/CouchLogSettings"
@rendermode InteractiveServer
@using CouchLog.Data
@using Microsoft.EntityFrameworkCore
@using Microsoft.AspNetCore.Components.Forms
@inject ApplicationDbContext CouchLogDB
<h3>CouchLog Settings</h3>
@if (accountsSettings is null)
{
<p>Lade Einstellungen…</p>
}
else
{
<EditForm Model="accountsSettings">
<div class="form-check form-switch">
<InputCheckbox class="form-check-input"
role="switch"
id="IsRegistrationallowedInput"
Value="accountsSettings.IsRegistrationAllowed"
ValueChanged="OnRegistrationChanged"
ValueExpression="() => accountsSettings.IsRegistrationAllowed" />
<label class="form-check-label" for="IsRegistrationallowedInput">
Is Registration allowed
</label>
</div>
</EditForm>
}
@code {
private AccountsSettings? accountsSettings;
protected override async Task OnInitializedAsync()
{
accountsSettings = await CouchLogDB.AccountsSettings.FirstAsync();
}
private async Task OnRegistrationChanged(bool value)
{
accountsSettings!.IsRegistrationAllowed = value;
CouchLogDB.AccountsSettings.Update(accountsSettings);
await CouchLogDB.SaveChangesAsync();
}
}

View File

@@ -9,7 +9,6 @@
@inject ApplicationDbContext CouchLogDB @inject ApplicationDbContext CouchLogDB
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@inject RoleManager<IdentityRole> RoleManager
@inject AuthenticationStateProvider AuthenticationStateProvider @inject AuthenticationStateProvider AuthenticationStateProvider
@inject NavigationManager NavigationManager @inject NavigationManager NavigationManager

View File

@@ -4,6 +4,9 @@
@inject SignInManager<ApplicationUser> SignInManager @inject SignInManager<ApplicationUser> SignInManager
<ul class="nav nav-pills flex-column"> <ul class="nav nav-pills flex-column">
<li class="nav-item">
<NavLink class="nav-link" href="/AdminSettings/CouchLogSettings">CouchLog Settings</NavLink>
</li>
<li class="nav-item"> <li class="nav-item">
<NavLink class="nav-link" href="/AdminSettings/UserManagement" Match="NavLinkMatch.All">User Management</NavLink> <NavLink class="nav-link" href="/AdminSettings/UserManagement" Match="NavLinkMatch.All">User Management</NavLink>
</li> </li>
@@ -11,8 +14,5 @@
<li class="nav-item"> <li class="nav-item">
<NavLink class="nav-link" href=""></NavLink> <NavLink class="nav-link" href=""></NavLink>
</li> </li>
<li class="nav-item">
<NavLink class="nav-link" href=""></NavLink>
</li>
--> -->
</ul> </ul>

View File

@@ -5,6 +5,7 @@
@inject NavigationManager NavigationManager @inject NavigationManager NavigationManager
@inject AuthenticationStateProvider AuthenticationStateProvider @inject AuthenticationStateProvider AuthenticationStateProvider
@inject UserManager<ApplicationUser> UserManager @inject UserManager<ApplicationUser> UserManager
@inject ApplicationDbContext CouchLogDB
<div class="top-row ps-3 navbar navbar-dark"> <div class="top-row ps-3 navbar navbar-dark">
<div class="container-fluid"> <div class="container-fluid">
@@ -58,11 +59,14 @@
</div> </div>
</Authorized> </Authorized>
<NotAuthorized> <NotAuthorized>
<div class="nav-item px-3"> @if(CouchLogDB.AccountsSettings.First().IsRegistrationAllowed)
<NavLink class="nav-link" href="Account/Register"> {
<span class="bi bi-person-nav-menu" aria-hidden="true"></span> Register <div class="nav-item px-3">
</NavLink> <NavLink class="nav-link" href="Account/Register">
</div> <span class="bi bi-person-nav-menu" aria-hidden="true"></span> Register
</NavLink>
</div>
}
<div class="nav-item px-3"> <div class="nav-item px-3">
<NavLink class="nav-link" href="Account/Login"> <NavLink class="nav-link" href="Account/Login">
<span class="bi bi-person-badge-nav-menu" aria-hidden="true"></span> Login <span class="bi bi-person-badge-nav-menu" aria-hidden="true"></span> Login

View File

@@ -43,10 +43,10 @@
</div> </div>
<div class="mb-3"> <div class="mb-3">
<label for="Picture" class="form-label">Picture</label> <label for="Picture" class="form-label">Picture</label>
<InputFile OnChange="@LoadFiles" accept="image/*"/> <InputFile OnChange="@LoadImage" accept="image/*" />
@if (!string.IsNullOrEmpty(ImagePreviewUrl)) @if (!string.IsNullOrEmpty(ImageString))
{ {
<img src="@ImagePreviewUrl" style="max-width: 256px; max-height: 256px;" /> <img src="@ImageString" style="max-width: 256px; max-height: 256px;" />
} }
</div> </div>
<div class="mb-3"> <div class="mb-3">
@@ -66,12 +66,12 @@
<!-- #endregion --> <!-- #endregion -->
<!-- #region Show Entitys --> <!-- #region Show Entitys -->
<div class="row"> <div class="row g-4">
@foreach (var Entity in GlobalEntities) @foreach (var Entity in GlobalEntities)
{ {
if (!Entity.IsPrivate || (Entity.IsPrivate && (Entity.CreatorId == AppUser.Id))) if (!Entity.IsPrivate || (Entity.IsPrivate && (Entity.CreatorId == AppUser.Id)))
{ {
<div name="Enity-Container" class="col-12 col-md-6 col-lg-3 mb-4 Entity-Container"> <div name="Enity-Container" class="col-6 col-md-4 col-lg-2 col-xl-2 mb-4 Entity-Container">
<div name="Entity-Container-Card" class="Entity-Container-Card"> <div name="Entity-Container-Card" class="Entity-Container-Card">
<div class="Entity-Container-Menu-Button dropdown ms-1"> <div class="Entity-Container-Menu-Button dropdown ms-1">
@@ -143,14 +143,14 @@
private List<GlobalEntity> GlobalEntities = new List<GlobalEntity>(); private List<GlobalEntity> GlobalEntities = new List<GlobalEntity>();
private List<int> GenreIds = new List<int>(); private List<int> GenreIds = new List<int>();
private HashSet<int> UserPrivateEntityIds = new(); private HashSet<int> UserPrivateEntityIds = new();
private string? ImagePreviewUrl;
private IBrowserFile? Picture; private IBrowserFile? Picture;
System.Security.Claims.ClaimsPrincipal User = new(); System.Security.Claims.ClaimsPrincipal User = new();
ApplicationUser? AppUser = new(); ApplicationUser AppUser = null!;
private GlobalEntity GlobalEntity = new(); private GlobalEntity GlobalEntity = new();
private bool isCollapseNewGlobalEntityOpen = false; private bool isCollapseNewGlobalEntityOpen = false;
private int SelectedMediaTypeId; private int SelectedMediaTypeId;
private bool isPrivate = false; private bool isPrivate = false;
private string ImageString = string.Empty;
/// <summary> /// <summary>
/// ///
@@ -159,14 +159,14 @@
/// <exception cref="NotImplementedException"></exception> /// <exception cref="NotImplementedException"></exception>
protected override async Task OnInitializedAsync() protected override async Task OnInitializedAsync()
{ {
GlobalEntities = await CouchLogDB.GlobalEntities.OrderByDescending(Entity => Entity.Id).ToListAsync(); GlobalEntities = await CouchLogDB.GlobalEntities.OrderByDescending(Entity => Entity.Title).ToListAsync();
MediaTypes = await CouchLogDB.MediaType.OrderBy(Type => Type.Id).ToListAsync(); MediaTypes = await CouchLogDB.MediaType.OrderBy(Type => Type.Id).ToListAsync();
Genres = await CouchLogDB.Genres.OrderBy(Genre => Genre.Id).ToListAsync(); Genres = await CouchLogDB.Genres.OrderBy(Genre => Genre.Name).ToListAsync();
var AuthState = await AuthenticationStateProvider.GetAuthenticationStateAsync(); var AuthState = await AuthenticationStateProvider.GetAuthenticationStateAsync();
User = AuthState.User; User = AuthState.User;
AppUser = await UserManager.GetUserAsync(User); AppUser = (await UserManager.GetUserAsync(User))!;
if (AppUser == null) if (AppUser == null)
{ {
@@ -181,6 +181,19 @@
UserPrivateEntityIds = TempUserPrivateEntityIds.ToHashSet(); UserPrivateEntityIds = TempUserPrivateEntityIds.ToHashSet();
} }
private async Task LoadImage(InputFileChangeEventArgs e)
{
Picture = e.File;
foreach(var file in e.GetMultipleFiles())
{
using var stream = file.OpenReadStream();
using var ms = new MemoryStream();
await stream.CopyToAsync(ms);
ImageString = $"data:{file.ContentType};base64,{Convert.ToBase64String(ms.ToArray())}";
}
}
/// <summary> /// <summary>
/// ///
/// </summary> /// </summary>

View File

@@ -24,45 +24,44 @@
<div class="row g-4"> <div class="row g-4">
@foreach (var Entity in PrivateEntities) @foreach (var Entity in PrivateEntities)
{ {
/*
Hier bleiben wir bei col-lg-6 (halbe Bildschirmbreite),
wie du es im roten Kasten wolltest.
*/
<div class="col-12 col-lg-6 col-xxl-4"> <div class="col-12 col-lg-6 col-xxl-4">
<div class="card shadow-sm border-0 overflow-hidden private-entity-card"> <div class="card shadow-sm border-0 overflow-hidden private-entity-card">
<div class="row g-0 h-100"> <div class="row g-0 h-100">
<!-- BILD: col-auto sorgt dafür, dass sich die Breite nach CSS richtet --> <!-- Feste Breite für das Bild, kein Umbruch -->
<div class="col-auto img-wrapper"> <div class="col-auto" style="flex: 0 0 auto; min-width: 120px; max-width: 150px;">
@if (!string.IsNullOrEmpty(Entity.GlobalEntity?.PicturePath)) @if (!string.IsNullOrEmpty(Entity.GlobalEntity?.PicturePath))
{ {
<img src="/@Entity.GlobalEntity.PicturePath" <img src="/@Entity.GlobalEntity.PicturePath"
class="entity-img" class="entity-img w-100 h-100"
style="object-fit: cover;"
alt="@Entity.GlobalEntity.Title"> alt="@Entity.GlobalEntity.Title">
} }
else else
{ {
<div class="d-flex align-items-center justify-content-center h-100 bg-light text-muted small px-2"> <div class="d-flex align-items-center justify-content-center h-100 bg-light text-muted small">
Kein Bild Kein Bild
</div> </div>
} }
</div> </div>
<!-- INFO: 'col' nimmt automatisch den RESTLICHEN Platz ein --> <!-- Der Rest nimmt den verbleibenden Platz -->
<div class="col"> <div class="col" style="min-width: 0;">
<div class="card-body d-flex flex-column h-100 py-2 px-3"> <div class="card-body d-flex flex-column h-100 py-2 px-3">
<!-- Header --> <!-- Header mit besserer Text-Behandlung -->
<div class="d-flex justify-content-between align-items-start"> <div class="d-flex justify-content-between align-items-start mb-2">
<div class="overflow-hidden"> <div style="min-width: 0; flex: 1;">
<h5 class="card-title fw-bold mb-0 text-truncate">@Entity.GlobalEntity?.Title</h5> <h5 class="card-title fw-bold mb-0" style="overflow: hidden; text-overflow: ellipsis; white-space: nowrap;">
@Entity.GlobalEntity?.Title
</h5>
<small class="text-muted meta-text"> <small class="text-muted meta-text">
@Entity.CreationTime.ToShortDateString() @Entity.CreationTime.ToShortDateString()
</small> </small>
</div> </div>
<div class="dropdown ms-1"> <div class="dropdown ms-2" style="flex-shrink: 0;">
<button class="btn btn-link menu-btn" type="button" data-bs-toggle="modal" data-bs-target="#modal-@Entity.Id"> <button class="btn btn-link menu-btn" type="button" data-bs-toggle="modal" data-bs-target="#modal-@Entity.Id">
&#8942; &#8942;
</button> </button>
@@ -79,7 +78,7 @@
} }
</select> </select>
@if (Entity.GlobalEntity?.MediaType.Name == "Series") @if (Entity.GlobalEntity?.MediaType.Name == "Series" || Entity.GlobalEntity?.MediaType.Name == "Anime")
{ {
<select class="form-select" value="@Entity.Season" @onchange="@(e => UpdateSeason(Entity, e.Value))"> <select class="form-select" value="@Entity.Season" @onchange="@(e => UpdateSeason(Entity, e.Value))">
@{ @{

View File

@@ -1,7 +1,7 @@
Microsoft Visual Studio Solution File, Format Version 12.00 Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 18 # Visual Studio Version 18
VisualStudioVersion = 18.1.11304.174 d18.0 VisualStudioVersion = 18.1.11304.174
MinimumVisualStudioVersion = 10.0.40219.1 MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CouchLog", "CouchLog.csproj", "{4FBF15C3-5FC5-4605-9EBC-3F7DA1ADC47A}" Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CouchLog", "CouchLog.csproj", "{4FBF15C3-5FC5-4605-9EBC-3F7DA1ADC47A}"
EndProject EndProject

View File

@@ -23,5 +23,9 @@ namespace CouchLog.Data
public DbSet<SharedListEntity> SharedListEntities { get; set; } public DbSet<SharedListEntity> SharedListEntities { get; set; }
public DbSet<SharedListLabel> SharedListLabels { get; set; } public DbSet<SharedListLabel> SharedListLabels { get; set; }
public DbSet<SharedWatchStatus> SharedWatchStatuses { get; set; } public DbSet<SharedWatchStatus> SharedWatchStatuses { get; set; }
//Settings
public DbSet<CouchLogState> CouchLogState { get; set; }
public DbSet<AccountsSettings> AccountsSettings { get; set; }
} }
} }

View File

@@ -27,6 +27,6 @@ namespace CouchLog.Data
[ForeignKey(nameof(CreatorId))] [ForeignKey(nameof(CreatorId))]
public virtual ApplicationUser User { get; set; } = null!; public virtual ApplicationUser User { get; set; } = null!;
public virtual ICollection<LinkTablePrivateLabel> LinkTablePrivateLabels { get; set; } = new List<LinkTablePrivateLabel>(); public virtual ICollection<LinkTablePrivateLabel> LinkTablePrivateLabels { get; set; } = [];
} }
} }

View File

@@ -0,0 +1,13 @@
using System.ComponentModel.DataAnnotations;
namespace CouchLog.Data
{
public class AccountsSettings
{
[Key]
public int Id { get; set; }
public bool IsRegistrationAllowed { get; set; }
//More Options that can be added
}
}

View File

@@ -0,0 +1,9 @@
namespace CouchLog.Data
{
public class CouchLogState
{
public int Id { get; set; }
public bool IsInitialized { get; set; }
public DateTime? InitializationDate { get; set; }
}
}

View File

@@ -0,0 +1,978 @@
// <auto-generated />
using System;
using CouchLog.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace CouchLog.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20251229004324_CouchLogState")]
partial class CouchLogState
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.1");
modelBuilder.Entity("CouchLog.Data.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("CouchLog.Data.CouchLogState", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime?>("InitializationDate")
.HasColumnType("TEXT");
b.Property<bool>("IsInitialized")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("CouchLogState");
});
modelBuilder.Entity("CouchLog.Data.Genre", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Genres");
});
modelBuilder.Entity("CouchLog.Data.GlobalEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("CreatorId")
.IsRequired()
.HasColumnType("TEXT");
b.Property<bool>("IsPrivate")
.HasColumnType("INTEGER");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("PicturePath")
.HasMaxLength(500)
.HasColumnType("TEXT");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<int>("TypeId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("CreatorId");
b.HasIndex("TypeId");
b.ToTable("GlobalEntities");
});
modelBuilder.Entity("CouchLog.Data.Label", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("CreatorId")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CreatorId");
b.ToTable("Labels");
});
modelBuilder.Entity("CouchLog.Data.LinkTableGlobalGenre", b =>
{
b.Property<int>("GlobalEntityId")
.HasColumnType("INTEGER")
.HasColumnOrder(0);
b.Property<int>("GenreId")
.HasColumnType("INTEGER")
.HasColumnOrder(1);
b.HasKey("GlobalEntityId", "GenreId");
b.HasIndex("GenreId");
b.ToTable("LinkTableGlobalGenre");
});
modelBuilder.Entity("CouchLog.Data.LinkTablePrivateLabel", b =>
{
b.Property<int>("PrivateEntityId")
.HasColumnType("INTEGER");
b.Property<int>("LabelId")
.HasColumnType("INTEGER");
b.HasKey("PrivateEntityId", "LabelId");
b.HasIndex("LabelId");
b.ToTable("LinkTablePrivateLabel");
});
modelBuilder.Entity("CouchLog.Data.LinkTablePrivateStreamingPlatform", b =>
{
b.Property<int>("PrivateEntityId")
.HasColumnType("INTEGER");
b.Property<int>("StreamingPlatformId")
.HasColumnType("INTEGER");
b.Property<int?>("SharedListEntityId")
.HasColumnType("INTEGER");
b.HasKey("PrivateEntityId", "StreamingPlatformId");
b.HasIndex("SharedListEntityId");
b.HasIndex("StreamingPlatformId");
b.ToTable("LinkTablePrivateStreamingPlatform");
});
modelBuilder.Entity("CouchLog.Data.LinkTableSharedLabel", b =>
{
b.Property<int>("SharedListLabelId")
.HasColumnType("INTEGER");
b.Property<int>("SharedListEntityId")
.HasColumnType("INTEGER");
b.HasKey("SharedListLabelId", "SharedListEntityId");
b.HasIndex("SharedListEntityId");
b.ToTable("LinkTableSharedLabel");
});
modelBuilder.Entity("CouchLog.Data.LinkTableSharedUser", b =>
{
b.Property<int>("SharedListId")
.HasColumnType("INTEGER");
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.HasKey("SharedListId", "UserId");
b.HasIndex("UserId");
b.ToTable("LinkTableSharedUser");
});
modelBuilder.Entity("CouchLog.Data.MediaType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("MediaType");
});
modelBuilder.Entity("CouchLog.Data.PrivateEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("TEXT");
b.Property<int?>("Episode")
.HasColumnType("INTEGER");
b.Property<bool>("Favorite")
.HasColumnType("INTEGER");
b.Property<int>("GlobalEntityId")
.HasColumnType("INTEGER");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<int?>("Rating")
.HasColumnType("INTEGER");
b.Property<int?>("Season")
.HasColumnType("INTEGER");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("UserWatchStatusId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("GlobalEntityId");
b.HasIndex("UserId");
b.HasIndex("UserWatchStatusId");
b.ToTable("PrivateEntities");
});
modelBuilder.Entity("CouchLog.Data.SharedList", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("SharedLists");
});
modelBuilder.Entity("CouchLog.Data.SharedListEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("TEXT");
b.Property<int?>("Episode")
.HasColumnType("INTEGER");
b.Property<bool>("Favorite")
.HasColumnType("INTEGER");
b.Property<int>("GlobalEntityId")
.HasColumnType("INTEGER");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<int?>("Season")
.HasColumnType("INTEGER");
b.Property<int>("SharedListId")
.HasColumnType("INTEGER");
b.Property<int?>("SharedWatchStatusId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("GlobalEntityId");
b.HasIndex("SharedListId");
b.HasIndex("SharedWatchStatusId");
b.ToTable("SharedListEntities");
});
modelBuilder.Entity("CouchLog.Data.SharedListLabel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<int>("SharedListId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("SharedListId");
b.ToTable("SharedListLabels");
});
modelBuilder.Entity("CouchLog.Data.SharedWatchStatus", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ColorCode")
.HasMaxLength(7)
.HasColumnType("TEXT");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("Description")
.HasMaxLength(255)
.HasColumnType("TEXT");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<int>("SharedListId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("SharedListId");
b.ToTable("SharedWatchStatuses");
});
modelBuilder.Entity("CouchLog.Data.StreamingPlatform", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<string>("PicturePath")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("StreamingPlatforms");
});
modelBuilder.Entity("CouchLog.Data.UserWatchStatus", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ColorCode")
.HasMaxLength(7)
.HasColumnType("TEXT");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("Description")
.HasMaxLength(255)
.HasColumnType("TEXT");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("UserWatchStatuses");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("ProviderKey")
.HasColumnType("TEXT");
b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("CouchLog.Data.GlobalEntity", b =>
{
b.HasOne("CouchLog.Data.ApplicationUser", "User")
.WithMany("CreatedGlobalEntities")
.HasForeignKey("CreatorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.MediaType", "MediaType")
.WithMany("GlobalEntities")
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("MediaType");
b.Navigation("User");
});
modelBuilder.Entity("CouchLog.Data.Label", b =>
{
b.HasOne("CouchLog.Data.ApplicationUser", "User")
.WithMany("CreatedLabels")
.HasForeignKey("CreatorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("CouchLog.Data.LinkTableGlobalGenre", b =>
{
b.HasOne("CouchLog.Data.Genre", "Genre")
.WithMany("LinkTableGlobalGenres")
.HasForeignKey("GenreId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.GlobalEntity", "GlobalEntity")
.WithMany("LinkTableGlobalGenres")
.HasForeignKey("GlobalEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Genre");
b.Navigation("GlobalEntity");
});
modelBuilder.Entity("CouchLog.Data.LinkTablePrivateLabel", b =>
{
b.HasOne("CouchLog.Data.Label", "Label")
.WithMany("LinkTablePrivateLabels")
.HasForeignKey("LabelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.PrivateEntity", "PrivateEntity")
.WithMany("PrivateEntityLabels")
.HasForeignKey("PrivateEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Label");
b.Navigation("PrivateEntity");
});
modelBuilder.Entity("CouchLog.Data.LinkTablePrivateStreamingPlatform", b =>
{
b.HasOne("CouchLog.Data.PrivateEntity", "PrivateEntity")
.WithMany("PrivateStreamingPlatforms")
.HasForeignKey("PrivateEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.SharedListEntity", null)
.WithMany("LinkTablePrivateStreamingPlatforms")
.HasForeignKey("SharedListEntityId");
b.HasOne("CouchLog.Data.StreamingPlatform", "StreamingPlatform")
.WithMany()
.HasForeignKey("StreamingPlatformId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("PrivateEntity");
b.Navigation("StreamingPlatform");
});
modelBuilder.Entity("CouchLog.Data.LinkTableSharedLabel", b =>
{
b.HasOne("CouchLog.Data.SharedListEntity", "SharedListEntity")
.WithMany("LinkTableSharedLabels")
.HasForeignKey("SharedListEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.SharedListLabel", "SharedListLabel")
.WithMany("LinkTableSharedLabels")
.HasForeignKey("SharedListLabelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("SharedListEntity");
b.Navigation("SharedListLabel");
});
modelBuilder.Entity("CouchLog.Data.LinkTableSharedUser", b =>
{
b.HasOne("CouchLog.Data.SharedList", "SharedList")
.WithMany("SharedListUsers")
.HasForeignKey("SharedListId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.ApplicationUser", "User")
.WithMany("LinkTableSharedUsers")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("SharedList");
b.Navigation("User");
});
modelBuilder.Entity("CouchLog.Data.PrivateEntity", b =>
{
b.HasOne("CouchLog.Data.GlobalEntity", "GlobalEntity")
.WithMany("PrivateEntities")
.HasForeignKey("GlobalEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.ApplicationUser", "User")
.WithMany("PrivateEntities")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.UserWatchStatus", "UserWatchStatus")
.WithMany()
.HasForeignKey("UserWatchStatusId");
b.Navigation("GlobalEntity");
b.Navigation("User");
b.Navigation("UserWatchStatus");
});
modelBuilder.Entity("CouchLog.Data.SharedListEntity", b =>
{
b.HasOne("CouchLog.Data.GlobalEntity", "GlobalEntity")
.WithMany("SharedListEntities")
.HasForeignKey("GlobalEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.SharedList", "SharedList")
.WithMany("SharedListEntities")
.HasForeignKey("SharedListId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.SharedWatchStatus", "SharedWatchStatus")
.WithMany("SharedListEntities")
.HasForeignKey("SharedWatchStatusId");
b.Navigation("GlobalEntity");
b.Navigation("SharedList");
b.Navigation("SharedWatchStatus");
});
modelBuilder.Entity("CouchLog.Data.SharedListLabel", b =>
{
b.HasOne("CouchLog.Data.SharedList", "SharedList")
.WithMany("SharedListLabels")
.HasForeignKey("SharedListId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("SharedList");
});
modelBuilder.Entity("CouchLog.Data.SharedWatchStatus", b =>
{
b.HasOne("CouchLog.Data.SharedList", "SharedList")
.WithMany("SharedWatchStatuses")
.HasForeignKey("SharedListId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("SharedList");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("CouchLog.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("CouchLog.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("CouchLog.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("CouchLog.Data.ApplicationUser", b =>
{
b.Navigation("CreatedGlobalEntities");
b.Navigation("CreatedLabels");
b.Navigation("LinkTableSharedUsers");
b.Navigation("PrivateEntities");
});
modelBuilder.Entity("CouchLog.Data.Genre", b =>
{
b.Navigation("LinkTableGlobalGenres");
});
modelBuilder.Entity("CouchLog.Data.GlobalEntity", b =>
{
b.Navigation("LinkTableGlobalGenres");
b.Navigation("PrivateEntities");
b.Navigation("SharedListEntities");
});
modelBuilder.Entity("CouchLog.Data.Label", b =>
{
b.Navigation("LinkTablePrivateLabels");
});
modelBuilder.Entity("CouchLog.Data.MediaType", b =>
{
b.Navigation("GlobalEntities");
});
modelBuilder.Entity("CouchLog.Data.PrivateEntity", b =>
{
b.Navigation("PrivateEntityLabels");
b.Navigation("PrivateStreamingPlatforms");
});
modelBuilder.Entity("CouchLog.Data.SharedList", b =>
{
b.Navigation("SharedListEntities");
b.Navigation("SharedListLabels");
b.Navigation("SharedListUsers");
b.Navigation("SharedWatchStatuses");
});
modelBuilder.Entity("CouchLog.Data.SharedListEntity", b =>
{
b.Navigation("LinkTablePrivateStreamingPlatforms");
b.Navigation("LinkTableSharedLabels");
});
modelBuilder.Entity("CouchLog.Data.SharedListLabel", b =>
{
b.Navigation("LinkTableSharedLabels");
});
modelBuilder.Entity("CouchLog.Data.SharedWatchStatus", b =>
{
b.Navigation("SharedListEntities");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,36 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CouchLog.Migrations
{
/// <inheritdoc />
public partial class CouchLogState : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "CouchLogState",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
IsInitialized = table.Column<bool>(type: "INTEGER", nullable: false),
InitializationDate = table.Column<DateTime>(type: "TEXT", nullable: true)
},
constraints: table =>
{
table.PrimaryKey("PK_CouchLogState", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CouchLogState");
}
}
}

View File

@@ -0,0 +1,992 @@
// <auto-generated />
using System;
using CouchLog.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace CouchLog.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20260103202104_AccountsSettings")]
partial class AccountsSettings
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.1");
modelBuilder.Entity("CouchLog.Data.AccountsSettings", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("IsRegistrationAllowed")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("AccountsSettings");
});
modelBuilder.Entity("CouchLog.Data.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("CouchLog.Data.CouchLogState", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime?>("InitializationDate")
.HasColumnType("TEXT");
b.Property<bool>("IsInitialized")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("CouchLogState");
});
modelBuilder.Entity("CouchLog.Data.Genre", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Genres");
});
modelBuilder.Entity("CouchLog.Data.GlobalEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("CreatorId")
.IsRequired()
.HasColumnType("TEXT");
b.Property<bool>("IsPrivate")
.HasColumnType("INTEGER");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("PicturePath")
.HasMaxLength(500)
.HasColumnType("TEXT");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<int>("TypeId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("CreatorId");
b.HasIndex("TypeId");
b.ToTable("GlobalEntities");
});
modelBuilder.Entity("CouchLog.Data.Label", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("CreatorId")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CreatorId");
b.ToTable("Labels");
});
modelBuilder.Entity("CouchLog.Data.LinkTableGlobalGenre", b =>
{
b.Property<int>("GlobalEntityId")
.HasColumnType("INTEGER")
.HasColumnOrder(0);
b.Property<int>("GenreId")
.HasColumnType("INTEGER")
.HasColumnOrder(1);
b.HasKey("GlobalEntityId", "GenreId");
b.HasIndex("GenreId");
b.ToTable("LinkTableGlobalGenre");
});
modelBuilder.Entity("CouchLog.Data.LinkTablePrivateLabel", b =>
{
b.Property<int>("PrivateEntityId")
.HasColumnType("INTEGER");
b.Property<int>("LabelId")
.HasColumnType("INTEGER");
b.HasKey("PrivateEntityId", "LabelId");
b.HasIndex("LabelId");
b.ToTable("LinkTablePrivateLabel");
});
modelBuilder.Entity("CouchLog.Data.LinkTablePrivateStreamingPlatform", b =>
{
b.Property<int>("PrivateEntityId")
.HasColumnType("INTEGER");
b.Property<int>("StreamingPlatformId")
.HasColumnType("INTEGER");
b.Property<int?>("SharedListEntityId")
.HasColumnType("INTEGER");
b.HasKey("PrivateEntityId", "StreamingPlatformId");
b.HasIndex("SharedListEntityId");
b.HasIndex("StreamingPlatformId");
b.ToTable("LinkTablePrivateStreamingPlatform");
});
modelBuilder.Entity("CouchLog.Data.LinkTableSharedLabel", b =>
{
b.Property<int>("SharedListLabelId")
.HasColumnType("INTEGER");
b.Property<int>("SharedListEntityId")
.HasColumnType("INTEGER");
b.HasKey("SharedListLabelId", "SharedListEntityId");
b.HasIndex("SharedListEntityId");
b.ToTable("LinkTableSharedLabel");
});
modelBuilder.Entity("CouchLog.Data.LinkTableSharedUser", b =>
{
b.Property<int>("SharedListId")
.HasColumnType("INTEGER");
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.HasKey("SharedListId", "UserId");
b.HasIndex("UserId");
b.ToTable("LinkTableSharedUser");
});
modelBuilder.Entity("CouchLog.Data.MediaType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("MediaType");
});
modelBuilder.Entity("CouchLog.Data.PrivateEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("TEXT");
b.Property<int?>("Episode")
.HasColumnType("INTEGER");
b.Property<bool>("Favorite")
.HasColumnType("INTEGER");
b.Property<int>("GlobalEntityId")
.HasColumnType("INTEGER");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<int?>("Rating")
.HasColumnType("INTEGER");
b.Property<int?>("Season")
.HasColumnType("INTEGER");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("UserWatchStatusId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("GlobalEntityId");
b.HasIndex("UserId");
b.HasIndex("UserWatchStatusId");
b.ToTable("PrivateEntities");
});
modelBuilder.Entity("CouchLog.Data.SharedList", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("SharedLists");
});
modelBuilder.Entity("CouchLog.Data.SharedListEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("TEXT");
b.Property<int?>("Episode")
.HasColumnType("INTEGER");
b.Property<bool>("Favorite")
.HasColumnType("INTEGER");
b.Property<int>("GlobalEntityId")
.HasColumnType("INTEGER");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<int?>("Season")
.HasColumnType("INTEGER");
b.Property<int>("SharedListId")
.HasColumnType("INTEGER");
b.Property<int?>("SharedWatchStatusId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("GlobalEntityId");
b.HasIndex("SharedListId");
b.HasIndex("SharedWatchStatusId");
b.ToTable("SharedListEntities");
});
modelBuilder.Entity("CouchLog.Data.SharedListLabel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<int>("SharedListId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("SharedListId");
b.ToTable("SharedListLabels");
});
modelBuilder.Entity("CouchLog.Data.SharedWatchStatus", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ColorCode")
.HasMaxLength(7)
.HasColumnType("TEXT");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("Description")
.HasMaxLength(255)
.HasColumnType("TEXT");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<int>("SharedListId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("SharedListId");
b.ToTable("SharedWatchStatuses");
});
modelBuilder.Entity("CouchLog.Data.StreamingPlatform", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<string>("PicturePath")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("StreamingPlatforms");
});
modelBuilder.Entity("CouchLog.Data.UserWatchStatus", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ColorCode")
.HasMaxLength(7)
.HasColumnType("TEXT");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("Description")
.HasMaxLength(255)
.HasColumnType("TEXT");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("UserWatchStatuses");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("ProviderKey")
.HasColumnType("TEXT");
b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("CouchLog.Data.GlobalEntity", b =>
{
b.HasOne("CouchLog.Data.ApplicationUser", "User")
.WithMany("CreatedGlobalEntities")
.HasForeignKey("CreatorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.MediaType", "MediaType")
.WithMany("GlobalEntities")
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("MediaType");
b.Navigation("User");
});
modelBuilder.Entity("CouchLog.Data.Label", b =>
{
b.HasOne("CouchLog.Data.ApplicationUser", "User")
.WithMany("CreatedLabels")
.HasForeignKey("CreatorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("CouchLog.Data.LinkTableGlobalGenre", b =>
{
b.HasOne("CouchLog.Data.Genre", "Genre")
.WithMany("LinkTableGlobalGenres")
.HasForeignKey("GenreId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.GlobalEntity", "GlobalEntity")
.WithMany("LinkTableGlobalGenres")
.HasForeignKey("GlobalEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Genre");
b.Navigation("GlobalEntity");
});
modelBuilder.Entity("CouchLog.Data.LinkTablePrivateLabel", b =>
{
b.HasOne("CouchLog.Data.Label", "Label")
.WithMany("LinkTablePrivateLabels")
.HasForeignKey("LabelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.PrivateEntity", "PrivateEntity")
.WithMany("PrivateEntityLabels")
.HasForeignKey("PrivateEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Label");
b.Navigation("PrivateEntity");
});
modelBuilder.Entity("CouchLog.Data.LinkTablePrivateStreamingPlatform", b =>
{
b.HasOne("CouchLog.Data.PrivateEntity", "PrivateEntity")
.WithMany("PrivateStreamingPlatforms")
.HasForeignKey("PrivateEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.SharedListEntity", null)
.WithMany("LinkTablePrivateStreamingPlatforms")
.HasForeignKey("SharedListEntityId");
b.HasOne("CouchLog.Data.StreamingPlatform", "StreamingPlatform")
.WithMany()
.HasForeignKey("StreamingPlatformId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("PrivateEntity");
b.Navigation("StreamingPlatform");
});
modelBuilder.Entity("CouchLog.Data.LinkTableSharedLabel", b =>
{
b.HasOne("CouchLog.Data.SharedListEntity", "SharedListEntity")
.WithMany("LinkTableSharedLabels")
.HasForeignKey("SharedListEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.SharedListLabel", "SharedListLabel")
.WithMany("LinkTableSharedLabels")
.HasForeignKey("SharedListLabelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("SharedListEntity");
b.Navigation("SharedListLabel");
});
modelBuilder.Entity("CouchLog.Data.LinkTableSharedUser", b =>
{
b.HasOne("CouchLog.Data.SharedList", "SharedList")
.WithMany("SharedListUsers")
.HasForeignKey("SharedListId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.ApplicationUser", "User")
.WithMany("LinkTableSharedUsers")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("SharedList");
b.Navigation("User");
});
modelBuilder.Entity("CouchLog.Data.PrivateEntity", b =>
{
b.HasOne("CouchLog.Data.GlobalEntity", "GlobalEntity")
.WithMany("PrivateEntities")
.HasForeignKey("GlobalEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.ApplicationUser", "User")
.WithMany("PrivateEntities")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.UserWatchStatus", "UserWatchStatus")
.WithMany()
.HasForeignKey("UserWatchStatusId");
b.Navigation("GlobalEntity");
b.Navigation("User");
b.Navigation("UserWatchStatus");
});
modelBuilder.Entity("CouchLog.Data.SharedListEntity", b =>
{
b.HasOne("CouchLog.Data.GlobalEntity", "GlobalEntity")
.WithMany("SharedListEntities")
.HasForeignKey("GlobalEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.SharedList", "SharedList")
.WithMany("SharedListEntities")
.HasForeignKey("SharedListId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.SharedWatchStatus", "SharedWatchStatus")
.WithMany("SharedListEntities")
.HasForeignKey("SharedWatchStatusId");
b.Navigation("GlobalEntity");
b.Navigation("SharedList");
b.Navigation("SharedWatchStatus");
});
modelBuilder.Entity("CouchLog.Data.SharedListLabel", b =>
{
b.HasOne("CouchLog.Data.SharedList", "SharedList")
.WithMany("SharedListLabels")
.HasForeignKey("SharedListId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("SharedList");
});
modelBuilder.Entity("CouchLog.Data.SharedWatchStatus", b =>
{
b.HasOne("CouchLog.Data.SharedList", "SharedList")
.WithMany("SharedWatchStatuses")
.HasForeignKey("SharedListId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("SharedList");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("CouchLog.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("CouchLog.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("CouchLog.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("CouchLog.Data.ApplicationUser", b =>
{
b.Navigation("CreatedGlobalEntities");
b.Navigation("CreatedLabels");
b.Navigation("LinkTableSharedUsers");
b.Navigation("PrivateEntities");
});
modelBuilder.Entity("CouchLog.Data.Genre", b =>
{
b.Navigation("LinkTableGlobalGenres");
});
modelBuilder.Entity("CouchLog.Data.GlobalEntity", b =>
{
b.Navigation("LinkTableGlobalGenres");
b.Navigation("PrivateEntities");
b.Navigation("SharedListEntities");
});
modelBuilder.Entity("CouchLog.Data.Label", b =>
{
b.Navigation("LinkTablePrivateLabels");
});
modelBuilder.Entity("CouchLog.Data.MediaType", b =>
{
b.Navigation("GlobalEntities");
});
modelBuilder.Entity("CouchLog.Data.PrivateEntity", b =>
{
b.Navigation("PrivateEntityLabels");
b.Navigation("PrivateStreamingPlatforms");
});
modelBuilder.Entity("CouchLog.Data.SharedList", b =>
{
b.Navigation("SharedListEntities");
b.Navigation("SharedListLabels");
b.Navigation("SharedListUsers");
b.Navigation("SharedWatchStatuses");
});
modelBuilder.Entity("CouchLog.Data.SharedListEntity", b =>
{
b.Navigation("LinkTablePrivateStreamingPlatforms");
b.Navigation("LinkTableSharedLabels");
});
modelBuilder.Entity("CouchLog.Data.SharedListLabel", b =>
{
b.Navigation("LinkTableSharedLabels");
});
modelBuilder.Entity("CouchLog.Data.SharedWatchStatus", b =>
{
b.Navigation("SharedListEntities");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,34 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CouchLog.Migrations
{
/// <inheritdoc />
public partial class AccountsSettings : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "AccountsSettings",
columns: table => new
{
Id = table.Column<int>(type: "INTEGER", nullable: false)
.Annotation("Sqlite:Autoincrement", true),
IsRegistrationAllowed = table.Column<bool>(type: "INTEGER", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_AccountsSettings", x => x.Id);
});
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "AccountsSettings");
}
}
}

View File

@@ -0,0 +1,992 @@
// <auto-generated />
using System;
using CouchLog.Data;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
#nullable disable
namespace CouchLog.Migrations
{
[DbContext(typeof(ApplicationDbContext))]
[Migration("20260104151950_FixAccountsSettingsKey")]
partial class FixAccountsSettingsKey
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.1");
modelBuilder.Entity("CouchLog.Data.AccountsSettings", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("IsRegistrationAllowed")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("AccountsSettings");
});
modelBuilder.Entity("CouchLog.Data.ApplicationUser", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Email")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<bool>("EmailConfirmed")
.HasColumnType("INTEGER");
b.Property<bool>("LockoutEnabled")
.HasColumnType("INTEGER");
b.Property<DateTimeOffset?>("LockoutEnd")
.HasColumnType("TEXT");
b.Property<string>("NormalizedEmail")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedUserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("PasswordHash")
.HasColumnType("TEXT");
b.Property<string>("PhoneNumber")
.HasColumnType("TEXT");
b.Property<bool>("PhoneNumberConfirmed")
.HasColumnType("INTEGER");
b.Property<string>("SecurityStamp")
.HasColumnType("TEXT");
b.Property<bool>("TwoFactorEnabled")
.HasColumnType("INTEGER");
b.Property<string>("UserName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedEmail")
.HasDatabaseName("EmailIndex");
b.HasIndex("NormalizedUserName")
.IsUnique()
.HasDatabaseName("UserNameIndex");
b.ToTable("AspNetUsers", (string)null);
});
modelBuilder.Entity("CouchLog.Data.CouchLogState", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime?>("InitializationDate")
.HasColumnType("TEXT");
b.Property<bool>("IsInitialized")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("CouchLogState");
});
modelBuilder.Entity("CouchLog.Data.Genre", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Genres");
});
modelBuilder.Entity("CouchLog.Data.GlobalEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("CreatorId")
.IsRequired()
.HasColumnType("TEXT");
b.Property<bool>("IsPrivate")
.HasColumnType("INTEGER");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("PicturePath")
.HasMaxLength(500)
.HasColumnType("TEXT");
b.Property<string>("Title")
.IsRequired()
.HasMaxLength(200)
.HasColumnType("TEXT");
b.Property<int>("TypeId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("CreatorId");
b.HasIndex("TypeId");
b.ToTable("GlobalEntities");
});
modelBuilder.Entity("CouchLog.Data.Label", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("CreatorId")
.IsRequired()
.HasColumnType("TEXT");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("CreatorId");
b.ToTable("Labels");
});
modelBuilder.Entity("CouchLog.Data.LinkTableGlobalGenre", b =>
{
b.Property<int>("GlobalEntityId")
.HasColumnType("INTEGER")
.HasColumnOrder(0);
b.Property<int>("GenreId")
.HasColumnType("INTEGER")
.HasColumnOrder(1);
b.HasKey("GlobalEntityId", "GenreId");
b.HasIndex("GenreId");
b.ToTable("LinkTableGlobalGenre");
});
modelBuilder.Entity("CouchLog.Data.LinkTablePrivateLabel", b =>
{
b.Property<int>("PrivateEntityId")
.HasColumnType("INTEGER");
b.Property<int>("LabelId")
.HasColumnType("INTEGER");
b.HasKey("PrivateEntityId", "LabelId");
b.HasIndex("LabelId");
b.ToTable("LinkTablePrivateLabel");
});
modelBuilder.Entity("CouchLog.Data.LinkTablePrivateStreamingPlatform", b =>
{
b.Property<int>("PrivateEntityId")
.HasColumnType("INTEGER");
b.Property<int>("StreamingPlatformId")
.HasColumnType("INTEGER");
b.Property<int?>("SharedListEntityId")
.HasColumnType("INTEGER");
b.HasKey("PrivateEntityId", "StreamingPlatformId");
b.HasIndex("SharedListEntityId");
b.HasIndex("StreamingPlatformId");
b.ToTable("LinkTablePrivateStreamingPlatform");
});
modelBuilder.Entity("CouchLog.Data.LinkTableSharedLabel", b =>
{
b.Property<int>("SharedListLabelId")
.HasColumnType("INTEGER");
b.Property<int>("SharedListEntityId")
.HasColumnType("INTEGER");
b.HasKey("SharedListLabelId", "SharedListEntityId");
b.HasIndex("SharedListEntityId");
b.ToTable("LinkTableSharedLabel");
});
modelBuilder.Entity("CouchLog.Data.LinkTableSharedUser", b =>
{
b.Property<int>("SharedListId")
.HasColumnType("INTEGER");
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.HasKey("SharedListId", "UserId");
b.HasIndex("UserId");
b.ToTable("LinkTableSharedUser");
});
modelBuilder.Entity("CouchLog.Data.MediaType", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("MediaType");
});
modelBuilder.Entity("CouchLog.Data.PrivateEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("TEXT");
b.Property<int?>("Episode")
.HasColumnType("INTEGER");
b.Property<bool>("Favorite")
.HasColumnType("INTEGER");
b.Property<int>("GlobalEntityId")
.HasColumnType("INTEGER");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<int?>("Rating")
.HasColumnType("INTEGER");
b.Property<int?>("Season")
.HasColumnType("INTEGER");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("UserWatchStatusId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("GlobalEntityId");
b.HasIndex("UserId");
b.HasIndex("UserWatchStatusId");
b.ToTable("PrivateEntities");
});
modelBuilder.Entity("CouchLog.Data.SharedList", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(150)
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("SharedLists");
});
modelBuilder.Entity("CouchLog.Data.SharedListEntity", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("Description")
.HasMaxLength(1000)
.HasColumnType("TEXT");
b.Property<int?>("Episode")
.HasColumnType("INTEGER");
b.Property<bool>("Favorite")
.HasColumnType("INTEGER");
b.Property<int>("GlobalEntityId")
.HasColumnType("INTEGER");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<int?>("Season")
.HasColumnType("INTEGER");
b.Property<int>("SharedListId")
.HasColumnType("INTEGER");
b.Property<int?>("SharedWatchStatusId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("GlobalEntityId");
b.HasIndex("SharedListId");
b.HasIndex("SharedWatchStatusId");
b.ToTable("SharedListEntities");
});
modelBuilder.Entity("CouchLog.Data.SharedListLabel", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<int>("SharedListId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("SharedListId");
b.ToTable("SharedListLabels");
});
modelBuilder.Entity("CouchLog.Data.SharedWatchStatus", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ColorCode")
.HasMaxLength(7)
.HasColumnType("TEXT");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("Description")
.HasMaxLength(255)
.HasColumnType("TEXT");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.Property<int>("SharedListId")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("SharedListId");
b.ToTable("SharedWatchStatuses");
});
modelBuilder.Entity("CouchLog.Data.StreamingPlatform", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(100)
.HasColumnType("TEXT");
b.Property<string>("PicturePath")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("StreamingPlatforms");
});
modelBuilder.Entity("CouchLog.Data.UserWatchStatus", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ColorCode")
.HasMaxLength(7)
.HasColumnType("TEXT");
b.Property<DateTime>("CreationTime")
.HasColumnType("TEXT");
b.Property<string>("Description")
.HasMaxLength(255)
.HasColumnType("TEXT");
b.Property<DateTime?>("LastChange")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasMaxLength(50)
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("UserWatchStatuses");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRole", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.Property<string>("NormalizedName")
.HasMaxLength(256)
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("NormalizedName")
.IsUnique()
.HasDatabaseName("RoleNameIndex");
b.ToTable("AspNetRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("RoleId");
b.ToTable("AspNetRoleClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("ClaimType")
.HasColumnType("TEXT");
b.Property<string>("ClaimValue")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("Id");
b.HasIndex("UserId");
b.ToTable("AspNetUserClaims", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("ProviderKey")
.HasColumnType("TEXT");
b.Property<string>("ProviderDisplayName")
.HasColumnType("TEXT");
b.Property<string>("UserId")
.IsRequired()
.HasColumnType("TEXT");
b.HasKey("LoginProvider", "ProviderKey");
b.HasIndex("UserId");
b.ToTable("AspNetUserLogins", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("RoleId")
.HasColumnType("TEXT");
b.HasKey("UserId", "RoleId");
b.HasIndex("RoleId");
b.ToTable("AspNetUserRoles", (string)null);
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.Property<string>("UserId")
.HasColumnType("TEXT");
b.Property<string>("LoginProvider")
.HasColumnType("TEXT");
b.Property<string>("Name")
.HasColumnType("TEXT");
b.Property<string>("Value")
.HasColumnType("TEXT");
b.HasKey("UserId", "LoginProvider", "Name");
b.ToTable("AspNetUserTokens", (string)null);
});
modelBuilder.Entity("CouchLog.Data.GlobalEntity", b =>
{
b.HasOne("CouchLog.Data.ApplicationUser", "User")
.WithMany("CreatedGlobalEntities")
.HasForeignKey("CreatorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.MediaType", "MediaType")
.WithMany("GlobalEntities")
.HasForeignKey("TypeId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("MediaType");
b.Navigation("User");
});
modelBuilder.Entity("CouchLog.Data.Label", b =>
{
b.HasOne("CouchLog.Data.ApplicationUser", "User")
.WithMany("CreatedLabels")
.HasForeignKey("CreatorId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("User");
});
modelBuilder.Entity("CouchLog.Data.LinkTableGlobalGenre", b =>
{
b.HasOne("CouchLog.Data.Genre", "Genre")
.WithMany("LinkTableGlobalGenres")
.HasForeignKey("GenreId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.GlobalEntity", "GlobalEntity")
.WithMany("LinkTableGlobalGenres")
.HasForeignKey("GlobalEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Genre");
b.Navigation("GlobalEntity");
});
modelBuilder.Entity("CouchLog.Data.LinkTablePrivateLabel", b =>
{
b.HasOne("CouchLog.Data.Label", "Label")
.WithMany("LinkTablePrivateLabels")
.HasForeignKey("LabelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.PrivateEntity", "PrivateEntity")
.WithMany("PrivateEntityLabels")
.HasForeignKey("PrivateEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Label");
b.Navigation("PrivateEntity");
});
modelBuilder.Entity("CouchLog.Data.LinkTablePrivateStreamingPlatform", b =>
{
b.HasOne("CouchLog.Data.PrivateEntity", "PrivateEntity")
.WithMany("PrivateStreamingPlatforms")
.HasForeignKey("PrivateEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.SharedListEntity", null)
.WithMany("LinkTablePrivateStreamingPlatforms")
.HasForeignKey("SharedListEntityId");
b.HasOne("CouchLog.Data.StreamingPlatform", "StreamingPlatform")
.WithMany()
.HasForeignKey("StreamingPlatformId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("PrivateEntity");
b.Navigation("StreamingPlatform");
});
modelBuilder.Entity("CouchLog.Data.LinkTableSharedLabel", b =>
{
b.HasOne("CouchLog.Data.SharedListEntity", "SharedListEntity")
.WithMany("LinkTableSharedLabels")
.HasForeignKey("SharedListEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.SharedListLabel", "SharedListLabel")
.WithMany("LinkTableSharedLabels")
.HasForeignKey("SharedListLabelId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("SharedListEntity");
b.Navigation("SharedListLabel");
});
modelBuilder.Entity("CouchLog.Data.LinkTableSharedUser", b =>
{
b.HasOne("CouchLog.Data.SharedList", "SharedList")
.WithMany("SharedListUsers")
.HasForeignKey("SharedListId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.ApplicationUser", "User")
.WithMany("LinkTableSharedUsers")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("SharedList");
b.Navigation("User");
});
modelBuilder.Entity("CouchLog.Data.PrivateEntity", b =>
{
b.HasOne("CouchLog.Data.GlobalEntity", "GlobalEntity")
.WithMany("PrivateEntities")
.HasForeignKey("GlobalEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.ApplicationUser", "User")
.WithMany("PrivateEntities")
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.UserWatchStatus", "UserWatchStatus")
.WithMany()
.HasForeignKey("UserWatchStatusId");
b.Navigation("GlobalEntity");
b.Navigation("User");
b.Navigation("UserWatchStatus");
});
modelBuilder.Entity("CouchLog.Data.SharedListEntity", b =>
{
b.HasOne("CouchLog.Data.GlobalEntity", "GlobalEntity")
.WithMany("SharedListEntities")
.HasForeignKey("GlobalEntityId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.SharedList", "SharedList")
.WithMany("SharedListEntities")
.HasForeignKey("SharedListId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.SharedWatchStatus", "SharedWatchStatus")
.WithMany("SharedListEntities")
.HasForeignKey("SharedWatchStatusId");
b.Navigation("GlobalEntity");
b.Navigation("SharedList");
b.Navigation("SharedWatchStatus");
});
modelBuilder.Entity("CouchLog.Data.SharedListLabel", b =>
{
b.HasOne("CouchLog.Data.SharedList", "SharedList")
.WithMany("SharedListLabels")
.HasForeignKey("SharedListId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("SharedList");
});
modelBuilder.Entity("CouchLog.Data.SharedWatchStatus", b =>
{
b.HasOne("CouchLog.Data.SharedList", "SharedList")
.WithMany("SharedWatchStatuses")
.HasForeignKey("SharedListId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("SharedList");
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim<string>", b =>
{
b.HasOne("CouchLog.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("CouchLog.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityRole", null)
.WithMany()
.HasForeignKey("RoleId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("CouchLog.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("CouchLog.Data.ApplicationUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("CouchLog.Data.ApplicationUser", b =>
{
b.Navigation("CreatedGlobalEntities");
b.Navigation("CreatedLabels");
b.Navigation("LinkTableSharedUsers");
b.Navigation("PrivateEntities");
});
modelBuilder.Entity("CouchLog.Data.Genre", b =>
{
b.Navigation("LinkTableGlobalGenres");
});
modelBuilder.Entity("CouchLog.Data.GlobalEntity", b =>
{
b.Navigation("LinkTableGlobalGenres");
b.Navigation("PrivateEntities");
b.Navigation("SharedListEntities");
});
modelBuilder.Entity("CouchLog.Data.Label", b =>
{
b.Navigation("LinkTablePrivateLabels");
});
modelBuilder.Entity("CouchLog.Data.MediaType", b =>
{
b.Navigation("GlobalEntities");
});
modelBuilder.Entity("CouchLog.Data.PrivateEntity", b =>
{
b.Navigation("PrivateEntityLabels");
b.Navigation("PrivateStreamingPlatforms");
});
modelBuilder.Entity("CouchLog.Data.SharedList", b =>
{
b.Navigation("SharedListEntities");
b.Navigation("SharedListLabels");
b.Navigation("SharedListUsers");
b.Navigation("SharedWatchStatuses");
});
modelBuilder.Entity("CouchLog.Data.SharedListEntity", b =>
{
b.Navigation("LinkTablePrivateStreamingPlatforms");
b.Navigation("LinkTableSharedLabels");
});
modelBuilder.Entity("CouchLog.Data.SharedListLabel", b =>
{
b.Navigation("LinkTableSharedLabels");
});
modelBuilder.Entity("CouchLog.Data.SharedWatchStatus", b =>
{
b.Navigation("SharedListEntities");
});
#pragma warning restore 612, 618
}
}
}

View File

@@ -0,0 +1,22 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace CouchLog.Migrations
{
/// <inheritdoc />
public partial class FixAccountsSettingsKey : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
}
}
}

View File

@@ -17,6 +17,20 @@ namespace CouchLog.Migrations
#pragma warning disable 612, 618 #pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "10.0.1"); modelBuilder.HasAnnotation("ProductVersion", "10.0.1");
modelBuilder.Entity("CouchLog.Data.AccountsSettings", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("IsRegistrationAllowed")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("AccountsSettings");
});
modelBuilder.Entity("CouchLog.Data.ApplicationUser", b => modelBuilder.Entity("CouchLog.Data.ApplicationUser", b =>
{ {
b.Property<string>("Id") b.Property<string>("Id")
@@ -81,6 +95,23 @@ namespace CouchLog.Migrations
b.ToTable("AspNetUsers", (string)null); b.ToTable("AspNetUsers", (string)null);
}); });
modelBuilder.Entity("CouchLog.Data.CouchLogState", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime?>("InitializationDate")
.HasColumnType("TEXT");
b.Property<bool>("IsInitialized")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("CouchLogState");
});
modelBuilder.Entity("CouchLog.Data.Genre", b => modelBuilder.Entity("CouchLog.Data.Genre", b =>
{ {
b.Property<int>("Id") b.Property<int>("Id")

View File

@@ -1,23 +1,52 @@
using CouchLog.Data; using CouchLog.Data;
using Microsoft.AspNetCore.Identity;
using Microsoft.EntityFrameworkCore;
namespace CouchLog namespace CouchLog
{ {
public class OnStartUp public class OnStartUp(ApplicationDbContext CouchLogDB, RoleManager<IdentityRole> RoleManager)
{ {
private ApplicationDbContext CouchLogDB; private readonly ApplicationDbContext CouchLogDB = CouchLogDB;
private readonly RoleManager<IdentityRole> RoleManager = RoleManager;
public OnStartUp(ApplicationDbContext CouchLogDB) public async Task CreateRoles()
{ {
this.CouchLogDB = CouchLogDB; string[] roleNames = ["Admin", "User"];
IdentityResult roleResult;
foreach (var roleName in roleNames)
{
var roleExist = await RoleManager.RoleExistsAsync(roleName);
if (!roleExist)
{
roleResult = await RoleManager.CreateAsync(new IdentityRole(roleName));
}
}
} }
public void AddBasicDatabaseEntries() public async Task CreateStanardSettings()
{
if(!CouchLogDB.AccountsSettings.Any())
{
AccountsSettings accountsSettings = new()
{
Id = 1,
IsRegistrationAllowed = true,
};
await CouchLogDB.AccountsSettings.AddAsync(accountsSettings);
await CouchLogDB.SaveChangesAsync();
}
}
public async Task AddBasicDatabaseEntries()
{ {
//################## //##################
//### MediaTypes ### //### MediaTypes ###
//################## //##################
List<MediaType> MediaTypes = new List<MediaType> List<MediaType> MediaTypes =
{ [
//Video based //Video based
new() { Name="Movie" }, new() { Name="Movie" },
new() { Name="Series" }, new() { Name="Series" },
@@ -38,23 +67,24 @@ namespace CouchLog
//Text based //Text based
new() { Name = "Book" }, new() { Name = "Book" },
new() { Name = "Comic" }, new() { Name = "Comic" },
}; ];
foreach (MediaType MediaType in MediaTypes) foreach (MediaType MediaType in MediaTypes)
{ {
if(!CouchLogDB.MediaType.Any(m => m.Name == MediaType.Name)) if(!await CouchLogDB.MediaType.AnyAsync(m => m.Name == MediaType.Name))
{ {
CouchLogDB.MediaType.Add(MediaType); await CouchLogDB.MediaType.AddAsync(MediaType);
} }
} }
//############## //##############
//### Genres ### //### Genres ###
//############## //##############
List<Genre> Genres = new List<Genre> List<Genre> Genres =
{ [
new() { Name = "Action", CreationTime = DateTime.Now }, new() { Name = "Action", CreationTime = DateTime.Now },
new() { Name = "Animation", CreationTime = DateTime.Now }, new() { Name = "Animation", CreationTime = DateTime.Now },
new() { Name = "Adventure", CreationTime = DateTime.Now },
new() { Name = "Comedy", CreationTime = DateTime.Now }, new() { Name = "Comedy", CreationTime = DateTime.Now },
new() { Name = "Crime", CreationTime = DateTime.Now }, new() { Name = "Crime", CreationTime = DateTime.Now },
new() { Name = "Drama", CreationTime = DateTime.Now }, new() { Name = "Drama", CreationTime = DateTime.Now },
@@ -69,13 +99,13 @@ namespace CouchLog
new() { Name = "Thriller", CreationTime = DateTime.Now }, new() { Name = "Thriller", CreationTime = DateTime.Now },
new() { Name = "War", CreationTime = DateTime.Now }, new() { Name = "War", CreationTime = DateTime.Now },
new() { Name = "Western", CreationTime = DateTime.Now }, new() { Name = "Western", CreationTime = DateTime.Now },
}; ];
foreach(Genre Genre in Genres) foreach(Genre Genre in Genres)
{ {
if(!CouchLogDB.Genres.Any(m => m.Name == Genre.Name)) if(! await CouchLogDB.Genres.AnyAsync(m => m.Name == Genre.Name))
{ {
CouchLogDB.Genres.Add(Genre); await CouchLogDB.Genres.AddAsync(Genre);
} }
} }
@@ -83,8 +113,8 @@ namespace CouchLog
//########################## //##########################
//### StreamingPlatforms ### //### StreamingPlatforms ###
//########################## //##########################
List<StreamingPlatform> StreamingPlatforms = new List<StreamingPlatform> List<StreamingPlatform> StreamingPlatforms =
{ [
new() { Name = "Netflix", PicturePath="StreamingPlatforms/Netflix.png", CreationTime = DateTime.Now }, new() { Name = "Netflix", PicturePath="StreamingPlatforms/Netflix.png", CreationTime = DateTime.Now },
new() { Name = "Prime Video", PicturePath="StreamingPlatforms/Prime-Video.png", CreationTime = DateTime.Now }, new() { Name = "Prime Video", PicturePath="StreamingPlatforms/Prime-Video.png", CreationTime = DateTime.Now },
new() { Name = "Disney+", PicturePath="StreamingPlatforms/Disney+.png", CreationTime = DateTime.Now }, new() { Name = "Disney+", PicturePath="StreamingPlatforms/Disney+.png", CreationTime = DateTime.Now },
@@ -92,38 +122,37 @@ namespace CouchLog
new() { Name = "WOW TV", PicturePath="StreamingPlatforms/WOWTV.png", CreationTime = DateTime.Now }, new() { Name = "WOW TV", PicturePath="StreamingPlatforms/WOWTV.png", CreationTime = DateTime.Now },
new() { Name = "Paramount+", PicturePath="StreamingPlatforms/Paramount+.png", CreationTime = DateTime.Now }, new() { Name = "Paramount+", PicturePath="StreamingPlatforms/Paramount+.png", CreationTime = DateTime.Now },
new() { Name = "Joyn", PicturePath="StreamingPlatforms/Joyn.png", CreationTime = DateTime.Now }, new() { Name = "Joyn", PicturePath="StreamingPlatforms/Joyn.png", CreationTime = DateTime.Now },
}; ];
foreach(StreamingPlatform StreamingPlatform in StreamingPlatforms) foreach(StreamingPlatform StreamingPlatform in StreamingPlatforms)
{ {
if(!CouchLogDB.StreamingPlatforms.Any(m => m.Name == StreamingPlatform.Name)) if(! await CouchLogDB.StreamingPlatforms.AnyAsync(m => m.Name == StreamingPlatform.Name))
{ {
CouchLogDB.StreamingPlatforms.Add(StreamingPlatform); await CouchLogDB.StreamingPlatforms.AddAsync(StreamingPlatform);
} }
} }
//########################## //##########################
//###### WatchStates ####### //###### WatchStates #######
//########################## //##########################
List<UserWatchStatus> UserWatchStatuses = new List<UserWatchStatus> List<UserWatchStatus> UserWatchStatuses =
{ [
new() { Name = "Not watched", CreationTime = DateTime.Now }, new() { Name = "Not watched", CreationTime = DateTime.Now },
new() { Name = "Started", CreationTime = DateTime.Now }, new() { Name = "Started", CreationTime = DateTime.Now },
new() { Name = "Finished", CreationTime = DateTime.Now }, new() { Name = "Finished", CreationTime = DateTime.Now },
new() { Name = "Paused", CreationTime = DateTime.Now }, new() { Name = "Paused", CreationTime = DateTime.Now },
new() { Name = "Aborted", CreationTime= DateTime.Now }, new() { Name = "Aborted", CreationTime= DateTime.Now },
}; ];
foreach(UserWatchStatus UserWatchStatus in UserWatchStatuses) foreach(UserWatchStatus UserWatchStatus in UserWatchStatuses)
{ {
if(!CouchLogDB.UserWatchStatuses.Any(m => m.Name == UserWatchStatus.Name)) if(! await CouchLogDB.UserWatchStatuses.AnyAsync(m => m.Name == UserWatchStatus.Name))
{ {
CouchLogDB.UserWatchStatuses.Add(UserWatchStatus); await CouchLogDB.UserWatchStatuses.AddAsync(UserWatchStatus);
} }
} }
await CouchLogDB.SaveChangesAsync();
CouchLogDB.SaveChanges();
} }
} }
} }

View File

@@ -65,91 +65,12 @@ using (var scope = app.Services.CreateScope())
var CouchLogDB = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>(); var CouchLogDB = scope.ServiceProvider.GetRequiredService<ApplicationDbContext>();
CouchLogDB.Database.Migrate(); CouchLogDB.Database.Migrate();
var roleManager = scope.ServiceProvider.GetRequiredService<RoleManager<IdentityRole>>(); var RoleManager = scope.ServiceProvider.GetRequiredService<RoleManager<IdentityRole>>();
var userManager = scope.ServiceProvider.GetRequiredService<UserManager<ApplicationUser>>();
string[] roleNames = { "Admin", "User" }; OnStartUp onStartUp = new(CouchLogDB, RoleManager);
IdentityResult roleResult; await onStartUp.CreateRoles();
await onStartUp.AddBasicDatabaseEntries();
foreach (var roleName in roleNames) await onStartUp.CreateStanardSettings();
{
var roleExist = await roleManager.RoleExistsAsync(roleName);
if (!roleExist)
{
roleResult = await roleManager.CreateAsync(new IdentityRole(roleName));
}
}
var adminUsername = "Admin";
var normalUsername = "User";
var adminPassword = "EinSehrSicheresPasswort123!";
var adminUser = await userManager.FindByNameAsync(adminUsername);
var normalUser = await userManager.FindByNameAsync(normalUsername);
if (adminUser == null)
{
adminUser = new ApplicationUser
{
UserName = adminUsername,
EmailConfirmed = true
};
var createResult = await userManager.CreateAsync(adminUser, adminPassword);
if (createResult.Succeeded)
{
await userManager.AddToRoleAsync(adminUser, "Admin");
}
}
else if (normalUser == null)
{
normalUser = new ApplicationUser
{
UserName = normalUsername,
EmailConfirmed = true
};
var createResult = await userManager.CreateAsync(normalUser, adminPassword);
if (createResult.Succeeded)
{
await userManager.AddToRoleAsync(adminUser, "User");
}
}
else if (!await userManager.IsInRoleAsync(normalUser, "User"))
{
await userManager.AddToRoleAsync(normalUser, "User");
}
else if (!await userManager.IsInRoleAsync(adminUser, "Admin"))
{
await userManager.AddToRoleAsync(adminUser, "Admin");
}
MediaType mediaType = new()
{
Name = "Movie"
};
if (!CouchLogDB.MediaType.Any())
CouchLogDB.MediaType.Add(mediaType);
await CouchLogDB.SaveChangesAsync();
GlobalEntity globalEntity = new()
{
Title = "Inception",
CreationTime = DateTime.Now,
CreatorId = (await userManager.FindByNameAsync("Admin"))!.Id,
TypeId = 1,
PicturePath = "Pictures/Inception.jpg"
};
if (!CouchLogDB.GlobalEntities.Any())
CouchLogDB.GlobalEntities.Add(globalEntity);
await CouchLogDB.SaveChangesAsync();
OnStartUp onStartUp = new(CouchLogDB);
onStartUp.AddBasicDatabaseEntries();
} }
app.Run(); app.Run();