test #2

Merged
admin merged 9 commits from test into develop 2025-12-04 11:54:18 +00:00
3 changed files with 1590 additions and 0 deletions
Showing only changes of commit 19366febb8 - Show all commits

File diff suppressed because it is too large Load Diff

View File

@@ -0,0 +1,76 @@
using System;
using Microsoft.EntityFrameworkCore.Migrations;
#nullable disable
namespace Webshop.Infrastructure.Migrations
{
/// <inheritdoc />
public partial class checkoutcart : Migration
{
/// <inheritdoc />
protected override void Up(MigrationBuilder migrationBuilder)
{
migrationBuilder.CreateTable(
name: "Carts",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
UserId = table.Column<string>(type: "text", nullable: true),
SessionId = table.Column<string>(type: "text", nullable: true),
LastModified = table.Column<DateTime>(type: "timestamp with time zone", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_Carts", x => x.Id);
});
migrationBuilder.CreateTable(
name: "CartItems",
columns: table => new
{
Id = table.Column<Guid>(type: "uuid", nullable: false),
CartId = table.Column<Guid>(type: "uuid", nullable: false),
ProductId = table.Column<Guid>(type: "uuid", nullable: false),
ProductVariantId = table.Column<Guid>(type: "uuid", nullable: true),
Quantity = table.Column<int>(type: "integer", nullable: false)
},
constraints: table =>
{
table.PrimaryKey("PK_CartItems", x => x.Id);
table.ForeignKey(
name: "FK_CartItems_Carts_CartId",
column: x => x.CartId,
principalTable: "Carts",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
table.ForeignKey(
name: "FK_CartItems_Products_ProductId",
column: x => x.ProductId,
principalTable: "Products",
principalColumn: "Id",
onDelete: ReferentialAction.Cascade);
});
migrationBuilder.CreateIndex(
name: "IX_CartItems_CartId",
table: "CartItems",
column: "CartId");
migrationBuilder.CreateIndex(
name: "IX_CartItems_ProductId",
table: "CartItems",
column: "ProductId");
}
/// <inheritdoc />
protected override void Down(MigrationBuilder migrationBuilder)
{
migrationBuilder.DropTable(
name: "CartItems");
migrationBuilder.DropTable(
name: "Carts");
}
}
}

View File

@@ -215,6 +215,53 @@ namespace Webshop.Infrastructure.Migrations
b.ToTable("Addresses");
});
modelBuilder.Entity("Webshop.Domain.Entities.Cart", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<DateTime>("LastModified")
.HasColumnType("timestamp with time zone");
b.Property<string>("SessionId")
.HasColumnType("text");
b.Property<string>("UserId")
.HasColumnType("text");
b.HasKey("Id");
b.ToTable("Carts");
});
modelBuilder.Entity("Webshop.Domain.Entities.CartItem", b =>
{
b.Property<Guid>("Id")
.ValueGeneratedOnAdd()
.HasColumnType("uuid");
b.Property<Guid>("CartId")
.HasColumnType("uuid");
b.Property<Guid>("ProductId")
.HasColumnType("uuid");
b.Property<Guid?>("ProductVariantId")
.HasColumnType("uuid");
b.Property<int>("Quantity")
.HasColumnType("integer");
b.HasKey("Id");
b.HasIndex("CartId");
b.HasIndex("ProductId");
b.ToTable("CartItems");
});
modelBuilder.Entity("Webshop.Domain.Entities.Categorie", b =>
{
b.Property<Guid>("Id")
@@ -1113,6 +1160,25 @@ namespace Webshop.Infrastructure.Migrations
b.Navigation("Customer");
});
modelBuilder.Entity("Webshop.Domain.Entities.CartItem", b =>
{
b.HasOne("Webshop.Domain.Entities.Cart", "Cart")
.WithMany("Items")
.HasForeignKey("CartId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.HasOne("Webshop.Domain.Entities.Product", "Product")
.WithMany()
.HasForeignKey("ProductId")
.OnDelete(DeleteBehavior.Cascade)
.IsRequired();
b.Navigation("Cart");
b.Navigation("Product");
});
modelBuilder.Entity("Webshop.Domain.Entities.Categorie", b =>
{
b.HasOne("Webshop.Domain.Entities.Categorie", "Parentcategorie")
@@ -1311,6 +1377,11 @@ namespace Webshop.Infrastructure.Migrations
b.Navigation("Address");
});
modelBuilder.Entity("Webshop.Domain.Entities.Cart", b =>
{
b.Navigation("Items");
});
modelBuilder.Entity("Webshop.Domain.Entities.Categorie", b =>
{
b.Navigation("Productcategories");