diff --git a/NetinaShop.Api/AppSettings/appsettings.Development.json b/NetinaShop.Api/AppSettings/appsettings.Development.json index be1518e..0a9133a 100644 --- a/NetinaShop.Api/AppSettings/appsettings.Development.json +++ b/NetinaShop.Api/AppSettings/appsettings.Development.json @@ -32,8 +32,8 @@ "LastName": "سیستم" }, "StorageSetting": { - "AccessKey": "d37a1cc6acfea3a6f92c538ef0f6601f1edcdc9143942b6470e5d1032aa6bfe2", - "SecretKey": "979313b7-30fb-40ff-94d8-d0390d3fa876", + "AccessKey": "979313b7-30fb-40ff-94d8-d0390d3fa876", + "SecretKey": "d37a1cc6acfea3a6f92c538ef0f6601f1edcdc9143942b6470e5d1032aa6bfe2", "BucketKey": "vesmeh-content" }, "JwtSettings": { diff --git a/NetinaShop.Common/NetinaShop.Common.csproj b/NetinaShop.Common/NetinaShop.Common.csproj index 7f66b1e..dbe9777 100644 --- a/NetinaShop.Common/NetinaShop.Common.csproj +++ b/NetinaShop.Common/NetinaShop.Common.csproj @@ -1,6 +1,6 @@  - + - + diff --git a/NetinaShop.Core/EntityServices/DiscountHandlers/CalculateOrderDiscountCommandHandler.cs b/NetinaShop.Core/EntityServices/DiscountHandlers/CalculateOrderDiscountCommandHandler.cs index cccb83a..b0607ea 100644 --- a/NetinaShop.Core/EntityServices/DiscountHandlers/CalculateOrderDiscountCommandHandler.cs +++ b/NetinaShop.Core/EntityServices/DiscountHandlers/CalculateOrderDiscountCommandHandler.cs @@ -3,10 +3,12 @@ public class CalculateOrderDiscountCommandHandler : IRequestHandler { private readonly IRepositoryWrapper _repositoryWrapper; + private readonly ICurrentUserService _currentUserService; - public CalculateOrderDiscountCommandHandler(IRepositoryWrapper repositoryWrapper) + public CalculateOrderDiscountCommandHandler(IRepositoryWrapper repositoryWrapper,ICurrentUserService currentUserService) { _repositoryWrapper = repositoryWrapper; + _currentUserService = currentUserService; } public async Task Handle(CalculateOrderDiscountCommand request, CancellationToken cancellationToken) { @@ -20,6 +22,27 @@ public class CalculateOrderDiscountCommandHandler : IRequestHandler() + .TableNoTracking + .FirstOrDefaultAsync(f => f.UserId == userId && f.DiscountCode == discount.Code, cancellationToken); + if (discountedUserOrder != null) + throw new AppException("شما یک بار از این کد تخفیف استفاده کرده اید", ApiResultStatusCode.BadRequest); + } + + if (discount.IsForFirstPurchase) + { + if (_currentUserService.UserId != null && Guid.TryParse(_currentUserService.UserId, out Guid firstPurchaseUserId)) + { + var userOrderCount = await _repositoryWrapper.SetRepository() + .TableNoTracking + .CountAsync(f => f.UserId == firstPurchaseUserId && f.DiscountCode == discount.Code, cancellationToken); + if (userOrderCount > 0) + throw new AppException("شما قبلا خریدی داشته اید و نمیتوانید از تخفیف اولین خرید استفاده کنید", ApiResultStatusCode.BadRequest); + } + } + double discountPrice = 0; double totalPrice = 0; if (discount.Type == DiscountType.All) diff --git a/NetinaShop.Domain/CommandQueries/Commands/DiscountCommands.cs b/NetinaShop.Domain/CommandQueries/Commands/DiscountCommands.cs index 39d5a35..dd87c40 100644 --- a/NetinaShop.Domain/CommandQueries/Commands/DiscountCommands.cs +++ b/NetinaShop.Domain/CommandQueries/Commands/DiscountCommands.cs @@ -1,6 +1,7 @@ namespace NetinaShop.Domain.CommandQueries.Commands; public sealed record CreateDiscountCommand(string Code, + string Description, int DiscountPercent, long DiscountAmount, bool HasCode, @@ -18,12 +19,14 @@ bool IsInfinity, long UseCount, bool IsForInvitation, bool IsSpecialOffer, +bool IsForFirstPurchase, Guid ProductId, Guid CategoryId) : IRequest; public sealed record UpdateDiscountCommand( Guid Id, string Code, + string Description, int DiscountPercent, long DiscountAmount, bool HasCode, @@ -41,6 +44,7 @@ public sealed record UpdateDiscountCommand( long UseCount, bool IsForInvitation, bool IsSpecialOffer, + bool IsForFirstPurchase, Guid ProductId, Guid CategoryId) : IRequest; @@ -48,4 +52,4 @@ public sealed record CreateSaleCooperationDiscount(Guid CorporateUserId) : IRequ public sealed record DeleteDiscountCommand(Guid Id) : IRequest; -public sealed record CalculateOrderDiscountCommand(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/Dtos/LargDtos/DiscountLDto.cs b/NetinaShop.Domain/Dtos/LargDtos/DiscountLDto.cs index ca35f41..ae2c0ec 100644 --- a/NetinaShop.Domain/Dtos/LargDtos/DiscountLDto.cs +++ b/NetinaShop.Domain/Dtos/LargDtos/DiscountLDto.cs @@ -3,6 +3,7 @@ public class DiscountLDto : BaseDto { public string Code { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; public int DiscountPercent { get; set; } public long DiscountAmount { get; set; } public bool HasCode { get; set; } @@ -24,4 +25,5 @@ public class DiscountLDto : BaseDto public string ProductName { get; set; } = string.Empty; public Guid CategoryId { get; set; } public string CategoryName { get; set; } = string.Empty; + public bool IsForFirstPurchase { get; set; } } \ No newline at end of file diff --git a/NetinaShop.Domain/Dtos/SmallDtos/DiscountSDto.cs b/NetinaShop.Domain/Dtos/SmallDtos/DiscountSDto.cs index 0e9e00b..e3ad7cd 100644 --- a/NetinaShop.Domain/Dtos/SmallDtos/DiscountSDto.cs +++ b/NetinaShop.Domain/Dtos/SmallDtos/DiscountSDto.cs @@ -3,6 +3,7 @@ public class DiscountSDto : BaseDto { public string Code { get; set; } = string.Empty; + public string Description { get; set; } = string.Empty; public int DiscountPercent { get; set; } public long DiscountAmount { get; set; } public bool HasCode { get; set; } @@ -19,4 +20,5 @@ public class DiscountSDto : BaseDto public long UseCount { get; set; } public bool IsSpecialOffer { get; set; } public bool IsForInvitation { get; set; } + public bool IsForFirstPurchase { get; set; } } \ No newline at end of file diff --git a/NetinaShop.Domain/Entities/Discounts/CategoryDiscount.cs b/NetinaShop.Domain/Entities/Discounts/CategoryDiscount.cs index bf72dfe..eda0d03 100644 --- a/NetinaShop.Domain/Entities/Discounts/CategoryDiscount.cs +++ b/NetinaShop.Domain/Entities/Discounts/CategoryDiscount.cs @@ -9,9 +9,12 @@ public partial class CategoryDiscount : Discount } - public CategoryDiscount(string code, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type, int count,bool immortal, DateTime startDate, DateTime expireDate, long priceFloor, bool hasPriceFloor, long priceCeiling, bool hasPriceCeiling, bool isInfinity, long useCount, bool isForInvitation,bool isSpecialOffer, Guid categoryId) - : base(code, discountPercent, discountAmount, hasCode, amountType, type, count, startDate, expireDate, priceFloor, hasPriceFloor, priceCeiling, hasPriceCeiling, isInfinity, useCount, - isForInvitation, isSpecialOffer, immortal) + public CategoryDiscount(string code, string description, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type, + int count, bool immortal, DateTime startDate, DateTime expireDate, long priceFloor, bool hasPriceFloor, long priceCeiling, + bool hasPriceCeiling, bool isInfinity, long useCount, bool isForInvitation, + bool isForFirstPurchase, bool isSpecialOffer , Guid categoryId) + : base(code, description, discountPercent, discountAmount, hasCode, amountType, type, count, startDate, expireDate, priceFloor, hasPriceFloor, priceCeiling, hasPriceCeiling, isInfinity, useCount, + isForInvitation, isSpecialOffer,isForFirstPurchase, immortal) { CategoryId = categoryId; } diff --git a/NetinaShop.Domain/Entities/Discounts/Discount.Aggregate.cs b/NetinaShop.Domain/Entities/Discounts/Discount.Aggregate.cs index 131a263..ec5225e 100644 --- a/NetinaShop.Domain/Entities/Discounts/Discount.Aggregate.cs +++ b/NetinaShop.Domain/Entities/Discounts/Discount.Aggregate.cs @@ -2,9 +2,13 @@ public partial class Discount { - public static Discount Create(string code, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type, int count,bool immortal, DateTime startDate, DateTime expireDate, long priceFloor, bool hasPriceFloor, long priceCeiling, bool hasPriceCeiling, bool isInfinity, long useCount, bool isForInvitation,bool isSpecialOffer) + public static Discount Create(string code,string description, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type, + int count,bool immortal, DateTime startDate, DateTime expireDate, long priceFloor, bool hasPriceFloor, long priceCeiling, + bool hasPriceCeiling, bool isInfinity, long useCount, bool isForInvitation, + bool isForFirstPurchase, bool isSpecialOffer) { - return new Discount(code, + return new Discount(code, + description, discountPercent, discountAmount, hasCode, @@ -21,6 +25,7 @@ public partial class Discount useCount, isForInvitation, isSpecialOffer, + isForFirstPurchase, immortal); } @@ -36,20 +41,26 @@ public partial class Discount public partial class ProductDiscount { - public static ProductDiscount Create(string code, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type, int count, bool immortal, DateTime startDate, DateTime expireDate, long priceFloor, bool hasPriceFloor, long priceCeiling, bool hasPriceCeiling, bool isInfinity, long useCount, bool isForInvitation ,bool isSpecialOffer, Guid productId) + public static ProductDiscount Create(string code, string description, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type, + int count, bool immortal, DateTime startDate, DateTime expireDate, long priceFloor, bool hasPriceFloor, long priceCeiling, + bool hasPriceCeiling, bool isInfinity, long useCount, bool isForInvitation, + bool isForFirstPurchase, bool isSpecialOffer, Guid productId) { - return new ProductDiscount(code, discountPercent, discountAmount, hasCode, amountType, type, count,immortal, startDate, + return new ProductDiscount(code,description, discountPercent, discountAmount, hasCode, amountType, type, count,immortal, startDate, expireDate, priceFloor, hasPriceFloor, priceCeiling, hasPriceCeiling, isInfinity, useCount, - isForInvitation, isSpecialOffer, productId); + isForInvitation, isForFirstPurchase, isSpecialOffer, productId); } } public partial class CategoryDiscount { - public static CategoryDiscount Create(string code, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type, int count, bool immortal, DateTime startDate, DateTime expireDate, long priceFloor, bool hasPriceFloor, long priceCeiling, bool hasPriceCeiling, bool isInfinity, long useCount, bool isForInvitation, bool isSpecialOffer, Guid categoryId) + public static CategoryDiscount Create(string code, string description, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type, + int count, bool immortal, DateTime startDate, DateTime expireDate, long priceFloor, bool hasPriceFloor, long priceCeiling, + bool hasPriceCeiling, bool isInfinity, long useCount, bool isForInvitation, + bool isForFirstPurchase, bool isSpecialOffer, Guid categoryId) { - return new CategoryDiscount(code, discountPercent, discountAmount, hasCode, amountType, type, count,immortal, startDate, + return new CategoryDiscount(code,description, discountPercent, discountAmount, hasCode, amountType, type, count,immortal, startDate, expireDate, priceFloor, hasPriceFloor, priceCeiling, hasPriceCeiling, isInfinity, useCount, - isForInvitation,isSpecialOffer, categoryId); + isForInvitation, isForFirstPurchase,isSpecialOffer, categoryId); } } diff --git a/NetinaShop.Domain/Entities/Discounts/Discount.cs b/NetinaShop.Domain/Entities/Discounts/Discount.cs index bccc4a5..06c9353 100644 --- a/NetinaShop.Domain/Entities/Discounts/Discount.cs +++ b/NetinaShop.Domain/Entities/Discounts/Discount.cs @@ -13,6 +13,7 @@ public partial class Discount : ApiEntity } public Discount(string code, + string description, int discountPercent, long discountAmount, bool hasCode, @@ -29,9 +30,11 @@ public partial class Discount : ApiEntity long useCount, bool isForInvitation, bool isSpecialOffer, + bool isForFirstPurchase, bool immortal) { Code = code; + Description = description; DiscountPercent = discountPercent; DiscountAmount = discountAmount; HasCode = hasCode; @@ -48,9 +51,11 @@ public partial class Discount : ApiEntity UseCount = useCount; IsForInvitation = isForInvitation; IsSpecialOffer = isSpecialOffer; + IsForFirstPurchase = isForFirstPurchase; Immortal = immortal; } public string Code { get; internal set; } = string.Empty; + public string Description { get; internal set; } = string.Empty; public int DiscountPercent { get; internal set; } public long DiscountAmount { get; internal set; } public bool HasCode { get; internal set; } @@ -69,6 +74,7 @@ public partial class Discount : ApiEntity public bool IsSpecialOffer { get; internal set; } public bool IsForInvitation { get; internal set; } public bool IsForSaleCooperation { get; internal set; } + public bool IsForFirstPurchase { get; internal set; } public Guid? CorporateUserId { get; internal set; } diff --git a/NetinaShop.Domain/Entities/Discounts/ProductDiscount.cs b/NetinaShop.Domain/Entities/Discounts/ProductDiscount.cs index f714862..07d131a 100644 --- a/NetinaShop.Domain/Entities/Discounts/ProductDiscount.cs +++ b/NetinaShop.Domain/Entities/Discounts/ProductDiscount.cs @@ -7,8 +7,12 @@ public partial class ProductDiscount : Discount } - public ProductDiscount(string code, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type, int count, bool immortal, DateTime startDate, DateTime expireDate, long priceFloor, bool hasPriceFloor, long priceCeiling, bool hasPriceCeiling, bool isInfinity, long useCount, bool isForInvitation,bool isSpecialOffer,Guid productId) - : base(code, discountPercent, discountAmount, hasCode, amountType, type, count, startDate, expireDate, priceFloor, hasPriceFloor, priceCeiling, hasPriceCeiling, isInfinity, useCount, isForInvitation, isSpecialOffer, immortal) + public ProductDiscount(string code, string description, int discountPercent, long discountAmount, bool hasCode, DiscountAmountType amountType, DiscountType type, + int count, bool immortal, DateTime startDate, DateTime expireDate, long priceFloor, bool hasPriceFloor, long priceCeiling, + bool hasPriceCeiling, bool isInfinity, long useCount, bool isForInvitation, + bool isForFirstPurchase, bool isSpecialOffer,Guid productId) + : base(code,description, discountPercent, discountAmount, hasCode, amountType, type, count, startDate, + expireDate, priceFloor, hasPriceFloor, priceCeiling, hasPriceCeiling, isInfinity, useCount, isForInvitation, isSpecialOffer,isForFirstPurchase, immortal) { ProductId = productId; } diff --git a/NetinaShop.Domain/Enums/DiscountType.cs b/NetinaShop.Domain/Enums/DiscountType.cs index e8c1765..e230128 100644 --- a/NetinaShop.Domain/Enums/DiscountType.cs +++ b/NetinaShop.Domain/Enums/DiscountType.cs @@ -3,11 +3,11 @@ public enum DiscountType { [Display(Name = "همه اقلام")] - All, + All = 0, [Display(Name = "محصولی")] - Product, + Product = 1, [Display(Name = "دسته ای")] - Category, + Category = 2, [Display(Name = "مشترکی")] - Subscriber + Subscriber = 3 } \ No newline at end of file diff --git a/NetinaShop.Domain/Mappers/DiscountMapper.g.cs b/NetinaShop.Domain/Mappers/DiscountMapper.g.cs index fa3cb37..2aff39d 100644 --- a/NetinaShop.Domain/Mappers/DiscountMapper.g.cs +++ b/NetinaShop.Domain/Mappers/DiscountMapper.g.cs @@ -13,6 +13,7 @@ namespace NetinaShop.Domain.Mappers return p1 == null ? null : new Discount() { Code = p1.Code, + Description = p1.Description, DiscountPercent = p1.DiscountPercent, DiscountAmount = p1.DiscountAmount, HasCode = p1.HasCode, @@ -30,6 +31,7 @@ namespace NetinaShop.Domain.Mappers UseCount = p1.UseCount, IsSpecialOffer = p1.IsSpecialOffer, IsForInvitation = p1.IsForInvitation, + IsForFirstPurchase = p1.IsForFirstPurchase, Id = p1.Id, CreatedAt = p1.CreatedAt }; @@ -43,6 +45,7 @@ namespace NetinaShop.Domain.Mappers Discount result = p3 ?? new Discount(); result.Code = p2.Code; + result.Description = p2.Description; result.DiscountPercent = p2.DiscountPercent; result.DiscountAmount = p2.DiscountAmount; result.HasCode = p2.HasCode; @@ -60,6 +63,7 @@ namespace NetinaShop.Domain.Mappers result.UseCount = p2.UseCount; result.IsSpecialOffer = p2.IsSpecialOffer; result.IsForInvitation = p2.IsForInvitation; + result.IsForFirstPurchase = p2.IsForFirstPurchase; result.Id = p2.Id; result.CreatedAt = p2.CreatedAt; return result; @@ -68,6 +72,7 @@ namespace NetinaShop.Domain.Mappers public static Expression> ProjectToDiscount => p4 => new Discount() { Code = p4.Code, + Description = p4.Description, DiscountPercent = p4.DiscountPercent, DiscountAmount = p4.DiscountAmount, HasCode = p4.HasCode, @@ -85,6 +90,7 @@ namespace NetinaShop.Domain.Mappers UseCount = p4.UseCount, IsSpecialOffer = p4.IsSpecialOffer, IsForInvitation = p4.IsForInvitation, + IsForFirstPurchase = p4.IsForFirstPurchase, Id = p4.Id, CreatedAt = p4.CreatedAt }; @@ -93,6 +99,7 @@ namespace NetinaShop.Domain.Mappers return p5 == null ? null : new DiscountLDto() { Code = p5.Code, + Description = p5.Description, DiscountPercent = p5.DiscountPercent, DiscountAmount = p5.DiscountAmount, HasCode = p5.HasCode, @@ -110,6 +117,7 @@ namespace NetinaShop.Domain.Mappers UseCount = p5.UseCount, IsSpecialOffer = p5.IsSpecialOffer, IsForInvitation = p5.IsForInvitation, + IsForFirstPurchase = p5.IsForFirstPurchase, Id = p5.Id, CreatedAt = p5.CreatedAt }; @@ -123,6 +131,7 @@ namespace NetinaShop.Domain.Mappers DiscountLDto result = p7 ?? new DiscountLDto(); result.Code = p6.Code; + result.Description = p6.Description; result.DiscountPercent = p6.DiscountPercent; result.DiscountAmount = p6.DiscountAmount; result.HasCode = p6.HasCode; @@ -140,6 +149,7 @@ namespace NetinaShop.Domain.Mappers result.UseCount = p6.UseCount; result.IsSpecialOffer = p6.IsSpecialOffer; result.IsForInvitation = p6.IsForInvitation; + result.IsForFirstPurchase = p6.IsForFirstPurchase; result.Id = p6.Id; result.CreatedAt = p6.CreatedAt; return result; @@ -148,6 +158,7 @@ namespace NetinaShop.Domain.Mappers public static Expression> ProjectToLDto => p8 => new DiscountLDto() { Code = p8.Code, + Description = p8.Description, DiscountPercent = p8.DiscountPercent, DiscountAmount = p8.DiscountAmount, HasCode = p8.HasCode, @@ -165,6 +176,7 @@ namespace NetinaShop.Domain.Mappers UseCount = p8.UseCount, IsSpecialOffer = p8.IsSpecialOffer, IsForInvitation = p8.IsForInvitation, + IsForFirstPurchase = p8.IsForFirstPurchase, Id = p8.Id, CreatedAt = p8.CreatedAt }; @@ -173,6 +185,7 @@ namespace NetinaShop.Domain.Mappers return p9 == null ? null : new Discount() { Code = p9.Code, + Description = p9.Description, DiscountPercent = p9.DiscountPercent, DiscountAmount = p9.DiscountAmount, HasCode = p9.HasCode, @@ -189,6 +202,7 @@ namespace NetinaShop.Domain.Mappers UseCount = p9.UseCount, IsSpecialOffer = p9.IsSpecialOffer, IsForInvitation = p9.IsForInvitation, + IsForFirstPurchase = p9.IsForFirstPurchase, Id = p9.Id, CreatedAt = p9.CreatedAt }; @@ -202,6 +216,7 @@ namespace NetinaShop.Domain.Mappers Discount result = p11 ?? new Discount(); result.Code = p10.Code; + result.Description = p10.Description; result.DiscountPercent = p10.DiscountPercent; result.DiscountAmount = p10.DiscountAmount; result.HasCode = p10.HasCode; @@ -218,6 +233,7 @@ namespace NetinaShop.Domain.Mappers result.UseCount = p10.UseCount; result.IsSpecialOffer = p10.IsSpecialOffer; result.IsForInvitation = p10.IsForInvitation; + result.IsForFirstPurchase = p10.IsForFirstPurchase; result.Id = p10.Id; result.CreatedAt = p10.CreatedAt; return result; @@ -228,6 +244,7 @@ namespace NetinaShop.Domain.Mappers return p12 == null ? null : new DiscountSDto() { Code = p12.Code, + Description = p12.Description, DiscountPercent = p12.DiscountPercent, DiscountAmount = p12.DiscountAmount, HasCode = p12.HasCode, @@ -244,6 +261,7 @@ namespace NetinaShop.Domain.Mappers UseCount = p12.UseCount, IsSpecialOffer = p12.IsSpecialOffer, IsForInvitation = p12.IsForInvitation, + IsForFirstPurchase = p12.IsForFirstPurchase, Id = p12.Id, CreatedAt = p12.CreatedAt }; @@ -257,6 +275,7 @@ namespace NetinaShop.Domain.Mappers DiscountSDto result = p14 ?? new DiscountSDto(); result.Code = p13.Code; + result.Description = p13.Description; result.DiscountPercent = p13.DiscountPercent; result.DiscountAmount = p13.DiscountAmount; result.HasCode = p13.HasCode; @@ -273,6 +292,7 @@ namespace NetinaShop.Domain.Mappers result.UseCount = p13.UseCount; result.IsSpecialOffer = p13.IsSpecialOffer; result.IsForInvitation = p13.IsForInvitation; + result.IsForFirstPurchase = p13.IsForFirstPurchase; result.Id = p13.Id; result.CreatedAt = p13.CreatedAt; return result; @@ -281,6 +301,7 @@ namespace NetinaShop.Domain.Mappers public static Expression> ProjectToSDto => p15 => new DiscountSDto() { Code = p15.Code, + Description = p15.Description, DiscountPercent = p15.DiscountPercent, DiscountAmount = p15.DiscountAmount, HasCode = p15.HasCode, @@ -297,6 +318,7 @@ namespace NetinaShop.Domain.Mappers UseCount = p15.UseCount, IsSpecialOffer = p15.IsSpecialOffer, IsForInvitation = p15.IsForInvitation, + IsForFirstPurchase = p15.IsForFirstPurchase, Id = p15.Id, CreatedAt = p15.CreatedAt }; diff --git a/NetinaShop.Domain/NetinaShop.Domain.csproj b/NetinaShop.Domain/NetinaShop.Domain.csproj index 7a35830..543800c 100644 --- a/NetinaShop.Domain/NetinaShop.Domain.csproj +++ b/NetinaShop.Domain/NetinaShop.Domain.csproj @@ -1,6 +1,6 @@  - + - + diff --git a/NetinaShop.Repository/Handlers/Discounts/CreateDiscountCommandHandler.cs b/NetinaShop.Repository/Handlers/Discounts/CreateDiscountCommandHandler.cs index 786adc0..2179942 100644 --- a/NetinaShop.Repository/Handlers/Discounts/CreateDiscountCommandHandler.cs +++ b/NetinaShop.Repository/Handlers/Discounts/CreateDiscountCommandHandler.cs @@ -13,29 +13,32 @@ public class CreateDiscountCommandHandler : IRequestHandler().Add(ent); break; case DiscountType.Category: - var catDis = CategoryDiscount.Create(request.Code, request.DiscountPercent, request.DiscountAmount, request.HasCode, + var catDis = CategoryDiscount.Create(request.Code,request.Description, request.DiscountPercent, request.DiscountAmount, request.HasCode, request.AmountType, request.Type, request.Count,request.IsImmortal, request.StartDate, request.ExpireDate, request.PriceFloor, request.HasPriceFloor, request.PriceCeiling, request.HasPriceCeiling, request.IsInfinity, request.UseCount, - request.IsForInvitation,request.IsSpecialOffer, request.CategoryId); + request.IsForInvitation,request.IsForFirstPurchase,request.IsSpecialOffer, request.CategoryId); _repositoryWrapper.SetRepository().Add(catDis); break; case DiscountType.Product: - var productDis = ProductDiscount.Create(request.Code, request.DiscountPercent, request.DiscountAmount, request.HasCode, + var productDis = ProductDiscount.Create(request.Code,request.Description, request.DiscountPercent, request.DiscountAmount, request.HasCode, request.AmountType, request.Type, request.Count, request.IsImmortal, request.StartDate, request.ExpireDate, request.PriceFloor, request.HasPriceFloor, request.PriceCeiling, request.HasPriceCeiling, request.IsInfinity, request.UseCount, - request.IsForInvitation, request.IsSpecialOffer,request.ProductId); + request.IsForInvitation,request.IsForFirstPurchase, request.IsSpecialOffer,request.ProductId); _repositoryWrapper.SetRepository().Add(productDis); break; default: - var def = Discount.Create(request.Code, request.DiscountPercent, request.DiscountAmount, request.HasCode, + var def = Discount.Create(request.Code,request.Description, request.DiscountPercent, request.DiscountAmount, request.HasCode, request.AmountType, request.Type, request.Count, request.IsImmortal, request.StartDate, request.ExpireDate, request.PriceFloor, request.HasPriceFloor, request.PriceCeiling, request.HasPriceCeiling, request.IsInfinity, request.UseCount, - request.IsForInvitation,request.IsSpecialOffer); + request.IsForInvitation, request.IsForFirstPurchase,request.IsSpecialOffer); _repositoryWrapper.SetRepository().Add(def); break; } diff --git a/NetinaShop.Repository/Handlers/Discounts/CreateSaleCooperationDiscountHandler.cs b/NetinaShop.Repository/Handlers/Discounts/CreateSaleCooperationDiscountHandler.cs index 63a8593..9651583 100644 --- a/NetinaShop.Repository/Handlers/Discounts/CreateSaleCooperationDiscountHandler.cs +++ b/NetinaShop.Repository/Handlers/Discounts/CreateSaleCooperationDiscountHandler.cs @@ -34,9 +34,9 @@ public class CreateSaleCooperationDiscountHandler : IRequestHandler().Add(foundedDiscount); diff --git a/NetinaShop.Repository/Handlers/Discounts/GetDiscountsQueryHandler.cs b/NetinaShop.Repository/Handlers/Discounts/GetDiscountsQueryHandler.cs index ed6825a..bfb9f5b 100644 --- a/NetinaShop.Repository/Handlers/Discounts/GetDiscountsQueryHandler.cs +++ b/NetinaShop.Repository/Handlers/Discounts/GetDiscountsQueryHandler.cs @@ -12,11 +12,12 @@ public class GetDiscountsQueryHandler : IRequestHandler> Handle(GetDiscountsQuery request, CancellationToken cancellationToken) { - return await _repositoryWrapper.SetRepository().TableNoTracking + var discounts = await _repositoryWrapper.SetRepository().TableNoTracking .Where(d=>!d.IsSpecialOffer) .OrderByDescending(b => b.CreatedAt) .Skip(request.Page * 15).Take(15) .Select(DiscountMapper.ProjectToSDto) .ToListAsync(cancellationToken); + return discounts; } } \ No newline at end of file diff --git a/NetinaShop.Repository/Handlers/Discounts/UpdateDiscountCommandHandler.cs b/NetinaShop.Repository/Handlers/Discounts/UpdateDiscountCommandHandler.cs index 067f7f7..097eb5c 100644 --- a/NetinaShop.Repository/Handlers/Discounts/UpdateDiscountCommandHandler.cs +++ b/NetinaShop.Repository/Handlers/Discounts/UpdateDiscountCommandHandler.cs @@ -18,7 +18,12 @@ public class UpdateDiscountCommandHandler : IRequestHandler().TableNoTracking.FirstOrDefaultAsync(d=>d.Id==request.Id,cancellationToken); if (ent == null) throw new AppException("Discount not found", ApiResultStatusCode.NotFound); - var newEnt = Discount.Create(request.Code, request.DiscountPercent, request.DiscountAmount, request.HasCode, request.AmountType, request.Type, request.Count,request.IsImmortal, request.StartDate, request.ExpireDate, request.PriceFloor, request.HasPriceFloor, request.PriceCeiling, request.HasPriceCeiling, request.IsInfinity, request.UseCount, request.IsForInvitation, request.IsSpecialOffer); + var newEnt = Discount.Create(request.Code,request.Description, + request.DiscountPercent, request.DiscountAmount, request.HasCode, + request.AmountType, request.Type, request.Count,request.IsImmortal, + request.StartDate, request.ExpireDate, request.PriceFloor, request.HasPriceFloor, + request.PriceCeiling, request.HasPriceCeiling, request.IsInfinity, + request.UseCount, request.IsForInvitation,request.IsForFirstPurchase, request.IsSpecialOffer); newEnt.Id = ent.Id; newEnt.CreatedAt = ent.CreatedAt; newEnt.CreatedBy = ent.CreatedBy; @@ -29,10 +34,12 @@ public class UpdateDiscountCommandHandler : IRequestHandler +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("20240414120218_editDiscountAddFirstPurchase")] + partial class editDiscountAddFirstPurchase + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("public") + .HasAnnotation("ProductVersion", "8.0.3") + .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.Accounting.Payment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Amount") + .HasColumnType("double precision"); + + b.Property("Authority") + .IsRequired() + .HasColumnType("text"); + + b.Property("CardPan") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("FactorNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("OrderId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("TransactionCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("OrderId"); + + b.HasIndex("UserId"); + + b.ToTable("Payments", "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") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("IsSuggested") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ReadingTime") + .HasColumnType("integer"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .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") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .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") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("EnglishName") + .IsRequired() + .HasColumnType("text"); + + b.Property("HasSpecialPage") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("PageUrl") + .IsRequired() + .HasColumnType("text"); + + b.Property("PersianName") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .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("CorporateUserId") + .HasColumnType("uuid"); + + b.Property("Count") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .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("Immortal") + .HasColumnType("boolean"); + + b.Property("IsForFirstPurchase") + .HasColumnType("boolean"); + + b.Property("IsForInvitation") + .HasColumnType("boolean"); + + b.Property("IsForSaleCooperation") + .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") + .IsRequired() + .HasColumnType("text"); + + b.Property("PriceCeiling") + .HasColumnType("bigint"); + + b.Property("PriceFloor") + .HasColumnType("bigint"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("UseCount") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("CorporateUserId"); + + 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") + .IsRequired() + .HasColumnType("text"); + + b.Property("DeliveredAt") + .HasColumnType("timestamp without time zone"); + + b.Property("DeliveryPrice") + .HasColumnType("double precision"); + + b.Property("DiscountCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("DiscountCodePrice") + .HasColumnType("double precision"); + + b.Property("DiscountId") + .HasColumnType("uuid"); + + b.Property("DiscountPrice") + .HasColumnType("double precision"); + + b.Property("DoneAt") + .HasColumnType("timestamp without time zone"); + + b.Property("FactorCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsPayed") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .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("ProductDiscountPrice") + .HasColumnType("double precision"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .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("AddressId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("DeliveryCost") + .HasColumnType("double precision"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("OrderId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ShippingId") + .HasColumnType("uuid"); + + b.Property("TrackingCode") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AddressId"); + + b.HasIndex("OrderId") + .IsUnique(); + + 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") + .IsRequired() + .HasColumnType("text"); + + b.Property("HasDiscount") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .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") + .IsRequired() + .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") + .IsRequired() + .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") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .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") + .IsRequired() + .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") + .IsRequired() + .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") + .IsRequired() + .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") + .IsRequired() + .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") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.Property("Rate") + .HasColumnType("real"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .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") + .IsRequired() + .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") + .IsRequired() + .HasColumnType("text"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .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") + .IsRequired() + .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") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .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("LatestVersionUsed") + .HasColumnType("double precision"); + + 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.NewsletterMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("NewsletterMembers", "public"); + }); + + modelBuilder.Entity("NetinaShop.Domain.Entities.Users.UserAddress", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Address") + .IsRequired() + .HasColumnType("text"); + + b.Property("BuildingUnit") + .IsRequired() + .HasColumnType("text"); + + b.Property("City") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .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") + .IsRequired() + .HasColumnType("text"); + + b.Property("Plaque") + .IsRequired() + .HasColumnType("text"); + + b.Property("PostalCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("Province") + .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") + .IsRequired() + .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") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .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") + .IsRequired() + .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") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("WarehouseName") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkingDays") + .HasColumnType("integer"); + + 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.Accounting.Payment", b => + { + b.HasOne("NetinaShop.Domain.Entities.Orders.Order", "Order") + .WithMany("Payments") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Order"); + + b.Navigation("User"); + }); + + 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.Discounts.Discount", b => + { + b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "CorporateUser") + .WithMany() + .HasForeignKey("CorporateUserId"); + + b.Navigation("CorporateUser"); + }); + + 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.Users.UserAddress", "Address") + .WithMany() + .HasForeignKey("AddressId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("NetinaShop.Domain.Entities.Orders.Order", "Order") + .WithOne("OrderDelivery") + .HasForeignKey("NetinaShop.Domain.Entities.Orders.OrderDelivery", "OrderId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("NetinaShop.Domain.Entities.Warehouses.Shipping", "Shipping") + .WithMany() + .HasForeignKey("ShippingId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Address"); + + 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("OrderDelivery"); + + b.Navigation("OrderProducts"); + + b.Navigation("Payments"); + }); + + 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/20240414120218_editDiscountAddFirstPurchase.cs b/NetinaShop.Repository/Migrations/20240414120218_editDiscountAddFirstPurchase.cs new file mode 100644 index 0000000..e526ccb --- /dev/null +++ b/NetinaShop.Repository/Migrations/20240414120218_editDiscountAddFirstPurchase.cs @@ -0,0 +1,1064 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace NetinaShop.Repository.Migrations +{ + /// + public partial class editDiscountAddFirstPurchase : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "UserFavoriteProducts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "UserFavoriteProducts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "UserFavoriteProducts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "UserAddresses", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "UserAddresses", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "UserAddresses", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "StorageFiles", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "StorageFiles", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "StorageFiles", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Specifications", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Specifications", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Specifications", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Shippings", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Shippings", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Shippings", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Reviews", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Reviews", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Reviews", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Products", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Products", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Products", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "ProductCategories", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "ProductCategories", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "ProductCategories", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Payments", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Payments", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Payments", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Orders", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Orders", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Orders", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "OrderProducts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "OrderProducts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "OrderProducts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "OrderDeliveries", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "OrderDeliveries", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "OrderDeliveries", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "NewsletterMembers", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "NewsletterMembers", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "NewsletterMembers", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Discounts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Discounts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Discounts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AddColumn( + name: "Description", + schema: "public", + table: "Discounts", + type: "text", + nullable: false, + defaultValue: ""); + + migrationBuilder.AddColumn( + name: "IsForFirstPurchase", + schema: "public", + table: "Discounts", + type: "boolean", + nullable: false, + defaultValue: false); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Brands", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Brands", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Brands", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Blogs", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Blogs", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Blogs", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "BlogCategories", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "BlogCategories", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "BlogCategories", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Description", + schema: "public", + table: "Discounts"); + + migrationBuilder.DropColumn( + name: "IsForFirstPurchase", + schema: "public", + table: "Discounts"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "UserFavoriteProducts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "UserFavoriteProducts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "UserFavoriteProducts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "UserAddresses", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "UserAddresses", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "UserAddresses", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "StorageFiles", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "StorageFiles", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "StorageFiles", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Specifications", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Specifications", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Specifications", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Shippings", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Shippings", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Shippings", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Reviews", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Reviews", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Reviews", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Products", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Products", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Products", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "ProductCategories", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "ProductCategories", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "ProductCategories", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Payments", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Payments", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Payments", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Orders", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Orders", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Orders", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "OrderProducts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "OrderProducts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "OrderProducts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "OrderDeliveries", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "OrderDeliveries", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "OrderDeliveries", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "NewsletterMembers", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "NewsletterMembers", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "NewsletterMembers", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Discounts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Discounts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Discounts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Brands", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Brands", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Brands", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Blogs", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Blogs", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Blogs", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "BlogCategories", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "BlogCategories", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "BlogCategories", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + } + } +} diff --git a/NetinaShop.Repository/Migrations/ApplicationContextModelSnapshot.cs b/NetinaShop.Repository/Migrations/ApplicationContextModelSnapshot.cs index 0597f15..ab415d9 100644 --- a/NetinaShop.Repository/Migrations/ApplicationContextModelSnapshot.cs +++ b/NetinaShop.Repository/Migrations/ApplicationContextModelSnapshot.cs @@ -147,6 +147,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("Description") @@ -164,6 +165,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("OrderId") @@ -173,6 +175,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("Status") @@ -214,6 +217,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("IsRemoved") @@ -226,6 +230,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("ReadingTime") @@ -235,6 +240,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("Summery") @@ -266,6 +272,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("Description") @@ -279,6 +286,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("Name") @@ -289,6 +297,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.HasKey("Id"); @@ -306,6 +315,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("Description") @@ -326,6 +336,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("PageUrl") @@ -340,6 +351,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.HasKey("Id"); @@ -370,6 +382,11 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() .HasColumnType("text"); b.Property("DiscountAmount") @@ -398,6 +415,9 @@ namespace NetinaShop.Repository.Migrations b.Property("Immortal") .HasColumnType("boolean"); + b.Property("IsForFirstPurchase") + .HasColumnType("boolean"); + b.Property("IsForInvitation") .HasColumnType("boolean"); @@ -417,6 +437,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("PriceCeiling") @@ -429,6 +450,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("StartDate") @@ -461,6 +483,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("DeliveredAt") @@ -499,6 +522,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("OrderAt") @@ -526,6 +550,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("ServicePrice") @@ -565,6 +590,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("DeliveryCost") @@ -577,6 +603,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("OrderId") @@ -586,6 +613,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("ShippingId") @@ -620,6 +648,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("HasDiscount") @@ -632,6 +661,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("OrderId") @@ -665,6 +695,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.HasKey("Id"); @@ -686,6 +717,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("Description") @@ -702,6 +734,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("Name") @@ -715,6 +748,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.HasKey("Id"); @@ -746,6 +780,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("EnglishName") @@ -772,6 +807,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("PackingCost") @@ -788,6 +824,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("ReviewCount") @@ -834,6 +871,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("IsBuyer") @@ -849,6 +887,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("ProductId") @@ -861,6 +900,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("Title") @@ -889,6 +929,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("Detail") @@ -905,6 +946,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("ParentId") @@ -917,6 +959,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("Title") @@ -946,6 +989,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("Discriminator") @@ -977,6 +1021,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("Name") @@ -987,6 +1032,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.HasKey("Id"); @@ -1136,6 +1182,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("Email") @@ -1149,6 +1196,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("PhoneNumber") @@ -1159,6 +1207,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.HasKey("Id"); @@ -1188,6 +1237,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("IsRemoved") @@ -1203,6 +1253,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("Plaque") @@ -1229,6 +1280,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("UserId") @@ -1251,6 +1303,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("IsRemoved") @@ -1260,6 +1313,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("ProductId") @@ -1269,6 +1323,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("UserId") @@ -1293,6 +1348,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("DeliveryCost") @@ -1314,6 +1370,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("Name") @@ -1324,6 +1381,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("WarehouseName")