Migrated database changes after refactoring the Notification model
This commit is contained in:
@@ -8,14 +8,26 @@ public class CreateOrderCommand : IRequest<Result<Guid>>
|
||||
|
||||
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;
|
||||
ShoppingCartId = shoppingCartId;
|
||||
DepositRequired = depositRequired;
|
||||
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)
|
||||
throw new ArgumentException("CustomerId is required.", nameof(customerId));
|
||||
@@ -23,6 +35,6 @@ public class CreateOrderCommand : IRequest<Result<Guid>>
|
||||
if (shoppingCartId == Guid.Empty)
|
||||
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.Models;
|
||||
|
||||
namespace LiteCharms.Features.Orders.Commands.Handlers;
|
||||
|
||||
@@ -21,10 +22,15 @@ public class CreateOrderCommandHandler(IDbContextFactory<ShopDbContext> contextF
|
||||
|
||||
var newOrder = context.Orders.Add(new Entities.Order
|
||||
{
|
||||
CreatedAt = DateTime.UtcNow,
|
||||
Status = OrderStatus.Pending,
|
||||
CustomerId = request.CustomerId,
|
||||
ShoppingCartId = request.ShoppingCartId,
|
||||
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
|
||||
|
||||
Reference in New Issue
Block a user