diff --git a/backend/API/API.csproj b/backend/API/API.csproj
index 1e9549b..e1ff1ea 100644
--- a/backend/API/API.csproj
+++ b/backend/API/API.csproj
@@ -13,6 +13,7 @@
all
runtime; build; native; contentfiles; analyzers; buildtransitive
+
all
runtime; build; native; contentfiles; analyzers; buildtransitive
diff --git a/backend/API/Migrations/20250428070005_RecipeModelAdded.cs b/backend/API/Migrations/20250428070005_RecipeModelAdded.cs
deleted file mode 100644
index afe234c..0000000
--- a/backend/API/Migrations/20250428070005_RecipeModelAdded.cs
+++ /dev/null
@@ -1,127 +0,0 @@
-using Microsoft.EntityFrameworkCore.Migrations;
-using MySql.EntityFrameworkCore.Metadata;
-
-#nullable disable
-
-namespace API.Migrations
-{
- ///
- public partial class RecipeModelAdded : Migration
- {
- ///
- protected override void Up(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.AddColumn(
- name: "PrefereredRecipesId",
- table: "Users",
- type: "int",
- nullable: false,
- defaultValue: 0);
-
- migrationBuilder.CreateTable(
- name: "PrefereredRecipes",
- columns: table => new
- {
- Id = table.Column(type: "int", nullable: false)
- .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_PrefereredRecipes", x => x.Id);
- })
- .Annotation("MySQL:Charset", "utf8mb4");
-
- migrationBuilder.CreateTable(
- name: "Recipes",
- columns: table => new
- {
- Id = table.Column(type: "int", nullable: false)
- .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn),
- Name = table.Column(type: "longtext", nullable: false),
- Description = table.Column(type: "longtext", nullable: false),
- Directions = table.Column(type: "longtext", nullable: false),
- PrefereredRecipesId = table.Column(type: "int", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Recipes", x => x.Id);
- table.ForeignKey(
- name: "FK_Recipes_PrefereredRecipes_PrefereredRecipesId",
- column: x => x.PrefereredRecipesId,
- principalTable: "PrefereredRecipes",
- principalColumn: "Id");
- })
- .Annotation("MySQL:Charset", "utf8mb4");
-
- migrationBuilder.CreateTable(
- name: "Ingredient",
- columns: table => new
- {
- Id = table.Column(type: "int", nullable: false)
- .Annotation("MySQL:ValueGenerationStrategy", MySQLValueGenerationStrategy.IdentityColumn),
- Amount = table.Column(type: "int", nullable: false),
- Unit = table.Column(type: "longtext", nullable: false),
- Element = table.Column(type: "longtext", nullable: false),
- RecipeId = table.Column(type: "int", nullable: true)
- },
- constraints: table =>
- {
- table.PrimaryKey("PK_Ingredient", x => x.Id);
- table.ForeignKey(
- name: "FK_Ingredient_Recipes_RecipeId",
- column: x => x.RecipeId,
- principalTable: "Recipes",
- principalColumn: "Id");
- })
- .Annotation("MySQL:Charset", "utf8mb4");
-
- migrationBuilder.CreateIndex(
- name: "IX_Users_PrefereredRecipesId",
- table: "Users",
- column: "PrefereredRecipesId");
-
- migrationBuilder.CreateIndex(
- name: "IX_Ingredient_RecipeId",
- table: "Ingredient",
- column: "RecipeId");
-
- migrationBuilder.CreateIndex(
- name: "IX_Recipes_PrefereredRecipesId",
- table: "Recipes",
- column: "PrefereredRecipesId");
-
- migrationBuilder.AddForeignKey(
- name: "FK_Users_PrefereredRecipes_PrefereredRecipesId",
- table: "Users",
- column: "PrefereredRecipesId",
- principalTable: "PrefereredRecipes",
- principalColumn: "Id",
- onDelete: ReferentialAction.Cascade);
- }
-
- ///
- protected override void Down(MigrationBuilder migrationBuilder)
- {
- migrationBuilder.DropForeignKey(
- name: "FK_Users_PrefereredRecipes_PrefereredRecipesId",
- table: "Users");
-
- migrationBuilder.DropTable(
- name: "Ingredient");
-
- migrationBuilder.DropTable(
- name: "Recipes");
-
- migrationBuilder.DropTable(
- name: "PrefereredRecipes");
-
- migrationBuilder.DropIndex(
- name: "IX_Users_PrefereredRecipesId",
- table: "Users");
-
- migrationBuilder.DropColumn(
- name: "PrefereredRecipesId",
- table: "Users");
- }
- }
-}
diff --git a/backend/API/Migrations/20250428070005_RecipeModelAdded.Designer.cs b/backend/API/Migrations/20250429115336_RecipeModelAdded.Designer.cs
similarity index 63%
rename from backend/API/Migrations/20250428070005_RecipeModelAdded.Designer.cs
rename to backend/API/Migrations/20250429115336_RecipeModelAdded.Designer.cs
index b851f33..48ed828 100644
--- a/backend/API/Migrations/20250428070005_RecipeModelAdded.Designer.cs
+++ b/backend/API/Migrations/20250429115336_RecipeModelAdded.Designer.cs
@@ -11,36 +11,34 @@ using Microsoft.EntityFrameworkCore.Storage.ValueConversion;
namespace API.Migrations
{
[DbContext(typeof(DBContext))]
- [Migration("20250428070005_RecipeModelAdded")]
+ [Migration("20250429115336_RecipeModelAdded")]
partial class RecipeModelAdded
{
///
protected override void BuildTargetModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "8.0.10")
- .HasAnnotation("Relational:MaxIdentifierLength", 64);
+ modelBuilder.HasAnnotation("ProductVersion", "8.0.10");
modelBuilder.Entity("API.Models.RecipeModels.Ingredient", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnType("int");
+ .HasColumnType("INTEGER");
b.Property("Amount")
- .HasColumnType("int");
+ .HasColumnType("INTEGER");
b.Property("Element")
.IsRequired()
- .HasColumnType("longtext");
+ .HasColumnType("TEXT");
b.Property("RecipeId")
- .HasColumnType("int");
+ .HasColumnType("INTEGER");
b.Property("Unit")
.IsRequired()
- .HasColumnType("longtext");
+ .HasColumnType("TEXT");
b.HasKey("Id");
@@ -53,7 +51,7 @@ namespace API.Migrations
{
b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnType("int");
+ .HasColumnType("INTEGER");
b.HasKey("Id");
@@ -64,22 +62,22 @@ namespace API.Migrations
{
b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnType("int");
+ .HasColumnType("INTEGER");
b.Property("Description")
.IsRequired()
- .HasColumnType("longtext");
+ .HasColumnType("TEXT");
b.Property("Directions")
.IsRequired()
- .HasColumnType("longtext");
+ .HasColumnType("TEXT");
b.Property("Name")
.IsRequired()
- .HasColumnType("longtext");
+ .HasColumnType("TEXT");
b.Property("PrefereredRecipesId")
- .HasColumnType("int");
+ .HasColumnType("INTEGER");
b.HasKey("Id");
@@ -88,35 +86,65 @@ namespace API.Migrations
b.ToTable("Recipes");
});
+ modelBuilder.Entity("API.Models.ShoppingListModels.ShoppingList", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("Amount")
+ .HasColumnType("REAL");
+
+ b.Property("Checked")
+ .HasColumnType("INTEGER");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Unit")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("ShoppingList");
+ });
+
modelBuilder.Entity("API.Models.UserModels.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnType("int");
+ .HasColumnType("INTEGER");
b.Property("Email")
.IsRequired()
- .HasColumnType("longtext");
+ .HasColumnType("TEXT");
b.Property("Password")
.IsRequired()
- .HasColumnType("longtext");
+ .HasColumnType("TEXT");
b.Property("PrefereredRecipesId")
- .HasColumnType("int");
+ .HasColumnType("INTEGER");
b.Property("RefreshToken")
- .HasColumnType("longtext");
+ .HasColumnType("TEXT");
b.Property("RefreshTokenExpireAt")
- .HasColumnType("datetime(6)");
+ .HasColumnType("TEXT");
b.Property("Salt")
- .HasColumnType("longtext");
+ .HasColumnType("TEXT");
b.Property("UserName")
.IsRequired()
- .HasColumnType("longtext");
+ .HasColumnType("TEXT");
b.HasKey("Id");
@@ -139,6 +167,13 @@ namespace API.Migrations
.HasForeignKey("PrefereredRecipesId");
});
+ modelBuilder.Entity("API.Models.ShoppingListModels.ShoppingList", b =>
+ {
+ b.HasOne("API.Models.UserModels.User", null)
+ .WithMany("ShoppingList")
+ .HasForeignKey("UserId");
+ });
+
modelBuilder.Entity("API.Models.UserModels.User", b =>
{
b.HasOne("API.Models.RecipeModels.PrefereredRecipes", "PrefereredRecipes")
@@ -159,6 +194,11 @@ namespace API.Migrations
{
b.Navigation("Ingredients");
});
+
+ modelBuilder.Entity("API.Models.UserModels.User", b =>
+ {
+ b.Navigation("ShoppingList");
+ });
#pragma warning restore 612, 618
}
}
diff --git a/backend/API/Migrations/20250429115336_RecipeModelAdded.cs b/backend/API/Migrations/20250429115336_RecipeModelAdded.cs
new file mode 100644
index 0000000..907b867
--- /dev/null
+++ b/backend/API/Migrations/20250429115336_RecipeModelAdded.cs
@@ -0,0 +1,274 @@
+using System;
+using Microsoft.EntityFrameworkCore.Migrations;
+
+#nullable disable
+
+namespace API.Migrations
+{
+ ///
+ public partial class RecipeModelAdded : Migration
+ {
+ ///
+ protected override void Up(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.AlterColumn(
+ name: "UserName",
+ table: "Users",
+ type: "TEXT",
+ nullable: false,
+ oldClrType: typeof(string),
+ oldType: "longtext");
+
+ migrationBuilder.AlterColumn(
+ name: "Salt",
+ table: "Users",
+ type: "TEXT",
+ nullable: true,
+ oldClrType: typeof(string),
+ oldType: "longtext",
+ oldNullable: true);
+
+ migrationBuilder.AlterColumn(
+ name: "RefreshTokenExpireAt",
+ table: "Users",
+ type: "TEXT",
+ nullable: false,
+ oldClrType: typeof(DateTime),
+ oldType: "datetime(6)");
+
+ migrationBuilder.AlterColumn(
+ name: "RefreshToken",
+ table: "Users",
+ type: "TEXT",
+ nullable: true,
+ oldClrType: typeof(string),
+ oldType: "longtext",
+ oldNullable: true);
+
+ migrationBuilder.AlterColumn(
+ name: "Password",
+ table: "Users",
+ type: "TEXT",
+ nullable: false,
+ oldClrType: typeof(string),
+ oldType: "longtext");
+
+ migrationBuilder.AlterColumn(
+ name: "Email",
+ table: "Users",
+ type: "TEXT",
+ nullable: false,
+ oldClrType: typeof(string),
+ oldType: "longtext");
+
+ migrationBuilder.AlterColumn(
+ name: "Id",
+ table: "Users",
+ type: "INTEGER",
+ nullable: false,
+ oldClrType: typeof(int),
+ oldType: "int")
+ .Annotation("Sqlite:Autoincrement", true)
+ .OldAnnotation("Sqlite:Autoincrement", true);
+
+ migrationBuilder.AddColumn(
+ name: "PrefereredRecipesId",
+ table: "Users",
+ type: "INTEGER",
+ nullable: false,
+ defaultValue: 0);
+
+ migrationBuilder.CreateTable(
+ name: "PrefereredRecipes",
+ columns: table => new
+ {
+ Id = table.Column(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_PrefereredRecipes", x => x.Id);
+ });
+
+ migrationBuilder.CreateTable(
+ name: "ShoppingList",
+ columns: table => new
+ {
+ Id = table.Column(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ Amount = table.Column(type: "REAL", nullable: false),
+ Unit = table.Column(type: "TEXT", nullable: false),
+ Name = table.Column(type: "TEXT", nullable: false),
+ Checked = table.Column(type: "INTEGER", nullable: false),
+ UserId = table.Column(type: "INTEGER", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_ShoppingList", x => x.Id);
+ table.ForeignKey(
+ name: "FK_ShoppingList_Users_UserId",
+ column: x => x.UserId,
+ principalTable: "Users",
+ principalColumn: "Id");
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Recipes",
+ columns: table => new
+ {
+ Id = table.Column(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ Name = table.Column(type: "TEXT", nullable: false),
+ Description = table.Column(type: "TEXT", nullable: false),
+ Directions = table.Column(type: "TEXT", nullable: false),
+ PrefereredRecipesId = table.Column(type: "INTEGER", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Recipes", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Recipes_PrefereredRecipes_PrefereredRecipesId",
+ column: x => x.PrefereredRecipesId,
+ principalTable: "PrefereredRecipes",
+ principalColumn: "Id");
+ });
+
+ migrationBuilder.CreateTable(
+ name: "Ingredient",
+ columns: table => new
+ {
+ Id = table.Column(type: "INTEGER", nullable: false)
+ .Annotation("Sqlite:Autoincrement", true),
+ Amount = table.Column(type: "INTEGER", nullable: false),
+ Unit = table.Column(type: "TEXT", nullable: false),
+ Element = table.Column(type: "TEXT", nullable: false),
+ RecipeId = table.Column(type: "INTEGER", nullable: true)
+ },
+ constraints: table =>
+ {
+ table.PrimaryKey("PK_Ingredient", x => x.Id);
+ table.ForeignKey(
+ name: "FK_Ingredient_Recipes_RecipeId",
+ column: x => x.RecipeId,
+ principalTable: "Recipes",
+ principalColumn: "Id");
+ });
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Users_PrefereredRecipesId",
+ table: "Users",
+ column: "PrefereredRecipesId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Ingredient_RecipeId",
+ table: "Ingredient",
+ column: "RecipeId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_Recipes_PrefereredRecipesId",
+ table: "Recipes",
+ column: "PrefereredRecipesId");
+
+ migrationBuilder.CreateIndex(
+ name: "IX_ShoppingList_UserId",
+ table: "ShoppingList",
+ column: "UserId");
+
+ migrationBuilder.AddForeignKey(
+ name: "FK_Users_PrefereredRecipes_PrefereredRecipesId",
+ table: "Users",
+ column: "PrefereredRecipesId",
+ principalTable: "PrefereredRecipes",
+ principalColumn: "Id",
+ onDelete: ReferentialAction.Cascade);
+ }
+
+ ///
+ protected override void Down(MigrationBuilder migrationBuilder)
+ {
+ migrationBuilder.DropForeignKey(
+ name: "FK_Users_PrefereredRecipes_PrefereredRecipesId",
+ table: "Users");
+
+ migrationBuilder.DropTable(
+ name: "Ingredient");
+
+ migrationBuilder.DropTable(
+ name: "ShoppingList");
+
+ migrationBuilder.DropTable(
+ name: "Recipes");
+
+ migrationBuilder.DropTable(
+ name: "PrefereredRecipes");
+
+ migrationBuilder.DropIndex(
+ name: "IX_Users_PrefereredRecipesId",
+ table: "Users");
+
+ migrationBuilder.DropColumn(
+ name: "PrefereredRecipesId",
+ table: "Users");
+
+ migrationBuilder.AlterColumn(
+ name: "UserName",
+ table: "Users",
+ type: "longtext",
+ nullable: false,
+ oldClrType: typeof(string),
+ oldType: "TEXT");
+
+ migrationBuilder.AlterColumn(
+ name: "Salt",
+ table: "Users",
+ type: "longtext",
+ nullable: true,
+ oldClrType: typeof(string),
+ oldType: "TEXT",
+ oldNullable: true);
+
+ migrationBuilder.AlterColumn(
+ name: "RefreshTokenExpireAt",
+ table: "Users",
+ type: "datetime(6)",
+ nullable: false,
+ oldClrType: typeof(DateTime),
+ oldType: "TEXT");
+
+ migrationBuilder.AlterColumn(
+ name: "RefreshToken",
+ table: "Users",
+ type: "longtext",
+ nullable: true,
+ oldClrType: typeof(string),
+ oldType: "TEXT",
+ oldNullable: true);
+
+ migrationBuilder.AlterColumn(
+ name: "Password",
+ table: "Users",
+ type: "longtext",
+ nullable: false,
+ oldClrType: typeof(string),
+ oldType: "TEXT");
+
+ migrationBuilder.AlterColumn(
+ name: "Email",
+ table: "Users",
+ type: "longtext",
+ nullable: false,
+ oldClrType: typeof(string),
+ oldType: "TEXT");
+
+ migrationBuilder.AlterColumn(
+ name: "Id",
+ table: "Users",
+ type: "int",
+ nullable: false,
+ oldClrType: typeof(int),
+ oldType: "INTEGER")
+ .Annotation("Sqlite:Autoincrement", true)
+ .OldAnnotation("Sqlite:Autoincrement", true);
+ }
+ }
+}
diff --git a/backend/API/Migrations/DBContextModelSnapshot.cs b/backend/API/Migrations/DBContextModelSnapshot.cs
index f11e5a4..1366ca7 100644
--- a/backend/API/Migrations/DBContextModelSnapshot.cs
+++ b/backend/API/Migrations/DBContextModelSnapshot.cs
@@ -15,29 +15,27 @@ namespace API.Migrations
protected override void BuildModel(ModelBuilder modelBuilder)
{
#pragma warning disable 612, 618
- modelBuilder
- .HasAnnotation("ProductVersion", "8.0.10")
- .HasAnnotation("Relational:MaxIdentifierLength", 64);
+ modelBuilder.HasAnnotation("ProductVersion", "8.0.10");
modelBuilder.Entity("API.Models.RecipeModels.Ingredient", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnType("int");
+ .HasColumnType("INTEGER");
b.Property("Amount")
- .HasColumnType("int");
+ .HasColumnType("INTEGER");
b.Property("Element")
.IsRequired()
- .HasColumnType("longtext");
+ .HasColumnType("TEXT");
b.Property("RecipeId")
- .HasColumnType("int");
+ .HasColumnType("INTEGER");
b.Property("Unit")
.IsRequired()
- .HasColumnType("longtext");
+ .HasColumnType("TEXT");
b.HasKey("Id");
@@ -50,7 +48,7 @@ namespace API.Migrations
{
b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnType("int");
+ .HasColumnType("INTEGER");
b.HasKey("Id");
@@ -61,22 +59,22 @@ namespace API.Migrations
{
b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnType("int");
+ .HasColumnType("INTEGER");
b.Property("Description")
.IsRequired()
- .HasColumnType("longtext");
+ .HasColumnType("TEXT");
b.Property("Directions")
.IsRequired()
- .HasColumnType("longtext");
+ .HasColumnType("TEXT");
b.Property("Name")
.IsRequired()
- .HasColumnType("longtext");
+ .HasColumnType("TEXT");
b.Property("PrefereredRecipesId")
- .HasColumnType("int");
+ .HasColumnType("INTEGER");
b.HasKey("Id");
@@ -85,35 +83,65 @@ namespace API.Migrations
b.ToTable("Recipes");
});
+ modelBuilder.Entity("API.Models.ShoppingListModels.ShoppingList", b =>
+ {
+ b.Property("Id")
+ .ValueGeneratedOnAdd()
+ .HasColumnType("INTEGER");
+
+ b.Property("Amount")
+ .HasColumnType("REAL");
+
+ b.Property("Checked")
+ .HasColumnType("INTEGER");
+
+ b.Property("Name")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("Unit")
+ .IsRequired()
+ .HasColumnType("TEXT");
+
+ b.Property("UserId")
+ .HasColumnType("INTEGER");
+
+ b.HasKey("Id");
+
+ b.HasIndex("UserId");
+
+ b.ToTable("ShoppingList");
+ });
+
modelBuilder.Entity("API.Models.UserModels.User", b =>
{
b.Property("Id")
.ValueGeneratedOnAdd()
- .HasColumnType("int");
+ .HasColumnType("INTEGER");
b.Property("Email")
.IsRequired()
- .HasColumnType("longtext");
+ .HasColumnType("TEXT");
b.Property("Password")
.IsRequired()
- .HasColumnType("longtext");
+ .HasColumnType("TEXT");
b.Property("PrefereredRecipesId")
- .HasColumnType("int");
+ .HasColumnType("INTEGER");
b.Property("RefreshToken")
- .HasColumnType("longtext");
+ .HasColumnType("TEXT");
b.Property("RefreshTokenExpireAt")
- .HasColumnType("datetime(6)");
+ .HasColumnType("TEXT");
b.Property("Salt")
- .HasColumnType("longtext");
+ .HasColumnType("TEXT");
b.Property("UserName")
.IsRequired()
- .HasColumnType("longtext");
+ .HasColumnType("TEXT");
b.HasKey("Id");
@@ -136,6 +164,13 @@ namespace API.Migrations
.HasForeignKey("PrefereredRecipesId");
});
+ modelBuilder.Entity("API.Models.ShoppingListModels.ShoppingList", b =>
+ {
+ b.HasOne("API.Models.UserModels.User", null)
+ .WithMany("ShoppingList")
+ .HasForeignKey("UserId");
+ });
+
modelBuilder.Entity("API.Models.UserModels.User", b =>
{
b.HasOne("API.Models.RecipeModels.PrefereredRecipes", "PrefereredRecipes")
@@ -156,6 +191,11 @@ namespace API.Migrations
{
b.Navigation("Ingredients");
});
+
+ modelBuilder.Entity("API.Models.UserModels.User", b =>
+ {
+ b.Navigation("ShoppingList");
+ });
#pragma warning restore 612, 618
}
}