Migrated database changes after refactoring the Notification model
This commit is contained in:
@@ -1,4 +1,6 @@
|
|||||||
namespace LiteCharms.Entities.Configuration;
|
using LiteCharms.Models;
|
||||||
|
|
||||||
|
namespace LiteCharms.Entities.Configuration;
|
||||||
|
|
||||||
public class NotificationConfiguration : IEntityTypeConfiguration<Notification>
|
public class NotificationConfiguration : IEntityTypeConfiguration<Notification>
|
||||||
{
|
{
|
||||||
@@ -9,18 +11,20 @@ public class NotificationConfiguration : IEntityTypeConfiguration<Notification>
|
|||||||
builder.HasKey(f => f.Id);
|
builder.HasKey(f => f.Id);
|
||||||
builder.Property(f => f.CreatedAt).IsRequired().ValueGeneratedOnAdd();
|
builder.Property(f => f.CreatedAt).IsRequired().ValueGeneratedOnAdd();
|
||||||
builder.Property(f => f.UpdatedAt).IsRequired(false).ValueGeneratedOnUpdate();
|
builder.Property(f => f.UpdatedAt).IsRequired(false).ValueGeneratedOnUpdate();
|
||||||
builder.Property(f => f.Direction).IsRequired();
|
builder.Property(f => f.Direction).IsRequired().HasConversion<int>();
|
||||||
builder.Property(f => f.Platform).IsRequired();
|
builder.Property(f => f.Platform).IsRequired().HasConversion<int>();
|
||||||
builder.Property(f => f.Priority).IsRequired();
|
builder.Property(f => f.Priority).IsRequired().HasConversion<int>();
|
||||||
|
builder.Property(f => f.CorrelationIdType).IsRequired().HasConversion<int>();
|
||||||
builder.Property(f => f.Sender).IsRequired();
|
builder.Property(f => f.Sender).IsRequired();
|
||||||
builder.Property(f => f.Subject).IsRequired();
|
builder.Property(f => f.Subject).IsRequired();
|
||||||
builder.Property(f => f.Message).IsRequired();
|
builder.Property(f => f.Message).IsRequired();
|
||||||
builder.Property(f => f.Recipient).IsRequired();
|
builder.Property(f => f.Recipient).IsRequired();
|
||||||
builder.Property(f => f.RecipientAddress).IsRequired();
|
builder.Property(f => f.RecipientAddress).IsRequired();
|
||||||
builder.Property(f => f.CorrelationId).IsRequired();
|
builder.Property(f => f.CorrelationId).IsRequired();
|
||||||
builder.Property(f => f.CorrelationIdType).IsRequired();
|
|
||||||
builder.Property(f => f.IsHtml).HasDefaultValue(false);
|
builder.Property(f => f.IsHtml).HasDefaultValue(false);
|
||||||
builder.Property(f => f.IsInternal).HasDefaultValue(true);
|
builder.Property(f => f.IsInternal).HasDefaultValue(true);
|
||||||
builder.Property(f => f.Processed).HasDefaultValue(false);
|
builder.Property(f => f.Processed).HasDefaultValue(false);
|
||||||
|
builder.Property(f => f.HasError).HasDefaultValue(false);
|
||||||
|
builder.Property(f => f.Errors).HasColumnType("jsonb").IsRequired(false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -11,7 +11,7 @@ public class QuoteConfiguration : IEntityTypeConfiguration<Quote>
|
|||||||
builder.Property(f => f.UpdatedAt).IsRequired(false).ValueGeneratedOnUpdate();
|
builder.Property(f => f.UpdatedAt).IsRequired(false).ValueGeneratedOnUpdate();
|
||||||
builder.Property(f => f.ExpiredAt).IsRequired(false);
|
builder.Property(f => f.ExpiredAt).IsRequired(false);
|
||||||
builder.Property(f => f.CustomerId).IsRequired();
|
builder.Property(f => f.CustomerId).IsRequired();
|
||||||
builder.Property(f => f.Status).IsRequired();
|
builder.Property(f => f.Status).IsRequired().HasConversion<int>();
|
||||||
builder.Property(f => f.ShoppingCartId).IsRequired();
|
builder.Property(f => f.ShoppingCartId).IsRequired();
|
||||||
builder.Property(f => f.Reason).IsRequired(false);
|
builder.Property(f => f.Reason).IsRequired(false);
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,9 @@ public static class EntityModeMappers
|
|||||||
RecipientAddress = entity.RecipientAddress,
|
RecipientAddress = entity.RecipientAddress,
|
||||||
Priority = entity.Priority,
|
Priority = entity.Priority,
|
||||||
UpdatedAt = entity?.UpdatedAt,
|
UpdatedAt = entity?.UpdatedAt,
|
||||||
IsHtml = entity!.IsHtml
|
IsHtml = entity!.IsHtml,
|
||||||
|
HasError = entity.HasError,
|
||||||
|
Errors = entity.Errors
|
||||||
};
|
};
|
||||||
|
|
||||||
public static Customer ToModel(this Entities.Customer entity) =>
|
public static Customer ToModel(this Entities.Customer entity) =>
|
||||||
|
|||||||
+3
-2
@@ -1,6 +1,7 @@
|
|||||||
using LiteCharms.Models.Configuraton.Email;
|
using LiteCharms.Features.Email.Commands;
|
||||||
|
using LiteCharms.Models.Configuraton.Email;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Utilities.Commands.Handlers;
|
namespace LiteCharms.Features.Email.Commands.Handlers;
|
||||||
|
|
||||||
public class SendEmailCommandHandler(IOptions<SmtpSettings> smtpOptions) : IRequestHandler<SendEmailCommand, Result>
|
public class SendEmailCommandHandler(IOptions<SmtpSettings> smtpOptions) : IRequestHandler<SendEmailCommand, Result>
|
||||||
{
|
{
|
||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Utilities.Commands;
|
namespace LiteCharms.Features.Email.Commands;
|
||||||
|
|
||||||
public class SendEmailCommand : IRequest<Result>
|
public class SendEmailCommand : IRequest<Result>
|
||||||
{
|
{
|
||||||
@@ -1,4 +1,4 @@
|
|||||||
using LiteCharms.Features.Utilities.Commands;
|
using LiteCharms.Features.Utilities.Hash.Commands;
|
||||||
using LiteCharms.Infrastructure.Database;
|
using LiteCharms.Infrastructure.Database;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Leads.Commands.Handlers;
|
namespace LiteCharms.Features.Leads.Commands.Handlers;
|
||||||
|
|||||||
@@ -61,4 +61,8 @@
|
|||||||
<ProjectReference Include="..\LiteCharms.Infrastructure\LiteCharms.Infrastructure.csproj" />
|
<ProjectReference Include="..\LiteCharms.Infrastructure\LiteCharms.Infrastructure.csproj" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<Folder Include="Email\Notifications\Handlers\" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
</Project>
|
</Project>
|
||||||
|
|||||||
+6
@@ -17,6 +17,12 @@ public class UpdateNotificationCommandHandler(IDbContextFactory<ShopDbContext> c
|
|||||||
|
|
||||||
notification.Processed = request.Processed;
|
notification.Processed = request.Processed;
|
||||||
|
|
||||||
|
if (request.HasError)
|
||||||
|
{
|
||||||
|
notification.HasError = request.HasError;
|
||||||
|
notification.Errors = request.Errors;
|
||||||
|
}
|
||||||
|
|
||||||
return await context.SaveChangesAsync(cancellationToken) > 0
|
return await context.SaveChangesAsync(cancellationToken) > 0
|
||||||
? Result.Ok()
|
? Result.Ok()
|
||||||
: Result.Fail(new Error($"Failed to update notification with id {request.NotificationId}."));
|
: Result.Fail(new Error($"Failed to update notification with id {request.NotificationId}."));
|
||||||
|
|||||||
@@ -6,13 +6,19 @@ public class UpdateNotificationCommand : IRequest<Result>
|
|||||||
|
|
||||||
public bool Processed { get; set; }
|
public bool Processed { get; set; }
|
||||||
|
|
||||||
private UpdateNotificationCommand(Guid notificationId, bool processed)
|
public bool HasError { get; set; }
|
||||||
|
|
||||||
|
public string[]? Errors { get; set; }
|
||||||
|
|
||||||
|
private UpdateNotificationCommand(Guid notificationId, bool processed, bool hasError = false, string[]? errors = null)
|
||||||
{
|
{
|
||||||
NotificationId = notificationId;
|
NotificationId = notificationId;
|
||||||
Processed = processed;
|
Processed = processed;
|
||||||
|
HasError = hasError;
|
||||||
|
Errors = errors;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static UpdateNotificationCommand Create(Guid notificationId, bool processed)
|
public static UpdateNotificationCommand Create(Guid notificationId, bool processed, bool hasError = false, string[]? errors = null)
|
||||||
{
|
{
|
||||||
if(notificationId == Guid.Empty)
|
if(notificationId == Guid.Empty)
|
||||||
throw new ArgumentException("Notification ID cannot be empty.", nameof(notificationId));
|
throw new ArgumentException("Notification ID cannot be empty.", nameof(notificationId));
|
||||||
|
|||||||
@@ -8,14 +8,26 @@ public class CreateOrderCommand : IRequest<Result<Guid>>
|
|||||||
|
|
||||||
public Guid? QuoteId { get; set; }
|
public Guid? QuoteId { get; set; }
|
||||||
|
|
||||||
private CreateOrderCommand(Guid customerId, Guid shoppingCartId, Guid? quoteId = null)
|
public string[]? Requirements { get; set; }
|
||||||
|
|
||||||
|
public string[]? Notes { get; set; }
|
||||||
|
|
||||||
|
public string[]? Terms { get; set; }
|
||||||
|
|
||||||
|
public bool DepositRequired { get; set; }
|
||||||
|
|
||||||
|
private CreateOrderCommand(Guid customerId, Guid shoppingCartId, bool depositRequired, Guid? quoteId = null, string[]? requirements = null, string[]? notes = null, string[]? terms = null)
|
||||||
{
|
{
|
||||||
CustomerId = customerId;
|
CustomerId = customerId;
|
||||||
ShoppingCartId = shoppingCartId;
|
ShoppingCartId = shoppingCartId;
|
||||||
|
DepositRequired = depositRequired;
|
||||||
QuoteId = quoteId;
|
QuoteId = quoteId;
|
||||||
|
Requirements = requirements;
|
||||||
|
Notes = notes;
|
||||||
|
Terms = terms;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static CreateOrderCommand Create(Guid customerId, Guid shoppingCartId, Guid? quoteId = null)
|
public static CreateOrderCommand Create(Guid customerId, Guid shoppingCartId, bool depositRequired, Guid? quoteId = null, string[]? requirements = null, string[]? notes = null, string[]? terms = null)
|
||||||
{
|
{
|
||||||
if (customerId == Guid.Empty)
|
if (customerId == Guid.Empty)
|
||||||
throw new ArgumentException("CustomerId is required.", nameof(customerId));
|
throw new ArgumentException("CustomerId is required.", nameof(customerId));
|
||||||
@@ -23,6 +35,6 @@ public class CreateOrderCommand : IRequest<Result<Guid>>
|
|||||||
if (shoppingCartId == Guid.Empty)
|
if (shoppingCartId == Guid.Empty)
|
||||||
throw new ArgumentException("ShoppingCartId is required.", nameof(shoppingCartId));
|
throw new ArgumentException("ShoppingCartId is required.", nameof(shoppingCartId));
|
||||||
|
|
||||||
return new(customerId, shoppingCartId, quoteId);
|
return new(customerId, shoppingCartId, depositRequired, quoteId, requirements, notes, terms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,4 +1,5 @@
|
|||||||
using LiteCharms.Infrastructure.Database;
|
using LiteCharms.Infrastructure.Database;
|
||||||
|
using LiteCharms.Models;
|
||||||
|
|
||||||
namespace LiteCharms.Features.Orders.Commands.Handlers;
|
namespace LiteCharms.Features.Orders.Commands.Handlers;
|
||||||
|
|
||||||
@@ -21,10 +22,15 @@ public class CreateOrderCommandHandler(IDbContextFactory<ShopDbContext> contextF
|
|||||||
|
|
||||||
var newOrder = context.Orders.Add(new Entities.Order
|
var newOrder = context.Orders.Add(new Entities.Order
|
||||||
{
|
{
|
||||||
|
CreatedAt = DateTime.UtcNow,
|
||||||
|
Status = OrderStatus.Pending,
|
||||||
CustomerId = request.CustomerId,
|
CustomerId = request.CustomerId,
|
||||||
ShoppingCartId = request.ShoppingCartId,
|
|
||||||
QuoteId = request.QuoteId,
|
QuoteId = request.QuoteId,
|
||||||
CreatedAt = DateTime.UtcNow
|
ShoppingCartId = request.ShoppingCartId,
|
||||||
|
DepositRequired = request.DepositRequired,
|
||||||
|
Requirements = request.Requirements,
|
||||||
|
Notes = request.Notes,
|
||||||
|
Terms = request.Terms
|
||||||
});
|
});
|
||||||
|
|
||||||
return await context.SaveChangesAsync(cancellationToken) > 0
|
return await context.SaveChangesAsync(cancellationToken) > 0
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
namespace LiteCharms.Features.Utilities.Commands;
|
namespace LiteCharms.Features.Utilities.Hash.Commands;
|
||||||
|
|
||||||
public class ComputeHashCommand : IRequest<Result<string>>
|
public class ComputeHashCommand : IRequest<Result<string>>
|
||||||
{
|
{
|
||||||
+3
-1
@@ -1,4 +1,6 @@
|
|||||||
namespace LiteCharms.Features.Utilities.Commands.Handlers;
|
using LiteCharms.Features.Utilities.Hash.Commands;
|
||||||
|
|
||||||
|
namespace LiteCharms.Features.Utilities.Hash.Commands.Handlers;
|
||||||
|
|
||||||
public class ComputeHashCommandHandler : IRequestHandler<ComputeHashCommand, Result<string>>
|
public class ComputeHashCommandHandler : IRequestHandler<ComputeHashCommand, Result<string>>
|
||||||
{
|
{
|
||||||
-631
@@ -1,631 +0,0 @@
|
|||||||
// <auto-generated />
|
|
||||||
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("20260510090446_Init")]
|
|
||||||
partial class Init
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
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<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<bool>("Active")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("boolean")
|
|
||||||
.HasDefaultValue(true);
|
|
||||||
|
|
||||||
b.Property<string>("Address")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("City")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Company")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Country")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("CreatedAt")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("Discord")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Email")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("LastName")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("LinkedIn")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Phone")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("PostalCode")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Region")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Slack")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Tax")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("UpdatedAt")
|
|
||||||
.ValueGeneratedOnUpdate()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("Website")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Whatsapp")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Customer", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LiteCharms.Entities.Lead", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<long?>("AdGroupId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<long?>("AdName")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<string>("AppClickId")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("AttributionHash")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<long?>("CampaignId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<string>("ClickId")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("ClickLocation")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("CreatedAt")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<Guid?>("CustomerId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<long?>("FeedItemId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<string>("Source")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<int>("Status")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<long?>("TargetId")
|
|
||||||
.HasColumnType("bigint");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("UpdatedAt")
|
|
||||||
.ValueGeneratedOnUpdate()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("WebClickId")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("CustomerId");
|
|
||||||
|
|
||||||
b.ToTable("Lead", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LiteCharms.Entities.Notification", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<string>("CorrelationId")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("CorrelationIdType")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("CreatedAt")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<int>("Direction")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<bool>("IsHtml")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("boolean")
|
|
||||||
.HasDefaultValue(false);
|
|
||||||
|
|
||||||
b.Property<bool>("IsInternal")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("boolean")
|
|
||||||
.HasDefaultValue(true);
|
|
||||||
|
|
||||||
b.Property<string>("Message")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<int>("Platform")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<int>("Priority")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<bool>("Processed")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("boolean")
|
|
||||||
.HasDefaultValue(false);
|
|
||||||
|
|
||||||
b.Property<string>("Recipient")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("RecipientAddress")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Sender")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("SenderName")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Subject")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("UpdatedAt")
|
|
||||||
.ValueGeneratedOnUpdate()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Notification", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LiteCharms.Entities.Order", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("CreatedAt")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<Guid>("CustomerId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<bool>("DepositRequired")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.PrimitiveCollection<string>("Notes")
|
|
||||||
.HasColumnType("jsonb");
|
|
||||||
|
|
||||||
b.Property<Guid?>("QuoteId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<Guid?>("RefundId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.PrimitiveCollection<string>("Requirements")
|
|
||||||
.HasColumnType("jsonb");
|
|
||||||
|
|
||||||
b.Property<Guid>("ShoppingCartId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<int>("Status")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.PrimitiveCollection<string>("Terms")
|
|
||||||
.HasColumnType("jsonb");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("UpdatedAt")
|
|
||||||
.ValueGeneratedOnUpdate()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("CustomerId");
|
|
||||||
|
|
||||||
b.HasIndex("QuoteId")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.HasIndex("ShoppingCartId")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("Order", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LiteCharms.Entities.OrderRefund", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<decimal>("Amount")
|
|
||||||
.HasPrecision(18, 2)
|
|
||||||
.HasColumnType("numeric(18,2)");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("CreatedAt")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<Guid>("OrderId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<string>("Reason")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("OrderId")
|
|
||||||
.IsUnique();
|
|
||||||
|
|
||||||
b.ToTable("OrderRefund", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LiteCharms.Entities.Product", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<bool>("Active")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("boolean")
|
|
||||||
.HasDefaultValue(true);
|
|
||||||
|
|
||||||
b.Property<string>("Description")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<string>("Name")
|
|
||||||
.IsRequired()
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.ToTable("Product", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LiteCharms.Entities.ProductPrice", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<bool>("Active")
|
|
||||||
.HasColumnType("boolean");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("CreatedAt")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<decimal>("Discount")
|
|
||||||
.HasPrecision(18, 2)
|
|
||||||
.HasColumnType("numeric(18,2)");
|
|
||||||
|
|
||||||
b.Property<decimal>("Price")
|
|
||||||
.HasPrecision(18, 2)
|
|
||||||
.HasColumnType("numeric(18,2)");
|
|
||||||
|
|
||||||
b.Property<Guid>("ProductId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("UpdatedAt")
|
|
||||||
.ValueGeneratedOnUpdate()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("ProductId");
|
|
||||||
|
|
||||||
b.ToTable("ProductPrice", (string)null);
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LiteCharms.Entities.Quote", b =>
|
|
||||||
{
|
|
||||||
b.Property<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("CreatedAt")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<Guid>("CustomerId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<Guid?>("CustomerId1")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("ExpiredAt")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<string>("Reason")
|
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<Guid>("ShoppingCartId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<int>("Status")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("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<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("CreatedAt")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<Guid?>("CustomerId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<Guid?>("OrderId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<Guid?>("QuoteId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("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<Guid>("Id")
|
|
||||||
.ValueGeneratedOnAdd()
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("CreatedAt")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.Property<Guid>("ProductPriceId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<int>("Quantity")
|
|
||||||
.HasColumnType("integer");
|
|
||||||
|
|
||||||
b.Property<Guid>("ShoppingCartId")
|
|
||||||
.HasColumnType("uuid");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("UpdatedAt")
|
|
||||||
.HasColumnType("timestamp with time zone");
|
|
||||||
|
|
||||||
b.HasKey("Id");
|
|
||||||
|
|
||||||
b.HasIndex("ProductPriceId");
|
|
||||||
|
|
||||||
b.HasIndex("ShoppingCartId");
|
|
||||||
|
|
||||||
b.ToTable("ShoppingCartItems");
|
|
||||||
});
|
|
||||||
|
|
||||||
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.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("Quote");
|
|
||||||
|
|
||||||
b.Navigation("ShoppingCart");
|
|
||||||
});
|
|
||||||
|
|
||||||
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.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.Customer", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Leads");
|
|
||||||
|
|
||||||
b.Navigation("Orders");
|
|
||||||
|
|
||||||
b.Navigation("Quotes");
|
|
||||||
|
|
||||||
b.Navigation("ShoppingCarts");
|
|
||||||
});
|
|
||||||
|
|
||||||
modelBuilder.Entity("LiteCharms.Entities.Order", b =>
|
|
||||||
{
|
|
||||||
b.Navigation("Refund");
|
|
||||||
});
|
|
||||||
|
|
||||||
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
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,114 +0,0 @@
|
|||||||
using System;
|
|
||||||
using Microsoft.EntityFrameworkCore.Migrations;
|
|
||||||
|
|
||||||
#nullable disable
|
|
||||||
|
|
||||||
namespace LiteCharms.Infrastructure.Database.Migrations
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
public partial class AddedPackages : Migration
|
|
||||||
{
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Up(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "Package",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
||||||
UpdatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
|
||||||
Name = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Description = table.Column<string>(type: "text", nullable: false),
|
|
||||||
Active = table.Column<bool>(type: "boolean", nullable: false)
|
|
||||||
},
|
|
||||||
constraints: table =>
|
|
||||||
{
|
|
||||||
table.PrimaryKey("PK_Package", x => x.Id);
|
|
||||||
});
|
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
|
||||||
name: "PackageItem",
|
|
||||||
columns: table => new
|
|
||||||
{
|
|
||||||
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
PackageId1 = table.Column<Guid>(type: "uuid", nullable: true),
|
|
||||||
PackageId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
ProductPriceId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
||||||
Active = table.Column<bool>(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<Guid>(type: "uuid", nullable: false),
|
|
||||||
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
|
||||||
ShoppingCartId = table.Column<Guid>(type: "uuid", nullable: false),
|
|
||||||
PackageId = table.Column<Guid>(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");
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <inheritdoc />
|
|
||||||
protected override void Down(MigrationBuilder migrationBuilder)
|
|
||||||
{
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "PackageItem");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "ShoppingCartPackage");
|
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
|
||||||
name: "Package");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
+26
-5
@@ -12,8 +12,8 @@ using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata;
|
|||||||
namespace LiteCharms.Infrastructure.Database.Migrations
|
namespace LiteCharms.Infrastructure.Database.Migrations
|
||||||
{
|
{
|
||||||
[DbContext(typeof(ShopDbContext))]
|
[DbContext(typeof(ShopDbContext))]
|
||||||
[Migration("20260510091540_AddedPackages")]
|
[Migration("20260510132008_Init")]
|
||||||
partial class AddedPackages
|
partial class Init
|
||||||
{
|
{
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
protected override void BuildTargetModel(ModelBuilder modelBuilder)
|
||||||
@@ -171,9 +171,8 @@ namespace LiteCharms.Infrastructure.Database.Migrations
|
|||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("CorrelationIdType")
|
b.Property<int>("CorrelationIdType")
|
||||||
.IsRequired()
|
.HasColumnType("integer");
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("CreatedAt")
|
b.Property<DateTimeOffset>("CreatedAt")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
@@ -182,6 +181,14 @@ namespace LiteCharms.Infrastructure.Database.Migrations
|
|||||||
b.Property<int>("Direction")
|
b.Property<int>("Direction")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.PrimitiveCollection<string>("Errors")
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<bool>("HasError")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("boolean")
|
||||||
|
.HasDefaultValue(false);
|
||||||
|
|
||||||
b.Property<bool>("IsHtml")
|
b.Property<bool>("IsHtml")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("boolean")
|
.HasColumnType("boolean")
|
||||||
@@ -339,12 +346,17 @@ namespace LiteCharms.Infrastructure.Database.Migrations
|
|||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<Guid?>("ShoppingCartId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("UpdatedAt")
|
b.Property<DateTimeOffset?>("UpdatedAt")
|
||||||
.ValueGeneratedOnUpdate()
|
.ValueGeneratedOnUpdate()
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ShoppingCartId");
|
||||||
|
|
||||||
b.ToTable("Package", (string)null);
|
b.ToTable("Package", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -614,6 +626,13 @@ namespace LiteCharms.Infrastructure.Database.Migrations
|
|||||||
b.Navigation("Order");
|
b.Navigation("Order");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("LiteCharms.Entities.Package", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("LiteCharms.Entities.ShoppingCart", null)
|
||||||
|
.WithMany("Packages")
|
||||||
|
.HasForeignKey("ShoppingCartId");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("LiteCharms.Entities.PackageItem", b =>
|
modelBuilder.Entity("LiteCharms.Entities.PackageItem", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("LiteCharms.Entities.Package", "Package")
|
b.HasOne("LiteCharms.Entities.Package", "Package")
|
||||||
@@ -746,6 +765,8 @@ namespace LiteCharms.Infrastructure.Database.Migrations
|
|||||||
{
|
{
|
||||||
b.Navigation("Order");
|
b.Navigation("Order");
|
||||||
|
|
||||||
|
b.Navigation("Packages");
|
||||||
|
|
||||||
b.Navigation("Quote");
|
b.Navigation("Quote");
|
||||||
|
|
||||||
b.Navigation("ShoppingCartItems");
|
b.Navigation("ShoppingCartItems");
|
||||||
+110
-2
@@ -51,6 +51,7 @@ namespace LiteCharms.Infrastructure.Database.Migrations
|
|||||||
Direction = table.Column<int>(type: "integer", nullable: false),
|
Direction = table.Column<int>(type: "integer", nullable: false),
|
||||||
Platform = table.Column<int>(type: "integer", nullable: false),
|
Platform = table.Column<int>(type: "integer", nullable: false),
|
||||||
Priority = table.Column<int>(type: "integer", nullable: false),
|
Priority = table.Column<int>(type: "integer", nullable: false),
|
||||||
|
CorrelationIdType = table.Column<int>(type: "integer", nullable: false),
|
||||||
Sender = table.Column<string>(type: "text", nullable: false),
|
Sender = table.Column<string>(type: "text", nullable: false),
|
||||||
SenderName = table.Column<string>(type: "text", nullable: true),
|
SenderName = table.Column<string>(type: "text", nullable: true),
|
||||||
Subject = table.Column<string>(type: "text", nullable: false),
|
Subject = table.Column<string>(type: "text", nullable: false),
|
||||||
@@ -58,10 +59,11 @@ namespace LiteCharms.Infrastructure.Database.Migrations
|
|||||||
Recipient = table.Column<string>(type: "text", nullable: false),
|
Recipient = table.Column<string>(type: "text", nullable: false),
|
||||||
RecipientAddress = table.Column<string>(type: "text", nullable: false),
|
RecipientAddress = table.Column<string>(type: "text", nullable: false),
|
||||||
CorrelationId = table.Column<string>(type: "text", nullable: false),
|
CorrelationId = table.Column<string>(type: "text", nullable: false),
|
||||||
CorrelationIdType = table.Column<string>(type: "text", nullable: false),
|
|
||||||
IsHtml = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
|
IsHtml = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
|
||||||
IsInternal = table.Column<bool>(type: "boolean", nullable: false, defaultValue: true),
|
IsInternal = table.Column<bool>(type: "boolean", nullable: false, defaultValue: true),
|
||||||
Processed = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false)
|
Processed = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
|
||||||
|
HasError = table.Column<bool>(type: "boolean", nullable: false, defaultValue: false),
|
||||||
|
Errors = table.Column<string>(type: "jsonb", nullable: true)
|
||||||
},
|
},
|
||||||
constraints: table =>
|
constraints: table =>
|
||||||
{
|
{
|
||||||
@@ -157,6 +159,28 @@ namespace LiteCharms.Infrastructure.Database.Migrations
|
|||||||
onDelete: ReferentialAction.Restrict);
|
onDelete: ReferentialAction.Restrict);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "Package",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
ShoppingCartId = table.Column<Guid>(type: "uuid", nullable: true),
|
||||||
|
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||||
|
UpdatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: true),
|
||||||
|
Name = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Description = table.Column<string>(type: "text", nullable: false),
|
||||||
|
Active = table.Column<bool>(type: "boolean", nullable: false)
|
||||||
|
},
|
||||||
|
constraints: table =>
|
||||||
|
{
|
||||||
|
table.PrimaryKey("PK_Package", x => x.Id);
|
||||||
|
table.ForeignKey(
|
||||||
|
name: "FK_Package_ShoppingCart_ShoppingCartId",
|
||||||
|
column: x => x.ShoppingCartId,
|
||||||
|
principalTable: "ShoppingCart",
|
||||||
|
principalColumn: "Id");
|
||||||
|
});
|
||||||
|
|
||||||
migrationBuilder.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Quote",
|
name: "Quote",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@@ -220,6 +244,56 @@ namespace LiteCharms.Infrastructure.Database.Migrations
|
|||||||
onDelete: ReferentialAction.Cascade);
|
onDelete: ReferentialAction.Cascade);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
migrationBuilder.CreateTable(
|
||||||
|
name: "PackageItem",
|
||||||
|
columns: table => new
|
||||||
|
{
|
||||||
|
Id = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
PackageId1 = table.Column<Guid>(type: "uuid", nullable: true),
|
||||||
|
PackageId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
ProductPriceId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||||
|
Active = table.Column<bool>(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<Guid>(type: "uuid", nullable: false),
|
||||||
|
CreatedAt = table.Column<DateTimeOffset>(type: "timestamp with time zone", nullable: false),
|
||||||
|
ShoppingCartId = table.Column<Guid>(type: "uuid", nullable: false),
|
||||||
|
PackageId = table.Column<Guid>(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.CreateTable(
|
migrationBuilder.CreateTable(
|
||||||
name: "Order",
|
name: "Order",
|
||||||
columns: table => new
|
columns: table => new
|
||||||
@@ -308,6 +382,21 @@ namespace LiteCharms.Infrastructure.Database.Migrations
|
|||||||
column: "OrderId",
|
column: "OrderId",
|
||||||
unique: true);
|
unique: true);
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_Package_ShoppingCartId",
|
||||||
|
table: "Package",
|
||||||
|
column: "ShoppingCartId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PackageItem_PackageId",
|
||||||
|
table: "PackageItem",
|
||||||
|
column: "PackageId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_PackageItem_PackageId1",
|
||||||
|
table: "PackageItem",
|
||||||
|
column: "PackageId1");
|
||||||
|
|
||||||
migrationBuilder.CreateIndex(
|
migrationBuilder.CreateIndex(
|
||||||
name: "IX_ProductPrice_ProductId",
|
name: "IX_ProductPrice_ProductId",
|
||||||
table: "ProductPrice",
|
table: "ProductPrice",
|
||||||
@@ -343,6 +432,16 @@ namespace LiteCharms.Infrastructure.Database.Migrations
|
|||||||
name: "IX_ShoppingCartItems_ShoppingCartId",
|
name: "IX_ShoppingCartItems_ShoppingCartId",
|
||||||
table: "ShoppingCartItems",
|
table: "ShoppingCartItems",
|
||||||
column: "ShoppingCartId");
|
column: "ShoppingCartId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ShoppingCartPackage_PackageId",
|
||||||
|
table: "ShoppingCartPackage",
|
||||||
|
column: "PackageId");
|
||||||
|
|
||||||
|
migrationBuilder.CreateIndex(
|
||||||
|
name: "IX_ShoppingCartPackage_ShoppingCartId",
|
||||||
|
table: "ShoppingCartPackage",
|
||||||
|
column: "ShoppingCartId");
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <inheritdoc />
|
/// <inheritdoc />
|
||||||
@@ -357,15 +456,24 @@ namespace LiteCharms.Infrastructure.Database.Migrations
|
|||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "OrderRefund");
|
name: "OrderRefund");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "PackageItem");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "ShoppingCartItems");
|
name: "ShoppingCartItems");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "ShoppingCartPackage");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Order");
|
name: "Order");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "ProductPrice");
|
name: "ProductPrice");
|
||||||
|
|
||||||
|
migrationBuilder.DropTable(
|
||||||
|
name: "Package");
|
||||||
|
|
||||||
migrationBuilder.DropTable(
|
migrationBuilder.DropTable(
|
||||||
name: "Quote");
|
name: "Quote");
|
||||||
|
|
||||||
@@ -168,9 +168,8 @@ namespace LiteCharms.Infrastructure.Database.Migrations
|
|||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
b.Property<string>("CorrelationIdType")
|
b.Property<int>("CorrelationIdType")
|
||||||
.IsRequired()
|
.HasColumnType("integer");
|
||||||
.HasColumnType("text");
|
|
||||||
|
|
||||||
b.Property<DateTimeOffset>("CreatedAt")
|
b.Property<DateTimeOffset>("CreatedAt")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
@@ -179,6 +178,14 @@ namespace LiteCharms.Infrastructure.Database.Migrations
|
|||||||
b.Property<int>("Direction")
|
b.Property<int>("Direction")
|
||||||
.HasColumnType("integer");
|
.HasColumnType("integer");
|
||||||
|
|
||||||
|
b.PrimitiveCollection<string>("Errors")
|
||||||
|
.HasColumnType("jsonb");
|
||||||
|
|
||||||
|
b.Property<bool>("HasError")
|
||||||
|
.ValueGeneratedOnAdd()
|
||||||
|
.HasColumnType("boolean")
|
||||||
|
.HasDefaultValue(false);
|
||||||
|
|
||||||
b.Property<bool>("IsHtml")
|
b.Property<bool>("IsHtml")
|
||||||
.ValueGeneratedOnAdd()
|
.ValueGeneratedOnAdd()
|
||||||
.HasColumnType("boolean")
|
.HasColumnType("boolean")
|
||||||
@@ -336,12 +343,17 @@ namespace LiteCharms.Infrastructure.Database.Migrations
|
|||||||
.IsRequired()
|
.IsRequired()
|
||||||
.HasColumnType("text");
|
.HasColumnType("text");
|
||||||
|
|
||||||
|
b.Property<Guid?>("ShoppingCartId")
|
||||||
|
.HasColumnType("uuid");
|
||||||
|
|
||||||
b.Property<DateTimeOffset?>("UpdatedAt")
|
b.Property<DateTimeOffset?>("UpdatedAt")
|
||||||
.ValueGeneratedOnUpdate()
|
.ValueGeneratedOnUpdate()
|
||||||
.HasColumnType("timestamp with time zone");
|
.HasColumnType("timestamp with time zone");
|
||||||
|
|
||||||
b.HasKey("Id");
|
b.HasKey("Id");
|
||||||
|
|
||||||
|
b.HasIndex("ShoppingCartId");
|
||||||
|
|
||||||
b.ToTable("Package", (string)null);
|
b.ToTable("Package", (string)null);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -611,6 +623,13 @@ namespace LiteCharms.Infrastructure.Database.Migrations
|
|||||||
b.Navigation("Order");
|
b.Navigation("Order");
|
||||||
});
|
});
|
||||||
|
|
||||||
|
modelBuilder.Entity("LiteCharms.Entities.Package", b =>
|
||||||
|
{
|
||||||
|
b.HasOne("LiteCharms.Entities.ShoppingCart", null)
|
||||||
|
.WithMany("Packages")
|
||||||
|
.HasForeignKey("ShoppingCartId");
|
||||||
|
});
|
||||||
|
|
||||||
modelBuilder.Entity("LiteCharms.Entities.PackageItem", b =>
|
modelBuilder.Entity("LiteCharms.Entities.PackageItem", b =>
|
||||||
{
|
{
|
||||||
b.HasOne("LiteCharms.Entities.Package", "Package")
|
b.HasOne("LiteCharms.Entities.Package", "Package")
|
||||||
@@ -743,6 +762,8 @@ namespace LiteCharms.Infrastructure.Database.Migrations
|
|||||||
{
|
{
|
||||||
b.Navigation("Order");
|
b.Navigation("Order");
|
||||||
|
|
||||||
|
b.Navigation("Packages");
|
||||||
|
|
||||||
b.Navigation("Quote");
|
b.Navigation("Quote");
|
||||||
|
|
||||||
b.Navigation("ShoppingCartItems");
|
b.Navigation("ShoppingCartItems");
|
||||||
|
|||||||
@@ -1,5 +1,20 @@
|
|||||||
namespace LiteCharms.Models;
|
namespace LiteCharms.Models;
|
||||||
|
|
||||||
|
public enum CorrelationIdTypes : int
|
||||||
|
{
|
||||||
|
None = 0,
|
||||||
|
Email = 1,
|
||||||
|
Discord = 2,
|
||||||
|
Slack = 3,
|
||||||
|
Whatsapp = 4,
|
||||||
|
Customer = 5,
|
||||||
|
Order = 6,
|
||||||
|
Refund = 7,
|
||||||
|
Lead = 8,
|
||||||
|
Quote = 9,
|
||||||
|
LinkedIn = 10
|
||||||
|
}
|
||||||
|
|
||||||
public enum Priorities : int
|
public enum Priorities : int
|
||||||
{
|
{
|
||||||
Low = 0,
|
Low = 0,
|
||||||
|
|||||||
@@ -14,6 +14,8 @@ public class Notification
|
|||||||
|
|
||||||
public Priorities Priority { get; set; }
|
public Priorities Priority { get; set; }
|
||||||
|
|
||||||
|
public CorrelationIdTypes CorrelationIdType { get; set; }
|
||||||
|
|
||||||
public string? Sender { get; set; }
|
public string? Sender { get; set; }
|
||||||
|
|
||||||
public string? SenderName { get; set; }
|
public string? SenderName { get; set; }
|
||||||
@@ -28,11 +30,13 @@ public class Notification
|
|||||||
|
|
||||||
public string? CorrelationId { get; set; }
|
public string? CorrelationId { get; set; }
|
||||||
|
|
||||||
public string? CorrelationIdType { get; set; }
|
|
||||||
|
|
||||||
public bool IsHtml { get; set; }
|
public bool IsHtml { get; set; }
|
||||||
|
|
||||||
public bool IsInternal { get; set; }
|
public bool IsInternal { get; set; }
|
||||||
|
|
||||||
public bool Processed { get; set; }
|
public bool Processed { get; set; }
|
||||||
|
|
||||||
|
public bool HasError { get; set; }
|
||||||
|
|
||||||
|
public string[]? Errors { get; set; }
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user