Name zu Sesssions-Klasse hinzugefügt

This commit is contained in:
BuildTools 2024-06-26 20:35:18 +02:00
parent da87abc703
commit 620d3794a6
5 changed files with 610 additions and 4 deletions

View File

@ -4,11 +4,11 @@
{ {
public int Id { get; set; } public int Id { get; set; }
public string Name { get; set; } = "Unbenannte Session";
public string? SessionCode { get; set; } public string? SessionCode { get; set; }
public bool Active { get; set; } public bool Active { get; set; }
public List<Library> EnabledLibraries { get; set; } = null!; public List<Library> EnabledLibraries { get; set; } = null!;
public List<QueuedSong> QueuedSongs { get; set; } = null!; public List<QueuedSong> QueuedSongs { get; set; } = null!;
public DateTime Created { get; set; } = DateTime.Now; public DateTime Created { get; set; } = DateTime.Now;
} }
} }

View File

@ -0,0 +1,559 @@
// <auto-generated />
using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Infrastructure;
using Microsoft.EntityFrameworkCore.Migrations;
using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
using songrequests_blazor.Data;
#nullable disable
namespace songrequests_blazor.Migrations
{
[DbContext(typeof(LocalDbContext))]
[Migration("20240626183259_AddSessionName")]
partial class AddSessionName
{
/// <inheritdoc />
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
modelBuilder.HasAnnotation("ProductVersion", "8.0.5");
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);
b.HasData(
new
{
Id = "fc985a25-19ce-48ed-8443-c845f550960a",
Name = "Administrator",
NormalizedName = "ADMINISTRATOR"
});
});
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.IdentityUser", b =>
{
b.Property<string>("Id")
.HasColumnType("TEXT");
b.Property<int>("AccessFailedCount")
.HasColumnType("INTEGER");
b.Property<string>("ConcurrencyStamp")
.IsConcurrencyToken()
.HasColumnType("TEXT");
b.Property<string>("Discriminator")
.IsRequired()
.HasMaxLength(13)
.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);
b.HasDiscriminator<string>("Discriminator").HasValue("IdentityUser");
b.UseTphMappingStrategy();
b.HasData(
new
{
Id = "5c2511d0-6a08-4950-babd-d107996749ba",
AccessFailedCount = 0,
ConcurrencyStamp = "7d7fc619-fde4-408c-8816-f4ed5f68a60e",
Email = "admin@admin.com",
EmailConfirmed = false,
LockoutEnabled = false,
NormalizedEmail = "ADMIN@ADMIN.COM",
NormalizedUserName = "ADMIN@ADMIN.COM",
PasswordHash = "AQAAAAIAAYagAAAAECVwoHKYEXKRa9Sp3UeNNeVSEZOUkCEVkYcF09ZOVlLm9VeDEoX8M9NzwegIk0EWrw==",
PhoneNumberConfirmed = false,
SecurityStamp = "10af871c-53d6-4dfc-9e69-5d3a97d8a016",
TwoFactorEnabled = false,
UserName = "admin@admin.com"
});
});
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);
b.HasData(
new
{
UserId = "5c2511d0-6a08-4950-babd-d107996749ba",
RoleId = "fc985a25-19ce-48ed-8443-c845f550960a"
});
});
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("QueuedSongs_UserVotes", b =>
{
b.Property<string>("UserVotesId")
.HasColumnType("TEXT");
b.Property<int>("VotedSongsId")
.HasColumnType("INTEGER");
b.HasKey("UserVotesId", "VotedSongsId");
b.HasIndex("VotedSongsId");
b.ToTable("QueuedSongs_UserVotes");
});
modelBuilder.Entity("Sessions_Libraries", b =>
{
b.Property<int>("EnabledLibrariesId")
.HasColumnType("INTEGER");
b.Property<int>("UsedInSessionsId")
.HasColumnType("INTEGER");
b.HasKey("EnabledLibrariesId", "UsedInSessionsId");
b.HasIndex("UsedInSessionsId");
b.ToTable("Sessions_Libraries");
});
modelBuilder.Entity("songrequests_blazor.Data.Library", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("ScanPaths")
.HasColumnType("TEXT");
b.Property<int>("Type")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.ToTable("Libraries");
});
modelBuilder.Entity("songrequests_blazor.Data.QueuedSong", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<DateTime>("Added")
.HasColumnType("TEXT");
b.Property<string>("AddedBy_User_ID")
.HasColumnType("TEXT");
b.Property<DateTime?>("Played")
.HasColumnType("TEXT");
b.Property<int>("Position")
.HasColumnType("INTEGER");
b.Property<int>("Session_ID")
.HasColumnType("INTEGER");
b.Property<int>("Song_ID")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("AddedBy_User_ID");
b.HasIndex("Session_ID");
b.HasIndex("Song_ID");
b.ToTable("QueuedSongs");
});
modelBuilder.Entity("songrequests_blazor.Data.Session", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<bool>("Active")
.HasColumnType("INTEGER");
b.Property<DateTime>("Created")
.HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("SessionCode")
.HasColumnType("TEXT");
b.HasKey("Id");
b.ToTable("Sessions");
});
modelBuilder.Entity("songrequests_blazor.Data.Song", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("INTEGER");
b.Property<string>("Album")
.HasColumnType("TEXT");
b.Property<string>("Artist")
.HasColumnType("TEXT");
b.Property<string>("Genre")
.HasColumnType("TEXT");
b.Property<TimeSpan>("Length")
.HasColumnType("TEXT");
b.Property<int>("Library_ID")
.HasColumnType("INTEGER");
b.Property<int>("RequestCount")
.HasColumnType("INTEGER");
b.Property<string>("Title")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("Uri")
.IsRequired()
.HasColumnType("TEXT");
b.Property<int?>("Year")
.HasColumnType("INTEGER");
b.HasKey("Id");
b.HasIndex("Library_ID");
b.ToTable("Songs");
});
modelBuilder.Entity("songrequests_blazor.Data.User", b =>
{
b.HasBaseType("Microsoft.AspNetCore.Identity.IdentityUser");
b.HasDiscriminator().HasValue("User");
});
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("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", 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("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken<string>", b =>
{
b.HasOne("Microsoft.AspNetCore.Identity.IdentityUser", null)
.WithMany()
.HasForeignKey("UserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("QueuedSongs_UserVotes", b =>
{
b.HasOne("songrequests_blazor.Data.User", null)
.WithMany()
.HasForeignKey("UserVotesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("songrequests_blazor.Data.QueuedSong", null)
.WithMany()
.HasForeignKey("VotedSongsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("Sessions_Libraries", b =>
{
b.HasOne("songrequests_blazor.Data.Library", null)
.WithMany()
.HasForeignKey("EnabledLibrariesId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("songrequests_blazor.Data.Session", null)
.WithMany()
.HasForeignKey("UsedInSessionsId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
});
modelBuilder.Entity("songrequests_blazor.Data.QueuedSong", b =>
{
b.HasOne("songrequests_blazor.Data.User", "AdddedBy")
.WithMany("AddedSongs")
.HasForeignKey("AddedBy_User_ID")
.HasConstraintName("FK_user_addedsongs");
b.HasOne("songrequests_blazor.Data.Session", "Session")
.WithMany("QueuedSongs")
.HasForeignKey("Session_ID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("FK_Session_QueuedSongs");
b.HasOne("songrequests_blazor.Data.Song", "Song")
.WithMany("Queued")
.HasForeignKey("Song_ID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("FK_queuedsongs_song");
b.Navigation("AdddedBy");
b.Navigation("Session");
b.Navigation("Song");
});
modelBuilder.Entity("songrequests_blazor.Data.Song", b =>
{
b.HasOne("songrequests_blazor.Data.Library", "Library")
.WithMany("Songs")
.HasForeignKey("Library_ID")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired()
.HasConstraintName("FK_library_songs");
b.Navigation("Library");
});
modelBuilder.Entity("songrequests_blazor.Data.Library", b =>
{
b.Navigation("Songs");
});
modelBuilder.Entity("songrequests_blazor.Data.Session", b =>
{
b.Navigation("QueuedSongs");
});
modelBuilder.Entity("songrequests_blazor.Data.Song", b =>
{
b.Navigation("Queued");
});
modelBuilder.Entity("songrequests_blazor.Data.User", b =>
{
b.Navigation("AddedSongs");
});
#pragma warning restore 612, 618
}
}
}

View File

@ -0,0 +1,43 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace songrequests_blazor.Migrations
{
/// <inheritdoc />
public partial class AddSessionName : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<string>(
name: "Name",
table: "Sessions",
type: "TEXT",
nullable: false,
defaultValue: "");
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "5c2511d0-6a08-4950-babd-d107996749ba",
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "7d7fc619-fde4-408c-8816-f4ed5f68a60e", "AQAAAAIAAYagAAAAECVwoHKYEXKRa9Sp3UeNNeVSEZOUkCEVkYcF09ZOVlLm9VeDEoX8M9NzwegIk0EWrw==", "10af871c-53d6-4dfc-9e69-5d3a97d8a016" });
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Name",
table: "Sessions");
migrationBuilder.UpdateData(
table: "AspNetUsers",
keyColumn: "Id",
keyValue: "5c2511d0-6a08-4950-babd-d107996749ba",
columns: new[] { "ConcurrencyStamp", "PasswordHash", "SecurityStamp" },
values: new object[] { "359200b3-8f0c-4984-9cb3-f5c6a9957d17", "AQAAAAIAAYagAAAAEObqrKlqsiNSIYErkAsuP7gY+2YW6//ZJ+/txgRXK8rj/8I1eizYiKoWPHANqBNHgA==", "eac1c0ae-b1db-4b57-84db-4cbc0f7d0688" });
}
}
}

View File

@ -151,15 +151,15 @@ namespace songrequests_blazor.Migrations
{ {
Id = "5c2511d0-6a08-4950-babd-d107996749ba", Id = "5c2511d0-6a08-4950-babd-d107996749ba",
AccessFailedCount = 0, AccessFailedCount = 0,
ConcurrencyStamp = "359200b3-8f0c-4984-9cb3-f5c6a9957d17", ConcurrencyStamp = "7d7fc619-fde4-408c-8816-f4ed5f68a60e",
Email = "admin@admin.com", Email = "admin@admin.com",
EmailConfirmed = false, EmailConfirmed = false,
LockoutEnabled = false, LockoutEnabled = false,
NormalizedEmail = "ADMIN@ADMIN.COM", NormalizedEmail = "ADMIN@ADMIN.COM",
NormalizedUserName = "ADMIN@ADMIN.COM", NormalizedUserName = "ADMIN@ADMIN.COM",
PasswordHash = "AQAAAAIAAYagAAAAEObqrKlqsiNSIYErkAsuP7gY+2YW6//ZJ+/txgRXK8rj/8I1eizYiKoWPHANqBNHgA==", PasswordHash = "AQAAAAIAAYagAAAAECVwoHKYEXKRa9Sp3UeNNeVSEZOUkCEVkYcF09ZOVlLm9VeDEoX8M9NzwegIk0EWrw==",
PhoneNumberConfirmed = false, PhoneNumberConfirmed = false,
SecurityStamp = "eac1c0ae-b1db-4b57-84db-4cbc0f7d0688", SecurityStamp = "10af871c-53d6-4dfc-9e69-5d3a97d8a016",
TwoFactorEnabled = false, TwoFactorEnabled = false,
UserName = "admin@admin.com" UserName = "admin@admin.com"
}); });
@ -349,6 +349,10 @@ namespace songrequests_blazor.Migrations
b.Property<DateTime>("Created") b.Property<DateTime>("Created")
.HasColumnType("TEXT"); .HasColumnType("TEXT");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("TEXT");
b.Property<string>("SessionCode") b.Property<string>("SessionCode")
.HasColumnType("TEXT"); .HasColumnType("TEXT");

Binary file not shown.