diff --git a/.version b/.version index a9c032b..662635e 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.4.3.12 \ No newline at end of file +0.5.4.13 \ No newline at end of file diff --git a/NetinaShop.Api/Controller/FileController.cs b/NetinaShop.Api/Controller/FileController.cs index a2ebffc..f445bcc 100644 --- a/NetinaShop.Api/Controller/FileController.cs +++ b/NetinaShop.Api/Controller/FileController.cs @@ -33,7 +33,7 @@ public class FileController : ICarterModule await uploadRequest.ImageResize(originalMedFileStream, mediumFileStream, 1280); await uploadRequest.ImageResize(originalThumbFileStream, thumbnailFileStream, 200); var medFileName = await storageService.UploadObjectFromFileAsync(uploadRequest.FileName, $"{uploadRequest.FileUploadType.ToDisplay()}/Med", uploadRequest.ContentType, mediumFileStream); - await storageService.UploadObjectFromFileAsync(uploadRequest.FileName, $"{uploadRequest.FileUploadType.ToDisplay()}/Thumb", uploadRequest.ContentType, thumbnailFileStream); + await storageService.UploadObjectFromFileAsync(uploadRequest.FileName, $"{uploadRequest.FileUploadType.ToDisplay()}/Thumb", uploadRequest.ContentType, thumbnailFileStream, false); var response = new FileUploadResponse { FileName = medFileName, diff --git a/NetinaShop.Api/NetinaShop.Api.csproj b/NetinaShop.Api/NetinaShop.Api.csproj index ac4bf8e..d3d373e 100644 --- a/NetinaShop.Api/NetinaShop.Api.csproj +++ b/NetinaShop.Api/NetinaShop.Api.csproj @@ -6,8 +6,8 @@ enable true Linux - 0.4.3.12 - 0.4.3.12 + 0.5.4.13 + 0.5.4.13 diff --git a/NetinaShop.Core/Abstracts/IStorageService.cs b/NetinaShop.Core/Abstracts/IStorageService.cs index 93ff3a8..de20571 100644 --- a/NetinaShop.Core/Abstracts/IStorageService.cs +++ b/NetinaShop.Core/Abstracts/IStorageService.cs @@ -3,7 +3,7 @@ public interface IStorageService : IScopedDependency { Task UploadObjectFromFileAsync(string fileName, string filePath, string contentType, byte[] fileBytes); - Task UploadObjectFromFileAsync(string fileName, string filePath, string contentType, Stream fileStream); + Task UploadObjectFromFileAsync(string fileName, string filePath, string contentType, Stream fileStream, bool fixName = true); Task> GetStorageFiles(StorageFileType fileType); } \ No newline at end of file diff --git a/NetinaShop.Core/EntityServices/DiscountHandlers/CalculateDiscountCommandHandler.cs b/NetinaShop.Core/EntityServices/DiscountHandlers/CalculateOrderDiscountCommandHandler.cs similarity index 57% rename from NetinaShop.Core/EntityServices/DiscountHandlers/CalculateDiscountCommandHandler.cs rename to NetinaShop.Core/EntityServices/DiscountHandlers/CalculateOrderDiscountCommandHandler.cs index fd63261..08f5718 100644 --- a/NetinaShop.Core/EntityServices/DiscountHandlers/CalculateDiscountCommandHandler.cs +++ b/NetinaShop.Core/EntityServices/DiscountHandlers/CalculateOrderDiscountCommandHandler.cs @@ -1,14 +1,14 @@ namespace NetinaShop.Core.EntityServices.DiscountHandlers; -public class CalculateDiscountCommandHandler : IRequestHandler +public class CalculateOrderDiscountCommandHandler : IRequestHandler { private readonly IRepositoryWrapper _repositoryWrapper; - public CalculateDiscountCommandHandler(IRepositoryWrapper repositoryWrapper) + public CalculateOrderDiscountCommandHandler(IRepositoryWrapper repositoryWrapper) { _repositoryWrapper = repositoryWrapper; } - public async Task Handle(CalculateDiscountCommand request, CancellationToken cancellationToken) + public async Task Handle(CalculateOrderDiscountCommand request, CancellationToken cancellationToken) { if (request.Order == null) throw new AppException("Order is null", ApiResultStatusCode.BadRequest); @@ -22,38 +22,6 @@ public class CalculateDiscountCommandHandler : IRequestHandlero.ProductCategoryId)) - { - var categoryDiscount = await _repositoryWrapper.SetRepository() - .TableNoTracking - .FirstOrDefaultAsync(d => d.CategoryId == orderProductGrouped.Key && d.HasCode == false && d.ExpireDate.Date > DateTime.Today.Date , cancellationToken); - - if (categoryDiscount != null && !categoryDiscount.IsExpired()) - { - var totalPrice = request.Order.OrderProducts.Where(op => op.ProductCategoryId == categoryDiscount.CategoryId) - .Sum(op => op.ProductCost); - discountPrice = categoryDiscount.AmountType == DiscountAmountType.Amount - ? totalPrice - categoryDiscount.DiscountAmount - : totalPrice - ((totalPrice / 100) * categoryDiscount.DiscountAmount); - } - - foreach (var orderProduct in orderProductGrouped) - { - - var productDiscount = await _repositoryWrapper.SetRepository() - .TableNoTracking - .FirstOrDefaultAsync(d => d.HasCode == false && d.ProductId == orderProduct.ProductId && d.ExpireDate.Date > DateTime.Today.Date, cancellationToken); - - if (productDiscount != null && !productDiscount.IsExpired()) - { - var totalPrice = request.Order.OrderProducts.Where(op => op.ProductId == productDiscount.ProductId).Sum(op => op.ProductCost); - discountPrice = productDiscount.AmountType == DiscountAmountType.Amount - ? totalPrice - productDiscount.DiscountAmount - : totalPrice - ((totalPrice / 100) * productDiscount.DiscountAmount); - } - } - } - if (discount.Type == DiscountType.All) { if (!discount.IsExpired()) diff --git a/NetinaShop.Core/EntityServices/DiscountHandlers/CalculateProductDiscountCommandHandler.cs b/NetinaShop.Core/EntityServices/DiscountHandlers/CalculateProductDiscountCommandHandler.cs new file mode 100644 index 0000000..02f138a --- /dev/null +++ b/NetinaShop.Core/EntityServices/DiscountHandlers/CalculateProductDiscountCommandHandler.cs @@ -0,0 +1,66 @@ +using NetinaShop.Domain.Dtos.SmallDtos; + +namespace NetinaShop.Core.EntityServices.DiscountHandlers; + +public class CalculateProductDiscountCommandHandler : IRequestHandler +{ + private readonly IRepositoryWrapper _repositoryWrapper; + + public CalculateProductDiscountCommandHandler(IRepositoryWrapper repositoryWrapper) + { + _repositoryWrapper = repositoryWrapper; + } + public async Task Handle(CalculateProductDiscountCommand request, CancellationToken cancellationToken) + { + double discountPrice = 0; + request.ProductSDto.CostWithDiscount = request.ProductSDto.Cost; + double totalPrice = request.ProductSDto.Cost; + + var allDiscount = await _repositoryWrapper.SetRepository() + .TableNoTracking + .FirstOrDefaultAsync(d => d.Type == DiscountType.All && d.HasCode == false && d.ExpireDate.Date >= DateTime.Today.Date, cancellationToken); + + if (allDiscount != null && !allDiscount.IsExpired()) + { + + discountPrice = allDiscount.AmountType == DiscountAmountType.Amount ? totalPrice - allDiscount.DiscountAmount : + totalPrice - totalPrice / 100 * allDiscount.DiscountPercent; + request.ProductSDto.HasDiscount = true; + } + + var categoryDiscount = await _repositoryWrapper.SetRepository() + .TableNoTracking + .FirstOrDefaultAsync(d => d.CategoryId == request.ProductSDto.CategoryId && d.HasCode == false && d.ExpireDate.Date >= DateTime.Today.Date, cancellationToken); + + if (categoryDiscount != null && !categoryDiscount.IsExpired()) + { + discountPrice = categoryDiscount.AmountType == DiscountAmountType.Amount + ? totalPrice - categoryDiscount.DiscountAmount : totalPrice - totalPrice / 100 * categoryDiscount.DiscountPercent; + request.ProductSDto.HasDiscount = true; + } + + var productDiscount = await _repositoryWrapper.SetRepository() + .TableNoTracking + .Where(d => d.HasCode == false && d.ProductId == request.ProductSDto.Id && d.ExpireDate.Date >= DateTime.Today.Date) + .OrderByDescending(d => d.CreatedAt) + .FirstOrDefaultAsync(cancellationToken); + + if (productDiscount != null && !productDiscount.IsExpired()) + { + discountPrice = productDiscount.AmountType == DiscountAmountType.Amount ? totalPrice - productDiscount.DiscountAmount + : totalPrice - totalPrice / 100 * productDiscount.DiscountPercent; + + request.ProductSDto.HasDiscount = true; + if (productDiscount.IsSpecialOffer) + request.ProductSDto.IsSpecial = true; + } + + if (request.ProductSDto.HasDiscount) + { + request.ProductSDto.CostWithDiscount = discountPrice; + request.ProductSDto.DiscountPercent = request.ProductSDto.Cost == 0 ? 0 : 100 - 100 * request.ProductSDto.CostWithDiscount / request.ProductSDto.Cost; + } + + return request.ProductSDto; + } +} \ No newline at end of file diff --git a/NetinaShop.Core/EntityServices/OrderBagHandlers/AddToOrderBagCommandHandler.cs b/NetinaShop.Core/EntityServices/OrderBagHandlers/AddToOrderBagCommandHandler.cs index 0d072a6..3daa6d4 100644 --- a/NetinaShop.Core/EntityServices/OrderBagHandlers/AddToOrderBagCommandHandler.cs +++ b/NetinaShop.Core/EntityServices/OrderBagHandlers/AddToOrderBagCommandHandler.cs @@ -1,6 +1,6 @@ namespace NetinaShop.Core.EntityServices.OrderBagHandlers; -public class AddToOrderBagCommandHandler : IRequestHandler +public class AddToOrderBagCommandHandler : IRequestHandler { private readonly IMediator _mediator; private readonly IRepositoryWrapper _repositoryWrapper; @@ -13,7 +13,7 @@ public class AddToOrderBagCommandHandler : IRequestHandler Handle(AddToOrderBagCommand request, CancellationToken cancellationToken) + public async Task Handle(AddToOrderBagCommand request, CancellationToken cancellationToken) { if (_currentUserService.UserId == null) throw new AppException("User id notfound", ApiResultStatusCode.BadRequest); @@ -28,21 +28,24 @@ public class AddToOrderBagCommandHandler : IRequestHandler() .TableNoTracking .FirstOrDefaultAsync(p => p.Id == requestDto.ProductId, cancellationToken); - + if (product == null) throw new AppException("Product not found ", ApiResultStatusCode.NotFound); if (!product.IsEnable) throw new AppException("Product is not enable", ApiResultStatusCode.BadRequest); + var productSDto = product.AdaptToSDto(); + await _mediator.Send(new CalculateProductDiscountCommand(productSDto), cancellationToken); - orderBag.AddToOrderBag(product, requestDto.Count); + orderBag.AddToOrderBag(productSDto.Id, productSDto.Cost, productSDto.CostWithDiscount, + productSDto.HasDiscount, productSDto.PackingCost, productSDto.CategoryId, requestDto.Count); } _repositoryWrapper.SetRepository().Update(orderBag); await _repositoryWrapper.SaveChangesAsync(cancellationToken); - await _mediator.Send(new CalculateOrderCommand(orderBag.Id), cancellationToken); + var order = await _mediator.Send(new CalculateOrderCommand(orderBag.Id), cancellationToken); - return true; + return order.AdaptToSDto(); } } \ No newline at end of file diff --git a/NetinaShop.Core/EntityServices/OrderBagHandlers/RemoveFromOrderBagCommandHandler.cs b/NetinaShop.Core/EntityServices/OrderBagHandlers/RemoveFromOrderBagCommandHandler.cs index 7107fe6..568719d 100644 --- a/NetinaShop.Core/EntityServices/OrderBagHandlers/RemoveFromOrderBagCommandHandler.cs +++ b/NetinaShop.Core/EntityServices/OrderBagHandlers/RemoveFromOrderBagCommandHandler.cs @@ -1,6 +1,6 @@ namespace NetinaShop.Core.EntityServices.OrderBagHandlers; -public class RemoveFromOrderBagCommandHandler : IRequestHandler +public class RemoveFromOrderBagCommandHandler : IRequestHandler { private readonly ICurrentUserService _currentUserService; private readonly IRepositoryWrapper _repositoryWrapper; @@ -12,7 +12,7 @@ public class RemoveFromOrderBagCommandHandler : IRequestHandler Handle(RemoveFromOrderBagCommand request, CancellationToken cancellationToken) + public async Task Handle(RemoveFromOrderBagCommand request, CancellationToken cancellationToken) { if (_currentUserService.UserId == null) throw new AppException("User id notfound", ApiResultStatusCode.BadRequest); @@ -33,14 +33,14 @@ public class RemoveFromOrderBagCommandHandler : IRequestHandler().Update(orderBag); await _repositoryWrapper.SaveChangesAsync(cancellationToken); - await _mediator.Send(new CalculateOrderCommand(orderBag.Id), cancellationToken); + var order = await _mediator.Send(new CalculateOrderCommand(orderBag.Id), cancellationToken); - return true; + return order.AdaptToSDto(); } } \ No newline at end of file diff --git a/NetinaShop.Core/EntityServices/OrderHandlers/CalculateOrderCommandHandler.cs b/NetinaShop.Core/EntityServices/OrderHandlers/CalculateOrderCommandHandler.cs index 91a6178..d95c526 100644 --- a/NetinaShop.Core/EntityServices/OrderHandlers/CalculateOrderCommandHandler.cs +++ b/NetinaShop.Core/EntityServices/OrderHandlers/CalculateOrderCommandHandler.cs @@ -6,30 +6,33 @@ public class CalculateOrderCommandHandler : IRequestHandler snapshot) + public CalculateOrderCommandHandler(IRepositoryWrapper repositoryWrapper, IMediator mediator, IOptionsSnapshot snapshot) { _repositoryWrapper = repositoryWrapper; _mediator = mediator; _shopSettings = snapshot.Value; } + public async Task Handle(CalculateOrderCommand request, CancellationToken cancellationToken) { var order = await _mediator.Send(new GetOrderQuery(request.OrderId), cancellationToken); if (order.OrderStatus != OrderStatus.OrderBag) throw new AppException("Order is not in bag status and cant be calculate", ApiResultStatusCode.BadRequest); - var totalProductPrice = order.OrderProducts.Sum(op => op.ProductCost); + var totalProductPrice = order.OrderProducts.Sum(op => op.ProductFee * op.Count); var totalPackingPrice = order.OrderProducts.Sum(op => op.PackingCost); - var servicePrice = _shopSettings.ServiceIsPercent - ? (totalProductPrice / 100) * _shopSettings.ServiceFee - : _shopSettings.ServiceFee; + //var servicePrice = _shopSettings.ServiceIsPercent + // ? (totalProductPrice / 100) * _shopSettings.ServiceFee + // : _shopSettings.ServiceFee; + var servicePrice = 0; var deliveryPrice = order.OrderDeliveries.Sum(op => op.DeliveryCost); - double discountPrice = 0; + double discountPrice = order.OrderProducts.Sum(op=>(op.ProductFee - op.ProductFeeWithDiscount) * op.Count); if (!order.DiscountCode.IsNullOrEmpty()) { - discountPrice = await _mediator.Send(new CalculateDiscountCommand(order.DiscountCode, order),cancellationToken); + discountPrice += await _mediator.Send(new CalculateOrderDiscountCommand(order.DiscountCode, order),cancellationToken); } - var taxesPrice = (((totalProductPrice - discountPrice) + totalPackingPrice + servicePrice) / 100) * _shopSettings.TaxesFee; + //var taxesPrice = (((totalProductPrice - discountPrice) + totalPackingPrice + servicePrice) / 100) * _shopSettings.TaxesFee; + var taxesPrice = 0; order.SetTotalPrice(totalProductPrice, totalPackingPrice, servicePrice, deliveryPrice, discountPrice, taxesPrice); diff --git a/NetinaShop.Core/NetinaShop.Core.csproj b/NetinaShop.Core/NetinaShop.Core.csproj index 870084f..7c8369f 100644 --- a/NetinaShop.Core/NetinaShop.Core.csproj +++ b/NetinaShop.Core/NetinaShop.Core.csproj @@ -24,6 +24,7 @@ + diff --git a/NetinaShop.Domain/CommandQueries/Commands/DiscountCommands.cs b/NetinaShop.Domain/CommandQueries/Commands/DiscountCommands.cs index 18df185..761fce7 100644 --- a/NetinaShop.Domain/CommandQueries/Commands/DiscountCommands.cs +++ b/NetinaShop.Domain/CommandQueries/Commands/DiscountCommands.cs @@ -43,4 +43,4 @@ public sealed record UpdateDiscountCommand(Guid Id, public sealed record DeleteDiscountCommand(Guid Id) : IRequest; -public sealed record CalculateDiscountCommand(string DiscountCode,Order Order) : IRequest; \ No newline at end of file +public sealed record CalculateOrderDiscountCommand(string DiscountCode,Order Order) : IRequest; \ No newline at end of file diff --git a/NetinaShop.Domain/CommandQueries/Commands/OrderBagCommands.cs b/NetinaShop.Domain/CommandQueries/Commands/OrderBagCommands.cs index b9c6074..27af618 100644 --- a/NetinaShop.Domain/CommandQueries/Commands/OrderBagCommands.cs +++ b/NetinaShop.Domain/CommandQueries/Commands/OrderBagCommands.cs @@ -4,8 +4,8 @@ namespace NetinaShop.Domain.CommandQueries.Commands; public sealed record CreateOrderCommand(string DiscountCode, List OrderProducts, OrderDeliverySDto OrderDelivery) : IRequest; -public sealed record AddToOrderBagCommand(List RequestDtos) : IRequest; -public sealed record RemoveFromOrderBagCommand(List RequestDtos) : IRequest; +public sealed record AddToOrderBagCommand(List RequestDtos) : IRequest; +public sealed record RemoveFromOrderBagCommand(List RequestDtos) : IRequest; public sealed record SubmitDiscountCommand(Guid OrderId,string DiscountCode) : IRequest; public sealed record SubmitOrderDeliveryCommand(string Address, string PostalCode, string ReceiverPhoneNumber, string ReceiverFullName, Guid OrderId, Guid ShippingId) : IRequest; diff --git a/NetinaShop.Domain/CommandQueries/Commands/OrderCommands.cs b/NetinaShop.Domain/CommandQueries/Commands/OrderCommands.cs index 1a87922..e0edb71 100644 --- a/NetinaShop.Domain/CommandQueries/Commands/OrderCommands.cs +++ b/NetinaShop.Domain/CommandQueries/Commands/OrderCommands.cs @@ -2,6 +2,6 @@ public sealed record CreateBaseOrderCommand(Guid UserId) : IRequest; -public sealed record CalculateOrderCommand(Guid OrderId) : IRequest; +public sealed record CalculateOrderCommand(Guid OrderId , bool NamoosiCalculate = false) : IRequest; public sealed record DeleteOrderCommand(Guid OrderId) : IRequest; \ No newline at end of file diff --git a/NetinaShop.Domain/CommandQueries/Commands/ProductCommands.cs b/NetinaShop.Domain/CommandQueries/Commands/ProductCommands.cs index f1b3434..7fce16e 100644 --- a/NetinaShop.Domain/CommandQueries/Commands/ProductCommands.cs +++ b/NetinaShop.Domain/CommandQueries/Commands/ProductCommands.cs @@ -41,4 +41,6 @@ public sealed record UpdateProductCommand( List Specifications, List Files) : IRequest; -public sealed record DeleteProductCommand(Guid Id) : IRequest; \ No newline at end of file +public sealed record DeleteProductCommand(Guid Id) : IRequest; + +public sealed record CalculateProductDiscountCommand(ProductSDto ProductSDto) : IRequest; \ No newline at end of file diff --git a/NetinaShop.Domain/Dtos/LargDtos/ProductLDto.cs b/NetinaShop.Domain/Dtos/LargDtos/ProductLDto.cs index 5bcb05a..79301a4 100644 --- a/NetinaShop.Domain/Dtos/LargDtos/ProductLDto.cs +++ b/NetinaShop.Domain/Dtos/LargDtos/ProductLDto.cs @@ -22,7 +22,6 @@ public class ProductLDto : BaseDto public List Specifications { get; set; } = new(); public List Reviews { get; set; } = new(); - public List Categories { get; set; } = new(); public List Files { get; set; } = new(); public DiscountSDto? SpecialOffer { get; set; } diff --git a/NetinaShop.Domain/Dtos/SmallDtos/ProductSDto.cs b/NetinaShop.Domain/Dtos/SmallDtos/ProductSDto.cs index edf67f3..625b676 100644 --- a/NetinaShop.Domain/Dtos/SmallDtos/ProductSDto.cs +++ b/NetinaShop.Domain/Dtos/SmallDtos/ProductSDto.cs @@ -15,6 +15,8 @@ public class ProductSDto : BaseDto public double CostWithDiscount { get; set; } public bool IsEnable { get; set; } public bool IsSpecial { get; set; } + public int Stock { get; internal set; } + public int MaxOrderCount { get; internal set; } public bool BeDisplayed { get; set; } public double PackingCost { get; set; } public float Rate { get; set; } diff --git a/NetinaShop.Domain/Entities/Orders/Order.Aggregate.cs b/NetinaShop.Domain/Entities/Orders/Order.Aggregate.cs index 513e7ee..d6c156d 100644 --- a/NetinaShop.Domain/Entities/Orders/Order.Aggregate.cs +++ b/NetinaShop.Domain/Entities/Orders/Order.Aggregate.cs @@ -8,12 +8,20 @@ public partial class Order } - public void AddToOrderBag(Product product, int count) + public void AddToOrderBag(Guid productId,double cost,double costWithDiscount,bool hasDiscount,double packingCost ,Guid categoryId , int count) { - var orderProduct = OrderProducts.FirstOrDefault(op => op.ProductId == product.Id); + var orderProduct = OrderProducts.FirstOrDefault(op => op.ProductId == productId); if (orderProduct == null) { - orderProduct = OrderProduct.Create(count, product.Cost,product.PackingCost, OrderStatus.OrderBag, product.Id,product.CategoryId, this.Id); + orderProduct = OrderProduct.Create(count, + cost, + costWithDiscount, + hasDiscount, + packingCost, + OrderStatus.OrderBag, + productId, + categoryId, + this.Id); OrderProducts.Add(orderProduct); } else @@ -21,9 +29,9 @@ public partial class Order orderProduct.SetCount(count); } } - public void RemoveFromOrderBag(Product product, int count) + public void RemoveFromOrderBag(Guid productId, int count) { - var orderProduct = OrderProducts.FirstOrDefault(op => op.ProductId == product.Id); + var orderProduct = OrderProducts.FirstOrDefault(op => op.ProductId == productId); if (orderProduct != null) { orderProduct.SetCount(count); @@ -89,17 +97,25 @@ public partial class Order public partial class OrderProduct { - public static OrderProduct Create(int count, double productFee, double packingFee, OrderStatus orderProductStatus, Guid productId, Guid productCategoryId, Guid orderId) + public static OrderProduct Create(int count, + double productFee, + double productFeeWithDiscount, + bool hasDiscount, + double packingFee, + OrderStatus orderProductStatus, + Guid productId, + Guid productCategoryId, + Guid orderId) { - var productCost = count * productFee; + var productCost = count * productFeeWithDiscount; var packingCost = count * packingFee; - return new OrderProduct(count, productFee, productCost,packingFee,packingCost, orderProductStatus, productId,productCategoryId, orderId); + return new OrderProduct(count, productFee, productFeeWithDiscount, hasDiscount, productCost, packingFee, packingCost, orderProductStatus, productId, productCategoryId, orderId); } public void SetCount(int count) { Count = count; - var productCost = ProductFee * Count; + var productCost = ProductFeeWithDiscount * Count; } } diff --git a/NetinaShop.Domain/Entities/Orders/OrderProduct.cs b/NetinaShop.Domain/Entities/Orders/OrderProduct.cs index 08ed5bd..896ffec 100644 --- a/NetinaShop.Domain/Entities/Orders/OrderProduct.cs +++ b/NetinaShop.Domain/Entities/Orders/OrderProduct.cs @@ -6,10 +6,22 @@ public partial class OrderProduct : ApiEntity { } - public OrderProduct(int count, double productFee, double productCost, double packingFee, double packingCost, OrderStatus orderProductStatus, Guid productId, Guid productCategoryId, Guid orderId) + public OrderProduct(int count, + double productFee, + double productFeeWithDiscount, + bool hasDiscount, + double productCost, + double packingFee, + double packingCost, + OrderStatus orderProductStatus, + Guid productId, + Guid productCategoryId, + Guid orderId) { Count = count; ProductFee = productFee; + ProductFeeWithDiscount = productFeeWithDiscount; + HasDiscount = hasDiscount; ProductCost = productCost; OrderProductStatus = orderProductStatus; ProductId = productId; @@ -20,6 +32,8 @@ public partial class OrderProduct : ApiEntity } public int Count { get; internal set; } public double ProductFee { get; internal set; } + public double ProductFeeWithDiscount { get; set; } + public bool HasDiscount { get; set; } public double ProductCost { get; internal set; } public double PackingFee { get; internal set; } public double PackingCost { get; internal set; } diff --git a/NetinaShop.Domain/Mappers/ProductMapper.g.cs b/NetinaShop.Domain/Mappers/ProductMapper.g.cs index 58704a1..9c990d7 100644 --- a/NetinaShop.Domain/Mappers/ProductMapper.g.cs +++ b/NetinaShop.Domain/Mappers/ProductMapper.g.cs @@ -268,9 +268,11 @@ namespace NetinaShop.Domain.Mappers IsEnable = p37.IsEnable, BeDisplayed = p37.BeDisplayed, PackingCost = p37.PackingCost, + Stock = p37.Stock, Rate = p37.Rate, ReviewCount = p37.ReviewCount, Viewed = p37.Viewed, + MaxOrderCount = p37.MaxOrderCount, BrandId = p37.BrandId, Brand = new Brand() { @@ -305,9 +307,11 @@ namespace NetinaShop.Domain.Mappers result.IsEnable = p38.IsEnable; result.BeDisplayed = p38.BeDisplayed; result.PackingCost = p38.PackingCost; + result.Stock = p38.Stock; result.Rate = p38.Rate; result.ReviewCount = p38.ReviewCount; result.Viewed = p38.Viewed; + result.MaxOrderCount = p38.MaxOrderCount; result.BrandId = p38.BrandId; result.Brand = funcMain15(new Never(), result.Brand, p38); result.CategoryId = p38.CategoryId; @@ -329,6 +333,8 @@ namespace NetinaShop.Domain.Mappers Warranty = p44.Warranty, Cost = p44.Cost, IsEnable = p44.IsEnable, + Stock = p44.Stock, + MaxOrderCount = p44.MaxOrderCount, BeDisplayed = p44.BeDisplayed, PackingCost = p44.PackingCost, Rate = p44.Rate, @@ -359,6 +365,8 @@ namespace NetinaShop.Domain.Mappers result.Warranty = p45.Warranty; result.Cost = p45.Cost; result.IsEnable = p45.IsEnable; + result.Stock = p45.Stock; + result.MaxOrderCount = p45.MaxOrderCount; result.BeDisplayed = p45.BeDisplayed; result.PackingCost = p45.PackingCost; result.Rate = p45.Rate; @@ -384,6 +392,8 @@ namespace NetinaShop.Domain.Mappers Warranty = p47.Warranty, Cost = p47.Cost, IsEnable = p47.IsEnable, + Stock = p47.Stock, + MaxOrderCount = p47.MaxOrderCount, BeDisplayed = p47.BeDisplayed, PackingCost = p47.PackingCost, Rate = p47.Rate, diff --git a/NetinaShop.Infrastructure/Services/StorageService.cs b/NetinaShop.Infrastructure/Services/StorageService.cs index 4e26ba6..7ad3d10 100644 --- a/NetinaShop.Infrastructure/Services/StorageService.cs +++ b/NetinaShop.Infrastructure/Services/StorageService.cs @@ -42,15 +42,18 @@ public class StorageService : IStorageService return fileName; } - public async Task UploadObjectFromFileAsync(string fileName, string filePath, string contentType, Stream fileStream) + public async Task UploadObjectFromFileAsync(string fileName, string filePath, string contentType, Stream fileStream , bool fixName = true) { var client = GetClientAsync(); - var fileEx = fileName.Split('.').Last(); - fileName = fileName.Split('.').First(); + if (fixName) + { + var fileEx = fileName.Split('.').Last(); + fileName = fileName.Split('.').First(); - fileName = fileName + "_" + StringExtensions.GetId(5) + "_" + DateTimeExtensions.DateTimeToUnixTimeStamp(DateTime.Now) + "." + fileEx; + fileName = fileName + "_" + StringExtensions.GetId(5) + "_" + DateTimeExtensions.DateTimeToUnixTimeStamp(DateTime.Now) + "." + fileEx; + } var putRequest = new PutObjectRequest { diff --git a/NetinaShop.Repository/Handlers/Products/GetProductsQueryHandler.cs b/NetinaShop.Repository/Handlers/Products/GetProductsQueryHandler.cs index 1ee90ce..4fce9e1 100644 --- a/NetinaShop.Repository/Handlers/Products/GetProductsQueryHandler.cs +++ b/NetinaShop.Repository/Handlers/Products/GetProductsQueryHandler.cs @@ -1,4 +1,5 @@ using Microsoft.EntityFrameworkCore.Internal; +using NetinaShop.Domain.Dtos.LargDtos; using NetinaShop.Domain.Dtos.SmallDtos; namespace NetinaShop.Repository.Handlers.Products; @@ -61,6 +62,8 @@ public class GetProductsQueryHandler : IRequestHandler productDiscount.Contains(p.Id)); } } + + List productSDtos = await products .Skip(request.Page * 20) .Take(20) @@ -69,43 +72,7 @@ public class GetProductsQueryHandler : IRequestHandler() - .TableNoTracking - .FirstOrDefaultAsync(d => d.CategoryId == productSDto.CategoryId && d.HasCode == false && d.ExpireDate.Date >= DateTime.Today.Date, cancellationToken); - - if (categoryDiscount != null && !categoryDiscount.IsExpired()) - { - var totalPrice = productSDto.Cost; - discountPrice = categoryDiscount.AmountType == DiscountAmountType.Amount - ? totalPrice - categoryDiscount.DiscountAmount : totalPrice - ((totalPrice / 100) * categoryDiscount.DiscountAmount); - productSDto.CostWithDiscount = productSDto.CostWithDiscount - discountPrice; - productSDto.HasDiscount = true; - productSDto.DiscountPercent = (100 * productSDto.CostWithDiscount) / productSDto.Cost; - } - - var productDiscount = await _repositoryWrapper.SetRepository() - .TableNoTracking - .Where(d => d.HasCode == false && d.ProductId == productSDto.Id && d.ExpireDate.Date >= DateTime.Today.Date) - .OrderByDescending(d => d.CreatedAt) - .FirstOrDefaultAsync(cancellationToken); - - if (productDiscount != null && !productDiscount.IsExpired()) - { - var totalPrice = productSDto.Cost; - discountPrice = productDiscount.AmountType == DiscountAmountType.Amount - ? totalPrice - productDiscount.DiscountAmount - : totalPrice - ((totalPrice / 100) * productDiscount.DiscountAmount); - - productSDto.CostWithDiscount = productSDto.CostWithDiscount - discountPrice; - productSDto.HasDiscount = true; - if (productSDto.Cost > 0) - productSDto.DiscountPercent = (100 * productSDto.CostWithDiscount) / productSDto.Cost; - if (productDiscount.IsSpecialOffer) - productSDto.IsSpecial = true; - } - + await _mediator.Send(new CalculateProductDiscountCommand(productSDto), cancellationToken); } return productSDtos; diff --git a/NetinaShop.Repository/Migrations/20240209214154_EditOrderProductAddDiscount.Designer.cs b/NetinaShop.Repository/Migrations/20240209214154_EditOrderProductAddDiscount.Designer.cs new file mode 100644 index 0000000..82448f3 --- /dev/null +++ b/NetinaShop.Repository/Migrations/20240209214154_EditOrderProductAddDiscount.Designer.cs @@ -0,0 +1,1569 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using NetinaShop.Repository.Models; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace NetinaShop.Repository.Migrations +{ + [DbContext(typeof(ApplicationContext))] + [Migration("20240209214154_EditOrderProductAddDiscount")] + partial class EditOrderProductAddDiscount + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("public") + .HasAnnotation("ProductVersion", "8.0.1") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleClaims", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Claims", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("Logins", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("UserRoles", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("Tokens", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.Blog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CategoryId") + .HasColumnType("uuid"); + + b.Property("Content") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("IsSuggested") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("ReadingTime") + .HasColumnType("integer"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("Summery") + .IsRequired() + .HasColumnType("text"); + + b.Property("Tags") + .IsRequired() + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("CategoryId"); + + b.ToTable("Blogs", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.BlogCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("BlogCategories", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Brands.Brand", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("HasSpecialPage") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("PageUrl") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Brands", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.Discount", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AmountType") + .HasColumnType("integer"); + + b.Property("Code") + .IsRequired() + .HasColumnType("text"); + + b.Property("Count") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("DiscountAmount") + .HasColumnType("bigint"); + + b.Property("DiscountPercent") + .HasColumnType("integer"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("character varying(21)"); + + b.Property("ExpireDate") + .HasColumnType("timestamp without time zone"); + + b.Property("HasCode") + .HasColumnType("boolean"); + + b.Property("HasPriceCeiling") + .HasColumnType("boolean"); + + b.Property("HasPriceFloor") + .HasColumnType("boolean"); + + b.Property("IsForInvitation") + .HasColumnType("boolean"); + + b.Property("IsInfinity") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("IsSpecialOffer") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("PriceCeiling") + .HasColumnType("bigint"); + + b.Property("PriceFloor") + .HasColumnType("bigint"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("UseCount") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.ToTable("Discounts", "public"); + + b.HasDiscriminator("Discriminator").HasValue("Discount"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("DeliveryPrice") + .HasColumnType("double precision"); + + b.Property("DiscountCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("DiscountId") + .HasColumnType("uuid"); + + b.Property("DiscountPrice") + .HasColumnType("double precision"); + + b.Property("DoneAt") + .HasColumnType("timestamp without time zone"); + + b.Property("IsPayed") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("OrderAt") + .HasColumnType("timestamp without time zone"); + + b.Property("OrderStatus") + .HasColumnType("integer"); + + b.Property("PackingPrice") + .HasColumnType("double precision"); + + b.Property("PayedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("PaymentMethod") + .HasColumnType("integer"); + + b.Property("PreparingMinute") + .HasColumnType("integer"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("ServicePrice") + .HasColumnType("double precision"); + + b.Property("TaxesPrice") + .HasColumnType("double precision"); + + b.Property("TotalPrice") + .HasColumnType("double precision"); + + b.Property("TotalProductsPrice") + .HasColumnType("double precision"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("DiscountId"); + + b.HasIndex("UserId"); + + b.ToTable("Orders", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.OrderDelivery", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Address") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("DeliveryCost") + .HasColumnType("double precision"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("OrderId") + .HasColumnType("uuid"); + + b.Property("PostalCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("ReceiverFullName") + .IsRequired() + .HasColumnType("text"); + + b.Property("ReceiverPhoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("ShippingId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("OrderId"); + + b.HasIndex("ShippingId"); + + b.ToTable("OrderDeliveries", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.OrderProduct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Count") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("HasDiscount") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("OrderId") + .HasColumnType("uuid"); + + b.Property("OrderProductStatus") + .HasColumnType("integer"); + + b.Property("PackingCost") + .HasColumnType("double precision"); + + b.Property("PackingFee") + .HasColumnType("double precision"); + + b.Property("ProductCategoryId") + .HasColumnType("uuid"); + + b.Property("ProductCost") + .HasColumnType("double precision"); + + b.Property("ProductFee") + .HasColumnType("double precision"); + + b.Property("ProductFeeWithDiscount") + .HasColumnType("double precision"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("OrderId"); + + b.HasIndex("ProductId"); + + b.ToTable("OrderProducts", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsMain") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.ToTable("ProductCategories", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("BeDisplayed") + .HasColumnType("boolean"); + + b.Property("BrandId") + .HasColumnType("uuid"); + + b.Property("CategoryId") + .HasColumnType("uuid"); + + b.Property("Cost") + .HasColumnType("double precision"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("EnglishName") + .IsRequired() + .HasColumnType("text"); + + b.Property("ExpertCheck") + .IsRequired() + .HasColumnType("text"); + + b.Property("HasExpressDelivery") + .HasColumnType("boolean"); + + b.Property("IsEnable") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("MaxOrderCount") + .HasColumnType("integer"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("PackingCost") + .HasColumnType("double precision"); + + b.Property("PersianName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Rate") + .HasColumnType("real"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("ReviewCount") + .HasColumnType("integer"); + + b.Property("Stock") + .HasColumnType("integer"); + + b.Property("Summery") + .IsRequired() + .HasColumnType("text"); + + b.Property("Tags") + .IsRequired() + .HasColumnType("text"); + + b.Property("Viewed") + .HasColumnType("integer"); + + b.Property("Warranty") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("BrandId"); + + b.HasIndex("CategoryId"); + + b.ToTable("Products", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Review", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Comment") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsBuyer") + .HasColumnType("boolean"); + + b.Property("IsConfirmed") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.Property("Rate") + .HasColumnType("real"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ProductId"); + + b.HasIndex("UserId"); + + b.ToTable("Reviews", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Specification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Detail") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsFeature") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.Property("Value") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.HasIndex("ProductId"); + + b.ToTable("Specifications", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.StorageFiles.StorageFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(34) + .HasColumnType("character varying(34)"); + + b.Property("FileLocation") + .IsRequired() + .HasColumnType("text"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("text"); + + b.Property("FileType") + .HasColumnType("integer"); + + b.Property("IsHeader") + .HasColumnType("boolean"); + + b.Property("IsPrimary") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("StorageFiles", "public"); + + b.HasDiscriminator("Discriminator").HasValue("StorageFile"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Users.ApplicationRole", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("EnglishName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PersianName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedName") + .IsUnique() + .HasDatabaseName("RoleNameIndex"); + + b.ToTable("Roles", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Users.ApplicationUser", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AccessFailedCount") + .HasColumnType("integer"); + + b.Property("BirthDate") + .HasColumnType("timestamp without time zone"); + + b.Property("ConcurrencyStamp") + .IsConcurrencyToken() + .HasColumnType("text"); + + b.Property("Email") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("EmailConfirmed") + .HasColumnType("boolean"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Gender") + .HasColumnType("integer"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("text"); + + b.Property("LockoutEnabled") + .HasColumnType("boolean"); + + b.Property("LockoutEnd") + .HasColumnType("timestamp with time zone"); + + b.Property("NationalId") + .IsRequired() + .HasColumnType("text"); + + b.Property("NormalizedEmail") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("NormalizedUserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.Property("PasswordHash") + .HasColumnType("text"); + + b.Property("PhoneNumber") + .HasColumnType("text"); + + b.Property("PhoneNumberConfirmed") + .HasColumnType("boolean"); + + b.Property("SecurityStamp") + .HasColumnType("text"); + + b.Property("SignUpStatus") + .HasColumnType("integer"); + + b.Property("TwoFactorEnabled") + .HasColumnType("boolean"); + + b.Property("UserName") + .HasMaxLength(256) + .HasColumnType("character varying(256)"); + + b.HasKey("Id"); + + b.HasIndex("NormalizedEmail") + .HasDatabaseName("EmailIndex"); + + b.HasIndex("NormalizedUserName") + .IsUnique() + .HasDatabaseName("UserNameIndex"); + + b.ToTable("Users", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Users.UserAddress", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Address") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("LocationLat") + .HasColumnType("real"); + + b.Property("LocationLong") + .HasColumnType("real"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("PostalCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("ReceiverFullName") + .IsRequired() + .HasColumnType("text"); + + b.Property("ReceiverPhoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserAddresses", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Users.UserFavoriteProduct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ProductId"); + + b.HasIndex("UserId"); + + b.ToTable("UserFavoriteProducts", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Warehouses.Shipping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .HasColumnType("text"); + + b.Property("DeliveryCost") + .HasColumnType("double precision"); + + b.Property("IsExpressShipping") + .HasColumnType("boolean"); + + b.Property("IsOriginalWarehouse") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("IsShipBySeller") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .HasColumnType("text"); + + b.Property("WarehouseName") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Shippings", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.CategoryDiscount", b => + { + b.HasBaseType("NetinaShop.Domain.Entities.Discounts.Discount"); + + b.Property("CategoryId") + .HasColumnType("uuid"); + + b.HasIndex("CategoryId"); + + b.HasDiscriminator().HasValue("CategoryDiscount"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.ProductDiscount", b => + { + b.HasBaseType("NetinaShop.Domain.Entities.Discounts.Discount"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.HasIndex("ProductId"); + + b.HasDiscriminator().HasValue("ProductDiscount"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.BlogStorageFile", b => + { + b.HasBaseType("NetinaShop.Domain.Entities.StorageFiles.StorageFile"); + + b.Property("BlogId") + .HasColumnType("uuid"); + + b.HasIndex("BlogId"); + + b.HasDiscriminator().HasValue("BlogStorageFile"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Brands.BrandStorageFile", b => + { + b.HasBaseType("NetinaShop.Domain.Entities.StorageFiles.StorageFile"); + + b.Property("BrandId") + .HasColumnType("uuid"); + + b.HasIndex("BrandId"); + + b.HasDiscriminator().HasValue("BrandStorageFile"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.ProductCategories.ProductCategoryStorageFile", b => + { + b.HasBaseType("NetinaShop.Domain.Entities.StorageFiles.StorageFile"); + + b.Property("CategoryId") + .HasColumnType("uuid"); + + b.HasIndex("CategoryId"); + + b.HasDiscriminator().HasValue("ProductCategoryStorageFile"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Products.ProductStorageFile", b => + { + b.HasBaseType("NetinaShop.Domain.Entities.StorageFiles.StorageFile"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.HasIndex("ProductId"); + + b.HasDiscriminator().HasValue("ProductStorageFile"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.Blog", b => + { + b.HasOne("NetinaShop.Domain.Entities.Blogs.BlogCategory", "Category") + .WithMany("Blogs") + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.Order", b => + { + b.HasOne("NetinaShop.Domain.Entities.Discounts.Discount", null) + .WithMany("Orders") + .HasForeignKey("DiscountId"); + + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("User"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.OrderDelivery", b => + { + b.HasOne("NetinaShop.Domain.Entities.Orders.Order", "Order") + .WithMany("OrderDeliveries") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("NetinaShop.Domain.Entities.Warehouses.Shipping", "Shipping") + .WithMany() + .HasForeignKey("ShippingId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Order"); + + b.Navigation("Shipping"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.OrderProduct", b => + { + b.HasOne("NetinaShop.Domain.Entities.Orders.Order", "Order") + .WithMany("OrderProducts") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") + .WithMany("OrderProducts") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Order"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", b => + { + b.HasOne("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", "Parent") + .WithMany() + .HasForeignKey("ParentId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Product", b => + { + b.HasOne("NetinaShop.Domain.Entities.Brands.Brand", "Brand") + .WithMany("Products") + .HasForeignKey("BrandId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", "Category") + .WithMany("Products") + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Brand"); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Review", b => + { + b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") + .WithMany("Reviews") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Product"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Specification", b => + { + b.HasOne("NetinaShop.Domain.Entities.Products.Specification", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId"); + + b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") + .WithMany("Specifications") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Parent"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Users.UserAddress", b => + { + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") + .WithMany("Addresses") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("User"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Users.UserFavoriteProduct", b => + { + b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") + .WithMany() + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Product"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.CategoryDiscount", b => + { + b.HasOne("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", "Category") + .WithMany() + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.ProductDiscount", b => + { + b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") + .WithMany() + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.BlogStorageFile", b => + { + b.HasOne("NetinaShop.Domain.Entities.Blogs.Blog", "Blog") + .WithMany("Files") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Brands.BrandStorageFile", b => + { + b.HasOne("NetinaShop.Domain.Entities.Brands.Brand", "Brand") + .WithMany("Files") + .HasForeignKey("BrandId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Brand"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.ProductCategories.ProductCategoryStorageFile", b => + { + b.HasOne("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", "Category") + .WithMany("Files") + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Products.ProductStorageFile", b => + { + b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") + .WithMany("Files") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.Blog", b => + { + b.Navigation("Files"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.BlogCategory", b => + { + b.Navigation("Blogs"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Brands.Brand", b => + { + b.Navigation("Files"); + + b.Navigation("Products"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.Discount", b => + { + b.Navigation("Orders"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.Order", b => + { + b.Navigation("OrderDeliveries"); + + b.Navigation("OrderProducts"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", b => + { + b.Navigation("Files"); + + b.Navigation("Products"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Product", b => + { + b.Navigation("Files"); + + b.Navigation("OrderProducts"); + + b.Navigation("Reviews"); + + b.Navigation("Specifications"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Specification", b => + { + b.Navigation("Children"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Users.ApplicationUser", b => + { + b.Navigation("Addresses"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/NetinaShop.Repository/Migrations/20240209214154_EditOrderProductAddDiscount.cs b/NetinaShop.Repository/Migrations/20240209214154_EditOrderProductAddDiscount.cs new file mode 100644 index 0000000..b025456 --- /dev/null +++ b/NetinaShop.Repository/Migrations/20240209214154_EditOrderProductAddDiscount.cs @@ -0,0 +1,44 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace NetinaShop.Repository.Migrations +{ + /// + public partial class EditOrderProductAddDiscount : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "HasDiscount", + schema: "public", + table: "OrderProducts", + type: "boolean", + nullable: false, + defaultValue: false); + + migrationBuilder.AddColumn( + name: "ProductFeeWithDiscount", + schema: "public", + table: "OrderProducts", + type: "double precision", + nullable: false, + defaultValue: 0.0); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "HasDiscount", + schema: "public", + table: "OrderProducts"); + + migrationBuilder.DropColumn( + name: "ProductFeeWithDiscount", + schema: "public", + table: "OrderProducts"); + } + } +} diff --git a/NetinaShop.Repository/Migrations/ApplicationContextModelSnapshot.cs b/NetinaShop.Repository/Migrations/ApplicationContextModelSnapshot.cs index 9d43d05..d315470 100644 --- a/NetinaShop.Repository/Migrations/ApplicationContextModelSnapshot.cs +++ b/NetinaShop.Repository/Migrations/ApplicationContextModelSnapshot.cs @@ -529,6 +529,9 @@ namespace NetinaShop.Repository.Migrations b.Property("CreatedBy") .HasColumnType("text"); + b.Property("HasDiscount") + .HasColumnType("boolean"); + b.Property("IsRemoved") .HasColumnType("boolean"); @@ -559,6 +562,9 @@ namespace NetinaShop.Repository.Migrations b.Property("ProductFee") .HasColumnType("double precision"); + b.Property("ProductFeeWithDiscount") + .HasColumnType("double precision"); + b.Property("ProductId") .HasColumnType("uuid");