From 32d1019eb5a96665d31572405c362e83a1fec02d Mon Sep 17 00:00:00 2001 From: Khwezi Mngoma Date: Sun, 10 May 2026 11:16:52 +0200 Subject: [PATCH] Migrated database changes --- .../NotificationConfiguration.cs | 12 +- .../Configuration/OrderConfiguration.cs | 3 + .../Configuration/PackageConfirguration.cs | 16 + .../Configuration/PackageItemConfiguration.cs | 20 + .../Configuration/QuoteConfiguration.cs | 2 +- .../ShoppingCartConfiguration.cs | 2 +- .../ShoppingCartItemConfiguration.cs | 2 +- .../ShoppingCartPackageConfiguration.cs | 24 + LiteCharms.Entities/Package.cs | 9 + LiteCharms.Entities/PackageItem.cs | 9 + LiteCharms.Entities/ShoppingCartPackage.cs | 11 + LiteCharms.Extensions/EntityModeMappers.cs | 8 +- .../Commands/CreateNotificationCommand.cs | 9 +- .../CreateNotificationCommandHandler.cs | 8 +- .../20260502231708_Init.Designer.cs | 272 ------------ .../Migrations/20260502231708_Init.cs | 154 ------- ...123_DefinedEntityRelationships.Designer.cs | 357 --------------- ...260503002123_DefinedEntityRelationships.cs | 175 -------- ...03003624_RemovedLeadIdFromLead.Designer.cs | 354 --------------- .../20260503003624_RemovedLeadIdFromLead.cs | 29 -- ...260503012708_AddedStatusToLead.Designer.cs | 357 --------------- .../20260503012708_AddedStatusToLead.cs | 29 -- ...tedAttributionHashColumnOnLead.Designer.cs | 357 --------------- ...55_CorrectedAttributionHashColumnOnLead.cs | 28 -- ...20260505120450_GeneralisedLead.Designer.cs | 360 --------------- .../20260505120450_GeneralisedLead.cs | 38 -- ...60505123745_AddedNotifications.Designer.cs | 409 ------------------ .../20260505123745_AddedNotifications.cs | 43 -- ...135_AddedProcessedColumnToNotifications.cs | 47 -- ...edQuoteShoppingCartalteredOrderCustomer.cs | 227 ---------- ...ner.cs => 20260510090446_Init.Designer.cs} | 65 ++- .../Migrations/20260510090446_Init.cs | 382 ++++++++++++++++ ... 20260510091540_AddedPackages.Designer.cs} | 384 +++++++++++++++- .../20260510091540_AddedPackages.cs | 114 +++++ ...pshot.cs => ShopDbContextModelSnapshot.cs} | 190 +++++++- .../Database/ShopDbContext.cs | 6 + .../LiteCharms.Infrastructure.csproj | 4 + LiteCharms.Models/Enums.cs | 16 + LiteCharms.Models/Notification.cs | 20 +- LiteCharms.Models/Order.cs | 8 +- LiteCharms.Models/Package.cs | 16 + LiteCharms.Models/PackageItem.cs | 14 + LiteCharms.Models/ShoppingCartPackage.cs | 12 + LiteCharmsShared.slnx | 7 - 44 files changed, 1279 insertions(+), 3330 deletions(-) create mode 100644 LiteCharms.Entities/Configuration/PackageConfirguration.cs create mode 100644 LiteCharms.Entities/Configuration/PackageItemConfiguration.cs create mode 100644 LiteCharms.Entities/Configuration/ShoppingCartPackageConfiguration.cs create mode 100644 LiteCharms.Entities/Package.cs create mode 100644 LiteCharms.Entities/PackageItem.cs create mode 100644 LiteCharms.Entities/ShoppingCartPackage.cs delete mode 100644 LiteCharms.Infrastructure/Database/Migrations/20260502231708_Init.Designer.cs delete mode 100644 LiteCharms.Infrastructure/Database/Migrations/20260502231708_Init.cs delete mode 100644 LiteCharms.Infrastructure/Database/Migrations/20260503002123_DefinedEntityRelationships.Designer.cs delete mode 100644 LiteCharms.Infrastructure/Database/Migrations/20260503002123_DefinedEntityRelationships.cs delete mode 100644 LiteCharms.Infrastructure/Database/Migrations/20260503003624_RemovedLeadIdFromLead.Designer.cs delete mode 100644 LiteCharms.Infrastructure/Database/Migrations/20260503003624_RemovedLeadIdFromLead.cs delete mode 100644 LiteCharms.Infrastructure/Database/Migrations/20260503012708_AddedStatusToLead.Designer.cs delete mode 100644 LiteCharms.Infrastructure/Database/Migrations/20260503012708_AddedStatusToLead.cs delete mode 100644 LiteCharms.Infrastructure/Database/Migrations/20260503133855_CorrectedAttributionHashColumnOnLead.Designer.cs delete mode 100644 LiteCharms.Infrastructure/Database/Migrations/20260503133855_CorrectedAttributionHashColumnOnLead.cs delete mode 100644 LiteCharms.Infrastructure/Database/Migrations/20260505120450_GeneralisedLead.Designer.cs delete mode 100644 LiteCharms.Infrastructure/Database/Migrations/20260505120450_GeneralisedLead.cs delete mode 100644 LiteCharms.Infrastructure/Database/Migrations/20260505123745_AddedNotifications.Designer.cs delete mode 100644 LiteCharms.Infrastructure/Database/Migrations/20260505123745_AddedNotifications.cs delete mode 100644 LiteCharms.Infrastructure/Database/Migrations/20260505124135_AddedProcessedColumnToNotifications.cs delete mode 100644 LiteCharms.Infrastructure/Database/Migrations/20260505202859_AddedQuoteShoppingCartalteredOrderCustomer.cs rename LiteCharms.Infrastructure/Database/Migrations/{20260505202859_AddedQuoteShoppingCartalteredOrderCustomer.Designer.cs => 20260510090446_Init.Designer.cs} (93%) create mode 100644 LiteCharms.Infrastructure/Database/Migrations/20260510090446_Init.cs rename LiteCharms.Infrastructure/Database/Migrations/{20260505124135_AddedProcessedColumnToNotifications.Designer.cs => 20260510091540_AddedPackages.Designer.cs} (53%) create mode 100644 LiteCharms.Infrastructure/Database/Migrations/20260510091540_AddedPackages.cs rename LiteCharms.Infrastructure/Database/Migrations/{LeadGeneratorDbContextModelSnapshot.cs => ShopDbContextModelSnapshot.cs} (77%) create mode 100644 LiteCharms.Models/Package.cs create mode 100644 LiteCharms.Models/PackageItem.cs create mode 100644 LiteCharms.Models/ShoppingCartPackage.cs diff --git a/LiteCharms.Entities/Configuration/NotificationConfiguration.cs b/LiteCharms.Entities/Configuration/NotificationConfiguration.cs index c5879f9..bd103f7 100644 --- a/LiteCharms.Entities/Configuration/NotificationConfiguration.cs +++ b/LiteCharms.Entities/Configuration/NotificationConfiguration.cs @@ -8,14 +8,18 @@ public class NotificationConfiguration : IEntityTypeConfiguration builder.HasKey(f => f.Id); builder.Property(f => f.CreatedAt).IsRequired().ValueGeneratedOnAdd(); + builder.Property(f => f.UpdatedAt).IsRequired(false).ValueGeneratedOnUpdate(); builder.Property(f => f.Direction).IsRequired(); - builder.Property(f => f.Author).IsRequired(); - builder.Property(f => f.Title).IsRequired(); - builder.Property(f => f.Description).IsRequired(); builder.Property(f => f.Platform).IsRequired(); - builder.Property(f => f.PlatformAddress).IsRequired(); + builder.Property(f => f.Priority).IsRequired(); + builder.Property(f => f.Sender).IsRequired(); + builder.Property(f => f.Subject).IsRequired(); + builder.Property(f => f.Message).IsRequired(); + builder.Property(f => f.Recipient).IsRequired(); + builder.Property(f => f.RecipientAddress).IsRequired(); builder.Property(f => f.CorrelationId).IsRequired(); builder.Property(f => f.CorrelationIdType).IsRequired(); + builder.Property(f => f.IsHtml).HasDefaultValue(false); builder.Property(f => f.IsInternal).HasDefaultValue(true); builder.Property(f => f.Processed).HasDefaultValue(false); } diff --git a/LiteCharms.Entities/Configuration/OrderConfiguration.cs b/LiteCharms.Entities/Configuration/OrderConfiguration.cs index 5db15cd..138e136 100644 --- a/LiteCharms.Entities/Configuration/OrderConfiguration.cs +++ b/LiteCharms.Entities/Configuration/OrderConfiguration.cs @@ -14,7 +14,10 @@ public class OrderConfiguration : IEntityTypeConfiguration builder.Property(f => f.RefundId).IsRequired(false); builder.Property(f => f.ShoppingCartId).IsRequired(); builder.Property(f => f.Status).HasConversion().IsRequired(); + builder.Property(f => f.Requirements).HasColumnType("jsonb").IsRequired(false); builder.Property(f => f.Notes).HasColumnType("jsonb").IsRequired(false); + builder.Property(f => f.Terms).HasColumnType("jsonb").IsRequired(false); + builder.Property(f => f.DepositRequired); builder.HasOne(f => f.Quote) .WithOne(f => f.Order) diff --git a/LiteCharms.Entities/Configuration/PackageConfirguration.cs b/LiteCharms.Entities/Configuration/PackageConfirguration.cs new file mode 100644 index 0000000..71aa4fc --- /dev/null +++ b/LiteCharms.Entities/Configuration/PackageConfirguration.cs @@ -0,0 +1,16 @@ +namespace LiteCharms.Entities.Configuration; + +public class PackageConfirguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable(nameof(Package)); + + builder.HasKey(f => f.Id); + builder.Property(f => f.CreatedAt).IsRequired().ValueGeneratedOnAdd(); + builder.Property(f => f.UpdatedAt).IsRequired(false).ValueGeneratedOnUpdate(); + builder.Property(f => f.Name).IsRequired(); + builder.Property(f => f.Description).IsRequired(); + builder.Property(f => f.Active); + } +} diff --git a/LiteCharms.Entities/Configuration/PackageItemConfiguration.cs b/LiteCharms.Entities/Configuration/PackageItemConfiguration.cs new file mode 100644 index 0000000..bf31659 --- /dev/null +++ b/LiteCharms.Entities/Configuration/PackageItemConfiguration.cs @@ -0,0 +1,20 @@ +namespace LiteCharms.Entities.Configuration; + +public class PackageItemConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable(nameof(PackageItem)); + + builder.HasKey(f => f.Id); + builder.Property(f => f.CreatedAt).IsRequired().ValueGeneratedOnAdd(); + builder.Property(f => f.PackageId).IsRequired(); + builder.Property(f => f.ProductPriceId).IsRequired(); + builder.Property(f => f.Active); + + builder.HasOne(f => f.Package) + .WithMany() + .HasForeignKey(f => f.PackageId) + .OnDelete(DeleteBehavior.NoAction); + } +} diff --git a/LiteCharms.Entities/Configuration/QuoteConfiguration.cs b/LiteCharms.Entities/Configuration/QuoteConfiguration.cs index 37125ae..de5240a 100644 --- a/LiteCharms.Entities/Configuration/QuoteConfiguration.cs +++ b/LiteCharms.Entities/Configuration/QuoteConfiguration.cs @@ -8,7 +8,7 @@ public class QuoteConfiguration : IEntityTypeConfiguration builder.HasKey(f => f.Id); builder.Property(f => f.CreatedAt).IsRequired().ValueGeneratedOnAdd(); - builder.Property(f => f.UpdatedAt).IsRequired().ValueGeneratedOnAddOrUpdate(); + builder.Property(f => f.UpdatedAt).IsRequired(false).ValueGeneratedOnUpdate(); builder.Property(f => f.ExpiredAt).IsRequired(false); builder.Property(f => f.CustomerId).IsRequired(); builder.Property(f => f.Status).IsRequired(); diff --git a/LiteCharms.Entities/Configuration/ShoppingCartConfiguration.cs b/LiteCharms.Entities/Configuration/ShoppingCartConfiguration.cs index 3a1926b..109fd99 100644 --- a/LiteCharms.Entities/Configuration/ShoppingCartConfiguration.cs +++ b/LiteCharms.Entities/Configuration/ShoppingCartConfiguration.cs @@ -8,7 +8,7 @@ public class ShoppingCartConfiguration : IEntityTypeConfiguration builder.HasKey(f => f.Id); builder.Property(f => f.CreatedAt).IsRequired().ValueGeneratedOnAdd(); - builder.Property(f => f.UpdatedAt).IsRequired().ValueGeneratedOnAddOrUpdate(); + builder.Property(f => f.UpdatedAt).IsRequired(false).ValueGeneratedOnUpdate(); builder.Property(f => f.CustomerId).IsRequired(false); builder.Property(f => f.OrderId).IsRequired(false); builder.Property(f => f.QuoteId).IsRequired(false); diff --git a/LiteCharms.Entities/Configuration/ShoppingCartItemConfiguration.cs b/LiteCharms.Entities/Configuration/ShoppingCartItemConfiguration.cs index 00fc2ab..948f988 100644 --- a/LiteCharms.Entities/Configuration/ShoppingCartItemConfiguration.cs +++ b/LiteCharms.Entities/Configuration/ShoppingCartItemConfiguration.cs @@ -8,7 +8,7 @@ public class ShoppingCartItemConfiguration : IEntityTypeConfiguration f.Id); builder.Property(f => f.CreatedAt).IsRequired().ValueGeneratedOnAdd(); - builder.Property(f => f.UpdatedAt).IsRequired().ValueGeneratedOnAddOrUpdate(); + builder.Property(f => f.UpdatedAt).IsRequired(false).ValueGeneratedOnUpdate(); builder.Property(f => f.Quantity).IsRequired().HasDefaultValue(1); builder.Property(f => f.ProductPriceId).IsRequired(); diff --git a/LiteCharms.Entities/Configuration/ShoppingCartPackageConfiguration.cs b/LiteCharms.Entities/Configuration/ShoppingCartPackageConfiguration.cs new file mode 100644 index 0000000..7d2f296 --- /dev/null +++ b/LiteCharms.Entities/Configuration/ShoppingCartPackageConfiguration.cs @@ -0,0 +1,24 @@ +namespace LiteCharms.Entities.Configuration; + +public class ShoppingCartPackageConfiguration : IEntityTypeConfiguration +{ + public void Configure(EntityTypeBuilder builder) + { + builder.ToTable(nameof(ShoppingCartPackage)); + + builder.HasKey(f => f.Id); + builder.Property(f => f.CreatedAt).IsRequired().ValueGeneratedOnAdd(); + builder.Property(f => f.ShoppingCartId).IsRequired(); + builder.Property(f => f.PackageId).IsRequired(); + + builder.HasOne(f => f.Package) + .WithMany() + .HasForeignKey(f => f.PackageId) + .OnDelete(DeleteBehavior.NoAction); + + builder.HasOne(f => f.ShoppingCart) + .WithMany() + .HasForeignKey(f => f.ShoppingCartId) + .OnDelete(DeleteBehavior.NoAction); + } +} diff --git a/LiteCharms.Entities/Package.cs b/LiteCharms.Entities/Package.cs new file mode 100644 index 0000000..ce8e799 --- /dev/null +++ b/LiteCharms.Entities/Package.cs @@ -0,0 +1,9 @@ +using LiteCharms.Entities.Configuration; + +namespace LiteCharms.Entities; + +[EntityTypeConfiguration] +public class Package : Models.Package +{ + public virtual ICollection? PackageItems { get; set; } +} diff --git a/LiteCharms.Entities/PackageItem.cs b/LiteCharms.Entities/PackageItem.cs new file mode 100644 index 0000000..986fc75 --- /dev/null +++ b/LiteCharms.Entities/PackageItem.cs @@ -0,0 +1,9 @@ +using LiteCharms.Entities.Configuration; + +namespace LiteCharms.Entities; + +[EntityTypeConfiguration] +public class PackageItem : Models.PackageItem +{ + public virtual Package? Package { get; set; } +} diff --git a/LiteCharms.Entities/ShoppingCartPackage.cs b/LiteCharms.Entities/ShoppingCartPackage.cs new file mode 100644 index 0000000..45a3831 --- /dev/null +++ b/LiteCharms.Entities/ShoppingCartPackage.cs @@ -0,0 +1,11 @@ +using LiteCharms.Entities.Configuration; + +namespace LiteCharms.Entities; + +[EntityTypeConfiguration] +public class ShoppingCartPackage : Models.ShoppingCartPackage +{ + public virtual ShoppingCart? ShoppingCart { get; set; } + + public virtual Package? Package { get; set; } +} diff --git a/LiteCharms.Extensions/EntityModeMappers.cs b/LiteCharms.Extensions/EntityModeMappers.cs index 8d41155..b3b8e64 100644 --- a/LiteCharms.Extensions/EntityModeMappers.cs +++ b/LiteCharms.Extensions/EntityModeMappers.cs @@ -44,15 +44,15 @@ public static class EntityModeMappers { Id = entity.Id, CreatedAt = entity.CreatedAt, - Description = entity.Description, + Message = entity.Message, Direction = entity.Direction, CorrelationId = entity.CorrelationId, CorrelationIdType = entity.CorrelationIdType, IsInternal = entity.IsInternal, - Author = entity.Author, + Sender = entity.Sender, Platform = entity.Platform, - PlatformAddress = entity.PlatformAddress, - Title = entity.Title, + Recipient = entity.Recipient, + Subject = entity.Subject, Processed = entity.Processed }; diff --git a/LiteCharms.Features/Notifications/Commands/CreateNotificationCommand.cs b/LiteCharms.Features/Notifications/Commands/CreateNotificationCommand.cs index cfa40b1..be81438 100644 --- a/LiteCharms.Features/Notifications/Commands/CreateNotificationCommand.cs +++ b/LiteCharms.Features/Notifications/Commands/CreateNotificationCommand.cs @@ -12,7 +12,7 @@ public class CreateNotificationCommand : IRequest> public string? Description { get; set; } - public string? Platform { get; set; } + public NotificationPlatforms Platform { get; set; } public string? PlatformAddress { get; set; } @@ -22,7 +22,7 @@ public class CreateNotificationCommand : IRequest> public bool IsInternal { get; set; } - private CreateNotificationCommand(NotificationDirection direction, string author, string title, string description, string platform, string platformAddress, string correlationId, string correlationIdType, bool isInternal) + private CreateNotificationCommand(NotificationDirection direction, string author, string title, string description, NotificationPlatforms platform, string platformAddress, string correlationId, string correlationIdType, bool isInternal) { Direction = direction; Author = author; @@ -35,7 +35,7 @@ public class CreateNotificationCommand : IRequest> IsInternal = isInternal; } - public static CreateNotificationCommand Create(NotificationDirection direction, string author, string title, string description, string platform, string platformAddress, string correlationId, string correlationIdType, bool isInternal) + public static CreateNotificationCommand Create(NotificationDirection direction, string author, string title, string description, NotificationPlatforms platform, string platformAddress, string correlationId, string correlationIdType, bool isInternal) { if (string.IsNullOrWhiteSpace(author)) throw new ArgumentException("Author cannot be null or whitespace.", nameof(author)); @@ -46,9 +46,6 @@ public class CreateNotificationCommand : IRequest> if (string.IsNullOrWhiteSpace(description)) throw new ArgumentException("Description cannot be null or whitespace.", nameof(description)); - if (string.IsNullOrWhiteSpace(platform)) - throw new ArgumentException("Platform cannot be null or whitespace.", nameof(platform)); - if (string.IsNullOrWhiteSpace(platformAddress)) throw new ArgumentException("PlatformAddress cannot be null or whitespace.", nameof(platformAddress)); diff --git a/LiteCharms.Features/Notifications/Commands/Handlers/CreateNotificationCommandHandler.cs b/LiteCharms.Features/Notifications/Commands/Handlers/CreateNotificationCommandHandler.cs index 1c5e251..d33fad6 100644 --- a/LiteCharms.Features/Notifications/Commands/Handlers/CreateNotificationCommandHandler.cs +++ b/LiteCharms.Features/Notifications/Commands/Handlers/CreateNotificationCommandHandler.cs @@ -13,11 +13,11 @@ public class CreateNotificationCommandHandler(IDbContextFactory c var newNotification = context.Notifications.Add(new Entities.Notification { Direction = request.Direction, - Author = request.Author, - Title = request.Title, - Description = request.Description, + Sender = request.Author, + Subject = request.Title, + Message = request.Description, Platform = request.Platform, - PlatformAddress = request.PlatformAddress, + Recipient = request.PlatformAddress, CorrelationId = request.CorrelationId, CorrelationIdType = request.CorrelationIdType, IsInternal = request.IsInternal, diff --git a/LiteCharms.Infrastructure/Database/Migrations/20260502231708_Init.Designer.cs b/LiteCharms.Infrastructure/Database/Migrations/20260502231708_Init.Designer.cs deleted file mode 100644 index 5168e4c..0000000 --- a/LiteCharms.Infrastructure/Database/Migrations/20260502231708_Init.Designer.cs +++ /dev/null @@ -1,272 +0,0 @@ -// -using System; -using LiteCharms.Infrastructure.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace LiteCharms.Infrastructure.Database.Migrations -{ - [DbContext(typeof(ShopDbContext))] - [Migration("20260502231708_Init")] - partial class Init - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.7") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Customer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Active") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("City") - .HasColumnType("text"); - - b.Property("Company") - .HasColumnType("text"); - - b.Property("Country") - .HasColumnType("text"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("Discord") - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("text"); - - b.Property("LinkedIn") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("PostalCode") - .HasColumnType("text"); - - b.Property("Region") - .HasColumnType("text"); - - b.Property("Slack") - .HasColumnType("text"); - - b.Property("Tax") - .HasColumnType("text"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.Property("Website") - .HasColumnType("text"); - - b.Property("Whatsapp") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Customer", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Lead", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AdGroupId") - .HasColumnType("bigint"); - - b.Property("AdName") - .HasColumnType("bigint"); - - b.Property("AppClickId") - .HasColumnType("text"); - - b.Property("AttribusionHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("CampaignId") - .HasColumnType("bigint"); - - b.Property("ClickLocation") - .HasColumnType("text"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("FeedItemId") - .HasColumnType("bigint"); - - b.Property("GoogleClickId") - .HasColumnType("text"); - - b.Property("TargetId") - .HasColumnType("bigint"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.Property("WebClickId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Lead", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("LeadId") - .HasColumnType("uuid"); - - b.PrimitiveCollection("Notes") - .HasColumnType("jsonb"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("ProductPriceId") - .HasColumnType("uuid"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.ToTable("Order", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.OrderRefund", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("Reason") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("OrderRefund", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Active") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Product", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.ProductPrice", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Active") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("Discount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Price") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.ToTable("ProductPrice", (string)null); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/LiteCharms.Infrastructure/Database/Migrations/20260502231708_Init.cs b/LiteCharms.Infrastructure/Database/Migrations/20260502231708_Init.cs deleted file mode 100644 index 60c879e..0000000 --- a/LiteCharms.Infrastructure/Database/Migrations/20260502231708_Init.cs +++ /dev/null @@ -1,154 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace LiteCharms.Infrastructure.Database.Migrations -{ - /// - public partial class Init : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Customer", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - Company = table.Column(type: "text", nullable: true), - Name = table.Column(type: "text", nullable: false), - LastName = table.Column(type: "text", nullable: false), - Tax = table.Column(type: "text", nullable: true), - Email = table.Column(type: "text", nullable: false), - Discord = table.Column(type: "text", nullable: true), - Slack = table.Column(type: "text", nullable: true), - LinkedIn = table.Column(type: "text", nullable: true), - Whatsapp = table.Column(type: "text", nullable: true), - Website = table.Column(type: "text", nullable: true), - Phone = table.Column(type: "text", nullable: true), - Address = table.Column(type: "text", nullable: true), - City = table.Column(type: "text", nullable: true), - Region = table.Column(type: "text", nullable: true), - Country = table.Column(type: "text", nullable: true), - PostalCode = table.Column(type: "text", nullable: true), - Active = table.Column(type: "boolean", nullable: false, defaultValue: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Customer", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Lead", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - GoogleClickId = table.Column(type: "text", nullable: true), - WebClickId = table.Column(type: "text", nullable: true), - AppClickId = table.Column(type: "text", nullable: true), - CampaignId = table.Column(type: "bigint", nullable: true), - AdGroupId = table.Column(type: "bigint", nullable: true), - AdName = table.Column(type: "bigint", nullable: true), - TargetId = table.Column(type: "bigint", nullable: true), - FeedItemId = table.Column(type: "bigint", nullable: true), - ClickLocation = table.Column(type: "text", nullable: true), - AttribusionHash = table.Column(type: "text", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Lead", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Order", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - LeadId = table.Column(type: "uuid", nullable: false), - ProductId = table.Column(type: "uuid", nullable: false), - ProductPriceId = table.Column(type: "uuid", nullable: false), - Status = table.Column(type: "integer", nullable: false), - Notes = table.Column(type: "jsonb", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Order", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "OrderRefund", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - OrderId = table.Column(type: "uuid", nullable: false), - Reason = table.Column(type: "text", nullable: false), - Amount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_OrderRefund", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Product", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "text", nullable: false), - Description = table.Column(type: "text", nullable: false), - Active = table.Column(type: "boolean", nullable: false, defaultValue: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Product", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "ProductPrice", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), - ProductId = table.Column(type: "uuid", nullable: false), - Price = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - Discount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), - Active = table.Column(type: "boolean", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ProductPrice", x => x.Id); - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Customer"); - - migrationBuilder.DropTable( - name: "Lead"); - - migrationBuilder.DropTable( - name: "Order"); - - migrationBuilder.DropTable( - name: "OrderRefund"); - - migrationBuilder.DropTable( - name: "Product"); - - migrationBuilder.DropTable( - name: "ProductPrice"); - } - } -} diff --git a/LiteCharms.Infrastructure/Database/Migrations/20260503002123_DefinedEntityRelationships.Designer.cs b/LiteCharms.Infrastructure/Database/Migrations/20260503002123_DefinedEntityRelationships.Designer.cs deleted file mode 100644 index 03d73e0..0000000 --- a/LiteCharms.Infrastructure/Database/Migrations/20260503002123_DefinedEntityRelationships.Designer.cs +++ /dev/null @@ -1,357 +0,0 @@ -// -using System; -using LiteCharms.Infrastructure.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace LiteCharms.Infrastructure.Database.Migrations -{ - [DbContext(typeof(ShopDbContext))] - [Migration("20260503002123_DefinedEntityRelationships")] - partial class DefinedEntityRelationships - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.7") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Customer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Active") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("City") - .HasColumnType("text"); - - b.Property("Company") - .HasColumnType("text"); - - b.Property("Country") - .HasColumnType("text"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("Discord") - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("text"); - - b.Property("LinkedIn") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("PostalCode") - .HasColumnType("text"); - - b.Property("Region") - .HasColumnType("text"); - - b.Property("Slack") - .HasColumnType("text"); - - b.Property("Tax") - .HasColumnType("text"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.Property("Website") - .HasColumnType("text"); - - b.Property("Whatsapp") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Customer", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Lead", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AdGroupId") - .HasColumnType("bigint"); - - b.Property("AdName") - .HasColumnType("bigint"); - - b.Property("AppClickId") - .HasColumnType("text"); - - b.Property("AttribusionHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("CampaignId") - .HasColumnType("bigint"); - - b.Property("ClickLocation") - .HasColumnType("text"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("uuid"); - - b.Property("FeedItemId") - .HasColumnType("bigint"); - - b.Property("GoogleClickId") - .HasColumnType("text"); - - b.Property("LeadId") - .HasColumnType("uuid"); - - b.Property("TargetId") - .HasColumnType("bigint"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.Property("WebClickId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CustomerId"); - - b.ToTable("Lead", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("uuid"); - - b.PrimitiveCollection("Notes") - .HasColumnType("jsonb"); - - b.Property("ProductPriceId") - .HasColumnType("uuid"); - - b.Property("RefundId") - .HasColumnType("uuid"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.HasIndex("CustomerId"); - - b.HasIndex("ProductPriceId"); - - b.ToTable("Order", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.OrderRefund", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("Reason") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("OrderId") - .IsUnique(); - - b.ToTable("OrderRefund", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Active") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Product", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.ProductPrice", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Active") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("Discount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Price") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.HasIndex("ProductId"); - - b.ToTable("ProductPrice", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Lead", b => - { - b.HasOne("LeadGenerator.Database.Entities.Customer", "Customer") - .WithMany("Leads") - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.NoAction); - - b.Navigation("Customer"); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Order", b => - { - b.HasOne("LeadGenerator.Database.Entities.Customer", "Customer") - .WithMany("Orders") - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("LeadGenerator.Database.Entities.ProductPrice", "ProductPrice") - .WithMany() - .HasForeignKey("ProductPriceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Customer"); - - b.Navigation("ProductPrice"); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.OrderRefund", b => - { - b.HasOne("LeadGenerator.Database.Entities.Order", "Order") - .WithOne("Refund") - .HasForeignKey("LeadGenerator.Database.Entities.OrderRefund", "OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.ProductPrice", b => - { - b.HasOne("LeadGenerator.Database.Entities.Product", "Product") - .WithMany("ProductPrices") - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Product"); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Customer", b => - { - b.Navigation("Leads"); - - b.Navigation("Orders"); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Order", b => - { - b.Navigation("Refund"); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Product", b => - { - b.Navigation("ProductPrices"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/LiteCharms.Infrastructure/Database/Migrations/20260503002123_DefinedEntityRelationships.cs b/LiteCharms.Infrastructure/Database/Migrations/20260503002123_DefinedEntityRelationships.cs deleted file mode 100644 index 059f789..0000000 --- a/LiteCharms.Infrastructure/Database/Migrations/20260503002123_DefinedEntityRelationships.cs +++ /dev/null @@ -1,175 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace LiteCharms.Infrastructure.Database.Migrations -{ - /// - public partial class DefinedEntityRelationships : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "LeadId", - table: "Order"); - - migrationBuilder.RenameColumn( - name: "ProductId", - table: "Order", - newName: "CustomerId"); - - migrationBuilder.AddColumn( - name: "RefundId", - table: "Order", - type: "uuid", - nullable: true); - - migrationBuilder.AddColumn( - name: "CustomerId", - table: "Lead", - type: "uuid", - nullable: true); - - migrationBuilder.AddColumn( - name: "LeadId", - table: "Lead", - type: "uuid", - nullable: true); - - migrationBuilder.CreateIndex( - name: "IX_ProductPrice_ProductId", - table: "ProductPrice", - column: "ProductId"); - - migrationBuilder.CreateIndex( - name: "IX_OrderRefund_OrderId", - table: "OrderRefund", - column: "OrderId", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Order_CustomerId", - table: "Order", - column: "CustomerId"); - - migrationBuilder.CreateIndex( - name: "IX_Order_ProductPriceId", - table: "Order", - column: "ProductPriceId"); - - migrationBuilder.CreateIndex( - name: "IX_Lead_CustomerId", - table: "Lead", - column: "CustomerId"); - - migrationBuilder.AddForeignKey( - name: "FK_Lead_Customer_CustomerId", - table: "Lead", - column: "CustomerId", - principalTable: "Customer", - principalColumn: "Id"); - - migrationBuilder.AddForeignKey( - name: "FK_Order_Customer_CustomerId", - table: "Order", - column: "CustomerId", - principalTable: "Customer", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_Order_ProductPrice_ProductPriceId", - table: "Order", - column: "ProductPriceId", - principalTable: "ProductPrice", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_OrderRefund_Order_OrderId", - table: "OrderRefund", - column: "OrderId", - principalTable: "Order", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - - migrationBuilder.AddForeignKey( - name: "FK_ProductPrice_Product_ProductId", - table: "ProductPrice", - column: "ProductId", - principalTable: "Product", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Lead_Customer_CustomerId", - table: "Lead"); - - migrationBuilder.DropForeignKey( - name: "FK_Order_Customer_CustomerId", - table: "Order"); - - migrationBuilder.DropForeignKey( - name: "FK_Order_ProductPrice_ProductPriceId", - table: "Order"); - - migrationBuilder.DropForeignKey( - name: "FK_OrderRefund_Order_OrderId", - table: "OrderRefund"); - - migrationBuilder.DropForeignKey( - name: "FK_ProductPrice_Product_ProductId", - table: "ProductPrice"); - - migrationBuilder.DropIndex( - name: "IX_ProductPrice_ProductId", - table: "ProductPrice"); - - migrationBuilder.DropIndex( - name: "IX_OrderRefund_OrderId", - table: "OrderRefund"); - - migrationBuilder.DropIndex( - name: "IX_Order_CustomerId", - table: "Order"); - - migrationBuilder.DropIndex( - name: "IX_Order_ProductPriceId", - table: "Order"); - - migrationBuilder.DropIndex( - name: "IX_Lead_CustomerId", - table: "Lead"); - - migrationBuilder.DropColumn( - name: "RefundId", - table: "Order"); - - migrationBuilder.DropColumn( - name: "CustomerId", - table: "Lead"); - - migrationBuilder.DropColumn( - name: "LeadId", - table: "Lead"); - - migrationBuilder.RenameColumn( - name: "CustomerId", - table: "Order", - newName: "ProductId"); - - migrationBuilder.AddColumn( - name: "LeadId", - table: "Order", - type: "uuid", - nullable: false, - defaultValue: new Guid("00000000-0000-0000-0000-000000000000")); - } - } -} diff --git a/LiteCharms.Infrastructure/Database/Migrations/20260503003624_RemovedLeadIdFromLead.Designer.cs b/LiteCharms.Infrastructure/Database/Migrations/20260503003624_RemovedLeadIdFromLead.Designer.cs deleted file mode 100644 index f0f5e49..0000000 --- a/LiteCharms.Infrastructure/Database/Migrations/20260503003624_RemovedLeadIdFromLead.Designer.cs +++ /dev/null @@ -1,354 +0,0 @@ -// -using System; -using LiteCharms.Infrastructure.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace LiteCharms.Infrastructure.Database.Migrations -{ - [DbContext(typeof(ShopDbContext))] - [Migration("20260503003624_RemovedLeadIdFromLead")] - partial class RemovedLeadIdFromLead - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.7") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Customer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Active") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("City") - .HasColumnType("text"); - - b.Property("Company") - .HasColumnType("text"); - - b.Property("Country") - .HasColumnType("text"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("Discord") - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("text"); - - b.Property("LinkedIn") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("PostalCode") - .HasColumnType("text"); - - b.Property("Region") - .HasColumnType("text"); - - b.Property("Slack") - .HasColumnType("text"); - - b.Property("Tax") - .HasColumnType("text"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.Property("Website") - .HasColumnType("text"); - - b.Property("Whatsapp") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Customer", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Lead", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AdGroupId") - .HasColumnType("bigint"); - - b.Property("AdName") - .HasColumnType("bigint"); - - b.Property("AppClickId") - .HasColumnType("text"); - - b.Property("AttribusionHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("CampaignId") - .HasColumnType("bigint"); - - b.Property("ClickLocation") - .HasColumnType("text"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("uuid"); - - b.Property("FeedItemId") - .HasColumnType("bigint"); - - b.Property("GoogleClickId") - .HasColumnType("text"); - - b.Property("TargetId") - .HasColumnType("bigint"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.Property("WebClickId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CustomerId"); - - b.ToTable("Lead", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("uuid"); - - b.PrimitiveCollection("Notes") - .HasColumnType("jsonb"); - - b.Property("ProductPriceId") - .HasColumnType("uuid"); - - b.Property("RefundId") - .HasColumnType("uuid"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.HasIndex("CustomerId"); - - b.HasIndex("ProductPriceId"); - - b.ToTable("Order", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.OrderRefund", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("Reason") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("OrderId") - .IsUnique(); - - b.ToTable("OrderRefund", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Active") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Product", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.ProductPrice", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Active") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("Discount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Price") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.HasIndex("ProductId"); - - b.ToTable("ProductPrice", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Lead", b => - { - b.HasOne("LeadGenerator.Database.Entities.Customer", "Customer") - .WithMany("Leads") - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.NoAction); - - b.Navigation("Customer"); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Order", b => - { - b.HasOne("LeadGenerator.Database.Entities.Customer", "Customer") - .WithMany("Orders") - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("LeadGenerator.Database.Entities.ProductPrice", "ProductPrice") - .WithMany() - .HasForeignKey("ProductPriceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Customer"); - - b.Navigation("ProductPrice"); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.OrderRefund", b => - { - b.HasOne("LeadGenerator.Database.Entities.Order", "Order") - .WithOne("Refund") - .HasForeignKey("LeadGenerator.Database.Entities.OrderRefund", "OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.ProductPrice", b => - { - b.HasOne("LeadGenerator.Database.Entities.Product", "Product") - .WithMany("ProductPrices") - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Product"); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Customer", b => - { - b.Navigation("Leads"); - - b.Navigation("Orders"); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Order", b => - { - b.Navigation("Refund"); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Product", b => - { - b.Navigation("ProductPrices"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/LiteCharms.Infrastructure/Database/Migrations/20260503003624_RemovedLeadIdFromLead.cs b/LiteCharms.Infrastructure/Database/Migrations/20260503003624_RemovedLeadIdFromLead.cs deleted file mode 100644 index d469ce3..0000000 --- a/LiteCharms.Infrastructure/Database/Migrations/20260503003624_RemovedLeadIdFromLead.cs +++ /dev/null @@ -1,29 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace LiteCharms.Infrastructure.Database.Migrations -{ - /// - public partial class RemovedLeadIdFromLead : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "LeadId", - table: "Lead"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "LeadId", - table: "Lead", - type: "uuid", - nullable: true); - } - } -} diff --git a/LiteCharms.Infrastructure/Database/Migrations/20260503012708_AddedStatusToLead.Designer.cs b/LiteCharms.Infrastructure/Database/Migrations/20260503012708_AddedStatusToLead.Designer.cs deleted file mode 100644 index 17dfee8..0000000 --- a/LiteCharms.Infrastructure/Database/Migrations/20260503012708_AddedStatusToLead.Designer.cs +++ /dev/null @@ -1,357 +0,0 @@ -// -using System; -using LiteCharms.Infrastructure.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace LiteCharms.Infrastructure.Database.Migrations -{ - [DbContext(typeof(ShopDbContext))] - [Migration("20260503012708_AddedStatusToLead")] - partial class AddedStatusToLead - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.7") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Customer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Active") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("City") - .HasColumnType("text"); - - b.Property("Company") - .HasColumnType("text"); - - b.Property("Country") - .HasColumnType("text"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("Discord") - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("text"); - - b.Property("LinkedIn") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("PostalCode") - .HasColumnType("text"); - - b.Property("Region") - .HasColumnType("text"); - - b.Property("Slack") - .HasColumnType("text"); - - b.Property("Tax") - .HasColumnType("text"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.Property("Website") - .HasColumnType("text"); - - b.Property("Whatsapp") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Customer", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Lead", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AdGroupId") - .HasColumnType("bigint"); - - b.Property("AdName") - .HasColumnType("bigint"); - - b.Property("AppClickId") - .HasColumnType("text"); - - b.Property("AttribusionHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("CampaignId") - .HasColumnType("bigint"); - - b.Property("ClickLocation") - .HasColumnType("text"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("uuid"); - - b.Property("FeedItemId") - .HasColumnType("bigint"); - - b.Property("GoogleClickId") - .HasColumnType("text"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TargetId") - .HasColumnType("bigint"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.Property("WebClickId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CustomerId"); - - b.ToTable("Lead", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("uuid"); - - b.PrimitiveCollection("Notes") - .HasColumnType("jsonb"); - - b.Property("ProductPriceId") - .HasColumnType("uuid"); - - b.Property("RefundId") - .HasColumnType("uuid"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.HasIndex("CustomerId"); - - b.HasIndex("ProductPriceId"); - - b.ToTable("Order", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.OrderRefund", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("Reason") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("OrderId") - .IsUnique(); - - b.ToTable("OrderRefund", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Active") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Product", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.ProductPrice", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Active") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("Discount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Price") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.HasIndex("ProductId"); - - b.ToTable("ProductPrice", (string)null); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Lead", b => - { - b.HasOne("LeadGenerator.Database.Entities.Customer", "Customer") - .WithMany("Leads") - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.NoAction); - - b.Navigation("Customer"); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Order", b => - { - b.HasOne("LeadGenerator.Database.Entities.Customer", "Customer") - .WithMany("Orders") - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("LeadGenerator.Database.Entities.ProductPrice", "ProductPrice") - .WithMany() - .HasForeignKey("ProductPriceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Customer"); - - b.Navigation("ProductPrice"); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.OrderRefund", b => - { - b.HasOne("LeadGenerator.Database.Entities.Order", "Order") - .WithOne("Refund") - .HasForeignKey("LeadGenerator.Database.Entities.OrderRefund", "OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.ProductPrice", b => - { - b.HasOne("LeadGenerator.Database.Entities.Product", "Product") - .WithMany("ProductPrices") - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Product"); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Customer", b => - { - b.Navigation("Leads"); - - b.Navigation("Orders"); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Order", b => - { - b.Navigation("Refund"); - }); - - modelBuilder.Entity("LeadGenerator.Database.Entities.Product", b => - { - b.Navigation("ProductPrices"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/LiteCharms.Infrastructure/Database/Migrations/20260503012708_AddedStatusToLead.cs b/LiteCharms.Infrastructure/Database/Migrations/20260503012708_AddedStatusToLead.cs deleted file mode 100644 index 71b82d1..0000000 --- a/LiteCharms.Infrastructure/Database/Migrations/20260503012708_AddedStatusToLead.cs +++ /dev/null @@ -1,29 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace LiteCharms.Infrastructure.Database.Migrations -{ - /// - public partial class AddedStatusToLead : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AddColumn( - name: "Status", - table: "Lead", - type: "integer", - nullable: false, - defaultValue: 0); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Status", - table: "Lead"); - } - } -} diff --git a/LiteCharms.Infrastructure/Database/Migrations/20260503133855_CorrectedAttributionHashColumnOnLead.Designer.cs b/LiteCharms.Infrastructure/Database/Migrations/20260503133855_CorrectedAttributionHashColumnOnLead.Designer.cs deleted file mode 100644 index 6e40369..0000000 --- a/LiteCharms.Infrastructure/Database/Migrations/20260503133855_CorrectedAttributionHashColumnOnLead.Designer.cs +++ /dev/null @@ -1,357 +0,0 @@ -// -using System; -using LiteCharms.Infrastructure.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace LiteCharms.Infrastructure.Database.Migrations -{ - [DbContext(typeof(ShopDbContext))] - [Migration("20260503133855_CorrectedAttributionHashColumnOnLead")] - partial class CorrectedAttributionHashColumnOnLead - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.7") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("LiteCharms.Entities.Customer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Active") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("City") - .HasColumnType("text"); - - b.Property("Company") - .HasColumnType("text"); - - b.Property("Country") - .HasColumnType("text"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("Discord") - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("text"); - - b.Property("LinkedIn") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("PostalCode") - .HasColumnType("text"); - - b.Property("Region") - .HasColumnType("text"); - - b.Property("Slack") - .HasColumnType("text"); - - b.Property("Tax") - .HasColumnType("text"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.Property("Website") - .HasColumnType("text"); - - b.Property("Whatsapp") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Customer", (string)null); - }); - - modelBuilder.Entity("LiteCharms.Entities.Lead", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AdGroupId") - .HasColumnType("bigint"); - - b.Property("AdName") - .HasColumnType("bigint"); - - b.Property("AppClickId") - .HasColumnType("text"); - - b.Property("AttributionHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("CampaignId") - .HasColumnType("bigint"); - - b.Property("ClickLocation") - .HasColumnType("text"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("uuid"); - - b.Property("FeedItemId") - .HasColumnType("bigint"); - - b.Property("GoogleClickId") - .HasColumnType("text"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TargetId") - .HasColumnType("bigint"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.Property("WebClickId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CustomerId"); - - b.ToTable("Lead", (string)null); - }); - - modelBuilder.Entity("LiteCharms.Entities.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("uuid"); - - b.PrimitiveCollection("Notes") - .HasColumnType("jsonb"); - - b.Property("ProductPriceId") - .HasColumnType("uuid"); - - b.Property("RefundId") - .HasColumnType("uuid"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.HasIndex("CustomerId"); - - b.HasIndex("ProductPriceId"); - - b.ToTable("Order", (string)null); - }); - - modelBuilder.Entity("LiteCharms.Entities.OrderRefund", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("Reason") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("OrderId") - .IsUnique(); - - b.ToTable("OrderRefund", (string)null); - }); - - modelBuilder.Entity("LiteCharms.Entities.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Active") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Product", (string)null); - }); - - modelBuilder.Entity("LiteCharms.Entities.ProductPrice", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Active") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("Discount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Price") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.HasIndex("ProductId"); - - b.ToTable("ProductPrice", (string)null); - }); - - modelBuilder.Entity("LiteCharms.Entities.Lead", b => - { - b.HasOne("LiteCharms.Entities.Customer", "Customer") - .WithMany("Leads") - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.NoAction); - - b.Navigation("Customer"); - }); - - modelBuilder.Entity("LiteCharms.Entities.Order", b => - { - b.HasOne("LiteCharms.Entities.Customer", "Customer") - .WithMany("Orders") - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("LiteCharms.Entities.ProductPrice", "ProductPrice") - .WithMany() - .HasForeignKey("ProductPriceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Customer"); - - b.Navigation("ProductPrice"); - }); - - modelBuilder.Entity("LiteCharms.Entities.OrderRefund", b => - { - b.HasOne("LiteCharms.Entities.Order", "Order") - .WithOne("Refund") - .HasForeignKey("LiteCharms.Entities.OrderRefund", "OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("LiteCharms.Entities.ProductPrice", b => - { - b.HasOne("LiteCharms.Entities.Product", "Product") - .WithMany("ProductPrices") - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Product"); - }); - - modelBuilder.Entity("LiteCharms.Entities.Customer", b => - { - b.Navigation("Leads"); - - b.Navigation("Orders"); - }); - - modelBuilder.Entity("LiteCharms.Entities.Order", b => - { - b.Navigation("Refund"); - }); - - modelBuilder.Entity("LiteCharms.Entities.Product", b => - { - b.Navigation("ProductPrices"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/LiteCharms.Infrastructure/Database/Migrations/20260503133855_CorrectedAttributionHashColumnOnLead.cs b/LiteCharms.Infrastructure/Database/Migrations/20260503133855_CorrectedAttributionHashColumnOnLead.cs deleted file mode 100644 index 9d1fd30..0000000 --- a/LiteCharms.Infrastructure/Database/Migrations/20260503133855_CorrectedAttributionHashColumnOnLead.cs +++ /dev/null @@ -1,28 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace LiteCharms.Infrastructure.Database.Migrations -{ - /// - public partial class CorrectedAttributionHashColumnOnLead : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "AttribusionHash", - table: "Lead", - newName: "AttributionHash"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "AttributionHash", - table: "Lead", - newName: "AttribusionHash"); - } - } -} diff --git a/LiteCharms.Infrastructure/Database/Migrations/20260505120450_GeneralisedLead.Designer.cs b/LiteCharms.Infrastructure/Database/Migrations/20260505120450_GeneralisedLead.Designer.cs deleted file mode 100644 index d9c0beb..0000000 --- a/LiteCharms.Infrastructure/Database/Migrations/20260505120450_GeneralisedLead.Designer.cs +++ /dev/null @@ -1,360 +0,0 @@ -// -using System; -using LiteCharms.Infrastructure.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace LiteCharms.Infrastructure.Database.Migrations -{ - [DbContext(typeof(ShopDbContext))] - [Migration("20260505120450_GeneralisedLead")] - partial class GeneralisedLead - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.7") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("LiteCharms.Entities.Customer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Active") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("City") - .HasColumnType("text"); - - b.Property("Company") - .HasColumnType("text"); - - b.Property("Country") - .HasColumnType("text"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("Discord") - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("text"); - - b.Property("LinkedIn") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("PostalCode") - .HasColumnType("text"); - - b.Property("Region") - .HasColumnType("text"); - - b.Property("Slack") - .HasColumnType("text"); - - b.Property("Tax") - .HasColumnType("text"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.Property("Website") - .HasColumnType("text"); - - b.Property("Whatsapp") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Customer", (string)null); - }); - - modelBuilder.Entity("LiteCharms.Entities.Lead", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AdGroupId") - .HasColumnType("bigint"); - - b.Property("AdName") - .HasColumnType("bigint"); - - b.Property("AppClickId") - .HasColumnType("text"); - - b.Property("AttributionHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("CampaignId") - .HasColumnType("bigint"); - - b.Property("ClickId") - .HasColumnType("text"); - - b.Property("ClickLocation") - .HasColumnType("text"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("uuid"); - - b.Property("FeedItemId") - .HasColumnType("bigint"); - - b.Property("Source") - .HasColumnType("text"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TargetId") - .HasColumnType("bigint"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.Property("WebClickId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CustomerId"); - - b.ToTable("Lead", (string)null); - }); - - modelBuilder.Entity("LiteCharms.Entities.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("uuid"); - - b.PrimitiveCollection("Notes") - .HasColumnType("jsonb"); - - b.Property("ProductPriceId") - .HasColumnType("uuid"); - - b.Property("RefundId") - .HasColumnType("uuid"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.HasIndex("CustomerId"); - - b.HasIndex("ProductPriceId"); - - b.ToTable("Order", (string)null); - }); - - modelBuilder.Entity("LiteCharms.Entities.OrderRefund", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("Reason") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("OrderId") - .IsUnique(); - - b.ToTable("OrderRefund", (string)null); - }); - - modelBuilder.Entity("LiteCharms.Entities.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Active") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Product", (string)null); - }); - - modelBuilder.Entity("LiteCharms.Entities.ProductPrice", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Active") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("Discount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Price") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.HasIndex("ProductId"); - - b.ToTable("ProductPrice", (string)null); - }); - - modelBuilder.Entity("LiteCharms.Entities.Lead", b => - { - b.HasOne("LiteCharms.Entities.Customer", "Customer") - .WithMany("Leads") - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.NoAction); - - b.Navigation("Customer"); - }); - - modelBuilder.Entity("LiteCharms.Entities.Order", b => - { - b.HasOne("LiteCharms.Entities.Customer", "Customer") - .WithMany("Orders") - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("LiteCharms.Entities.ProductPrice", "ProductPrice") - .WithMany() - .HasForeignKey("ProductPriceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Customer"); - - b.Navigation("ProductPrice"); - }); - - modelBuilder.Entity("LiteCharms.Entities.OrderRefund", b => - { - b.HasOne("LiteCharms.Entities.Order", "Order") - .WithOne("Refund") - .HasForeignKey("LiteCharms.Entities.OrderRefund", "OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("LiteCharms.Entities.ProductPrice", b => - { - b.HasOne("LiteCharms.Entities.Product", "Product") - .WithMany("ProductPrices") - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Product"); - }); - - modelBuilder.Entity("LiteCharms.Entities.Customer", b => - { - b.Navigation("Leads"); - - b.Navigation("Orders"); - }); - - modelBuilder.Entity("LiteCharms.Entities.Order", b => - { - b.Navigation("Refund"); - }); - - modelBuilder.Entity("LiteCharms.Entities.Product", b => - { - b.Navigation("ProductPrices"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/LiteCharms.Infrastructure/Database/Migrations/20260505120450_GeneralisedLead.cs b/LiteCharms.Infrastructure/Database/Migrations/20260505120450_GeneralisedLead.cs deleted file mode 100644 index 6176058..0000000 --- a/LiteCharms.Infrastructure/Database/Migrations/20260505120450_GeneralisedLead.cs +++ /dev/null @@ -1,38 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace LiteCharms.Infrastructure.Database.Migrations -{ - /// - public partial class GeneralisedLead : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.RenameColumn( - name: "GoogleClickId", - table: "Lead", - newName: "Source"); - - migrationBuilder.AddColumn( - name: "ClickId", - table: "Lead", - type: "text", - nullable: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "ClickId", - table: "Lead"); - - migrationBuilder.RenameColumn( - name: "Source", - table: "Lead", - newName: "GoogleClickId"); - } - } -} diff --git a/LiteCharms.Infrastructure/Database/Migrations/20260505123745_AddedNotifications.Designer.cs b/LiteCharms.Infrastructure/Database/Migrations/20260505123745_AddedNotifications.Designer.cs deleted file mode 100644 index 9f54643..0000000 --- a/LiteCharms.Infrastructure/Database/Migrations/20260505123745_AddedNotifications.Designer.cs +++ /dev/null @@ -1,409 +0,0 @@ -// -using System; -using LiteCharms.Infrastructure.Database; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Migrations; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace LiteCharms.Infrastructure.Database.Migrations -{ - [DbContext(typeof(ShopDbContext))] - [Migration("20260505123745_AddedNotifications")] - partial class AddedNotifications - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasAnnotation("ProductVersion", "10.0.7") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("LiteCharms.Entities.Customer", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Active") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("Address") - .HasColumnType("text"); - - b.Property("City") - .HasColumnType("text"); - - b.Property("Company") - .HasColumnType("text"); - - b.Property("Country") - .HasColumnType("text"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("Discord") - .HasColumnType("text"); - - b.Property("Email") - .IsRequired() - .HasColumnType("text"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("text"); - - b.Property("LinkedIn") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("Phone") - .HasColumnType("text"); - - b.Property("PostalCode") - .HasColumnType("text"); - - b.Property("Region") - .HasColumnType("text"); - - b.Property("Slack") - .HasColumnType("text"); - - b.Property("Tax") - .HasColumnType("text"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.Property("Website") - .HasColumnType("text"); - - b.Property("Whatsapp") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Customer", (string)null); - }); - - modelBuilder.Entity("LiteCharms.Entities.Lead", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AdGroupId") - .HasColumnType("bigint"); - - b.Property("AdName") - .HasColumnType("bigint"); - - b.Property("AppClickId") - .HasColumnType("text"); - - b.Property("AttributionHash") - .IsRequired() - .HasColumnType("text"); - - b.Property("CampaignId") - .HasColumnType("bigint"); - - b.Property("ClickId") - .HasColumnType("text"); - - b.Property("ClickLocation") - .HasColumnType("text"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("uuid"); - - b.Property("FeedItemId") - .HasColumnType("bigint"); - - b.Property("Source") - .HasColumnType("text"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("TargetId") - .HasColumnType("bigint"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.Property("WebClickId") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CustomerId"); - - b.ToTable("Lead", (string)null); - }); - - modelBuilder.Entity("LiteCharms.Entities.Notification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Author") - .IsRequired() - .HasColumnType("text"); - - b.Property("CorrelationId") - .IsRequired() - .HasColumnType("text"); - - b.Property("CorrelationIdType") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("Direction") - .HasColumnType("integer"); - - b.Property("IsInternal") - .HasColumnType("boolean"); - - b.Property("Platform") - .IsRequired() - .HasColumnType("text"); - - b.Property("PlatformAddress") - .IsRequired() - .HasColumnType("text"); - - b.Property("Title") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Notification", (string)null); - }); - - modelBuilder.Entity("LiteCharms.Entities.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("CustomerId") - .HasColumnType("uuid"); - - b.PrimitiveCollection("Notes") - .HasColumnType("jsonb"); - - b.Property("ProductPriceId") - .HasColumnType("uuid"); - - b.Property("RefundId") - .HasColumnType("uuid"); - - b.Property("Status") - .HasColumnType("integer"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.HasIndex("CustomerId"); - - b.HasIndex("ProductPriceId"); - - b.ToTable("Order", (string)null); - }); - - modelBuilder.Entity("LiteCharms.Entities.OrderRefund", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Amount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("Reason") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("OrderId") - .IsUnique(); - - b.ToTable("OrderRefund", (string)null); - }); - - modelBuilder.Entity("LiteCharms.Entities.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Active") - .ValueGeneratedOnAdd() - .HasColumnType("boolean") - .HasDefaultValue(true); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Product", (string)null); - }); - - modelBuilder.Entity("LiteCharms.Entities.ProductPrice", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Active") - .HasColumnType("boolean"); - - b.Property("CreatedAt") - .ValueGeneratedOnAdd() - .HasColumnType("timestamp with time zone"); - - b.Property("Discount") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("Price") - .HasPrecision(18, 2) - .HasColumnType("numeric(18,2)"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("UpdatedAt") - .ValueGeneratedOnUpdate() - .HasColumnType("timestamp with time zone"); - - b.HasKey("Id"); - - b.HasIndex("ProductId"); - - b.ToTable("ProductPrice", (string)null); - }); - - modelBuilder.Entity("LiteCharms.Entities.Lead", b => - { - b.HasOne("LiteCharms.Entities.Customer", "Customer") - .WithMany("Leads") - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.NoAction); - - b.Navigation("Customer"); - }); - - modelBuilder.Entity("LiteCharms.Entities.Order", b => - { - b.HasOne("LiteCharms.Entities.Customer", "Customer") - .WithMany("Orders") - .HasForeignKey("CustomerId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("LiteCharms.Entities.ProductPrice", "ProductPrice") - .WithMany() - .HasForeignKey("ProductPriceId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Customer"); - - b.Navigation("ProductPrice"); - }); - - modelBuilder.Entity("LiteCharms.Entities.OrderRefund", b => - { - b.HasOne("LiteCharms.Entities.Order", "Order") - .WithOne("Refund") - .HasForeignKey("LiteCharms.Entities.OrderRefund", "OrderId") - .OnDelete(DeleteBehavior.Cascade) - .IsRequired(); - - b.Navigation("Order"); - }); - - modelBuilder.Entity("LiteCharms.Entities.ProductPrice", b => - { - b.HasOne("LiteCharms.Entities.Product", "Product") - .WithMany("ProductPrices") - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Product"); - }); - - modelBuilder.Entity("LiteCharms.Entities.Customer", b => - { - b.Navigation("Leads"); - - b.Navigation("Orders"); - }); - - modelBuilder.Entity("LiteCharms.Entities.Order", b => - { - b.Navigation("Refund"); - }); - - modelBuilder.Entity("LiteCharms.Entities.Product", b => - { - b.Navigation("ProductPrices"); - }); -#pragma warning restore 612, 618 - } - } -} diff --git a/LiteCharms.Infrastructure/Database/Migrations/20260505123745_AddedNotifications.cs b/LiteCharms.Infrastructure/Database/Migrations/20260505123745_AddedNotifications.cs deleted file mode 100644 index c39cf39..0000000 --- a/LiteCharms.Infrastructure/Database/Migrations/20260505123745_AddedNotifications.cs +++ /dev/null @@ -1,43 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace LiteCharms.Infrastructure.Database.Migrations -{ - /// - public partial class AddedNotifications : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.CreateTable( - name: "Notification", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - Direction = table.Column(type: "integer", nullable: false), - Author = table.Column(type: "text", nullable: false), - Title = table.Column(type: "text", nullable: false), - Description = table.Column(type: "text", nullable: false), - Platform = table.Column(type: "text", nullable: false), - PlatformAddress = table.Column(type: "text", nullable: false), - CorrelationId = table.Column(type: "text", nullable: false), - CorrelationIdType = table.Column(type: "text", nullable: false), - IsInternal = table.Column(type: "boolean", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Notification", x => x.Id); - }); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Notification"); - } - } -} diff --git a/LiteCharms.Infrastructure/Database/Migrations/20260505124135_AddedProcessedColumnToNotifications.cs b/LiteCharms.Infrastructure/Database/Migrations/20260505124135_AddedProcessedColumnToNotifications.cs deleted file mode 100644 index 3439cab..0000000 --- a/LiteCharms.Infrastructure/Database/Migrations/20260505124135_AddedProcessedColumnToNotifications.cs +++ /dev/null @@ -1,47 +0,0 @@ -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace LiteCharms.Infrastructure.Database.Migrations -{ - /// - public partial class AddedProcessedColumnToNotifications : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.AlterColumn( - name: "IsInternal", - table: "Notification", - type: "boolean", - nullable: false, - defaultValue: true, - oldClrType: typeof(bool), - oldType: "boolean"); - - migrationBuilder.AddColumn( - name: "Processed", - table: "Notification", - type: "boolean", - nullable: false, - defaultValue: false); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropColumn( - name: "Processed", - table: "Notification"); - - migrationBuilder.AlterColumn( - name: "IsInternal", - table: "Notification", - type: "boolean", - nullable: false, - oldClrType: typeof(bool), - oldType: "boolean", - oldDefaultValue: true); - } - } -} diff --git a/LiteCharms.Infrastructure/Database/Migrations/20260505202859_AddedQuoteShoppingCartalteredOrderCustomer.cs b/LiteCharms.Infrastructure/Database/Migrations/20260505202859_AddedQuoteShoppingCartalteredOrderCustomer.cs deleted file mode 100644 index 8442535..0000000 --- a/LiteCharms.Infrastructure/Database/Migrations/20260505202859_AddedQuoteShoppingCartalteredOrderCustomer.cs +++ /dev/null @@ -1,227 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; - -#nullable disable - -namespace LiteCharms.Infrastructure.Database.Migrations -{ - /// - public partial class AddedQuoteShoppingCartalteredOrderCustomer : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Order_ProductPrice_ProductPriceId", - table: "Order"); - - migrationBuilder.DropIndex( - name: "IX_Order_ProductPriceId", - table: "Order"); - - migrationBuilder.RenameColumn( - name: "ProductPriceId", - table: "Order", - newName: "ShoppingCartId"); - - migrationBuilder.AddColumn( - name: "QuoteId", - table: "Order", - type: "uuid", - nullable: true); - - migrationBuilder.CreateTable( - name: "ShoppingCart", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false), - CustomerId = table.Column(type: "uuid", nullable: true), - OrderId = table.Column(type: "uuid", nullable: true), - QuoteId = table.Column(type: "uuid", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_ShoppingCart", x => x.Id); - table.ForeignKey( - name: "FK_ShoppingCart_Customer_CustomerId", - column: x => x.CustomerId, - principalTable: "Customer", - principalColumn: "Id"); - }); - - migrationBuilder.CreateTable( - name: "Quote", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - CustomerId1 = table.Column(type: "uuid", nullable: true), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false), - ExpiredAt = table.Column(type: "timestamp with time zone", nullable: true), - CustomerId = table.Column(type: "uuid", nullable: false), - ShoppingCartId = table.Column(type: "uuid", nullable: false), - Status = table.Column(type: "integer", nullable: false), - Reason = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Quote", x => x.Id); - table.ForeignKey( - name: "FK_Quote_Customer_CustomerId", - column: x => x.CustomerId, - principalTable: "Customer", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_Quote_Customer_CustomerId1", - column: x => x.CustomerId1, - principalTable: "Customer", - principalColumn: "Id"); - table.ForeignKey( - name: "FK_Quote_ShoppingCart_ShoppingCartId", - column: x => x.ShoppingCartId, - principalTable: "ShoppingCart", - principalColumn: "Id"); - }); - - migrationBuilder.CreateTable( - name: "ShoppingCartItems", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - ShoppingCartId = table.Column(type: "uuid", nullable: false), - ProductPriceId = table.Column(type: "uuid", nullable: false), - CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), - UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false), - Quantity = table.Column(type: "integer", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_ShoppingCartItems", x => x.Id); - table.ForeignKey( - name: "FK_ShoppingCartItems_ProductPrice_ProductPriceId", - column: x => x.ProductPriceId, - principalTable: "ProductPrice", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - table.ForeignKey( - name: "FK_ShoppingCartItems_ShoppingCart_ShoppingCartId", - column: x => x.ShoppingCartId, - principalTable: "ShoppingCart", - principalColumn: "Id", - onDelete: ReferentialAction.Cascade); - }); - - migrationBuilder.CreateIndex( - name: "IX_Order_QuoteId", - table: "Order", - column: "QuoteId", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Order_ShoppingCartId", - table: "Order", - column: "ShoppingCartId", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Quote_CustomerId", - table: "Quote", - column: "CustomerId"); - - migrationBuilder.CreateIndex( - name: "IX_Quote_CustomerId1", - table: "Quote", - column: "CustomerId1"); - - migrationBuilder.CreateIndex( - name: "IX_Quote_ShoppingCartId", - table: "Quote", - column: "ShoppingCartId", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_ShoppingCart_CustomerId", - table: "ShoppingCart", - column: "CustomerId"); - - migrationBuilder.CreateIndex( - name: "IX_ShoppingCartItems_ProductPriceId", - table: "ShoppingCartItems", - column: "ProductPriceId"); - - migrationBuilder.CreateIndex( - name: "IX_ShoppingCartItems_ShoppingCartId", - table: "ShoppingCartItems", - column: "ShoppingCartId"); - - migrationBuilder.AddForeignKey( - name: "FK_Order_Quote_QuoteId", - table: "Order", - column: "QuoteId", - principalTable: "Quote", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - - migrationBuilder.AddForeignKey( - name: "FK_Order_ShoppingCart_ShoppingCartId", - table: "Order", - column: "ShoppingCartId", - principalTable: "ShoppingCart", - principalColumn: "Id"); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropForeignKey( - name: "FK_Order_Quote_QuoteId", - table: "Order"); - - migrationBuilder.DropForeignKey( - name: "FK_Order_ShoppingCart_ShoppingCartId", - table: "Order"); - - migrationBuilder.DropTable( - name: "Quote"); - - migrationBuilder.DropTable( - name: "ShoppingCartItems"); - - migrationBuilder.DropTable( - name: "ShoppingCart"); - - migrationBuilder.DropIndex( - name: "IX_Order_QuoteId", - table: "Order"); - - migrationBuilder.DropIndex( - name: "IX_Order_ShoppingCartId", - table: "Order"); - - migrationBuilder.DropColumn( - name: "QuoteId", - table: "Order"); - - migrationBuilder.RenameColumn( - name: "ShoppingCartId", - table: "Order", - newName: "ProductPriceId"); - - migrationBuilder.CreateIndex( - name: "IX_Order_ProductPriceId", - table: "Order", - column: "ProductPriceId"); - - migrationBuilder.AddForeignKey( - name: "FK_Order_ProductPrice_ProductPriceId", - table: "Order", - column: "ProductPriceId", - principalTable: "ProductPrice", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - } - } -} diff --git a/LiteCharms.Infrastructure/Database/Migrations/20260505202859_AddedQuoteShoppingCartalteredOrderCustomer.Designer.cs b/LiteCharms.Infrastructure/Database/Migrations/20260510090446_Init.Designer.cs similarity index 93% rename from LiteCharms.Infrastructure/Database/Migrations/20260505202859_AddedQuoteShoppingCartalteredOrderCustomer.Designer.cs rename to LiteCharms.Infrastructure/Database/Migrations/20260510090446_Init.Designer.cs index 90c8e8f..6ae5382 100644 --- a/LiteCharms.Infrastructure/Database/Migrations/20260505202859_AddedQuoteShoppingCartalteredOrderCustomer.Designer.cs +++ b/LiteCharms.Infrastructure/Database/Migrations/20260510090446_Init.Designer.cs @@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace LiteCharms.Infrastructure.Database.Migrations { [DbContext(typeof(ShopDbContext))] - [Migration("20260505202859_AddedQuoteShoppingCartalteredOrderCustomer")] - partial class AddedQuoteShoppingCartalteredOrderCustomer + [Migration("20260510090446_Init")] + partial class Init { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -167,10 +167,6 @@ namespace LiteCharms.Infrastructure.Database.Migrations .ValueGeneratedOnAdd() .HasColumnType("uuid"); - b.Property("Author") - .IsRequired() - .HasColumnType("text"); - b.Property("CorrelationId") .IsRequired() .HasColumnType("text"); @@ -183,35 +179,57 @@ namespace LiteCharms.Infrastructure.Database.Migrations .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone"); - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - b.Property("Direction") .HasColumnType("integer"); + b.Property("IsHtml") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false); + b.Property("IsInternal") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(true); - b.Property("Platform") + b.Property("Message") .IsRequired() .HasColumnType("text"); - b.Property("PlatformAddress") - .IsRequired() - .HasColumnType("text"); + b.Property("Platform") + .HasColumnType("integer"); + + b.Property("Priority") + .HasColumnType("integer"); b.Property("Processed") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false); - b.Property("Title") + b.Property("Recipient") .IsRequired() .HasColumnType("text"); + b.Property("RecipientAddress") + .IsRequired() + .HasColumnType("text"); + + b.Property("Sender") + .IsRequired() + .HasColumnType("text"); + + b.Property("SenderName") + .HasColumnType("text"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("text"); + + b.Property("UpdatedAt") + .ValueGeneratedOnUpdate() + .HasColumnType("timestamp with time zone"); + b.HasKey("Id"); b.ToTable("Notification", (string)null); @@ -230,6 +248,9 @@ namespace LiteCharms.Infrastructure.Database.Migrations b.Property("CustomerId") .HasColumnType("uuid"); + b.Property("DepositRequired") + .HasColumnType("boolean"); + b.PrimitiveCollection("Notes") .HasColumnType("jsonb"); @@ -239,12 +260,18 @@ namespace LiteCharms.Infrastructure.Database.Migrations b.Property("RefundId") .HasColumnType("uuid"); + b.PrimitiveCollection("Requirements") + .HasColumnType("jsonb"); + b.Property("ShoppingCartId") .HasColumnType("uuid"); b.Property("Status") .HasColumnType("integer"); + b.PrimitiveCollection("Terms") + .HasColumnType("jsonb"); + b.Property("UpdatedAt") .ValueGeneratedOnUpdate() .HasColumnType("timestamp with time zone"); @@ -378,8 +405,8 @@ namespace LiteCharms.Infrastructure.Database.Migrations b.Property("Status") .HasColumnType("integer"); - b.Property("UpdatedAt") - .ValueGeneratedOnAddOrUpdate() + b.Property("UpdatedAt") + .ValueGeneratedOnUpdate() .HasColumnType("timestamp with time zone"); b.HasKey("Id"); @@ -413,8 +440,8 @@ namespace LiteCharms.Infrastructure.Database.Migrations b.Property("QuoteId") .HasColumnType("uuid"); - b.Property("UpdatedAt") - .ValueGeneratedOnAddOrUpdate() + b.Property("UpdatedAt") + .ValueGeneratedOnUpdate() .HasColumnType("timestamp with time zone"); b.HasKey("Id"); diff --git a/LiteCharms.Infrastructure/Database/Migrations/20260510090446_Init.cs b/LiteCharms.Infrastructure/Database/Migrations/20260510090446_Init.cs new file mode 100644 index 0000000..3bc9554 --- /dev/null +++ b/LiteCharms.Infrastructure/Database/Migrations/20260510090446_Init.cs @@ -0,0 +1,382 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace LiteCharms.Infrastructure.Database.Migrations +{ + /// + public partial class Init : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Customer", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), + Company = table.Column(type: "text", nullable: true), + Name = table.Column(type: "text", nullable: false), + LastName = table.Column(type: "text", nullable: false), + Tax = table.Column(type: "text", nullable: true), + Email = table.Column(type: "text", nullable: false), + Discord = table.Column(type: "text", nullable: true), + Slack = table.Column(type: "text", nullable: true), + LinkedIn = table.Column(type: "text", nullable: true), + Whatsapp = table.Column(type: "text", nullable: true), + Website = table.Column(type: "text", nullable: true), + Phone = table.Column(type: "text", nullable: true), + Address = table.Column(type: "text", nullable: true), + City = table.Column(type: "text", nullable: true), + Region = table.Column(type: "text", nullable: true), + Country = table.Column(type: "text", nullable: true), + PostalCode = table.Column(type: "text", nullable: true), + Active = table.Column(type: "boolean", nullable: false, defaultValue: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Customer", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Notification", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), + Direction = table.Column(type: "integer", nullable: false), + Platform = table.Column(type: "integer", nullable: false), + Priority = table.Column(type: "integer", nullable: false), + Sender = table.Column(type: "text", nullable: false), + SenderName = table.Column(type: "text", nullable: true), + Subject = table.Column(type: "text", nullable: false), + Message = table.Column(type: "text", nullable: false), + Recipient = table.Column(type: "text", nullable: false), + RecipientAddress = table.Column(type: "text", nullable: false), + CorrelationId = table.Column(type: "text", nullable: false), + CorrelationIdType = table.Column(type: "text", nullable: false), + IsHtml = table.Column(type: "boolean", nullable: false, defaultValue: false), + IsInternal = table.Column(type: "boolean", nullable: false, defaultValue: true), + Processed = table.Column(type: "boolean", nullable: false, defaultValue: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Notification", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Product", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + Name = table.Column(type: "text", nullable: false), + Description = table.Column(type: "text", nullable: false), + Active = table.Column(type: "boolean", nullable: false, defaultValue: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Product", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Lead", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), + CustomerId = table.Column(type: "uuid", nullable: true), + Source = table.Column(type: "text", nullable: true), + ClickId = table.Column(type: "text", nullable: true), + WebClickId = table.Column(type: "text", nullable: true), + AppClickId = table.Column(type: "text", nullable: true), + CampaignId = table.Column(type: "bigint", nullable: true), + AdGroupId = table.Column(type: "bigint", nullable: true), + AdName = table.Column(type: "bigint", nullable: true), + TargetId = table.Column(type: "bigint", nullable: true), + FeedItemId = table.Column(type: "bigint", nullable: true), + ClickLocation = table.Column(type: "text", nullable: true), + AttributionHash = table.Column(type: "text", nullable: false), + Status = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Lead", x => x.Id); + table.ForeignKey( + name: "FK_Lead_Customer_CustomerId", + column: x => x.CustomerId, + principalTable: "Customer", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "ShoppingCart", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), + CustomerId = table.Column(type: "uuid", nullable: true), + OrderId = table.Column(type: "uuid", nullable: true), + QuoteId = table.Column(type: "uuid", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_ShoppingCart", x => x.Id); + table.ForeignKey( + name: "FK_ShoppingCart_Customer_CustomerId", + column: x => x.CustomerId, + principalTable: "Customer", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "ProductPrice", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), + ProductId = table.Column(type: "uuid", nullable: false), + Price = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), + Discount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false), + Active = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProductPrice", x => x.Id); + table.ForeignKey( + name: "FK_ProductPrice_Product_ProductId", + column: x => x.ProductId, + principalTable: "Product", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "Quote", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + CustomerId1 = table.Column(type: "uuid", nullable: true), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), + ExpiredAt = table.Column(type: "timestamp with time zone", nullable: true), + CustomerId = table.Column(type: "uuid", nullable: false), + ShoppingCartId = table.Column(type: "uuid", nullable: false), + Status = table.Column(type: "integer", nullable: false), + Reason = table.Column(type: "text", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Quote", x => x.Id); + table.ForeignKey( + name: "FK_Quote_Customer_CustomerId", + column: x => x.CustomerId, + principalTable: "Customer", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Quote_Customer_CustomerId1", + column: x => x.CustomerId1, + principalTable: "Customer", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Quote_ShoppingCart_ShoppingCartId", + column: x => x.ShoppingCartId, + principalTable: "ShoppingCart", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "ShoppingCartItems", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + ShoppingCartId = table.Column(type: "uuid", nullable: false), + ProductPriceId = table.Column(type: "uuid", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: false), + Quantity = table.Column(type: "integer", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ShoppingCartItems", x => x.Id); + table.ForeignKey( + name: "FK_ShoppingCartItems_ProductPrice_ProductPriceId", + column: x => x.ProductPriceId, + principalTable: "ProductPrice", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ShoppingCartItems_ShoppingCart_ShoppingCartId", + column: x => x.ShoppingCartId, + principalTable: "ShoppingCart", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Order", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), + CustomerId = table.Column(type: "uuid", nullable: false), + QuoteId = table.Column(type: "uuid", nullable: true), + ShoppingCartId = table.Column(type: "uuid", nullable: false), + RefundId = table.Column(type: "uuid", nullable: true), + Status = table.Column(type: "integer", nullable: false), + Requirements = table.Column(type: "jsonb", nullable: true), + Notes = table.Column(type: "jsonb", nullable: true), + Terms = table.Column(type: "jsonb", nullable: true), + DepositRequired = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Order", x => x.Id); + table.ForeignKey( + name: "FK_Order_Customer_CustomerId", + column: x => x.CustomerId, + principalTable: "Customer", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Order_Quote_QuoteId", + column: x => x.QuoteId, + principalTable: "Quote", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Order_ShoppingCart_ShoppingCartId", + column: x => x.ShoppingCartId, + principalTable: "ShoppingCart", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "OrderRefund", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + OrderId = table.Column(type: "uuid", nullable: false), + Reason = table.Column(type: "text", nullable: false), + Amount = table.Column(type: "numeric(18,2)", precision: 18, scale: 2, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_OrderRefund", x => x.Id); + table.ForeignKey( + name: "FK_OrderRefund_Order_OrderId", + column: x => x.OrderId, + principalTable: "Order", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Lead_CustomerId", + table: "Lead", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_Order_CustomerId", + table: "Order", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_Order_QuoteId", + table: "Order", + column: "QuoteId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_Order_ShoppingCartId", + table: "Order", + column: "ShoppingCartId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_OrderRefund_OrderId", + table: "OrderRefund", + column: "OrderId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ProductPrice_ProductId", + table: "ProductPrice", + column: "ProductId"); + + migrationBuilder.CreateIndex( + name: "IX_Quote_CustomerId", + table: "Quote", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_Quote_CustomerId1", + table: "Quote", + column: "CustomerId1"); + + migrationBuilder.CreateIndex( + name: "IX_Quote_ShoppingCartId", + table: "Quote", + column: "ShoppingCartId", + unique: true); + + migrationBuilder.CreateIndex( + name: "IX_ShoppingCart_CustomerId", + table: "ShoppingCart", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_ShoppingCartItems_ProductPriceId", + table: "ShoppingCartItems", + column: "ProductPriceId"); + + migrationBuilder.CreateIndex( + name: "IX_ShoppingCartItems_ShoppingCartId", + table: "ShoppingCartItems", + column: "ShoppingCartId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Lead"); + + migrationBuilder.DropTable( + name: "Notification"); + + migrationBuilder.DropTable( + name: "OrderRefund"); + + migrationBuilder.DropTable( + name: "ShoppingCartItems"); + + migrationBuilder.DropTable( + name: "Order"); + + migrationBuilder.DropTable( + name: "ProductPrice"); + + migrationBuilder.DropTable( + name: "Quote"); + + migrationBuilder.DropTable( + name: "Product"); + + migrationBuilder.DropTable( + name: "ShoppingCart"); + + migrationBuilder.DropTable( + name: "Customer"); + } + } +} diff --git a/LiteCharms.Infrastructure/Database/Migrations/20260505124135_AddedProcessedColumnToNotifications.Designer.cs b/LiteCharms.Infrastructure/Database/Migrations/20260510091540_AddedPackages.Designer.cs similarity index 53% rename from LiteCharms.Infrastructure/Database/Migrations/20260505124135_AddedProcessedColumnToNotifications.Designer.cs rename to LiteCharms.Infrastructure/Database/Migrations/20260510091540_AddedPackages.Designer.cs index 8ec4ca5..f83fabb 100644 --- a/LiteCharms.Infrastructure/Database/Migrations/20260505124135_AddedProcessedColumnToNotifications.Designer.cs +++ b/LiteCharms.Infrastructure/Database/Migrations/20260510091540_AddedPackages.Designer.cs @@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; namespace LiteCharms.Infrastructure.Database.Migrations { [DbContext(typeof(ShopDbContext))] - [Migration("20260505124135_AddedProcessedColumnToNotifications")] - partial class AddedProcessedColumnToNotifications + [Migration("20260510091540_AddedPackages")] + partial class AddedPackages { /// protected override void BuildTargetModel(ModelBuilder modelBuilder) @@ -167,10 +167,6 @@ namespace LiteCharms.Infrastructure.Database.Migrations .ValueGeneratedOnAdd() .HasColumnType("uuid"); - b.Property("Author") - .IsRequired() - .HasColumnType("text"); - b.Property("CorrelationId") .IsRequired() .HasColumnType("text"); @@ -183,35 +179,57 @@ namespace LiteCharms.Infrastructure.Database.Migrations .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone"); - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - b.Property("Direction") .HasColumnType("integer"); + b.Property("IsHtml") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false); + b.Property("IsInternal") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(true); - b.Property("Platform") + b.Property("Message") .IsRequired() .HasColumnType("text"); - b.Property("PlatformAddress") - .IsRequired() - .HasColumnType("text"); + b.Property("Platform") + .HasColumnType("integer"); + + b.Property("Priority") + .HasColumnType("integer"); b.Property("Processed") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false); - b.Property("Title") + b.Property("Recipient") .IsRequired() .HasColumnType("text"); + b.Property("RecipientAddress") + .IsRequired() + .HasColumnType("text"); + + b.Property("Sender") + .IsRequired() + .HasColumnType("text"); + + b.Property("SenderName") + .HasColumnType("text"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("text"); + + b.Property("UpdatedAt") + .ValueGeneratedOnUpdate() + .HasColumnType("timestamp with time zone"); + b.HasKey("Id"); b.ToTable("Notification", (string)null); @@ -230,18 +248,30 @@ namespace LiteCharms.Infrastructure.Database.Migrations b.Property("CustomerId") .HasColumnType("uuid"); + b.Property("DepositRequired") + .HasColumnType("boolean"); + b.PrimitiveCollection("Notes") .HasColumnType("jsonb"); - b.Property("ProductPriceId") + b.Property("QuoteId") .HasColumnType("uuid"); b.Property("RefundId") .HasColumnType("uuid"); + b.PrimitiveCollection("Requirements") + .HasColumnType("jsonb"); + + b.Property("ShoppingCartId") + .HasColumnType("uuid"); + b.Property("Status") .HasColumnType("integer"); + b.PrimitiveCollection("Terms") + .HasColumnType("jsonb"); + b.Property("UpdatedAt") .ValueGeneratedOnUpdate() .HasColumnType("timestamp with time zone"); @@ -250,7 +280,11 @@ namespace LiteCharms.Infrastructure.Database.Migrations b.HasIndex("CustomerId"); - b.HasIndex("ProductPriceId"); + b.HasIndex("QuoteId") + .IsUnique(); + + b.HasIndex("ShoppingCartId") + .IsUnique(); b.ToTable("Order", (string)null); }); @@ -284,6 +318,67 @@ namespace LiteCharms.Infrastructure.Database.Migrations b.ToTable("OrderRefund", (string)null); }); + modelBuilder.Entity("LiteCharms.Entities.Package", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Active") + .HasColumnType("boolean"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("UpdatedAt") + .ValueGeneratedOnUpdate() + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.ToTable("Package", (string)null); + }); + + modelBuilder.Entity("LiteCharms.Entities.PackageItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Active") + .HasColumnType("boolean"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone"); + + b.Property("PackageId") + .HasColumnType("uuid"); + + b.Property("PackageId1") + .HasColumnType("uuid"); + + b.Property("ProductPriceId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("PackageId"); + + b.HasIndex("PackageId1"); + + b.ToTable("PackageItem", (string)null); + }); + modelBuilder.Entity("LiteCharms.Entities.Product", b => { b.Property("Id") @@ -343,6 +438,135 @@ namespace LiteCharms.Infrastructure.Database.Migrations b.ToTable("ProductPrice", (string)null); }); + modelBuilder.Entity("LiteCharms.Entities.Quote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("CustomerId1") + .HasColumnType("uuid"); + + b.Property("ExpiredAt") + .HasColumnType("timestamp with time zone"); + + b.Property("Reason") + .HasColumnType("text"); + + b.Property("ShoppingCartId") + .HasColumnType("uuid"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("UpdatedAt") + .ValueGeneratedOnUpdate() + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("CustomerId1"); + + b.HasIndex("ShoppingCartId") + .IsUnique(); + + b.ToTable("Quote", (string)null); + }); + + modelBuilder.Entity("LiteCharms.Entities.ShoppingCart", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("OrderId") + .HasColumnType("uuid"); + + b.Property("QuoteId") + .HasColumnType("uuid"); + + b.Property("UpdatedAt") + .ValueGeneratedOnUpdate() + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.ToTable("ShoppingCart", (string)null); + }); + + modelBuilder.Entity("LiteCharms.Entities.ShoppingCartItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp with time zone"); + + b.Property("ProductPriceId") + .HasColumnType("uuid"); + + b.Property("Quantity") + .HasColumnType("integer"); + + b.Property("ShoppingCartId") + .HasColumnType("uuid"); + + b.Property("UpdatedAt") + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.HasIndex("ProductPriceId"); + + b.HasIndex("ShoppingCartId"); + + b.ToTable("ShoppingCartItems"); + }); + + modelBuilder.Entity("LiteCharms.Entities.ShoppingCartPackage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone"); + + b.Property("PackageId") + .HasColumnType("uuid"); + + b.Property("ShoppingCartId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("PackageId"); + + b.HasIndex("ShoppingCartId"); + + b.ToTable("ShoppingCartPackage", (string)null); + }); + modelBuilder.Entity("LiteCharms.Entities.Lead", b => { b.HasOne("LiteCharms.Entities.Customer", "Customer") @@ -361,15 +585,22 @@ namespace LiteCharms.Infrastructure.Database.Migrations .OnDelete(DeleteBehavior.Restrict) .IsRequired(); - b.HasOne("LiteCharms.Entities.ProductPrice", "ProductPrice") - .WithMany() - .HasForeignKey("ProductPriceId") - .OnDelete(DeleteBehavior.Restrict) + b.HasOne("LiteCharms.Entities.Quote", "Quote") + .WithOne("Order") + .HasForeignKey("LiteCharms.Entities.Order", "QuoteId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("LiteCharms.Entities.ShoppingCart", "ShoppingCart") + .WithOne("Order") + .HasForeignKey("LiteCharms.Entities.Order", "ShoppingCartId") + .OnDelete(DeleteBehavior.NoAction) .IsRequired(); b.Navigation("Customer"); - b.Navigation("ProductPrice"); + b.Navigation("Quote"); + + b.Navigation("ShoppingCart"); }); modelBuilder.Entity("LiteCharms.Entities.OrderRefund", b => @@ -383,6 +614,21 @@ namespace LiteCharms.Infrastructure.Database.Migrations b.Navigation("Order"); }); + modelBuilder.Entity("LiteCharms.Entities.PackageItem", b => + { + b.HasOne("LiteCharms.Entities.Package", "Package") + .WithMany() + .HasForeignKey("PackageId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("LiteCharms.Entities.Package", null) + .WithMany("PackageItems") + .HasForeignKey("PackageId1"); + + b.Navigation("Package"); + }); + modelBuilder.Entity("LiteCharms.Entities.ProductPrice", b => { b.HasOne("LiteCharms.Entities.Product", "Product") @@ -394,11 +640,86 @@ namespace LiteCharms.Infrastructure.Database.Migrations b.Navigation("Product"); }); + modelBuilder.Entity("LiteCharms.Entities.Quote", b => + { + b.HasOne("LiteCharms.Entities.Customer", "Customer") + .WithMany() + .HasForeignKey("CustomerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LiteCharms.Entities.Customer", null) + .WithMany("Quotes") + .HasForeignKey("CustomerId1"); + + b.HasOne("LiteCharms.Entities.ShoppingCart", "ShoppingCart") + .WithOne("Quote") + .HasForeignKey("LiteCharms.Entities.Quote", "ShoppingCartId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Customer"); + + b.Navigation("ShoppingCart"); + }); + + modelBuilder.Entity("LiteCharms.Entities.ShoppingCart", b => + { + b.HasOne("LiteCharms.Entities.Customer", "Customer") + .WithMany("ShoppingCarts") + .HasForeignKey("CustomerId") + .OnDelete(DeleteBehavior.NoAction); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("LiteCharms.Entities.ShoppingCartItem", b => + { + b.HasOne("LiteCharms.Entities.ProductPrice", "ProductPrice") + .WithMany() + .HasForeignKey("ProductPriceId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("LiteCharms.Entities.ShoppingCart", "ShoppingCart") + .WithMany("ShoppingCartItems") + .HasForeignKey("ShoppingCartId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProductPrice"); + + b.Navigation("ShoppingCart"); + }); + + modelBuilder.Entity("LiteCharms.Entities.ShoppingCartPackage", b => + { + b.HasOne("LiteCharms.Entities.Package", "Package") + .WithMany() + .HasForeignKey("PackageId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("LiteCharms.Entities.ShoppingCart", "ShoppingCart") + .WithMany() + .HasForeignKey("ShoppingCartId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Package"); + + b.Navigation("ShoppingCart"); + }); + modelBuilder.Entity("LiteCharms.Entities.Customer", b => { b.Navigation("Leads"); b.Navigation("Orders"); + + b.Navigation("Quotes"); + + b.Navigation("ShoppingCarts"); }); modelBuilder.Entity("LiteCharms.Entities.Order", b => @@ -406,10 +727,29 @@ namespace LiteCharms.Infrastructure.Database.Migrations b.Navigation("Refund"); }); + modelBuilder.Entity("LiteCharms.Entities.Package", b => + { + b.Navigation("PackageItems"); + }); + modelBuilder.Entity("LiteCharms.Entities.Product", b => { b.Navigation("ProductPrices"); }); + + modelBuilder.Entity("LiteCharms.Entities.Quote", b => + { + b.Navigation("Order"); + }); + + modelBuilder.Entity("LiteCharms.Entities.ShoppingCart", b => + { + b.Navigation("Order"); + + b.Navigation("Quote"); + + b.Navigation("ShoppingCartItems"); + }); #pragma warning restore 612, 618 } } diff --git a/LiteCharms.Infrastructure/Database/Migrations/20260510091540_AddedPackages.cs b/LiteCharms.Infrastructure/Database/Migrations/20260510091540_AddedPackages.cs new file mode 100644 index 0000000..351ac6b --- /dev/null +++ b/LiteCharms.Infrastructure/Database/Migrations/20260510091540_AddedPackages.cs @@ -0,0 +1,114 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace LiteCharms.Infrastructure.Database.Migrations +{ + /// + public partial class AddedPackages : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Package", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + UpdatedAt = table.Column(type: "timestamp with time zone", nullable: true), + Name = table.Column(type: "text", nullable: false), + Description = table.Column(type: "text", nullable: false), + Active = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Package", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "PackageItem", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + PackageId1 = table.Column(type: "uuid", nullable: true), + PackageId = table.Column(type: "uuid", nullable: false), + ProductPriceId = table.Column(type: "uuid", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + Active = table.Column(type: "boolean", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_PackageItem", x => x.Id); + table.ForeignKey( + name: "FK_PackageItem_Package_PackageId", + column: x => x.PackageId, + principalTable: "Package", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_PackageItem_Package_PackageId1", + column: x => x.PackageId1, + principalTable: "Package", + principalColumn: "Id"); + }); + + migrationBuilder.CreateTable( + name: "ShoppingCartPackage", + columns: table => new + { + Id = table.Column(type: "uuid", nullable: false), + CreatedAt = table.Column(type: "timestamp with time zone", nullable: false), + ShoppingCartId = table.Column(type: "uuid", nullable: false), + PackageId = table.Column(type: "uuid", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ShoppingCartPackage", x => x.Id); + table.ForeignKey( + name: "FK_ShoppingCartPackage_Package_PackageId", + column: x => x.PackageId, + principalTable: "Package", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_ShoppingCartPackage_ShoppingCart_ShoppingCartId", + column: x => x.ShoppingCartId, + principalTable: "ShoppingCart", + principalColumn: "Id"); + }); + + migrationBuilder.CreateIndex( + name: "IX_PackageItem_PackageId", + table: "PackageItem", + column: "PackageId"); + + migrationBuilder.CreateIndex( + name: "IX_PackageItem_PackageId1", + table: "PackageItem", + column: "PackageId1"); + + migrationBuilder.CreateIndex( + name: "IX_ShoppingCartPackage_PackageId", + table: "ShoppingCartPackage", + column: "PackageId"); + + migrationBuilder.CreateIndex( + name: "IX_ShoppingCartPackage_ShoppingCartId", + table: "ShoppingCartPackage", + column: "ShoppingCartId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "PackageItem"); + + migrationBuilder.DropTable( + name: "ShoppingCartPackage"); + + migrationBuilder.DropTable( + name: "Package"); + } + } +} diff --git a/LiteCharms.Infrastructure/Database/Migrations/LeadGeneratorDbContextModelSnapshot.cs b/LiteCharms.Infrastructure/Database/Migrations/ShopDbContextModelSnapshot.cs similarity index 77% rename from LiteCharms.Infrastructure/Database/Migrations/LeadGeneratorDbContextModelSnapshot.cs rename to LiteCharms.Infrastructure/Database/Migrations/ShopDbContextModelSnapshot.cs index 09719f3..8a32836 100644 --- a/LiteCharms.Infrastructure/Database/Migrations/LeadGeneratorDbContextModelSnapshot.cs +++ b/LiteCharms.Infrastructure/Database/Migrations/ShopDbContextModelSnapshot.cs @@ -8,10 +8,10 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; #nullable disable -namespace LiteCharms.Infrastructure.Migrations +namespace LiteCharms.Infrastructure.Database.Migrations { [DbContext(typeof(ShopDbContext))] - partial class LeadGeneratorDbContextModelSnapshot : ModelSnapshot + partial class ShopDbContextModelSnapshot : ModelSnapshot { protected override void BuildModel(ModelBuilder modelBuilder) { @@ -164,10 +164,6 @@ namespace LiteCharms.Infrastructure.Migrations .ValueGeneratedOnAdd() .HasColumnType("uuid"); - b.Property("Author") - .IsRequired() - .HasColumnType("text"); - b.Property("CorrelationId") .IsRequired() .HasColumnType("text"); @@ -180,35 +176,57 @@ namespace LiteCharms.Infrastructure.Migrations .ValueGeneratedOnAdd() .HasColumnType("timestamp with time zone"); - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - b.Property("Direction") .HasColumnType("integer"); + b.Property("IsHtml") + .ValueGeneratedOnAdd() + .HasColumnType("boolean") + .HasDefaultValue(false); + b.Property("IsInternal") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(true); - b.Property("Platform") + b.Property("Message") .IsRequired() .HasColumnType("text"); - b.Property("PlatformAddress") - .IsRequired() - .HasColumnType("text"); + b.Property("Platform") + .HasColumnType("integer"); + + b.Property("Priority") + .HasColumnType("integer"); b.Property("Processed") .ValueGeneratedOnAdd() .HasColumnType("boolean") .HasDefaultValue(false); - b.Property("Title") + b.Property("Recipient") .IsRequired() .HasColumnType("text"); + b.Property("RecipientAddress") + .IsRequired() + .HasColumnType("text"); + + b.Property("Sender") + .IsRequired() + .HasColumnType("text"); + + b.Property("SenderName") + .HasColumnType("text"); + + b.Property("Subject") + .IsRequired() + .HasColumnType("text"); + + b.Property("UpdatedAt") + .ValueGeneratedOnUpdate() + .HasColumnType("timestamp with time zone"); + b.HasKey("Id"); b.ToTable("Notification", (string)null); @@ -227,6 +245,9 @@ namespace LiteCharms.Infrastructure.Migrations b.Property("CustomerId") .HasColumnType("uuid"); + b.Property("DepositRequired") + .HasColumnType("boolean"); + b.PrimitiveCollection("Notes") .HasColumnType("jsonb"); @@ -236,12 +257,18 @@ namespace LiteCharms.Infrastructure.Migrations b.Property("RefundId") .HasColumnType("uuid"); + b.PrimitiveCollection("Requirements") + .HasColumnType("jsonb"); + b.Property("ShoppingCartId") .HasColumnType("uuid"); b.Property("Status") .HasColumnType("integer"); + b.PrimitiveCollection("Terms") + .HasColumnType("jsonb"); + b.Property("UpdatedAt") .ValueGeneratedOnUpdate() .HasColumnType("timestamp with time zone"); @@ -288,6 +315,67 @@ namespace LiteCharms.Infrastructure.Migrations b.ToTable("OrderRefund", (string)null); }); + modelBuilder.Entity("LiteCharms.Entities.Package", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Active") + .HasColumnType("boolean"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("UpdatedAt") + .ValueGeneratedOnUpdate() + .HasColumnType("timestamp with time zone"); + + b.HasKey("Id"); + + b.ToTable("Package", (string)null); + }); + + modelBuilder.Entity("LiteCharms.Entities.PackageItem", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Active") + .HasColumnType("boolean"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone"); + + b.Property("PackageId") + .HasColumnType("uuid"); + + b.Property("PackageId1") + .HasColumnType("uuid"); + + b.Property("ProductPriceId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("PackageId"); + + b.HasIndex("PackageId1"); + + b.ToTable("PackageItem", (string)null); + }); + modelBuilder.Entity("LiteCharms.Entities.Product", b => { b.Property("Id") @@ -375,8 +463,8 @@ namespace LiteCharms.Infrastructure.Migrations b.Property("Status") .HasColumnType("integer"); - b.Property("UpdatedAt") - .ValueGeneratedOnAddOrUpdate() + b.Property("UpdatedAt") + .ValueGeneratedOnUpdate() .HasColumnType("timestamp with time zone"); b.HasKey("Id"); @@ -410,8 +498,8 @@ namespace LiteCharms.Infrastructure.Migrations b.Property("QuoteId") .HasColumnType("uuid"); - b.Property("UpdatedAt") - .ValueGeneratedOnAddOrUpdate() + b.Property("UpdatedAt") + .ValueGeneratedOnUpdate() .HasColumnType("timestamp with time zone"); b.HasKey("Id"); @@ -451,6 +539,31 @@ namespace LiteCharms.Infrastructure.Migrations b.ToTable("ShoppingCartItems"); }); + modelBuilder.Entity("LiteCharms.Entities.ShoppingCartPackage", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .ValueGeneratedOnAdd() + .HasColumnType("timestamp with time zone"); + + b.Property("PackageId") + .HasColumnType("uuid"); + + b.Property("ShoppingCartId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("PackageId"); + + b.HasIndex("ShoppingCartId"); + + b.ToTable("ShoppingCartPackage", (string)null); + }); + modelBuilder.Entity("LiteCharms.Entities.Lead", b => { b.HasOne("LiteCharms.Entities.Customer", "Customer") @@ -498,6 +611,21 @@ namespace LiteCharms.Infrastructure.Migrations b.Navigation("Order"); }); + modelBuilder.Entity("LiteCharms.Entities.PackageItem", b => + { + b.HasOne("LiteCharms.Entities.Package", "Package") + .WithMany() + .HasForeignKey("PackageId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("LiteCharms.Entities.Package", null) + .WithMany("PackageItems") + .HasForeignKey("PackageId1"); + + b.Navigation("Package"); + }); + modelBuilder.Entity("LiteCharms.Entities.ProductPrice", b => { b.HasOne("LiteCharms.Entities.Product", "Product") @@ -561,6 +689,25 @@ namespace LiteCharms.Infrastructure.Migrations b.Navigation("ShoppingCart"); }); + modelBuilder.Entity("LiteCharms.Entities.ShoppingCartPackage", b => + { + b.HasOne("LiteCharms.Entities.Package", "Package") + .WithMany() + .HasForeignKey("PackageId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("LiteCharms.Entities.ShoppingCart", "ShoppingCart") + .WithMany() + .HasForeignKey("ShoppingCartId") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.Navigation("Package"); + + b.Navigation("ShoppingCart"); + }); + modelBuilder.Entity("LiteCharms.Entities.Customer", b => { b.Navigation("Leads"); @@ -577,6 +724,11 @@ namespace LiteCharms.Infrastructure.Migrations b.Navigation("Refund"); }); + modelBuilder.Entity("LiteCharms.Entities.Package", b => + { + b.Navigation("PackageItems"); + }); + modelBuilder.Entity("LiteCharms.Entities.Product", b => { b.Navigation("ProductPrices"); diff --git a/LiteCharms.Infrastructure/Database/ShopDbContext.cs b/LiteCharms.Infrastructure/Database/ShopDbContext.cs index 91de689..c3d0679 100644 --- a/LiteCharms.Infrastructure/Database/ShopDbContext.cs +++ b/LiteCharms.Infrastructure/Database/ShopDbContext.cs @@ -23,4 +23,10 @@ public class ShopDbContext(DbContextOptions options) : DbContext( public DbSet ShoppingCarts { get; set; } public DbSet ShoppingCartItems { get; set; } + + public DbSet Packages { get; set; } + + public DbSet PackageItems { get; set; } + + public DbSet ShoppingCartPackages { get; set; } } diff --git a/LiteCharms.Infrastructure/LiteCharms.Infrastructure.csproj b/LiteCharms.Infrastructure/LiteCharms.Infrastructure.csproj index 9647c3a..765140f 100644 --- a/LiteCharms.Infrastructure/LiteCharms.Infrastructure.csproj +++ b/LiteCharms.Infrastructure/LiteCharms.Infrastructure.csproj @@ -100,5 +100,9 @@ PreserveNewest + + + + diff --git a/LiteCharms.Models/Enums.cs b/LiteCharms.Models/Enums.cs index 96bda99..385a5b5 100644 --- a/LiteCharms.Models/Enums.cs +++ b/LiteCharms.Models/Enums.cs @@ -1,5 +1,21 @@ namespace LiteCharms.Models; +public enum Priorities : int +{ + Low = 0, + Medium = 1, + High = 2, +} + +public enum NotificationPlatforms : int +{ + Email = 1, + Discord = 2, + Slack = 3, + WhatsApp = 4, + System = 5 +} + public enum QuoteStatus : int { Draft = 0, diff --git a/LiteCharms.Models/Notification.cs b/LiteCharms.Models/Notification.cs index 88c4896..90ac390 100644 --- a/LiteCharms.Models/Notification.cs +++ b/LiteCharms.Models/Notification.cs @@ -6,22 +6,32 @@ public class Notification public DateTimeOffset CreatedAt { get; set; } + public DateTimeOffset? UpdatedAt { get; set; } + public NotificationDirection Direction { get; set; } - public string? Author { get; set; } + public NotificationPlatforms Platform { get; set; } - public string? Title { get; set; } + public Priorities Priority { get; set; } - public string? Description { get; set; } + public string? Sender { get; set; } - public string? Platform { get; set; } + public string? SenderName { get; set; } - public string? PlatformAddress { get; set; } + public string? Subject { get; set; } + + public string? Message { get; set; } + + public string? Recipient { get; set; } + + public string? RecipientAddress { get; set; } public string? CorrelationId { get; set; } public string? CorrelationIdType { get; set; } + public bool IsHtml { get; set; } + public bool IsInternal { get; set; } public bool Processed { get; set; } diff --git a/LiteCharms.Models/Order.cs b/LiteCharms.Models/Order.cs index 70ec1f3..3c55c81 100644 --- a/LiteCharms.Models/Order.cs +++ b/LiteCharms.Models/Order.cs @@ -12,11 +12,17 @@ public class Order public Guid? QuoteId { get; set; } - public Guid ShoppingCartId { get; set; } + public Guid ShoppingCartId { get; set; } public Guid? RefundId { get; set; } public OrderStatus Status { get; set; } + public string[]? Requirements { get; set; } + public string[]? Notes { get; set; } + + public string[]? Terms { get; set; } + + public bool DepositRequired { get; set; } } diff --git a/LiteCharms.Models/Package.cs b/LiteCharms.Models/Package.cs new file mode 100644 index 0000000..cfc0feb --- /dev/null +++ b/LiteCharms.Models/Package.cs @@ -0,0 +1,16 @@ +namespace LiteCharms.Models; + +public class Package +{ + public Guid Id { get; set; } + + public DateTimeOffset CreatedAt { get; set; } + + public DateTimeOffset? UpdatedAt { get; set; } + + public string? Name { get; set; } + + public string? Description { get; set; } + + public bool Active { get; set; } +} diff --git a/LiteCharms.Models/PackageItem.cs b/LiteCharms.Models/PackageItem.cs new file mode 100644 index 0000000..2c27ad3 --- /dev/null +++ b/LiteCharms.Models/PackageItem.cs @@ -0,0 +1,14 @@ +namespace LiteCharms.Models; + +public class PackageItem +{ + public Guid Id { get; set; } + + public Guid PackageId { get; set; } + + public Guid ProductPriceId { get; set; } + + public DateTimeOffset CreatedAt { get; set; } + + public bool Active { get; set; } +} diff --git a/LiteCharms.Models/ShoppingCartPackage.cs b/LiteCharms.Models/ShoppingCartPackage.cs new file mode 100644 index 0000000..673b577 --- /dev/null +++ b/LiteCharms.Models/ShoppingCartPackage.cs @@ -0,0 +1,12 @@ +namespace LiteCharms.Models; + +public class ShoppingCartPackage +{ + public Guid Id { get; set; } + + public DateTimeOffset CreatedAt { get; set; } + + public Guid ShoppingCartId { get; set; } + + public Guid PackageId { get; set; } +} diff --git a/LiteCharmsShared.slnx b/LiteCharmsShared.slnx index f43a12e..05f4368 100644 --- a/LiteCharmsShared.slnx +++ b/LiteCharmsShared.slnx @@ -1,13 +1,6 @@ - - - - - - - -- 2.47.3