From f2d7acecae4e4db2f66d6db732600f1cdbe50434 Mon Sep 17 00:00:00 2001 From: lumijiez <59575049+lumijiez@users.noreply.github.com> Date: Mon, 30 Jun 2025 00:29:40 +0300 Subject: [PATCH] Full creation -> payment flow --- .../Commands/Orders/GetMyOrders.cs | 38 + .../Commands/Orders/SetOrderPaymentStatus.cs | 6 + .../Commands/Orders/SetOrderShippingStatus.cs | 6 + src/Imprink.Application/Dtos/EnumValueDto.cs | 6 + .../{ => Mappings}/MappingProfile.cs | 0 .../Mappings/OrderStatusMappingProfile.cs | 15 - .../Mappings/ShippingStatusMappingProfile.cs | 15 - src/Imprink.Domain/Entities/OrderStatus.cs | 9 - src/Imprink.Domain/Entities/ShippingStatus.cs | 9 - src/Imprink.Domain/Enums/OrderStatusEnum.cs | 6 + .../Enums/ShippingStatusEnum.cs | 6 + .../Extensions/StatusExtensions.cs | 6 + .../Configuration/OrderStatusConfiguration.cs | 31 - .../ShippingStatusConfiguration.cs | 31 - .../20250625223159_InitialSetup.Designer.cs | 1027 ----------------- .../Migrations/20250625223159_InitialSetup.cs | 676 ----------- .../ApplicationDbContextModelSnapshot.cs | 1024 ---------------- 17 files changed, 74 insertions(+), 2837 deletions(-) create mode 100644 src/Imprink.Application/Commands/Orders/GetMyOrders.cs create mode 100644 src/Imprink.Application/Commands/Orders/SetOrderPaymentStatus.cs create mode 100644 src/Imprink.Application/Commands/Orders/SetOrderShippingStatus.cs create mode 100644 src/Imprink.Application/Dtos/EnumValueDto.cs rename src/Imprink.Application/{ => Mappings}/MappingProfile.cs (100%) delete mode 100644 src/Imprink.Application/Mappings/OrderStatusMappingProfile.cs delete mode 100644 src/Imprink.Application/Mappings/ShippingStatusMappingProfile.cs delete mode 100644 src/Imprink.Domain/Entities/OrderStatus.cs delete mode 100644 src/Imprink.Domain/Entities/ShippingStatus.cs create mode 100644 src/Imprink.Domain/Enums/OrderStatusEnum.cs create mode 100644 src/Imprink.Domain/Enums/ShippingStatusEnum.cs create mode 100644 src/Imprink.Domain/Extensions/StatusExtensions.cs delete mode 100644 src/Imprink.Infrastructure/Configuration/OrderStatusConfiguration.cs delete mode 100644 src/Imprink.Infrastructure/Configuration/ShippingStatusConfiguration.cs delete mode 100644 src/Imprink.Infrastructure/Migrations/20250625223159_InitialSetup.Designer.cs delete mode 100644 src/Imprink.Infrastructure/Migrations/20250625223159_InitialSetup.cs delete mode 100644 src/Imprink.Infrastructure/Migrations/ApplicationDbContextModelSnapshot.cs diff --git a/src/Imprink.Application/Commands/Orders/GetMyOrders.cs b/src/Imprink.Application/Commands/Orders/GetMyOrders.cs new file mode 100644 index 0000000..7889877 --- /dev/null +++ b/src/Imprink.Application/Commands/Orders/GetMyOrders.cs @@ -0,0 +1,38 @@ +using AutoMapper; +using Imprink.Application.Dtos; +using Imprink.Domain.Entities; +using MediatR; + +namespace Imprink.Application.Commands.Orders; + +public class GetOrdersByUserIdQuery : IRequest> +{ + public string UserId { get; set; } = null!; + public bool IncludeDetails { get; set; } +} + +public class GetOrdersByUserId( + IUnitOfWork uw, + IMapper mapper) + : IRequestHandler> +{ + public async Task> Handle( + GetOrdersByUserIdQuery request, + CancellationToken cancellationToken) + { + IEnumerable orders; + + if (request.IncludeDetails) + { + orders = await uw.OrderRepository + .GetByUserIdWithDetailsAsync(request.UserId, cancellationToken); + } + else + { + orders = await uw.OrderRepository + .GetByUserIdAsync(request.UserId, cancellationToken); + } + + return mapper.Map>(orders); + } +} \ No newline at end of file diff --git a/src/Imprink.Application/Commands/Orders/SetOrderPaymentStatus.cs b/src/Imprink.Application/Commands/Orders/SetOrderPaymentStatus.cs new file mode 100644 index 0000000..c3adb00 --- /dev/null +++ b/src/Imprink.Application/Commands/Orders/SetOrderPaymentStatus.cs @@ -0,0 +1,6 @@ +namespace Imprink.Application.Commands.Orders; + +public class SetOrderStatus +{ + +} \ No newline at end of file diff --git a/src/Imprink.Application/Commands/Orders/SetOrderShippingStatus.cs b/src/Imprink.Application/Commands/Orders/SetOrderShippingStatus.cs new file mode 100644 index 0000000..01efc38 --- /dev/null +++ b/src/Imprink.Application/Commands/Orders/SetOrderShippingStatus.cs @@ -0,0 +1,6 @@ +namespace Imprink.Application.Commands.Orders; + +public class SetOrderShippingStatus +{ + +} \ No newline at end of file diff --git a/src/Imprink.Application/Dtos/EnumValueDto.cs b/src/Imprink.Application/Dtos/EnumValueDto.cs new file mode 100644 index 0000000..8d433f6 --- /dev/null +++ b/src/Imprink.Application/Dtos/EnumValueDto.cs @@ -0,0 +1,6 @@ +namespace Imprink.Application.Dtos; + +public class EnumValueDto +{ + +} \ No newline at end of file diff --git a/src/Imprink.Application/MappingProfile.cs b/src/Imprink.Application/Mappings/MappingProfile.cs similarity index 100% rename from src/Imprink.Application/MappingProfile.cs rename to src/Imprink.Application/Mappings/MappingProfile.cs diff --git a/src/Imprink.Application/Mappings/OrderStatusMappingProfile.cs b/src/Imprink.Application/Mappings/OrderStatusMappingProfile.cs deleted file mode 100644 index c61c7fe..0000000 --- a/src/Imprink.Application/Mappings/OrderStatusMappingProfile.cs +++ /dev/null @@ -1,15 +0,0 @@ -using AutoMapper; -using Imprink.Application.Dtos; -using Imprink.Domain.Entities; - -namespace Imprink.Application.Mappings; - -public class OrderStatusMappingProfile : Profile -{ - public OrderStatusMappingProfile() - { - CreateMap(); - - CreateMap(); - } -} \ No newline at end of file diff --git a/src/Imprink.Application/Mappings/ShippingStatusMappingProfile.cs b/src/Imprink.Application/Mappings/ShippingStatusMappingProfile.cs deleted file mode 100644 index 16a60a5..0000000 --- a/src/Imprink.Application/Mappings/ShippingStatusMappingProfile.cs +++ /dev/null @@ -1,15 +0,0 @@ -using AutoMapper; -using Imprink.Application.Dtos; -using Imprink.Domain.Entities; - -namespace Imprink.Application.Mappings; - -public class ShippingStatusMappingProfile : Profile -{ - public ShippingStatusMappingProfile() - { - CreateMap(); - - CreateMap(); - } -} \ No newline at end of file diff --git a/src/Imprink.Domain/Entities/OrderStatus.cs b/src/Imprink.Domain/Entities/OrderStatus.cs deleted file mode 100644 index 0408618..0000000 --- a/src/Imprink.Domain/Entities/OrderStatus.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Imprink.Domain.Entities; - -public class OrderStatus -{ - public int Id { get; set; } - public string Name { get; set; } = null!; - - public virtual ICollection Orders { get; set; } = new List(); -} \ No newline at end of file diff --git a/src/Imprink.Domain/Entities/ShippingStatus.cs b/src/Imprink.Domain/Entities/ShippingStatus.cs deleted file mode 100644 index d2384bf..0000000 --- a/src/Imprink.Domain/Entities/ShippingStatus.cs +++ /dev/null @@ -1,9 +0,0 @@ -namespace Imprink.Domain.Entities; - -public class ShippingStatus -{ - public int Id { get; set; } - public string Name { get; set; } = null!; - - public virtual ICollection Orders { get; set; } = new List(); -} \ No newline at end of file diff --git a/src/Imprink.Domain/Enums/OrderStatusEnum.cs b/src/Imprink.Domain/Enums/OrderStatusEnum.cs new file mode 100644 index 0000000..7a0f670 --- /dev/null +++ b/src/Imprink.Domain/Enums/OrderStatusEnum.cs @@ -0,0 +1,6 @@ +namespace Imprink.Domain.Enums; + +public enum OrderStatusEnum +{ + +} \ No newline at end of file diff --git a/src/Imprink.Domain/Enums/ShippingStatusEnum.cs b/src/Imprink.Domain/Enums/ShippingStatusEnum.cs new file mode 100644 index 0000000..50922af --- /dev/null +++ b/src/Imprink.Domain/Enums/ShippingStatusEnum.cs @@ -0,0 +1,6 @@ +namespace Imprink.Domain.Enums; + +public enum ShippingStatusEnum +{ + +} \ No newline at end of file diff --git a/src/Imprink.Domain/Extensions/StatusExtensions.cs b/src/Imprink.Domain/Extensions/StatusExtensions.cs new file mode 100644 index 0000000..694aeb5 --- /dev/null +++ b/src/Imprink.Domain/Extensions/StatusExtensions.cs @@ -0,0 +1,6 @@ +namespace Imprink.Domain.Extensions; + +public class StatusExtensions +{ + +} \ No newline at end of file diff --git a/src/Imprink.Infrastructure/Configuration/OrderStatusConfiguration.cs b/src/Imprink.Infrastructure/Configuration/OrderStatusConfiguration.cs deleted file mode 100644 index 917d343..0000000 --- a/src/Imprink.Infrastructure/Configuration/OrderStatusConfiguration.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Imprink.Domain.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Imprink.Infrastructure.Configuration; - -public class OrderStatusConfiguration : IEntityTypeConfiguration -{ - public void Configure(EntityTypeBuilder builder) - { - builder.HasKey(os => os.Id); - - builder.Property(os => os.Id) - .ValueGeneratedNever(); - - builder.Property(os => os.Name) - .IsRequired() - .HasMaxLength(50); - - builder.HasIndex(os => os.Name) - .IsUnique() - .HasDatabaseName("IX_OrderStatus_Name"); - - builder.HasData( - new OrderStatus { Id = 0, Name = "Pending" }, - new OrderStatus { Id = 1, Name = "Processing" }, - new OrderStatus { Id = 2, Name = "Completed" }, - new OrderStatus { Id = 3, Name = "Cancelled" } - ); - } -} \ No newline at end of file diff --git a/src/Imprink.Infrastructure/Configuration/ShippingStatusConfiguration.cs b/src/Imprink.Infrastructure/Configuration/ShippingStatusConfiguration.cs deleted file mode 100644 index 1dcf9b5..0000000 --- a/src/Imprink.Infrastructure/Configuration/ShippingStatusConfiguration.cs +++ /dev/null @@ -1,31 +0,0 @@ -using Imprink.Domain.Entities; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Metadata.Builders; - -namespace Imprink.Infrastructure.Configuration; - -public class ShippingStatusConfiguration : IEntityTypeConfiguration -{ - public void Configure(EntityTypeBuilder builder) - { - builder.HasKey(ss => ss.Id); - - builder.Property(ss => ss.Id) - .ValueGeneratedNever(); - - builder.Property(ss => ss.Name) - .IsRequired() - .HasMaxLength(50); - - builder.HasIndex(ss => ss.Name) - .IsUnique() - .HasDatabaseName("IX_ShippingStatus_Name"); - - builder.HasData( - new ShippingStatus { Id = 0, Name = "Prepping" }, - new ShippingStatus { Id = 1, Name = "Packaging" }, - new ShippingStatus { Id = 2, Name = "Shipped" }, - new ShippingStatus { Id = 3, Name = "Delivered" } - ); - } -} \ No newline at end of file diff --git a/src/Imprink.Infrastructure/Migrations/20250625223159_InitialSetup.Designer.cs b/src/Imprink.Infrastructure/Migrations/20250625223159_InitialSetup.Designer.cs deleted file mode 100644 index 8e73eb7..0000000 --- a/src/Imprink.Infrastructure/Migrations/20250625223159_InitialSetup.Designer.cs +++ /dev/null @@ -1,1027 +0,0 @@ -// -using System; -using Imprink.Infrastructure.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Imprink.Infrastructure.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - [Migration("20250625223159_InitialSetup")] - partial class InitialSetup - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Imprink.Domain.Entities.Address", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier") - .HasDefaultValueSql("NEWID()"); - - b.Property("AddressLine1") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("AddressType") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("ApartmentNumber") - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.Property("BuildingNumber") - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.Property("City") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Company") - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("Country") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("FirstName") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Floor") - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.Property("Instructions") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("IsActive") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("IsDefault") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastName") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("ModifiedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("ModifiedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("PhoneNumber") - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.Property("PostalCode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.Property("State") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("CreatedAt") - .HasDatabaseName("IX_Address_CreatedAt"); - - b.HasIndex("CreatedBy") - .HasDatabaseName("IX_Address_CreatedBy"); - - b.HasIndex("ModifiedAt") - .HasDatabaseName("IX_Address_ModifiedAt"); - - b.HasIndex("UserId") - .HasDatabaseName("IX_Address_UserId"); - - b.HasIndex("UserId", "AddressType") - .HasDatabaseName("IX_Address_User_Type"); - - b.HasIndex("UserId", "IsDefault") - .HasDatabaseName("IX_Address_User_Default"); - - b.ToTable("Addresses"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Category", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier") - .HasDefaultValueSql("NEWID()"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("ImageUrl") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("IsActive") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("ModifiedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("ModifiedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("ParentCategoryId") - .HasColumnType("uniqueidentifier"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(0); - - b.HasKey("Id"); - - b.HasIndex("CreatedAt") - .HasDatabaseName("IX_Category_CreatedAt"); - - b.HasIndex("CreatedBy") - .HasDatabaseName("IX_Category_CreatedBy"); - - b.HasIndex("IsActive") - .HasDatabaseName("IX_Category_IsActive"); - - b.HasIndex("ModifiedAt") - .HasDatabaseName("IX_Category_ModifiedAt"); - - b.HasIndex("Name") - .HasDatabaseName("IX_Category_Name"); - - b.HasIndex("ParentCategoryId") - .HasDatabaseName("IX_Category_ParentCategoryId"); - - b.HasIndex("IsActive", "SortOrder") - .HasDatabaseName("IX_Category_Active_SortOrder"); - - b.HasIndex("ParentCategoryId", "SortOrder") - .HasDatabaseName("IX_Category_Parent_SortOrder"); - - b.ToTable("Categories"); - - b.HasData( - new - { - Id = new Guid("11111111-1111-1111-1111-111111111111"), - CreatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - CreatedBy = "system@printbase.com", - Description = "Textile and fabric-based products", - IsActive = true, - ModifiedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - ModifiedBy = "system@printbase.com", - Name = "Textile", - SortOrder = 1 - }, - new - { - Id = new Guid("22222222-2222-2222-2222-222222222222"), - CreatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - CreatedBy = "system@printbase.com", - Description = "Products for hard surface printing", - IsActive = true, - ModifiedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - ModifiedBy = "system@printbase.com", - Name = "Hard Surfaces", - SortOrder = 2 - }, - new - { - Id = new Guid("33333333-3333-3333-3333-333333333333"), - CreatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - CreatedBy = "system@printbase.com", - Description = "Paper-based printing products", - IsActive = true, - ModifiedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - ModifiedBy = "system@printbase.com", - Name = "Paper", - SortOrder = 3 - }); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier") - .HasDefaultValueSql("NEWID()"); - - b.Property("Amount") - .HasColumnType("decimal(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("CustomizationDescription") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CustomizationImageUrl") - .HasMaxLength(1000) - .HasColumnType("nvarchar(1000)"); - - b.Property("MerchantId") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("ModifiedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("ModifiedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("nvarchar(1000)"); - - b.Property("OrderDate") - .HasColumnType("datetime2"); - - b.Property("OrderStatusId") - .HasColumnType("int"); - - b.Property("OriginalImageUrls") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProductId") - .HasColumnType("uniqueidentifier"); - - b.Property("ProductVariantId") - .HasColumnType("uniqueidentifier"); - - b.Property("Quantity") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(1); - - b.Property("ShippingStatusId") - .HasColumnType("int"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("CreatedAt") - .HasDatabaseName("IX_Order_CreatedAt"); - - b.HasIndex("CreatedBy") - .HasDatabaseName("IX_Order_CreatedBy"); - - b.HasIndex("MerchantId") - .HasDatabaseName("IX_Order_MerchantId"); - - b.HasIndex("ModifiedAt") - .HasDatabaseName("IX_Order_ModifiedAt"); - - b.HasIndex("OrderDate") - .HasDatabaseName("IX_Order_OrderDate"); - - b.HasIndex("OrderStatusId") - .HasDatabaseName("IX_Order_OrderStatusId"); - - b.HasIndex("ProductId") - .HasDatabaseName("IX_Order_ProductId"); - - b.HasIndex("ProductVariantId") - .HasDatabaseName("IX_Order_ProductVariantId"); - - b.HasIndex("ShippingStatusId") - .HasDatabaseName("IX_Order_ShippingStatusId"); - - b.HasIndex("UserId") - .HasDatabaseName("IX_Order_UserId"); - - b.HasIndex("MerchantId", "OrderDate") - .HasDatabaseName("IX_Order_Merchant_Date"); - - b.HasIndex("ProductId", "OrderDate") - .HasDatabaseName("IX_Order_Product_Date"); - - b.HasIndex("UserId", "OrderDate") - .HasDatabaseName("IX_Order_User_Date"); - - b.ToTable("Orders"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.OrderAddress", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier") - .HasDefaultValueSql("NEWID()"); - - b.Property("AddressLine1") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("AddressType") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("ApartmentNumber") - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.Property("BuildingNumber") - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.Property("City") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Company") - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("Country") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("FirstName") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Floor") - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.Property("Instructions") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("LastName") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("ModifiedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("ModifiedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("OrderId") - .HasColumnType("uniqueidentifier"); - - b.Property("PhoneNumber") - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.Property("PostalCode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.Property("State") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.HasKey("Id"); - - b.HasIndex("CreatedAt") - .HasDatabaseName("IX_OrderAddress_CreatedAt"); - - b.HasIndex("CreatedBy") - .HasDatabaseName("IX_OrderAddress_CreatedBy"); - - b.HasIndex("ModifiedAt") - .HasDatabaseName("IX_OrderAddress_ModifiedAt"); - - b.HasIndex("OrderId") - .IsUnique() - .HasDatabaseName("IX_OrderAddress_OrderId"); - - b.ToTable("OrderAddresses"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.OrderStatus", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("IX_OrderStatus_Name"); - - b.ToTable("OrderStatuses"); - - b.HasData( - new - { - Id = 0, - Name = "Pending" - }, - new - { - Id = 1, - Name = "Processing" - }, - new - { - Id = 2, - Name = "Completed" - }, - new - { - Id = 3, - Name = "Cancelled" - }); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier") - .HasDefaultValueSql("NEWID()"); - - b.Property("BasePrice") - .HasColumnType("decimal(18,2)"); - - b.Property("CategoryId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("ImageUrl") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("IsActive") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("IsCustomizable") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("ModifiedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("ModifiedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId") - .HasDatabaseName("IX_Product_CategoryId"); - - b.HasIndex("CreatedAt") - .HasDatabaseName("IX_Product_CreatedAt"); - - b.HasIndex("CreatedBy") - .HasDatabaseName("IX_Product_CreatedBy"); - - b.HasIndex("IsActive") - .HasDatabaseName("IX_Product_IsActive"); - - b.HasIndex("IsCustomizable") - .HasDatabaseName("IX_Product_IsCustomizable"); - - b.HasIndex("ModifiedAt") - .HasDatabaseName("IX_Product_ModifiedAt"); - - b.HasIndex("Name") - .HasDatabaseName("IX_Product_Name"); - - b.HasIndex("CategoryId", "IsActive") - .HasDatabaseName("IX_Product_Category_Active"); - - b.HasIndex("IsActive", "IsCustomizable") - .HasDatabaseName("IX_Product_Active_Customizable"); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.ProductVariant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier") - .HasDefaultValueSql("NEWID()"); - - b.Property("Color") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("ImageUrl") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("IsActive") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("ModifiedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("ModifiedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("Price") - .HasColumnType("decimal(18,2)"); - - b.Property("ProductId") - .HasColumnType("uniqueidentifier"); - - b.Property("Size") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("StockQuantity") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(0); - - b.HasKey("Id"); - - b.HasIndex("CreatedAt") - .HasDatabaseName("IX_ProductVariant_CreatedAt"); - - b.HasIndex("CreatedBy") - .HasDatabaseName("IX_ProductVariant_CreatedBy"); - - b.HasIndex("IsActive") - .HasDatabaseName("IX_ProductVariant_IsActive"); - - b.HasIndex("ModifiedAt") - .HasDatabaseName("IX_ProductVariant_ModifiedAt"); - - b.HasIndex("ProductId") - .HasDatabaseName("IX_ProductVariant_ProductId"); - - b.HasIndex("Sku") - .IsUnique() - .HasDatabaseName("IX_ProductVariant_SKU"); - - b.HasIndex("ProductId", "Size", "Color") - .IsUnique() - .HasDatabaseName("IX_ProductVariant_Product_Size_Color") - .HasFilter("[Color] IS NOT NULL"); - - b.ToTable("ProductVariants"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Role", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleName") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.HasIndex("RoleName") - .IsUnique() - .HasDatabaseName("IX_Role_RoleName"); - - b.ToTable("Roles"); - - b.HasData( - new - { - Id = new Guid("22222222-2222-2222-2222-222222222222"), - RoleName = "Merchant" - }, - new - { - Id = new Guid("33333333-3333-3333-3333-333333333333"), - RoleName = "Admin" - }); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.ShippingStatus", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("IX_ShippingStatus_Name"); - - b.ToTable("ShippingStatuses"); - - b.HasData( - new - { - Id = 0, - Name = "Prepping" - }, - new - { - Id = 1, - Name = "Packaging" - }, - new - { - Id = 2, - Name = "Shipped" - }, - new - { - Id = 3, - Name = "Delivered" - }); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.User", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailVerified") - .HasColumnType("bit"); - - b.Property("FirstName") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("IsActive") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("LastName") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Nickname") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("PhoneNumber") - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.HasKey("Id"); - - b.HasIndex("Email") - .IsUnique() - .HasDatabaseName("IX_User_Email"); - - b.HasIndex("IsActive") - .HasDatabaseName("IX_User_IsActive"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.UserRole", b => - { - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId") - .HasDatabaseName("IX_UserRole_RoleId"); - - b.HasIndex("UserId") - .HasDatabaseName("IX_UserRole_UserId"); - - b.ToTable("UserRole"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Address", b => - { - b.HasOne("Imprink.Domain.Entities.User", "User") - .WithMany("Addresses") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Category", b => - { - b.HasOne("Imprink.Domain.Entities.Category", "ParentCategory") - .WithMany("SubCategories") - .HasForeignKey("ParentCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("ParentCategory"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Order", b => - { - b.HasOne("Imprink.Domain.Entities.User", "Merchant") - .WithMany("MerchantOrders") - .HasForeignKey("MerchantId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("Imprink.Domain.Entities.OrderStatus", "OrderStatus") - .WithMany("Orders") - .HasForeignKey("OrderStatusId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Imprink.Domain.Entities.Product", "Product") - .WithMany("Orders") - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Imprink.Domain.Entities.ProductVariant", "ProductVariant") - .WithMany("Orders") - .HasForeignKey("ProductVariantId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Imprink.Domain.Entities.ShippingStatus", "ShippingStatus") - .WithMany("Orders") - .HasForeignKey("ShippingStatusId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Imprink.Domain.Entities.User", "User") - .WithMany("Orders") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Merchant"); - - b.Navigation("OrderStatus"); - - b.Navigation("Product"); - - b.Navigation("ProductVariant"); - - b.Navigation("ShippingStatus"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.OrderAddress", b => - { - b.HasOne("Imprink.Domain.Entities.Order", "Order") - .WithOne("OrderAddress") - .HasForeignKey("Imprink.Domain.Entities.OrderAddress", "OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Product", b => - { - b.HasOne("Imprink.Domain.Entities.Category", "Category") - .WithMany("Products") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.ProductVariant", b => - { - b.HasOne("Imprink.Domain.Entities.Product", "Product") - .WithMany("ProductVariants") - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Product"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.UserRole", b => - { - b.HasOne("Imprink.Domain.Entities.Role", "Role") - .WithMany("UserRoles") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Imprink.Domain.Entities.User", "User") - .WithMany("UserRoles") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Category", b => - { - b.Navigation("Products"); - - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Order", b => - { - b.Navigation("OrderAddress") - .IsRequired(); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.OrderStatus", b => - { - b.Navigation("Orders"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Product", b => - { - b.Navigation("Orders"); - - b.Navigation("ProductVariants"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.ProductVariant", b => - { - b.Navigation("Orders"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Role", b => - { - b.Navigation("UserRoles"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.ShippingStatus", b => - { - b.Navigation("Orders"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.User", b => - { - b.Navigation("Addresses"); - - b.Navigation("MerchantOrders"); - - b.Navigation("Orders"); - - b.Navigation("UserRoles"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/src/Imprink.Infrastructure/Migrations/20250625223159_InitialSetup.cs b/src/Imprink.Infrastructure/Migrations/20250625223159_InitialSetup.cs deleted file mode 100644 index 9606a5c..0000000 --- a/src/Imprink.Infrastructure/Migrations/20250625223159_InitialSetup.cs +++ /dev/null @@ -1,676 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -#pragma warning disable CA1814 // Prefer jagged arrays over multidimensional - -namespace Imprink.Infrastructure.Migrations -{ - /// - public partial class InitialSetup : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Categories", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"), - Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), - Description = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: false), - ImageUrl = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), - SortOrder = table.Column(type: "int", nullable: false, defaultValue: 0), - IsActive = table.Column(type: "bit", nullable: false, defaultValue: true), - ParentCategoryId = table.Column(type: "uniqueidentifier", nullable: true), - CreatedAt = table.Column(type: "datetime2", nullable: true), - ModifiedAt = table.Column(type: "datetime2", nullable: true, defaultValueSql: "GETUTCDATE()"), - CreatedBy = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true), - ModifiedBy = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Categories", x => x.Id); - table.ForeignKey( - name: "FK_Categories_Categories_ParentCategoryId", - column: x => x.ParentCategoryId, - principalTable: "Categories", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "OrderStatuses", - columns: table => new - { - Id = table.Column(type: "int", nullable: false), - Name = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_OrderStatuses", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Roles", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false), - RoleName = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Roles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "ShippingStatuses", - columns: table => new - { - Id = table.Column(type: "int", nullable: false), - Name = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ShippingStatuses", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Users", - columns: table => new - { - Id = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: false), - Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - Nickname = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - Email = table.Column(type: "nvarchar(256)", maxLength: 256, nullable: false), - EmailVerified = table.Column(type: "bit", nullable: false), - FirstName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), - LastName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), - PhoneNumber = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), - IsActive = table.Column(type: "bit", nullable: false, defaultValue: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Users", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Products", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"), - Name = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), - Description = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), - BasePrice = table.Column(type: "decimal(18,2)", nullable: false), - IsCustomizable = table.Column(type: "bit", nullable: false, defaultValue: false), - IsActive = table.Column(type: "bit", nullable: false, defaultValue: true), - ImageUrl = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), - CategoryId = table.Column(type: "uniqueidentifier", nullable: true), - CreatedAt = table.Column(type: "datetime2", nullable: true), - ModifiedAt = table.Column(type: "datetime2", nullable: true, defaultValueSql: "GETUTCDATE()"), - CreatedBy = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true), - ModifiedBy = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Products", x => x.Id); - table.ForeignKey( - name: "FK_Products_Categories_CategoryId", - column: x => x.CategoryId, - principalTable: "Categories", - principalColumn: "Id", - onDelete: ReferentialAction.SetNull); - }); - - migrationBuilder.CreateTable( - name: "Addresses", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"), - UserId = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: false), - AddressType = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), - FirstName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), - LastName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), - Company = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), - AddressLine1 = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), - AddressLine2 = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), - ApartmentNumber = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), - BuildingNumber = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), - Floor = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), - City = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - State = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - PostalCode = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), - Country = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - PhoneNumber = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), - Instructions = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), - IsDefault = table.Column(type: "bit", nullable: false, defaultValue: false), - IsActive = table.Column(type: "bit", nullable: false, defaultValue: true), - CreatedAt = table.Column(type: "datetime2", nullable: true), - ModifiedAt = table.Column(type: "datetime2", nullable: true, defaultValueSql: "GETUTCDATE()"), - CreatedBy = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true), - ModifiedBy = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Addresses", x => x.Id); - table.ForeignKey( - name: "FK_Addresses_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "UserRole", - columns: table => new - { - UserId = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: false), - RoleId = table.Column(type: "uniqueidentifier", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_UserRole", x => new { x.UserId, x.RoleId }); - table.ForeignKey( - name: "FK_UserRole_Roles_RoleId", - column: x => x.RoleId, - principalTable: "Roles", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_UserRole_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "ProductVariants", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"), - ProductId = table.Column(type: "uniqueidentifier", nullable: false), - Size = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), - Color = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: true), - Price = table.Column(type: "decimal(18,2)", nullable: false), - ImageUrl = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), - Sku = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - StockQuantity = table.Column(type: "int", nullable: false, defaultValue: 0), - IsActive = table.Column(type: "bit", nullable: false, defaultValue: true), - CreatedAt = table.Column(type: "datetime2", nullable: true), - ModifiedAt = table.Column(type: "datetime2", nullable: true, defaultValueSql: "GETUTCDATE()"), - CreatedBy = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true), - ModifiedBy = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_ProductVariants", x => x.Id); - table.ForeignKey( - name: "FK_ProductVariants_Products_ProductId", - column: x => x.ProductId, - principalTable: "Products", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateTable( - name: "Orders", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"), - UserId = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: false), - OrderDate = table.Column(type: "datetime2", nullable: false), - Amount = table.Column(type: "decimal(18,2)", nullable: false), - Quantity = table.Column(type: "int", nullable: false, defaultValue: 1), - ProductId = table.Column(type: "uniqueidentifier", nullable: false), - ProductVariantId = table.Column(type: "uniqueidentifier", nullable: true), - OrderStatusId = table.Column(type: "int", nullable: false), - ShippingStatusId = table.Column(type: "int", nullable: false), - Notes = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), - MerchantId = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true), - CustomizationImageUrl = table.Column(type: "nvarchar(1000)", maxLength: 1000, nullable: true), - OriginalImageUrls = table.Column(type: "nvarchar(max)", nullable: false), - CustomizationDescription = table.Column(type: "nvarchar(2000)", maxLength: 2000, nullable: true), - CreatedAt = table.Column(type: "datetime2", nullable: true), - ModifiedAt = table.Column(type: "datetime2", nullable: true, defaultValueSql: "GETUTCDATE()"), - CreatedBy = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true), - ModifiedBy = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Orders", x => x.Id); - table.ForeignKey( - name: "FK_Orders_OrderStatuses_OrderStatusId", - column: x => x.OrderStatusId, - principalTable: "OrderStatuses", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Orders_ProductVariants_ProductVariantId", - column: x => x.ProductVariantId, - principalTable: "ProductVariants", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Orders_Products_ProductId", - column: x => x.ProductId, - principalTable: "Products", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Orders_ShippingStatuses_ShippingStatusId", - column: x => x.ShippingStatusId, - principalTable: "ShippingStatuses", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Orders_Users_MerchantId", - column: x => x.MerchantId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.SetNull); - table.ForeignKey( - name: "FK_Orders_Users_UserId", - column: x => x.UserId, - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "OrderAddresses", - columns: table => new - { - Id = table.Column(type: "uniqueidentifier", nullable: false, defaultValueSql: "NEWID()"), - OrderId = table.Column(type: "uniqueidentifier", nullable: false), - AddressType = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), - FirstName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), - LastName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: true), - Company = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), - AddressLine1 = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), - AddressLine2 = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: true), - ApartmentNumber = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), - BuildingNumber = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), - Floor = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), - City = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - State = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - PostalCode = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: false), - Country = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), - PhoneNumber = table.Column(type: "nvarchar(20)", maxLength: 20, nullable: true), - Instructions = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), - CreatedAt = table.Column(type: "datetime2", nullable: true), - ModifiedAt = table.Column(type: "datetime2", nullable: true, defaultValueSql: "GETUTCDATE()"), - CreatedBy = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true), - ModifiedBy = table.Column(type: "nvarchar(450)", maxLength: 450, nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_OrderAddresses", x => x.Id); - table.ForeignKey( - name: "FK_OrderAddresses_Orders_OrderId", - column: x => x.OrderId, - principalTable: "Orders", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.InsertData( - table: "Categories", - columns: new[] { "Id", "CreatedAt", "CreatedBy", "Description", "ImageUrl", "IsActive", "ModifiedAt", "ModifiedBy", "Name", "ParentCategoryId", "SortOrder" }, - values: new object[,] - { - { new Guid("11111111-1111-1111-1111-111111111111"), new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "system@printbase.com", "Textile and fabric-based products", null, true, new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "system@printbase.com", "Textile", null, 1 }, - { new Guid("22222222-2222-2222-2222-222222222222"), new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "system@printbase.com", "Products for hard surface printing", null, true, new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "system@printbase.com", "Hard Surfaces", null, 2 }, - { new Guid("33333333-3333-3333-3333-333333333333"), new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "system@printbase.com", "Paper-based printing products", null, true, new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), "system@printbase.com", "Paper", null, 3 } - }); - - migrationBuilder.InsertData( - table: "OrderStatuses", - columns: new[] { "Id", "Name" }, - values: new object[,] - { - { 0, "Pending" }, - { 1, "Processing" }, - { 2, "Completed" }, - { 3, "Cancelled" } - }); - - migrationBuilder.InsertData( - table: "Roles", - columns: new[] { "Id", "RoleName" }, - values: new object[,] - { - { new Guid("22222222-2222-2222-2222-222222222222"), "Merchant" }, - { new Guid("33333333-3333-3333-3333-333333333333"), "Admin" } - }); - - migrationBuilder.InsertData( - table: "ShippingStatuses", - columns: new[] { "Id", "Name" }, - values: new object[,] - { - { 0, "Prepping" }, - { 1, "Packaging" }, - { 2, "Shipped" }, - { 3, "Delivered" } - }); - - migrationBuilder.CreateIndex( - name: "IX_Address_CreatedAt", - table: "Addresses", - column: "CreatedAt"); - - migrationBuilder.CreateIndex( - name: "IX_Address_CreatedBy", - table: "Addresses", - column: "CreatedBy"); - - migrationBuilder.CreateIndex( - name: "IX_Address_ModifiedAt", - table: "Addresses", - column: "ModifiedAt"); - - migrationBuilder.CreateIndex( - name: "IX_Address_User_Default", - table: "Addresses", - columns: new[] { "UserId", "IsDefault" }); - - migrationBuilder.CreateIndex( - name: "IX_Address_User_Type", - table: "Addresses", - columns: new[] { "UserId", "AddressType" }); - - migrationBuilder.CreateIndex( - name: "IX_Address_UserId", - table: "Addresses", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_Category_Active_SortOrder", - table: "Categories", - columns: new[] { "IsActive", "SortOrder" }); - - migrationBuilder.CreateIndex( - name: "IX_Category_CreatedAt", - table: "Categories", - column: "CreatedAt"); - - migrationBuilder.CreateIndex( - name: "IX_Category_CreatedBy", - table: "Categories", - column: "CreatedBy"); - - migrationBuilder.CreateIndex( - name: "IX_Category_IsActive", - table: "Categories", - column: "IsActive"); - - migrationBuilder.CreateIndex( - name: "IX_Category_ModifiedAt", - table: "Categories", - column: "ModifiedAt"); - - migrationBuilder.CreateIndex( - name: "IX_Category_Name", - table: "Categories", - column: "Name"); - - migrationBuilder.CreateIndex( - name: "IX_Category_Parent_SortOrder", - table: "Categories", - columns: new[] { "ParentCategoryId", "SortOrder" }); - - migrationBuilder.CreateIndex( - name: "IX_Category_ParentCategoryId", - table: "Categories", - column: "ParentCategoryId"); - - migrationBuilder.CreateIndex( - name: "IX_OrderAddress_CreatedAt", - table: "OrderAddresses", - column: "CreatedAt"); - - migrationBuilder.CreateIndex( - name: "IX_OrderAddress_CreatedBy", - table: "OrderAddresses", - column: "CreatedBy"); - - migrationBuilder.CreateIndex( - name: "IX_OrderAddress_ModifiedAt", - table: "OrderAddresses", - column: "ModifiedAt"); - - migrationBuilder.CreateIndex( - name: "IX_OrderAddress_OrderId", - table: "OrderAddresses", - column: "OrderId", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Order_CreatedAt", - table: "Orders", - column: "CreatedAt"); - - migrationBuilder.CreateIndex( - name: "IX_Order_CreatedBy", - table: "Orders", - column: "CreatedBy"); - - migrationBuilder.CreateIndex( - name: "IX_Order_Merchant_Date", - table: "Orders", - columns: new[] { "MerchantId", "OrderDate" }); - - migrationBuilder.CreateIndex( - name: "IX_Order_MerchantId", - table: "Orders", - column: "MerchantId"); - - migrationBuilder.CreateIndex( - name: "IX_Order_ModifiedAt", - table: "Orders", - column: "ModifiedAt"); - - migrationBuilder.CreateIndex( - name: "IX_Order_OrderDate", - table: "Orders", - column: "OrderDate"); - - migrationBuilder.CreateIndex( - name: "IX_Order_OrderStatusId", - table: "Orders", - column: "OrderStatusId"); - - migrationBuilder.CreateIndex( - name: "IX_Order_Product_Date", - table: "Orders", - columns: new[] { "ProductId", "OrderDate" }); - - migrationBuilder.CreateIndex( - name: "IX_Order_ProductId", - table: "Orders", - column: "ProductId"); - - migrationBuilder.CreateIndex( - name: "IX_Order_ProductVariantId", - table: "Orders", - column: "ProductVariantId"); - - migrationBuilder.CreateIndex( - name: "IX_Order_ShippingStatusId", - table: "Orders", - column: "ShippingStatusId"); - - migrationBuilder.CreateIndex( - name: "IX_Order_User_Date", - table: "Orders", - columns: new[] { "UserId", "OrderDate" }); - - migrationBuilder.CreateIndex( - name: "IX_Order_UserId", - table: "Orders", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_OrderStatus_Name", - table: "OrderStatuses", - column: "Name", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Product_Active_Customizable", - table: "Products", - columns: new[] { "IsActive", "IsCustomizable" }); - - migrationBuilder.CreateIndex( - name: "IX_Product_Category_Active", - table: "Products", - columns: new[] { "CategoryId", "IsActive" }); - - migrationBuilder.CreateIndex( - name: "IX_Product_CategoryId", - table: "Products", - column: "CategoryId"); - - migrationBuilder.CreateIndex( - name: "IX_Product_CreatedAt", - table: "Products", - column: "CreatedAt"); - - migrationBuilder.CreateIndex( - name: "IX_Product_CreatedBy", - table: "Products", - column: "CreatedBy"); - - migrationBuilder.CreateIndex( - name: "IX_Product_IsActive", - table: "Products", - column: "IsActive"); - - migrationBuilder.CreateIndex( - name: "IX_Product_IsCustomizable", - table: "Products", - column: "IsCustomizable"); - - migrationBuilder.CreateIndex( - name: "IX_Product_ModifiedAt", - table: "Products", - column: "ModifiedAt"); - - migrationBuilder.CreateIndex( - name: "IX_Product_Name", - table: "Products", - column: "Name"); - - migrationBuilder.CreateIndex( - name: "IX_ProductVariant_CreatedAt", - table: "ProductVariants", - column: "CreatedAt"); - - migrationBuilder.CreateIndex( - name: "IX_ProductVariant_CreatedBy", - table: "ProductVariants", - column: "CreatedBy"); - - migrationBuilder.CreateIndex( - name: "IX_ProductVariant_IsActive", - table: "ProductVariants", - column: "IsActive"); - - migrationBuilder.CreateIndex( - name: "IX_ProductVariant_ModifiedAt", - table: "ProductVariants", - column: "ModifiedAt"); - - migrationBuilder.CreateIndex( - name: "IX_ProductVariant_Product_Size_Color", - table: "ProductVariants", - columns: new[] { "ProductId", "Size", "Color" }, - unique: true, - filter: "[Color] IS NOT NULL"); - - migrationBuilder.CreateIndex( - name: "IX_ProductVariant_ProductId", - table: "ProductVariants", - column: "ProductId"); - - migrationBuilder.CreateIndex( - name: "IX_ProductVariant_SKU", - table: "ProductVariants", - column: "Sku", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Role_RoleName", - table: "Roles", - column: "RoleName", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ShippingStatus_Name", - table: "ShippingStatuses", - column: "Name", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_UserRole_RoleId", - table: "UserRole", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "IX_UserRole_UserId", - table: "UserRole", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_User_Email", - table: "Users", - column: "Email", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_User_IsActive", - table: "Users", - column: "IsActive"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Addresses"); - - migrationBuilder.DropTable( - name: "OrderAddresses"); - - migrationBuilder.DropTable( - name: "UserRole"); - - migrationBuilder.DropTable( - name: "Orders"); - - migrationBuilder.DropTable( - name: "Roles"); - - migrationBuilder.DropTable( - name: "OrderStatuses"); - - migrationBuilder.DropTable( - name: "ProductVariants"); - - migrationBuilder.DropTable( - name: "ShippingStatuses"); - - migrationBuilder.DropTable( - name: "Users"); - - migrationBuilder.DropTable( - name: "Products"); - - migrationBuilder.DropTable( - name: "Categories"); - } - } -} diff --git a/src/Imprink.Infrastructure/Migrations/ApplicationDbContextModelSnapshot.cs b/src/Imprink.Infrastructure/Migrations/ApplicationDbContextModelSnapshot.cs deleted file mode 100644 index 9d264b9..0000000 --- a/src/Imprink.Infrastructure/Migrations/ApplicationDbContextModelSnapshot.cs +++ /dev/null @@ -1,1024 +0,0 @@ -// -using System; -using Imprink.Infrastructure.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Metadata; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; - -#nullable disable - -namespace Imprink.Infrastructure.Migrations -{ - [DbContext(typeof(ApplicationDbContext))] - partial class ApplicationDbContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "9.0.5") - .HasAnnotation("Relational:MaxIdentifierLength", 128); - - SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); - - modelBuilder.Entity("Imprink.Domain.Entities.Address", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier") - .HasDefaultValueSql("NEWID()"); - - b.Property("AddressLine1") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("AddressType") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("ApartmentNumber") - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.Property("BuildingNumber") - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.Property("City") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Company") - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("Country") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("FirstName") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Floor") - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.Property("Instructions") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("IsActive") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("IsDefault") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("LastName") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("ModifiedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("ModifiedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("PhoneNumber") - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.Property("PostalCode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.Property("State") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("CreatedAt") - .HasDatabaseName("IX_Address_CreatedAt"); - - b.HasIndex("CreatedBy") - .HasDatabaseName("IX_Address_CreatedBy"); - - b.HasIndex("ModifiedAt") - .HasDatabaseName("IX_Address_ModifiedAt"); - - b.HasIndex("UserId") - .HasDatabaseName("IX_Address_UserId"); - - b.HasIndex("UserId", "AddressType") - .HasDatabaseName("IX_Address_User_Type"); - - b.HasIndex("UserId", "IsDefault") - .HasDatabaseName("IX_Address_User_Default"); - - b.ToTable("Addresses"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Category", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier") - .HasDefaultValueSql("NEWID()"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("Description") - .IsRequired() - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("ImageUrl") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("IsActive") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("ModifiedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("ModifiedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("ParentCategoryId") - .HasColumnType("uniqueidentifier"); - - b.Property("SortOrder") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(0); - - b.HasKey("Id"); - - b.HasIndex("CreatedAt") - .HasDatabaseName("IX_Category_CreatedAt"); - - b.HasIndex("CreatedBy") - .HasDatabaseName("IX_Category_CreatedBy"); - - b.HasIndex("IsActive") - .HasDatabaseName("IX_Category_IsActive"); - - b.HasIndex("ModifiedAt") - .HasDatabaseName("IX_Category_ModifiedAt"); - - b.HasIndex("Name") - .HasDatabaseName("IX_Category_Name"); - - b.HasIndex("ParentCategoryId") - .HasDatabaseName("IX_Category_ParentCategoryId"); - - b.HasIndex("IsActive", "SortOrder") - .HasDatabaseName("IX_Category_Active_SortOrder"); - - b.HasIndex("ParentCategoryId", "SortOrder") - .HasDatabaseName("IX_Category_Parent_SortOrder"); - - b.ToTable("Categories"); - - b.HasData( - new - { - Id = new Guid("11111111-1111-1111-1111-111111111111"), - CreatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - CreatedBy = "system@printbase.com", - Description = "Textile and fabric-based products", - IsActive = true, - ModifiedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - ModifiedBy = "system@printbase.com", - Name = "Textile", - SortOrder = 1 - }, - new - { - Id = new Guid("22222222-2222-2222-2222-222222222222"), - CreatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - CreatedBy = "system@printbase.com", - Description = "Products for hard surface printing", - IsActive = true, - ModifiedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - ModifiedBy = "system@printbase.com", - Name = "Hard Surfaces", - SortOrder = 2 - }, - new - { - Id = new Guid("33333333-3333-3333-3333-333333333333"), - CreatedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - CreatedBy = "system@printbase.com", - Description = "Paper-based printing products", - IsActive = true, - ModifiedAt = new DateTime(2025, 1, 1, 0, 0, 0, 0, DateTimeKind.Utc), - ModifiedBy = "system@printbase.com", - Name = "Paper", - SortOrder = 3 - }); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier") - .HasDefaultValueSql("NEWID()"); - - b.Property("Amount") - .HasColumnType("decimal(18,2)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("CustomizationDescription") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("CustomizationImageUrl") - .HasMaxLength(1000) - .HasColumnType("nvarchar(1000)"); - - b.Property("MerchantId") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("ModifiedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("ModifiedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("Notes") - .HasMaxLength(1000) - .HasColumnType("nvarchar(1000)"); - - b.Property("OrderDate") - .HasColumnType("datetime2"); - - b.Property("OrderStatusId") - .HasColumnType("int"); - - b.Property("OriginalImageUrls") - .IsRequired() - .HasColumnType("nvarchar(max)"); - - b.Property("ProductId") - .HasColumnType("uniqueidentifier"); - - b.Property("ProductVariantId") - .HasColumnType("uniqueidentifier"); - - b.Property("Quantity") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(1); - - b.Property("ShippingStatusId") - .HasColumnType("int"); - - b.Property("UserId") - .IsRequired() - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.HasKey("Id"); - - b.HasIndex("CreatedAt") - .HasDatabaseName("IX_Order_CreatedAt"); - - b.HasIndex("CreatedBy") - .HasDatabaseName("IX_Order_CreatedBy"); - - b.HasIndex("MerchantId") - .HasDatabaseName("IX_Order_MerchantId"); - - b.HasIndex("ModifiedAt") - .HasDatabaseName("IX_Order_ModifiedAt"); - - b.HasIndex("OrderDate") - .HasDatabaseName("IX_Order_OrderDate"); - - b.HasIndex("OrderStatusId") - .HasDatabaseName("IX_Order_OrderStatusId"); - - b.HasIndex("ProductId") - .HasDatabaseName("IX_Order_ProductId"); - - b.HasIndex("ProductVariantId") - .HasDatabaseName("IX_Order_ProductVariantId"); - - b.HasIndex("ShippingStatusId") - .HasDatabaseName("IX_Order_ShippingStatusId"); - - b.HasIndex("UserId") - .HasDatabaseName("IX_Order_UserId"); - - b.HasIndex("MerchantId", "OrderDate") - .HasDatabaseName("IX_Order_Merchant_Date"); - - b.HasIndex("ProductId", "OrderDate") - .HasDatabaseName("IX_Order_Product_Date"); - - b.HasIndex("UserId", "OrderDate") - .HasDatabaseName("IX_Order_User_Date"); - - b.ToTable("Orders"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.OrderAddress", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier") - .HasDefaultValueSql("NEWID()"); - - b.Property("AddressLine1") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("AddressLine2") - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("AddressType") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("ApartmentNumber") - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.Property("BuildingNumber") - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.Property("City") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Company") - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.Property("Country") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("FirstName") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Floor") - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.Property("Instructions") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("LastName") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("ModifiedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("ModifiedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("OrderId") - .HasColumnType("uniqueidentifier"); - - b.Property("PhoneNumber") - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.Property("PostalCode") - .IsRequired() - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.Property("State") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.HasKey("Id"); - - b.HasIndex("CreatedAt") - .HasDatabaseName("IX_OrderAddress_CreatedAt"); - - b.HasIndex("CreatedBy") - .HasDatabaseName("IX_OrderAddress_CreatedBy"); - - b.HasIndex("ModifiedAt") - .HasDatabaseName("IX_OrderAddress_ModifiedAt"); - - b.HasIndex("OrderId") - .IsUnique() - .HasDatabaseName("IX_OrderAddress_OrderId"); - - b.ToTable("OrderAddresses"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.OrderStatus", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("IX_OrderStatus_Name"); - - b.ToTable("OrderStatuses"); - - b.HasData( - new - { - Id = 0, - Name = "Pending" - }, - new - { - Id = 1, - Name = "Processing" - }, - new - { - Id = 2, - Name = "Completed" - }, - new - { - Id = 3, - Name = "Cancelled" - }); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier") - .HasDefaultValueSql("NEWID()"); - - b.Property("BasePrice") - .HasColumnType("decimal(18,2)"); - - b.Property("CategoryId") - .HasColumnType("uniqueidentifier"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("Description") - .HasMaxLength(2000) - .HasColumnType("nvarchar(2000)"); - - b.Property("ImageUrl") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("IsActive") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("IsCustomizable") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(false); - - b.Property("ModifiedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("ModifiedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(200) - .HasColumnType("nvarchar(200)"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId") - .HasDatabaseName("IX_Product_CategoryId"); - - b.HasIndex("CreatedAt") - .HasDatabaseName("IX_Product_CreatedAt"); - - b.HasIndex("CreatedBy") - .HasDatabaseName("IX_Product_CreatedBy"); - - b.HasIndex("IsActive") - .HasDatabaseName("IX_Product_IsActive"); - - b.HasIndex("IsCustomizable") - .HasDatabaseName("IX_Product_IsCustomizable"); - - b.HasIndex("ModifiedAt") - .HasDatabaseName("IX_Product_ModifiedAt"); - - b.HasIndex("Name") - .HasDatabaseName("IX_Product_Name"); - - b.HasIndex("CategoryId", "IsActive") - .HasDatabaseName("IX_Product_Category_Active"); - - b.HasIndex("IsActive", "IsCustomizable") - .HasDatabaseName("IX_Product_Active_Customizable"); - - b.ToTable("Products"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.ProductVariant", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uniqueidentifier") - .HasDefaultValueSql("NEWID()"); - - b.Property("Color") - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("CreatedAt") - .HasColumnType("datetime2"); - - b.Property("CreatedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("ImageUrl") - .HasMaxLength(500) - .HasColumnType("nvarchar(500)"); - - b.Property("IsActive") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("ModifiedAt") - .ValueGeneratedOnAdd() - .HasColumnType("datetime2") - .HasDefaultValueSql("GETUTCDATE()"); - - b.Property("ModifiedBy") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("Price") - .HasColumnType("decimal(18,2)"); - - b.Property("ProductId") - .HasColumnType("uniqueidentifier"); - - b.Property("Size") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.Property("Sku") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("StockQuantity") - .ValueGeneratedOnAdd() - .HasColumnType("int") - .HasDefaultValue(0); - - b.HasKey("Id"); - - b.HasIndex("CreatedAt") - .HasDatabaseName("IX_ProductVariant_CreatedAt"); - - b.HasIndex("CreatedBy") - .HasDatabaseName("IX_ProductVariant_CreatedBy"); - - b.HasIndex("IsActive") - .HasDatabaseName("IX_ProductVariant_IsActive"); - - b.HasIndex("ModifiedAt") - .HasDatabaseName("IX_ProductVariant_ModifiedAt"); - - b.HasIndex("ProductId") - .HasDatabaseName("IX_ProductVariant_ProductId"); - - b.HasIndex("Sku") - .IsUnique() - .HasDatabaseName("IX_ProductVariant_SKU"); - - b.HasIndex("ProductId", "Size", "Color") - .IsUnique() - .HasDatabaseName("IX_ProductVariant_Product_Size_Color") - .HasFilter("[Color] IS NOT NULL"); - - b.ToTable("ProductVariants"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Role", b => - { - b.Property("Id") - .HasColumnType("uniqueidentifier"); - - b.Property("RoleName") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.HasIndex("RoleName") - .IsUnique() - .HasDatabaseName("IX_Role_RoleName"); - - b.ToTable("Roles"); - - b.HasData( - new - { - Id = new Guid("22222222-2222-2222-2222-222222222222"), - RoleName = "Merchant" - }, - new - { - Id = new Guid("33333333-3333-3333-3333-333333333333"), - RoleName = "Admin" - }); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.ShippingStatus", b => - { - b.Property("Id") - .HasColumnType("int"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(50) - .HasColumnType("nvarchar(50)"); - - b.HasKey("Id"); - - b.HasIndex("Name") - .IsUnique() - .HasDatabaseName("IX_ShippingStatus_Name"); - - b.ToTable("ShippingStatuses"); - - b.HasData( - new - { - Id = 0, - Name = "Prepping" - }, - new - { - Id = 1, - Name = "Packaging" - }, - new - { - Id = 2, - Name = "Shipped" - }, - new - { - Id = 3, - Name = "Delivered" - }); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.User", b => - { - b.Property("Id") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("Email") - .IsRequired() - .HasMaxLength(256) - .HasColumnType("nvarchar(256)"); - - b.Property("EmailVerified") - .HasColumnType("bit"); - - b.Property("FirstName") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("IsActive") - .ValueGeneratedOnAdd() - .HasColumnType("bit") - .HasDefaultValue(true); - - b.Property("LastName") - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Name") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("Nickname") - .IsRequired() - .HasMaxLength(100) - .HasColumnType("nvarchar(100)"); - - b.Property("PhoneNumber") - .HasMaxLength(20) - .HasColumnType("nvarchar(20)"); - - b.HasKey("Id"); - - b.HasIndex("Email") - .IsUnique() - .HasDatabaseName("IX_User_Email"); - - b.HasIndex("IsActive") - .HasDatabaseName("IX_User_IsActive"); - - b.ToTable("Users"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.UserRole", b => - { - b.Property("UserId") - .HasMaxLength(450) - .HasColumnType("nvarchar(450)"); - - b.Property("RoleId") - .HasColumnType("uniqueidentifier"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId") - .HasDatabaseName("IX_UserRole_RoleId"); - - b.HasIndex("UserId") - .HasDatabaseName("IX_UserRole_UserId"); - - b.ToTable("UserRole"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Address", b => - { - b.HasOne("Imprink.Domain.Entities.User", "User") - .WithMany("Addresses") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Category", b => - { - b.HasOne("Imprink.Domain.Entities.Category", "ParentCategory") - .WithMany("SubCategories") - .HasForeignKey("ParentCategoryId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("ParentCategory"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Order", b => - { - b.HasOne("Imprink.Domain.Entities.User", "Merchant") - .WithMany("MerchantOrders") - .HasForeignKey("MerchantId") - .OnDelete(DeleteBehavior.SetNull); - - b.HasOne("Imprink.Domain.Entities.OrderStatus", "OrderStatus") - .WithMany("Orders") - .HasForeignKey("OrderStatusId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Imprink.Domain.Entities.Product", "Product") - .WithMany("Orders") - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Imprink.Domain.Entities.ProductVariant", "ProductVariant") - .WithMany("Orders") - .HasForeignKey("ProductVariantId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Imprink.Domain.Entities.ShippingStatus", "ShippingStatus") - .WithMany("Orders") - .HasForeignKey("ShippingStatusId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Imprink.Domain.Entities.User", "User") - .WithMany("Orders") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Merchant"); - - b.Navigation("OrderStatus"); - - b.Navigation("Product"); - - b.Navigation("ProductVariant"); - - b.Navigation("ShippingStatus"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.OrderAddress", b => - { - b.HasOne("Imprink.Domain.Entities.Order", "Order") - .WithOne("OrderAddress") - .HasForeignKey("Imprink.Domain.Entities.OrderAddress", "OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Product", b => - { - b.HasOne("Imprink.Domain.Entities.Category", "Category") - .WithMany("Products") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.SetNull); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.ProductVariant", b => - { - b.HasOne("Imprink.Domain.Entities.Product", "Product") - .WithMany("ProductVariants") - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Product"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.UserRole", b => - { - b.HasOne("Imprink.Domain.Entities.Role", "Role") - .WithMany("UserRoles") - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("Imprink.Domain.Entities.User", "User") - .WithMany("UserRoles") - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Role"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Category", b => - { - b.Navigation("Products"); - - b.Navigation("SubCategories"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Order", b => - { - b.Navigation("OrderAddress") - .IsRequired(); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.OrderStatus", b => - { - b.Navigation("Orders"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Product", b => - { - b.Navigation("Orders"); - - b.Navigation("ProductVariants"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.ProductVariant", b => - { - b.Navigation("Orders"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.Role", b => - { - b.Navigation("UserRoles"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.ShippingStatus", b => - { - b.Navigation("Orders"); - }); - - modelBuilder.Entity("Imprink.Domain.Entities.User", b => - { - b.Navigation("Addresses"); - - b.Navigation("MerchantOrders"); - - b.Navigation("Orders"); - - b.Navigation("UserRoles"); - }); -#pragma warning restore 612, 618 - } - } -}