diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index cd01791..e71b6b9 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,19 +3,19 @@ "isRoot": true, "tools": { "dotnet-ef": { - "version": "5.0.9", + "version": "6.0.1", "commands": [ "dotnet-ef" ] }, "dotnet-format": { - "version": "5.0.211103", + "version": "5.1.250801", "commands": [ "dotnet-format" ] }, "dotnet-aspnet-codegenerator": { - "version": "5.0.2", + "version": "6.0.1", "commands": [ "dotnet-aspnet-codegenerator" ] diff --git a/SpeiderappAPI/Migrations/20210830202724_initial.Designer.cs b/SpeiderappAPI/Migrations/20210830202724_initial.Designer.cs index a9b90d9..de102ec 100644 --- a/SpeiderappAPI/Migrations/20210830202724_initial.Designer.cs +++ b/SpeiderappAPI/Migrations/20210830202724_initial.Designer.cs @@ -72,21 +72,21 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) RequirementID = -2L, AuthorID = -1L, Description = "Actually chop wood", - PublishTime = new DateTime(2021, 8, 30, 22, 27, 23, 271, DateTimeKind.Local).AddTicks(2065) + PublishTime = new DateTime(2021, 8, 30, 22, 27, 23, 271, DateTimeKind.Unspecified).AddTicks(2065) }, new { RequirementID = -5L, AuthorID = -1L, Description = "Stoff-handling", - PublishTime = new DateTime(2021, 8, 28, 22, 27, 23, 271, DateTimeKind.Local).AddTicks(2186) + PublishTime = new DateTime(2021, 8, 28, 22, 27, 23, 271, DateTimeKind.Unspecified).AddTicks(2186) }, new { RequirementID = -6L, AuthorID = -3L, Description = "Sytråd-shopping", - PublishTime = new DateTime(2021, 8, 30, 7, 27, 23, 271, DateTimeKind.Local).AddTicks(2196) + PublishTime = new DateTime(2021, 8, 30, 7, 27, 23, 271, DateTimeKind.Unspecified).AddTicks(2196) }); }); @@ -270,7 +270,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) RequirementID = -1L, AuthorID = -1L, Description = "This is a cool badge for chucking wood.", - PublishTime = new DateTime(2021, 8, 30, 22, 27, 23, 270, DateTimeKind.Local).AddTicks(6919), + PublishTime = new DateTime(2021, 8, 30, 22, 27, 23, 270, DateTimeKind.Unspecified).AddTicks(6919), Image = "3aas!2d=", Title = "Woodchuck" }, @@ -279,7 +279,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) RequirementID = -3L, AuthorID = -2L, Description = "Beskrivende test-tekst", - PublishTime = new DateTime(2021, 8, 30, 22, 27, 23, 271, DateTimeKind.Local).AddTicks(1704), + PublishTime = new DateTime(2021, 8, 30, 22, 27, 23, 271, DateTimeKind.Unspecified).AddTicks(1704), Image = "http://placekitten.com/g/200/300", Title = "Testing" }, @@ -288,7 +288,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) RequirementID = -4L, AuthorID = -1L, Description = "Hobby-baserte aktiviteter for alle aldre", - PublishTime = new DateTime(2021, 8, 27, 20, 27, 23, 271, DateTimeKind.Utc).AddTicks(1750), + PublishTime = new DateTime(2021, 8, 27, 20, 27, 23, 271, DateTimeKind.Unspecified).AddTicks(1750), Image = "http://placekitten.com/g/200/200", Title = "Hobby" }); diff --git a/SpeiderappAPI/Migrations/20210830202724_initial.cs b/SpeiderappAPI/Migrations/20210830202724_initial.cs index b07c6ce..bee3cd4 100644 --- a/SpeiderappAPI/Migrations/20210830202724_initial.cs +++ b/SpeiderappAPI/Migrations/20210830202724_initial.cs @@ -166,8 +166,8 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: new[] { "RequirementID", "AuthorID", "Description", "Discriminator", "Image", "PublishTime", "Title" }, values: new object[,] { - { -1L, -1L, "This is a cool badge for chucking wood.", "Badge", "3aas!2d=", new DateTime(2021, 8, 30, 22, 27, 23, 270, DateTimeKind.Local).AddTicks(6919), "Woodchuck" }, - { -4L, -1L, "Hobby-baserte aktiviteter for alle aldre", "Badge", "http://placekitten.com/g/200/200", new DateTime(2021, 8, 27, 20, 27, 23, 271, DateTimeKind.Utc).AddTicks(1750), "Hobby" } + { -1L, -1L, "This is a cool badge for chucking wood.", "Badge", "3aas!2d=", new DateTime(2021, 8, 30, 22, 27, 23, 270, DateTimeKind.Unspecified).AddTicks(6919), "Woodchuck" }, + { -4L, -1L, "Hobby-baserte aktiviteter for alle aldre", "Badge", "http://placekitten.com/g/200/200", new DateTime(2021, 8, 27, 20, 27, 23, 271, DateTimeKind.Unspecified).AddTicks(1750), "Hobby" } }); migrationBuilder.InsertData( @@ -175,19 +175,19 @@ protected override void Up(MigrationBuilder migrationBuilder) columns: new[] { "RequirementID", "AuthorID", "Description", "Discriminator", "PublishTime" }, values: new object[,] { - { -2L, -1L, "Actually chop wood", "Requirement", new DateTime(2021, 8, 30, 22, 27, 23, 271, DateTimeKind.Local).AddTicks(2065) }, - { -5L, -1L, "Stoff-handling", "Requirement", new DateTime(2021, 8, 28, 22, 27, 23, 271, DateTimeKind.Local).AddTicks(2186) } + { -2L, -1L, "Actually chop wood", "Requirement", new DateTime(2021, 8, 30, 22, 27, 23, 271, DateTimeKind.Unspecified).AddTicks(2065) }, + { -5L, -1L, "Stoff-handling", "Requirement", new DateTime(2021, 8, 28, 22, 27, 23, 271, DateTimeKind.Unspecified).AddTicks(2186) } }); migrationBuilder.InsertData( table: "Requirements", columns: new[] { "RequirementID", "AuthorID", "Description", "Discriminator", "Image", "PublishTime", "Title" }, - values: new object[] { -3L, -2L, "Beskrivende test-tekst", "Badge", "http://placekitten.com/g/200/300", new DateTime(2021, 8, 30, 22, 27, 23, 271, DateTimeKind.Local).AddTicks(1704), "Testing" }); + values: new object[] { -3L, -2L, "Beskrivende test-tekst", "Badge", "http://placekitten.com/g/200/300", new DateTime(2021, 8, 30, 22, 27, 23, 271, DateTimeKind.Unspecified).AddTicks(1704), "Testing" }); migrationBuilder.InsertData( table: "Requirements", columns: new[] { "RequirementID", "AuthorID", "Description", "Discriminator", "PublishTime" }, - values: new object[] { -6L, -3L, "Sytråd-shopping", "Requirement", new DateTime(2021, 8, 30, 7, 27, 23, 271, DateTimeKind.Local).AddTicks(2196) }); + values: new object[] { -6L, -3L, "Sytråd-shopping", "Requirement", new DateTime(2021, 8, 30, 7, 27, 23, 271, DateTimeKind.Unspecified).AddTicks(2196) }); migrationBuilder.InsertData( table: "RequirementPrerequisites", diff --git a/SpeiderappAPI/Migrations/20211008172734_nullability_fix.Designer.cs b/SpeiderappAPI/Migrations/20211008172734_nullability_fix.Designer.cs index ce94686..9a09a93 100644 --- a/SpeiderappAPI/Migrations/20211008172734_nullability_fix.Designer.cs +++ b/SpeiderappAPI/Migrations/20211008172734_nullability_fix.Designer.cs @@ -72,21 +72,21 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) RequirementID = -2L, AuthorID = -1L, Description = "Actually chop wood", - PublishTime = new DateTime(2021, 10, 8, 19, 27, 33, 816, DateTimeKind.Local).AddTicks(5283) + PublishTime = new DateTime(2021, 10, 8, 19, 27, 33, 816, DateTimeKind.Unspecified).AddTicks(5283) }, new { RequirementID = -5L, AuthorID = -1L, Description = "Stoff-handling", - PublishTime = new DateTime(2021, 10, 6, 19, 27, 33, 816, DateTimeKind.Local).AddTicks(5357) + PublishTime = new DateTime(2021, 10, 6, 19, 27, 33, 816, DateTimeKind.Unspecified).AddTicks(5357) }, new { RequirementID = -6L, AuthorID = -3L, Description = "Sytråd-shopping", - PublishTime = new DateTime(2021, 10, 8, 4, 27, 33, 816, DateTimeKind.Local).AddTicks(5365) + PublishTime = new DateTime(2021, 10, 8, 4, 27, 33, 816, DateTimeKind.Unspecified).AddTicks(5365) }); }); @@ -270,7 +270,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) RequirementID = -1L, AuthorID = -1L, Description = "This is a cool badge for chucking wood.", - PublishTime = new DateTime(2021, 10, 8, 19, 27, 33, 816, DateTimeKind.Local).AddTicks(3685), + PublishTime = new DateTime(2021, 10, 8, 19, 27, 33, 816, DateTimeKind.Unspecified).AddTicks(3685), Image = "3aas!2d=", Title = "Woodchuck" }, @@ -279,7 +279,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) RequirementID = -3L, AuthorID = -2L, Description = "Beskrivende test-tekst", - PublishTime = new DateTime(2021, 10, 8, 19, 27, 33, 816, DateTimeKind.Local).AddTicks(5059), + PublishTime = new DateTime(2021, 10, 8, 19, 27, 33, 816, DateTimeKind.Unspecified).AddTicks(5059), Image = "http://placekitten.com/g/200/300", Title = "Testing" }, @@ -288,7 +288,7 @@ protected override void BuildTargetModel(ModelBuilder modelBuilder) RequirementID = -4L, AuthorID = -1L, Description = "Hobby-baserte aktiviteter for alle aldre", - PublishTime = new DateTime(2021, 10, 5, 17, 27, 33, 816, DateTimeKind.Utc).AddTicks(5079), + PublishTime = new DateTime(2021, 10, 5, 17, 27, 33, 816, DateTimeKind.Unspecified).AddTicks(5079), Image = "http://placekitten.com/g/200/200", Title = "Hobby" }); diff --git a/SpeiderappAPI/Migrations/20211008172734_nullability_fix.cs b/SpeiderappAPI/Migrations/20211008172734_nullability_fix.cs index 6c552a0..b650a28 100644 --- a/SpeiderappAPI/Migrations/20211008172734_nullability_fix.cs +++ b/SpeiderappAPI/Migrations/20211008172734_nullability_fix.cs @@ -12,42 +12,42 @@ protected override void Up(MigrationBuilder migrationBuilder) keyColumn: "RequirementID", keyValue: -4L, column: "PublishTime", - value: new DateTime(2021, 10, 5, 17, 27, 33, 816, DateTimeKind.Utc).AddTicks(5079)); + value: new DateTime(2021, 10, 5, 17, 27, 33, 816, DateTimeKind.Unspecified).AddTicks(5079)); migrationBuilder.UpdateData( table: "Requirements", keyColumn: "RequirementID", keyValue: -3L, column: "PublishTime", - value: new DateTime(2021, 10, 8, 19, 27, 33, 816, DateTimeKind.Local).AddTicks(5059)); + value: new DateTime(2021, 10, 8, 19, 27, 33, 816, DateTimeKind.Unspecified).AddTicks(5059)); migrationBuilder.UpdateData( table: "Requirements", keyColumn: "RequirementID", keyValue: -1L, column: "PublishTime", - value: new DateTime(2021, 10, 8, 19, 27, 33, 816, DateTimeKind.Local).AddTicks(3685)); + value: new DateTime(2021, 10, 8, 19, 27, 33, 816, DateTimeKind.Unspecified).AddTicks(3685)); migrationBuilder.UpdateData( table: "Requirements", keyColumn: "RequirementID", keyValue: -6L, column: "PublishTime", - value: new DateTime(2021, 10, 8, 4, 27, 33, 816, DateTimeKind.Local).AddTicks(5365)); + value: new DateTime(2021, 10, 8, 4, 27, 33, 816, DateTimeKind.Unspecified).AddTicks(5365)); migrationBuilder.UpdateData( table: "Requirements", keyColumn: "RequirementID", keyValue: -5L, column: "PublishTime", - value: new DateTime(2021, 10, 6, 19, 27, 33, 816, DateTimeKind.Local).AddTicks(5357)); + value: new DateTime(2021, 10, 6, 19, 27, 33, 816, DateTimeKind.Unspecified).AddTicks(5357)); migrationBuilder.UpdateData( table: "Requirements", keyColumn: "RequirementID", keyValue: -2L, column: "PublishTime", - value: new DateTime(2021, 10, 8, 19, 27, 33, 816, DateTimeKind.Local).AddTicks(5283)); + value: new DateTime(2021, 10, 8, 19, 27, 33, 816, DateTimeKind.Unspecified).AddTicks(5283)); } protected override void Down(MigrationBuilder migrationBuilder) @@ -57,42 +57,42 @@ protected override void Down(MigrationBuilder migrationBuilder) keyColumn: "RequirementID", keyValue: -4L, column: "PublishTime", - value: new DateTime(2021, 10, 5, 17, 25, 42, 845, DateTimeKind.Utc).AddTicks(5525)); + value: new DateTime(2021, 10, 5, 17, 25, 42, 845, DateTimeKind.Unspecified).AddTicks(5525)); migrationBuilder.UpdateData( table: "Requirements", keyColumn: "RequirementID", keyValue: -3L, column: "PublishTime", - value: new DateTime(2021, 10, 8, 19, 25, 42, 845, DateTimeKind.Local).AddTicks(5507)); + value: new DateTime(2021, 10, 8, 19, 25, 42, 845, DateTimeKind.Unspecified).AddTicks(5507)); migrationBuilder.UpdateData( table: "Requirements", keyColumn: "RequirementID", keyValue: -1L, column: "PublishTime", - value: new DateTime(2021, 10, 8, 19, 25, 42, 845, DateTimeKind.Local).AddTicks(4632)); + value: new DateTime(2021, 10, 8, 19, 25, 42, 845, DateTimeKind.Unspecified).AddTicks(4632)); migrationBuilder.UpdateData( table: "Requirements", keyColumn: "RequirementID", keyValue: -6L, column: "PublishTime", - value: new DateTime(2021, 10, 8, 4, 25, 42, 845, DateTimeKind.Local).AddTicks(5710)); + value: new DateTime(2021, 10, 8, 4, 25, 42, 845, DateTimeKind.Unspecified).AddTicks(5710)); migrationBuilder.UpdateData( table: "Requirements", keyColumn: "RequirementID", keyValue: -5L, column: "PublishTime", - value: new DateTime(2021, 10, 6, 19, 25, 42, 845, DateTimeKind.Local).AddTicks(5706)); + value: new DateTime(2021, 10, 6, 19, 25, 42, 845, DateTimeKind.Unspecified).AddTicks(5706)); migrationBuilder.UpdateData( table: "Requirements", keyColumn: "RequirementID", keyValue: -2L, column: "PublishTime", - value: new DateTime(2021, 10, 8, 19, 25, 42, 845, DateTimeKind.Local).AddTicks(5668)); + value: new DateTime(2021, 10, 8, 19, 25, 42, 845, DateTimeKind.Unspecified).AddTicks(5668)); } } } diff --git a/SpeiderappAPI/Migrations/20211008173529_fix_seed_datetime.cs b/SpeiderappAPI/Migrations/20211008173529_fix_seed_datetime.cs index f57a010..df8d454 100644 --- a/SpeiderappAPI/Migrations/20211008173529_fix_seed_datetime.cs +++ b/SpeiderappAPI/Migrations/20211008173529_fix_seed_datetime.cs @@ -57,42 +57,42 @@ protected override void Down(MigrationBuilder migrationBuilder) keyColumn: "RequirementID", keyValue: -4L, column: "PublishTime", - value: new DateTime(2021, 8, 27, 20, 27, 23, 271, DateTimeKind.Utc).AddTicks(1750)); + value: new DateTime(2021, 8, 27, 20, 27, 23, 271, DateTimeKind.Unspecified).AddTicks(1750)); migrationBuilder.UpdateData( table: "Requirements", keyColumn: "RequirementID", keyValue: -3L, column: "PublishTime", - value: new DateTime(2021, 8, 30, 22, 27, 23, 271, DateTimeKind.Local).AddTicks(1704)); + value: new DateTime(2021, 8, 30, 22, 27, 23, 271, DateTimeKind.Unspecified).AddTicks(1704)); migrationBuilder.UpdateData( table: "Requirements", keyColumn: "RequirementID", keyValue: -1L, column: "PublishTime", - value: new DateTime(2021, 8, 30, 22, 27, 23, 270, DateTimeKind.Local).AddTicks(6919)); + value: new DateTime(2021, 8, 30, 22, 27, 23, 270, DateTimeKind.Unspecified).AddTicks(6919)); migrationBuilder.UpdateData( table: "Requirements", keyColumn: "RequirementID", keyValue: -6L, column: "PublishTime", - value: new DateTime(2021, 8, 30, 7, 27, 23, 271, DateTimeKind.Local).AddTicks(2196)); + value: new DateTime(2021, 8, 30, 7, 27, 23, 271, DateTimeKind.Unspecified).AddTicks(2196)); migrationBuilder.UpdateData( table: "Requirements", keyColumn: "RequirementID", keyValue: -5L, column: "PublishTime", - value: new DateTime(2021, 8, 28, 22, 27, 23, 271, DateTimeKind.Local).AddTicks(2186)); + value: new DateTime(2021, 8, 28, 22, 27, 23, 271, DateTimeKind.Unspecified).AddTicks(2186)); migrationBuilder.UpdateData( table: "Requirements", keyColumn: "RequirementID", keyValue: -2L, column: "PublishTime", - value: new DateTime(2021, 8, 30, 22, 27, 23, 271, DateTimeKind.Local).AddTicks(2065)); + value: new DateTime(2021, 8, 30, 22, 27, 23, 271, DateTimeKind.Unspecified).AddTicks(2065)); } } } diff --git a/SpeiderappAPI/Migrations/20220126185423_dotnet6_update.Designer.cs b/SpeiderappAPI/Migrations/20220126185423_dotnet6_update.Designer.cs new file mode 100644 index 0000000..97b04c6 --- /dev/null +++ b/SpeiderappAPI/Migrations/20220126185423_dotnet6_update.Designer.cs @@ -0,0 +1,419 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; +using SpeiderappAPI.Database; + +#nullable disable + +namespace SpeiderappAPI.Migrations +{ + [DbContext(typeof(ApiContext))] + [Migration("20220126185423_dotnet6_update")] + partial class dotnet6_update + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "6.0.1") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("SpeiderappAPI.Models.Category", b => + { + b.Property("CategoryID") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryID")); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("CategoryID"); + + b.ToTable("Categories"); + }); + + modelBuilder.Entity("SpeiderappAPI.Models.Requirement", b => + { + b.Property("RequirementID") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequirementID")); + + b.Property("AuthorID") + .HasColumnType("bigint"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("PublishTime") + .HasColumnType("timestamp with time zone"); + + b.Property("RequirementType") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("RequirementID"); + + b.HasIndex("AuthorID"); + + b.ToTable("Requirements"); + + b.HasDiscriminator("RequirementType").HasValue("Requirement"); + + b.HasData( + new + { + RequirementID = -2L, + AuthorID = -1L, + Description = "Actually chop wood", + PublishTime = new DateTime(2021, 10, 7, 19, 0, 0, 0, DateTimeKind.Unspecified) + }, + new + { + RequirementID = -5L, + AuthorID = -1L, + Description = "Stoff-handling", + PublishTime = new DateTime(2021, 10, 6, 0, 0, 0, 0, DateTimeKind.Unspecified) + }, + new + { + RequirementID = -6L, + AuthorID = -3L, + Description = "Sytråd-shopping", + PublishTime = new DateTime(2021, 10, 7, 9, 0, 0, 0, DateTimeKind.Unspecified) + }); + }); + + modelBuilder.Entity("SpeiderappAPI.Models.RequirementPrerequisite", b => + { + b.Property("RequirerID") + .HasColumnType("bigint"); + + b.Property("RequireeID") + .HasColumnType("bigint"); + + b.Property("IsAdvisory") + .HasColumnType("boolean"); + + b.HasKey("RequirerID", "RequireeID"); + + b.HasIndex("RequireeID"); + + b.ToTable("RequirementPrerequisites"); + + b.HasData( + new + { + RequirerID = -1L, + RequireeID = -2L, + IsAdvisory = false + }, + new + { + RequirerID = -4L, + RequireeID = -5L, + IsAdvisory = true + }, + new + { + RequirerID = -4L, + RequireeID = -6L, + IsAdvisory = false + }); + }); + + modelBuilder.Entity("SpeiderappAPI.Models.Resource", b => + { + b.Property("ResourceID") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ResourceID")); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Location") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RequirementID") + .HasColumnType("bigint"); + + b.HasKey("ResourceID"); + + b.HasIndex("RequirementID"); + + b.ToTable("Resources"); + + b.HasData( + new + { + ResourceID = -1L, + Description = "Oversikt over aktiviteter og merker i KMSpeideren", + Location = "https://kmspeider.no/aktivitetsbanken", + Name = "Aktivitetsbanken", + RequirementID = -1L + }); + }); + + modelBuilder.Entity("SpeiderappAPI.Models.Tag", b => + { + b.Property("TagID") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TagID")); + + b.Property("CategoryID") + .HasColumnType("bigint"); + + b.Property("Value") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("TagID"); + + b.HasIndex("CategoryID"); + + b.ToTable("Tags"); + }); + + modelBuilder.Entity("SpeiderappAPI.Models.TaggedWith", b => + { + b.Property("BadgeID") + .HasColumnType("bigint"); + + b.Property("TagID") + .HasColumnType("bigint"); + + b.HasKey("BadgeID", "TagID"); + + b.HasIndex("TagID"); + + b.ToTable("TaggedWiths"); + }); + + modelBuilder.Entity("SpeiderappAPI.Models.User", b => + { + b.Property("UserID") + .ValueGeneratedOnAdd() + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserID")); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("text"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("UserID"); + + b.ToTable("Users"); + + b.HasData( + new + { + UserID = -1L, + Email = "ocrispe0@jugem.jp", + FirstName = "Ozzie", + LastName = "Crispe" + }, + new + { + UserID = -2L, + Email = "adandye@hexun.com", + FirstName = "Aggi", + LastName = "Dandy" + }, + new + { + UserID = -3L, + Email = "gspottiswood2@psu.com", + FirstName = "Gerry", + LastName = "Spottiswood" + }); + }); + + modelBuilder.Entity("SpeiderappAPI.Models.Badge", b => + { + b.HasBaseType("SpeiderappAPI.Models.Requirement"); + + b.Property("Image") + .IsRequired() + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasDiscriminator().HasValue("Badge"); + + b.HasData( + new + { + RequirementID = -1L, + AuthorID = -1L, + Description = "This is a cool badge for chucking wood.", + PublishTime = new DateTime(2021, 10, 8, 0, 0, 0, 0, DateTimeKind.Unspecified), + Image = "3aas!2d=", + Title = "Woodchuck" + }, + new + { + RequirementID = -3L, + AuthorID = -2L, + Description = "Beskrivende test-tekst", + PublishTime = new DateTime(2021, 11, 8, 0, 0, 0, 0, DateTimeKind.Unspecified), + Image = "http://placekitten.com/g/200/300", + Title = "Testing" + }, + new + { + RequirementID = -4L, + AuthorID = -1L, + Description = "Hobby-baserte aktiviteter for alle aldre", + PublishTime = new DateTime(2021, 10, 12, 0, 0, 0, 0, DateTimeKind.Unspecified), + Image = "http://placekitten.com/g/200/200", + Title = "Hobby" + }); + }); + + modelBuilder.Entity("SpeiderappAPI.Models.MultipleChoice", b => + { + b.HasBaseType("SpeiderappAPI.Models.Requirement"); + + b.Property("Count") + .HasColumnType("integer"); + + b.HasDiscriminator().HasValue("MultipleChoice"); + }); + + modelBuilder.Entity("SpeiderappAPI.Models.UserDefined", b => + { + b.HasBaseType("SpeiderappAPI.Models.Requirement"); + + b.HasDiscriminator().HasValue("UserDefined"); + }); + + modelBuilder.Entity("SpeiderappAPI.Models.Requirement", b => + { + b.HasOne("SpeiderappAPI.Models.User", "Author") + .WithMany() + .HasForeignKey("AuthorID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Author"); + }); + + modelBuilder.Entity("SpeiderappAPI.Models.RequirementPrerequisite", b => + { + b.HasOne("SpeiderappAPI.Models.Requirement", "Requiree") + .WithMany("RequiredBy") + .HasForeignKey("RequireeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SpeiderappAPI.Models.Requirement", "Requirer") + .WithMany("Requiring") + .HasForeignKey("RequirerID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Requiree"); + + b.Navigation("Requirer"); + }); + + modelBuilder.Entity("SpeiderappAPI.Models.Resource", b => + { + b.HasOne("SpeiderappAPI.Models.Requirement", "Requirement") + .WithMany("Resources") + .HasForeignKey("RequirementID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Requirement"); + }); + + modelBuilder.Entity("SpeiderappAPI.Models.Tag", b => + { + b.HasOne("SpeiderappAPI.Models.Category", "Category") + .WithMany("Tags") + .HasForeignKey("CategoryID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("SpeiderappAPI.Models.TaggedWith", b => + { + b.HasOne("SpeiderappAPI.Models.Badge", "Badge") + .WithMany("TaggedWiths") + .HasForeignKey("BadgeID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("SpeiderappAPI.Models.Tag", "Tag") + .WithMany("TaggedWiths") + .HasForeignKey("TagID") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Badge"); + + b.Navigation("Tag"); + }); + + modelBuilder.Entity("SpeiderappAPI.Models.Category", b => + { + b.Navigation("Tags"); + }); + + modelBuilder.Entity("SpeiderappAPI.Models.Requirement", b => + { + b.Navigation("RequiredBy"); + + b.Navigation("Requiring"); + + b.Navigation("Resources"); + }); + + modelBuilder.Entity("SpeiderappAPI.Models.Tag", b => + { + b.Navigation("TaggedWiths"); + }); + + modelBuilder.Entity("SpeiderappAPI.Models.Badge", b => + { + b.Navigation("TaggedWiths"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/SpeiderappAPI/Migrations/20220126185423_dotnet6_update.cs b/SpeiderappAPI/Migrations/20220126185423_dotnet6_update.cs new file mode 100644 index 0000000..8fb4aa8 --- /dev/null +++ b/SpeiderappAPI/Migrations/20220126185423_dotnet6_update.cs @@ -0,0 +1,32 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace SpeiderappAPI.Migrations +{ + public partial class dotnet6_update : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "PublishTime", + table: "Requirements", + type: "timestamp with time zone", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "timestamp without time zone"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "PublishTime", + table: "Requirements", + type: "timestamp without time zone", + nullable: false, + oldClrType: typeof(DateTime), + oldType: "timestamp with time zone"); + } + } +} diff --git a/SpeiderappAPI/Migrations/ApiContextModelSnapshot.cs b/SpeiderappAPI/Migrations/ApiContextModelSnapshot.cs index 766cb98..951e71c 100644 --- a/SpeiderappAPI/Migrations/ApiContextModelSnapshot.cs +++ b/SpeiderappAPI/Migrations/ApiContextModelSnapshot.cs @@ -6,6 +6,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; using SpeiderappAPI.Database; +#nullable disable + namespace SpeiderappAPI.Migrations { [DbContext(typeof(ApiContext))] @@ -15,16 +17,18 @@ protected override void BuildModel(ModelBuilder modelBuilder) { #pragma warning disable 612, 618 modelBuilder - .HasAnnotation("Relational:MaxIdentifierLength", 63) - .HasAnnotation("ProductVersion", "5.0.9") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + .HasAnnotation("ProductVersion", "6.0.1") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); modelBuilder.Entity("SpeiderappAPI.Models.Category", b => { b.Property("CategoryID") .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("CategoryID")); b.Property("Title") .IsRequired() @@ -39,8 +43,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Property("RequirementID") .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("RequirementID")); b.Property("AuthorID") .HasColumnType("bigint"); @@ -50,7 +55,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("text"); b.Property("PublishTime") - .HasColumnType("timestamp without time zone"); + .HasColumnType("timestamp with time zone"); b.Property("RequirementType") .IsRequired() @@ -130,8 +135,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Property("ResourceID") .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("ResourceID")); b.Property("Description") .IsRequired() @@ -169,8 +175,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Property("TagID") .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("TagID")); b.Property("CategoryID") .HasColumnType("bigint"); @@ -205,8 +212,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.Property("UserID") .ValueGeneratedOnAdd() - .HasColumnType("bigint") - .HasAnnotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn); + .HasColumnType("bigint"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("UserID")); b.Property("Email") .IsRequired() diff --git a/SpeiderappAPI/SpeiderappAPI.csproj b/SpeiderappAPI/SpeiderappAPI.csproj index cdd0a8e..60fbee5 100644 --- a/SpeiderappAPI/SpeiderappAPI.csproj +++ b/SpeiderappAPI/SpeiderappAPI.csproj @@ -1,24 +1,24 @@  - net5.0 + net6.0 enable 6d78ab2e-1560-4d82-a173-5c28bf728190 - - - + + + runtime; build; native; contentfiles; analyzers; buildtransitive all - - - - - - + + + + + + diff --git a/SpeiderappPWA/SpeiderappPWA.csproj b/SpeiderappPWA/SpeiderappPWA.csproj index e79d416..939e4e1 100644 --- a/SpeiderappPWA/SpeiderappPWA.csproj +++ b/SpeiderappPWA/SpeiderappPWA.csproj @@ -2,14 +2,14 @@ - net5.0 + net6.0 service-worker-assets.js - - - + + + diff --git a/docker-compose.yml b/docker-compose.yml index da4e8bd..c2fba2d 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -24,7 +24,7 @@ services: - POSTGRES__ROOT_PASS - SPEIDERAPP__DB_PASS backend: - image: mcr.microsoft.com/dotnet/sdk:5.0 + image: mcr.microsoft.com/dotnet/sdk:6.0 profiles: - development ports: