Wish and veckomeny fixes

This commit is contained in:
Elias Jansson
2025-09-22 21:22:43 +02:00
parent 4c577ea0ef
commit 75812f1a10
20 changed files with 5139 additions and 151 deletions

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,53 @@
using System;
using Microsoft.EntityFrameworkCore.Metadata;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Aberwyn.Migrations
{
public partial class AddMealWish : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "MealWishes",
columns: table => new
{
Id = table.Column<int>(type: "int", nullable: false)
.Annotation("MySql:ValueGenerationStrategy", MySqlValueGenerationStrategy.IdentityColumn),
Name = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
Recipe = table.Column<string>(type: "longtext", nullable: true)
.Annotation("MySql:CharSet", "utf8mb4"),
LinkedMealId = table.Column<int>(type: "int", nullable: true),
RequestedByUserId = table.Column<string>(type: "longtext", nullable: false)
.Annotation("MySql:CharSet", "utf8mb4"),
CreatedAt = table.Column<DateTime>(type: "datetime(6)", nullable: false),
IsArchived = table.Column<bool>(type: "tinyint(1)", nullable: false),
IsImported = table.Column<bool>(type: "tinyint(1)", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_MealWishes", x => x.Id);
table.ForeignKey(
name: "FK_MealWishes_Meals_LinkedMealId",
column: x => x.LinkedMealId,
principalTable: "Meals",
principalColumn: "Id");
})
.Annotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_MealWishes_LinkedMealId",
table: "MealWishes",
column: "LinkedMealId");
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "MealWishes");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,56 @@
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Aberwyn.Migrations
{
public partial class AddMealWishUserRelation : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AlterColumn<string>(
name: "RequestedByUserId",
table: "MealWishes",
type: "varchar(255)",
nullable: false,
oldClrType: typeof(string),
oldType: "longtext")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
migrationBuilder.CreateIndex(
name: "IX_MealWishes_RequestedByUserId",
table: "MealWishes",
column: "RequestedByUserId");
migrationBuilder.AddForeignKey(
name: "FK_MealWishes_AspNetUsers_RequestedByUserId",
table: "MealWishes",
column: "RequestedByUserId",
principalTable: "AspNetUsers",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropForeignKey(
name: "FK_MealWishes_AspNetUsers_RequestedByUserId",
table: "MealWishes");
migrationBuilder.DropIndex(
name: "IX_MealWishes_RequestedByUserId",
table: "MealWishes");
migrationBuilder.AlterColumn<string>(
name: "RequestedByUserId",
table: "MealWishes",
type: "longtext",
nullable: false,
oldClrType: typeof(string),
oldType: "varchar(255)")
.Annotation("MySql:CharSet", "utf8mb4")
.OldAnnotation("MySql:CharSet", "utf8mb4");
}
}
}

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,27 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Aberwyn.Migrations
{
public partial class AddDateToWeeklyMenu : Migration
{
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.AddColumn<DateTime>(
name: "Date",
table: "WeeklyMenu",
type: "datetime(6)",
nullable: false,
defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified));
}
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropColumn(
name: "Date",
table: "WeeklyMenu");
}
}
}

View File

@@ -484,6 +484,44 @@ namespace Aberwyn.Migrations
b.ToTable("MealRatings");
});
modelBuilder.Entity("Aberwyn.Models.MealWish", b =>
{
b.Property<int>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("int");
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)");
b.Property<bool>("IsArchived")
.HasColumnType("tinyint(1)");
b.Property<bool>("IsImported")
.HasColumnType("tinyint(1)");
b.Property<int?>("LinkedMealId")
.HasColumnType("int");
b.Property<string>("Name")
.IsRequired()
.HasColumnType("longtext");
b.Property<string>("Recipe")
.HasColumnType("longtext");
b.Property<string>("RequestedByUserId")
.IsRequired()
.HasColumnType("varchar(255)");
b.HasKey("Id");
b.HasIndex("LinkedMealId");
b.HasIndex("RequestedByUserId");
b.ToTable("MealWishes");
});
modelBuilder.Entity("Aberwyn.Models.PizzaOrder", b =>
{
b.Property<int>("Id")
@@ -719,6 +757,9 @@ namespace Aberwyn.Migrations
b.Property<DateTime>("CreatedAt")
.HasColumnType("datetime(6)");
b.Property<DateTime>("Date")
.HasColumnType("datetime(6)");
b.Property<int>("DayOfWeek")
.HasColumnType("int");
@@ -1097,6 +1138,23 @@ namespace Aberwyn.Migrations
b.Navigation("Meal");
});
modelBuilder.Entity("Aberwyn.Models.MealWish", b =>
{
b.HasOne("Aberwyn.Models.Meal", "LinkedMeal")
.WithMany()
.HasForeignKey("LinkedMealId");
b.HasOne("Aberwyn.Models.ApplicationUser", "RequestedByUser")
.WithMany()
.HasForeignKey("RequestedByUserId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("LinkedMeal");
b.Navigation("RequestedByUser");
});
modelBuilder.Entity("Aberwyn.Models.PushSubscriber", b =>
{
b.HasOne("Aberwyn.Models.PizzaOrder", "PizzaOrder")