diff --git a/NetinaShop.Api/Controller/ProductController.cs b/NetinaShop.Api/Controller/ProductController.cs index 6b85bad..a31e143 100644 --- a/NetinaShop.Api/Controller/ProductController.cs +++ b/NetinaShop.Api/Controller/ProductController.cs @@ -1,4 +1,6 @@ -namespace NetinaShop.Api.Controller; +using NetinaShop.Domain.Enums; + +namespace NetinaShop.Api.Controller; public class ProductController : ICarterModule { @@ -28,8 +30,8 @@ public class ProductController : ICarterModule } // GET:Get All Entity - public async Task GetAllAsync([FromQuery] int page, IMediator mediator, CancellationToken cancellationToken) - => TypedResults.Ok(await mediator.Send(new GetProductsQuery(page),cancellationToken)); + public async Task GetAllAsync([FromQuery] int page, [FromQuery] QuerySortBy? sortBy,[FromQuery] Guid? categoryId , [FromQuery]Guid? brandId , [FromQuery]double? minPrice , [FromQuery] double? maxPrice, IMediator mediator, CancellationToken cancellationToken) + => TypedResults.Ok(await mediator.Send(new GetProductsQuery(page,SortBy: sortBy ?? 0 , CategoryId: categoryId ?? default , BrandId: brandId ?? default , MinPrice: minPrice ?? -1 , MaxPrice:maxPrice ?? 0),cancellationToken)); // GET:Get An Entity By Id public async Task GetAsync(Guid id, IMediator mediator,CancellationToken cancellationToken) diff --git a/NetinaShop.Api/Controller/ProductReviewController.cs b/NetinaShop.Api/Controller/ProductReviewController.cs new file mode 100644 index 0000000..62f33d1 --- /dev/null +++ b/NetinaShop.Api/Controller/ProductReviewController.cs @@ -0,0 +1,46 @@ +namespace NetinaShop.Api.Controller; + +public class ProductReviewController : ICarterModule +{ + public void AddRoutes(IEndpointRouteBuilder app) + { + var group = app.NewVersionedApi("ProductReview") + .MapGroup("product/review") + .RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser()); + + group.MapGet("{id}", GetAsync) + .WithDisplayName("GetOneAsync") + .HasApiVersion(1.0); + + group.MapGet("", GetAllAsync) + .WithDisplayName("GetAllAsync") + .HasApiVersion(1.0); + + group.MapPost("", PostAsync) + .WithDisplayName("PostReview") + .HasApiVersion(1.0); + + group.MapPut("confirm/{id}", ConfirmAsync) + .WithDisplayName("ConfirmAsync") + .HasApiVersion(1.0); + + group.MapDelete("{id}", DeleteAsync) + .WithDisplayName("DeleteAsync") + .HasApiVersion(1.0); + } + + public async Task GetAllAsync([FromQuery] int page, IMediator mediator, CancellationToken cancellationToken) + => TypedResults.Ok(await mediator.Send(new GetReviewsQuery(page), cancellationToken)); + + public async Task GetAsync(Guid id, IMediator mediator, CancellationToken cancellationToken) + => TypedResults.Ok(await mediator.Send(new GetReviewQuery(id), cancellationToken)); + + public async Task PostAsync(CreateReviewCommand request, IMediator mediator, CancellationToken cancellationToken) + => TypedResults.Ok(await mediator.Send(request, cancellationToken)); + + public async Task ConfirmAsync(Guid id, IMediator mediator, CancellationToken cancellationToken) + => TypedResults.Ok(await mediator.Send(new ConfirmReviewCommand(id), cancellationToken)); + + public async Task DeleteAsync(Guid id, IMediator mediator, CancellationToken cancellationToken) + => TypedResults.Ok(await mediator.Send(new DeleteReviewCommand(id), cancellationToken)); +} \ No newline at end of file diff --git a/NetinaShop.Api/Controller/ShippingController.cs b/NetinaShop.Api/Controller/ShippingController.cs index bfa4ba8..b49047b 100644 --- a/NetinaShop.Api/Controller/ShippingController.cs +++ b/NetinaShop.Api/Controller/ShippingController.cs @@ -5,7 +5,7 @@ public class ShippingController : ICarterModule public virtual void AddRoutes(IEndpointRouteBuilder app) { - var group = app.NewVersionedApi("Warehouse") + var group = app.NewVersionedApi("WarehouseShipping") .MapGroup($"api/warehouse/shipping") .RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser()); diff --git a/NetinaShop.Repository/Handlers/Discounts/CalculateDiscountCommandHandler.cs b/NetinaShop.Core/EntityServices/DiscountHandlers/CalculateDiscountCommandHandler.cs similarity index 97% rename from NetinaShop.Repository/Handlers/Discounts/CalculateDiscountCommandHandler.cs rename to NetinaShop.Core/EntityServices/DiscountHandlers/CalculateDiscountCommandHandler.cs index ff855b3..878ade8 100644 --- a/NetinaShop.Repository/Handlers/Discounts/CalculateDiscountCommandHandler.cs +++ b/NetinaShop.Core/EntityServices/DiscountHandlers/CalculateDiscountCommandHandler.cs @@ -1,4 +1,4 @@ -namespace NetinaShop.Repository.Handlers.Discounts; +namespace NetinaShop.Core.EntityServices.DiscountHandlers; public class CalculateDiscountCommandHandler : IRequestHandler { diff --git a/NetinaShop.Repository/Handlers/OrderBags/AddToOrderBagCommandHandler.cs b/NetinaShop.Core/EntityServices/OrderBagHandlers/AddToOrderBagCommandHandler.cs similarity index 94% rename from NetinaShop.Repository/Handlers/OrderBags/AddToOrderBagCommandHandler.cs rename to NetinaShop.Core/EntityServices/OrderBagHandlers/AddToOrderBagCommandHandler.cs index caf1e13..d8beb89 100644 --- a/NetinaShop.Repository/Handlers/OrderBags/AddToOrderBagCommandHandler.cs +++ b/NetinaShop.Core/EntityServices/OrderBagHandlers/AddToOrderBagCommandHandler.cs @@ -1,6 +1,4 @@ -using NetinaShop.Domain.Entities.Orders; - -namespace NetinaShop.Repository.Handlers.OrderBags; +namespace NetinaShop.Core.EntityServices.OrderBagHandlers; public class AddToOrderBagCommandHandler : IRequestHandler { diff --git a/NetinaShop.Repository/Handlers/OrderBags/GetUserOrderBagQueryHandler.cs b/NetinaShop.Core/EntityServices/OrderBagHandlers/GetUserOrderBagQueryHandler.cs similarity index 94% rename from NetinaShop.Repository/Handlers/OrderBags/GetUserOrderBagQueryHandler.cs rename to NetinaShop.Core/EntityServices/OrderBagHandlers/GetUserOrderBagQueryHandler.cs index 90ac509..d9ad616 100644 --- a/NetinaShop.Repository/Handlers/OrderBags/GetUserOrderBagQueryHandler.cs +++ b/NetinaShop.Core/EntityServices/OrderBagHandlers/GetUserOrderBagQueryHandler.cs @@ -1,6 +1,4 @@ -using NetinaShop.Domain.Entities.Orders; - -namespace NetinaShop.Repository.Handlers.OrderBags; +namespace NetinaShop.Core.EntityServices.OrderBagHandlers; public class GetUserOrderBagQueryHandler : IRequestHandler { diff --git a/NetinaShop.Repository/Handlers/OrderBags/RemoveFromOrderBagCommandHandler.cs b/NetinaShop.Core/EntityServices/OrderBagHandlers/RemoveFromOrderBagCommandHandler.cs similarity index 94% rename from NetinaShop.Repository/Handlers/OrderBags/RemoveFromOrderBagCommandHandler.cs rename to NetinaShop.Core/EntityServices/OrderBagHandlers/RemoveFromOrderBagCommandHandler.cs index 061197d..79b62f9 100644 --- a/NetinaShop.Repository/Handlers/OrderBags/RemoveFromOrderBagCommandHandler.cs +++ b/NetinaShop.Core/EntityServices/OrderBagHandlers/RemoveFromOrderBagCommandHandler.cs @@ -1,6 +1,4 @@ -using Order = NetinaShop.Domain.Entities.Orders.Order; - -namespace NetinaShop.Repository.Handlers.OrderBags; +namespace NetinaShop.Core.EntityServices.OrderBagHandlers; public class RemoveFromOrderBagCommandHandler : IRequestHandler { diff --git a/NetinaShop.Repository/Handlers/OrderBags/SubmitDiscountCommandHandler.cs b/NetinaShop.Core/EntityServices/OrderBagHandlers/SubmitDiscountCommandHandler.cs similarity index 91% rename from NetinaShop.Repository/Handlers/OrderBags/SubmitDiscountCommandHandler.cs rename to NetinaShop.Core/EntityServices/OrderBagHandlers/SubmitDiscountCommandHandler.cs index 7ae463f..5e38de4 100644 --- a/NetinaShop.Repository/Handlers/OrderBags/SubmitDiscountCommandHandler.cs +++ b/NetinaShop.Core/EntityServices/OrderBagHandlers/SubmitDiscountCommandHandler.cs @@ -1,6 +1,4 @@ -using NetinaShop.Domain.Entities.Orders; - -namespace NetinaShop.Repository.Handlers.OrderBags; +namespace NetinaShop.Core.EntityServices.OrderBagHandlers; public class SubmitDiscountCommandHandler : IRequestHandler { diff --git a/NetinaShop.Repository/Handlers/OrderBags/SubmitOrderDeliveryCommandHandler.cs b/NetinaShop.Core/EntityServices/OrderBagHandlers/SubmitOrderDeliveryCommandHandler.cs similarity index 92% rename from NetinaShop.Repository/Handlers/OrderBags/SubmitOrderDeliveryCommandHandler.cs rename to NetinaShop.Core/EntityServices/OrderBagHandlers/SubmitOrderDeliveryCommandHandler.cs index f059e5b..547d710 100644 --- a/NetinaShop.Repository/Handlers/OrderBags/SubmitOrderDeliveryCommandHandler.cs +++ b/NetinaShop.Core/EntityServices/OrderBagHandlers/SubmitOrderDeliveryCommandHandler.cs @@ -1,7 +1,6 @@ -using NetinaShop.Domain.Entities.Orders; -using NetinaShop.Domain.Entities.Warehouses; +using NetinaShop.Domain.Entities.Warehouses; -namespace NetinaShop.Repository.Handlers.OrderBags; +namespace NetinaShop.Core.EntityServices.OrderBagHandlers; public class SubmitOrderDeliveryCommandHandler : IRequestHandler { diff --git a/NetinaShop.Repository/Handlers/OrderBags/SubmitOrderPaymentCommandHandler.cs b/NetinaShop.Core/EntityServices/OrderBagHandlers/SubmitOrderPaymentCommandHandler.cs similarity index 95% rename from NetinaShop.Repository/Handlers/OrderBags/SubmitOrderPaymentCommandHandler.cs rename to NetinaShop.Core/EntityServices/OrderBagHandlers/SubmitOrderPaymentCommandHandler.cs index 4fd0bfc..2fcfc47 100644 --- a/NetinaShop.Repository/Handlers/OrderBags/SubmitOrderPaymentCommandHandler.cs +++ b/NetinaShop.Core/EntityServices/OrderBagHandlers/SubmitOrderPaymentCommandHandler.cs @@ -1,6 +1,4 @@ -using NetinaShop.Domain.Entities.Orders; - -namespace NetinaShop.Repository.Handlers.OrderBags; +namespace NetinaShop.Core.EntityServices.OrderBagHandlers; public class SubmitOrderPaymentCommandHandler : IRequestHandler { diff --git a/NetinaShop.Repository/Handlers/Orders/CalculateOrderCommandHandler.cs b/NetinaShop.Core/EntityServices/OrderHandlers/CalculateOrderCommandHandler.cs similarity index 93% rename from NetinaShop.Repository/Handlers/Orders/CalculateOrderCommandHandler.cs rename to NetinaShop.Core/EntityServices/OrderHandlers/CalculateOrderCommandHandler.cs index 07da1bf..91a6178 100644 --- a/NetinaShop.Repository/Handlers/Orders/CalculateOrderCommandHandler.cs +++ b/NetinaShop.Core/EntityServices/OrderHandlers/CalculateOrderCommandHandler.cs @@ -1,7 +1,4 @@ -using Microsoft.IdentityModel.Tokens; -using NetinaShop.Domain.Entities.Orders; - -namespace NetinaShop.Repository.Handlers.Orders; +namespace NetinaShop.Core.EntityServices.OrderHandlers; public class CalculateOrderCommandHandler : IRequestHandler { diff --git a/NetinaShop.Core/EntityServices/ReviewHandlers/ConfirmReviewCommandHandler.cs b/NetinaShop.Core/EntityServices/ReviewHandlers/ConfirmReviewCommandHandler.cs new file mode 100644 index 0000000..9d23346 --- /dev/null +++ b/NetinaShop.Core/EntityServices/ReviewHandlers/ConfirmReviewCommandHandler.cs @@ -0,0 +1,23 @@ +namespace NetinaShop.Core.EntityServices.ReviewHandlers; + +public class ConfirmReviewCommandHandler : IRequestHandler +{ + private readonly IRepositoryWrapper _repositoryWrapper; + + public ConfirmReviewCommandHandler(IRepositoryWrapper repositoryWrapper) + { + _repositoryWrapper = repositoryWrapper; + } + public async Task Handle(ConfirmReviewCommand request, CancellationToken cancellationToken) + { + var review = await _repositoryWrapper.SetRepository().TableNoTracking + .FirstOrDefaultAsync(r => r.Id == request.Id, cancellationToken); + if (review == null) + throw new AppException("Review not found", ApiResultStatusCode.NotFound); + review.ConfirmReview(); + + _repositoryWrapper.SetRepository().Update(review); + await _repositoryWrapper.SaveChangesAsync(cancellationToken); + return true; + } +} \ No newline at end of file diff --git a/NetinaShop.Core/NetinaShop.Core.csproj b/NetinaShop.Core/NetinaShop.Core.csproj index 44bc97d..645548d 100644 --- a/NetinaShop.Core/NetinaShop.Core.csproj +++ b/NetinaShop.Core/NetinaShop.Core.csproj @@ -24,12 +24,14 @@ + + @@ -43,9 +45,14 @@ + + + + + diff --git a/NetinaShop.Domain/CommandQueries/Commands/ReviewCommands.cs b/NetinaShop.Domain/CommandQueries/Commands/ReviewCommands.cs new file mode 100644 index 0000000..551724c --- /dev/null +++ b/NetinaShop.Domain/CommandQueries/Commands/ReviewCommands.cs @@ -0,0 +1,6 @@ +namespace NetinaShop.Domain.CommandQueries.Commands; + +public sealed record CreateReviewCommand(string Title, string Comment, float Rate, bool IsBuyer, Guid ProductId, Guid UserId) : IRequest; +public sealed record UpdateReviewCommand(Guid Id,string Title, string Comment, float Rate, bool IsBuyer, Guid ProductId, Guid UserId): IRequest; +public sealed record ConfirmReviewCommand(Guid Id) : IRequest; +public sealed record DeleteReviewCommand(Guid Id) : IRequest; \ No newline at end of file diff --git a/NetinaShop.Domain/CommandQueries/Queries/ProductQueries.cs b/NetinaShop.Domain/CommandQueries/Queries/ProductQueries.cs index efe05ba..c6649ca 100644 --- a/NetinaShop.Domain/CommandQueries/Queries/ProductQueries.cs +++ b/NetinaShop.Domain/CommandQueries/Queries/ProductQueries.cs @@ -2,4 +2,4 @@ public sealed record GetProductQuery(Guid Id) : IRequest; -public sealed record GetProductsQuery(int Page = 0) : IRequest>; \ No newline at end of file +public sealed record GetProductsQuery(int Page = 0 , QuerySortBy SortBy = QuerySortBy.None , Guid CategoryId = default , Guid BrandId = default , double MinPrice = -1 , double MaxPrice = 0) : IRequest>; \ No newline at end of file diff --git a/NetinaShop.Domain/CommandQueries/Queries/ReviewQueries.cs b/NetinaShop.Domain/CommandQueries/Queries/ReviewQueries.cs new file mode 100644 index 0000000..fe2fd59 --- /dev/null +++ b/NetinaShop.Domain/CommandQueries/Queries/ReviewQueries.cs @@ -0,0 +1,4 @@ +namespace NetinaShop.Domain.CommandQueries.Queries; + +public record GetReviewsQuery(int Page = 0) : IRequest>; +public record GetReviewQuery(Guid Id) : IRequest; \ No newline at end of file diff --git a/NetinaShop.Domain/Dtos/LargDtos/ReviewLDto.cs b/NetinaShop.Domain/Dtos/LargDtos/ReviewLDto.cs new file mode 100644 index 0000000..0dcb45f --- /dev/null +++ b/NetinaShop.Domain/Dtos/LargDtos/ReviewLDto.cs @@ -0,0 +1,12 @@ +namespace NetinaShop.Domain.Dtos.LargDtos; + +public class ReviewLDto : BaseDto +{ + public string Title { get; set; } = string.Empty; + public string Comment { get; set; } = string.Empty; + public float Rate { get; set; } + public bool IsBuyer { get; set; } + public bool IsConfirmed { get; set; } + public Guid ProductId { get; set; } + public Guid UserId { get; set; } +} \ No newline at end of file diff --git a/NetinaShop.Domain/Entities/Products/Product.Aggregate.cs b/NetinaShop.Domain/Entities/Products/Product.Aggregate.cs index a2fbede..0aa2c30 100644 --- a/NetinaShop.Domain/Entities/Products/Product.Aggregate.cs +++ b/NetinaShop.Domain/Entities/Products/Product.Aggregate.cs @@ -2,10 +2,29 @@ public partial class Product { - public static Product Create(string persianName, string englishName, string summery, string expertCheck, string tags, string warranty, bool beDisplayed, double cost, double packingCost, Guid brandId,Guid categoryId) + public static Product Create(string persianName, string englishName, string summery, string expertCheck, string tags, string warranty, bool beDisplayed, double cost, double packingCost, + int reviewCount, + float reviewRate, + int viewed, + Guid brandId, + Guid categoryId) { - return new Product(persianName, englishName, summery, expertCheck, tags, warranty, beDisplayed,cost,packingCost, brandId,categoryId); + return new Product(persianName, englishName, summery, expertCheck, tags, warranty, beDisplayed,cost, packingCost, reviewCount, reviewRate, viewed, brandId,categoryId); } + + public void AddRate(float rate) + { + Rate = ((Rate * ReviewCount) + rate) / (ReviewCount + 1); + ReviewCount++; + } + + public void RemoveRate(float rate) + { + + Rate = ((Rate * ReviewCount) - rate) / (ReviewCount - 1); + ReviewCount--; + } + public ProductStorageFile AddFile(string name, string fileLocation, string fileName, bool isHeader, bool isPrimary, StorageFileType fileType) { var ent = ProductStorageFile.Create(name, fileLocation, fileName, isHeader, isPrimary, fileType, Id); @@ -37,6 +56,8 @@ public partial class Review return new Review(title, comment, rate, isBuyer, productId, userId); } + public void ConfirmReview() + => IsConfirmed = true; } public partial class Specification diff --git a/NetinaShop.Domain/Entities/Products/Product.cs b/NetinaShop.Domain/Entities/Products/Product.cs index b2223c8..156e1f0 100644 --- a/NetinaShop.Domain/Entities/Products/Product.cs +++ b/NetinaShop.Domain/Entities/Products/Product.cs @@ -10,7 +10,20 @@ public partial class Product : ApiEntity } - public Product(string persianName, string englishName, string summery, string expertCheck, string tags, string warranty, bool beDisplayed, double cost, double packingCost, Guid brandId, Guid categoryId) + public Product(string persianName, + string englishName, + string summery, + string expertCheck, + string tags, + string warranty, + bool beDisplayed, + double cost, + double packingCost, + int reviewCount, + float rate, + int viewed, + Guid brandId, + Guid categoryId) { PersianName = persianName; EnglishName = englishName; @@ -23,21 +36,27 @@ public partial class Product : ApiEntity PackingCost = packingCost; BrandId = brandId; CategoryId = categoryId; + ReviewCount = reviewCount; + Rate = rate; + Viewed = viewed; } public string PersianName { get; internal set; } = string.Empty; public string EnglishName { get; internal set; } = string.Empty; public string Summery { get; internal set; } = string.Empty; public string ExpertCheck { get; internal set; } = string.Empty; public string Tags { get; internal set; } = string.Empty; - public string Warranty { get; set; } = string.Empty; - public double Cost { get; set; } - public bool IsEnable { get; set; } - public bool BeDisplayed { get; set; } - public double PackingCost { get; set; } + public string Warranty { get; internal set; } = string.Empty; + public double Cost { get; internal set; } + public bool IsEnable { get; internal set; } + public bool BeDisplayed { get; internal set; } + public double PackingCost { get; internal set; } + public float Rate { get; internal set; } + public int ReviewCount { get; internal set; } + public int Viewed { get; internal set; } public Guid BrandId { get; internal set; } - public Brand? Brand { get; set; } + public Brand? Brand { get; internal set; } public Guid CategoryId { get; internal set; } public Category? Category { get; internal set; } diff --git a/NetinaShop.Domain/Entities/Products/Review.cs b/NetinaShop.Domain/Entities/Products/Review.cs index f22d10d..713cfae 100644 --- a/NetinaShop.Domain/Entities/Products/Review.cs +++ b/NetinaShop.Domain/Entities/Products/Review.cs @@ -23,6 +23,7 @@ public partial class Review : ApiEntity public string Comment { get; internal set; } = string.Empty; public float Rate { get; internal set; } public bool IsBuyer { get; internal set; } + public bool IsConfirmed { get; internal set; } public Guid ProductId { get; internal set; } public Product? Product { get; internal set; } diff --git a/NetinaShop.Domain/Enums/QuerySortBy.cs b/NetinaShop.Domain/Enums/QuerySortBy.cs new file mode 100644 index 0000000..fdd16a3 --- /dev/null +++ b/NetinaShop.Domain/Enums/QuerySortBy.cs @@ -0,0 +1,15 @@ +namespace NetinaShop.Domain.Enums; + +public enum QuerySortBy +{ + [Display(Name = "هیچکدام")] + None = 0, + [Display(Name = "پربازدید ترین")] + MostViewed = 1, + [Display(Name = "محبوب ترین")] + MostPopular = 2, + [Display(Name = "گرانترین")] + MostExpensive = 3, + [Display(Name = "ارزانترین")] + Cheapest = 4, +} \ No newline at end of file diff --git a/NetinaShop.Domain/Mappers/ReviewMapper.g.cs b/NetinaShop.Domain/Mappers/ReviewMapper.g.cs index 080d0ee..53d803c 100644 --- a/NetinaShop.Domain/Mappers/ReviewMapper.g.cs +++ b/NetinaShop.Domain/Mappers/ReviewMapper.g.cs @@ -1,5 +1,6 @@ using System; using System.Linq.Expressions; +using NetinaShop.Domain.Dtos.LargDtos; using NetinaShop.Domain.Dtos.SmallDtos; using NetinaShop.Domain.Entities.Products; @@ -7,7 +8,7 @@ namespace NetinaShop.Domain.Mappers { public static partial class ReviewMapper { - public static Review AdaptToReview(this ReviewSDto p1) + public static Review AdaptToReview(this ReviewLDto p1) { return p1 == null ? null : new Review() { @@ -15,12 +16,13 @@ namespace NetinaShop.Domain.Mappers Comment = p1.Comment, Rate = p1.Rate, IsBuyer = p1.IsBuyer, + IsConfirmed = p1.IsConfirmed, ProductId = p1.ProductId, UserId = p1.UserId, Id = p1.Id }; } - public static Review AdaptTo(this ReviewSDto p2, Review p3) + public static Review AdaptTo(this ReviewLDto p2, Review p3) { if (p2 == null) { @@ -32,52 +34,139 @@ namespace NetinaShop.Domain.Mappers result.Comment = p2.Comment; result.Rate = p2.Rate; result.IsBuyer = p2.IsBuyer; + result.IsConfirmed = p2.IsConfirmed; result.ProductId = p2.ProductId; result.UserId = p2.UserId; result.Id = p2.Id; return result; } - public static ReviewSDto AdaptToSDto(this Review p4) + public static Expression> ProjectToReview => p4 => new Review() { - return p4 == null ? null : new ReviewSDto() + Title = p4.Title, + Comment = p4.Comment, + Rate = p4.Rate, + IsBuyer = p4.IsBuyer, + IsConfirmed = p4.IsConfirmed, + ProductId = p4.ProductId, + UserId = p4.UserId, + Id = p4.Id + }; + public static ReviewLDto AdaptToLDto(this Review p5) + { + return p5 == null ? null : new ReviewLDto() { - Title = p4.Title, - Comment = p4.Comment, - Rate = p4.Rate, - IsBuyer = p4.IsBuyer, - ProductId = p4.ProductId, - UserId = p4.UserId, - Id = p4.Id + Title = p5.Title, + Comment = p5.Comment, + Rate = p5.Rate, + IsBuyer = p5.IsBuyer, + IsConfirmed = p5.IsConfirmed, + ProductId = p5.ProductId, + UserId = p5.UserId, + Id = p5.Id }; } - public static ReviewSDto AdaptTo(this Review p5, ReviewSDto p6) + public static ReviewLDto AdaptTo(this Review p6, ReviewLDto p7) { - if (p5 == null) + if (p6 == null) { return null; } - ReviewSDto result = p6 ?? new ReviewSDto(); + ReviewLDto result = p7 ?? new ReviewLDto(); - result.Title = p5.Title; - result.Comment = p5.Comment; - result.Rate = p5.Rate; - result.IsBuyer = p5.IsBuyer; - result.ProductId = p5.ProductId; - result.UserId = p5.UserId; - result.Id = p5.Id; + result.Title = p6.Title; + result.Comment = p6.Comment; + result.Rate = p6.Rate; + result.IsBuyer = p6.IsBuyer; + result.IsConfirmed = p6.IsConfirmed; + result.ProductId = p6.ProductId; + result.UserId = p6.UserId; + result.Id = p6.Id; return result; } - public static Expression> ProjectToSDto => p7 => new ReviewSDto() + public static Expression> ProjectToLDto => p8 => new ReviewLDto() { - Title = p7.Title, - Comment = p7.Comment, - Rate = p7.Rate, - IsBuyer = p7.IsBuyer, - ProductId = p7.ProductId, - UserId = p7.UserId, - Id = p7.Id + Title = p8.Title, + Comment = p8.Comment, + Rate = p8.Rate, + IsBuyer = p8.IsBuyer, + IsConfirmed = p8.IsConfirmed, + ProductId = p8.ProductId, + UserId = p8.UserId, + Id = p8.Id + }; + public static Review AdaptToReview(this ReviewSDto p9) + { + return p9 == null ? null : new Review() + { + Title = p9.Title, + Comment = p9.Comment, + Rate = p9.Rate, + IsBuyer = p9.IsBuyer, + ProductId = p9.ProductId, + UserId = p9.UserId, + Id = p9.Id + }; + } + public static Review AdaptTo(this ReviewSDto p10, Review p11) + { + if (p10 == null) + { + return null; + } + Review result = p11 ?? new Review(); + + result.Title = p10.Title; + result.Comment = p10.Comment; + result.Rate = p10.Rate; + result.IsBuyer = p10.IsBuyer; + result.ProductId = p10.ProductId; + result.UserId = p10.UserId; + result.Id = p10.Id; + return result; + + } + public static ReviewSDto AdaptToSDto(this Review p12) + { + return p12 == null ? null : new ReviewSDto() + { + Title = p12.Title, + Comment = p12.Comment, + Rate = p12.Rate, + IsBuyer = p12.IsBuyer, + ProductId = p12.ProductId, + UserId = p12.UserId, + Id = p12.Id + }; + } + public static ReviewSDto AdaptTo(this Review p13, ReviewSDto p14) + { + if (p13 == null) + { + return null; + } + ReviewSDto result = p14 ?? new ReviewSDto(); + + result.Title = p13.Title; + result.Comment = p13.Comment; + result.Rate = p13.Rate; + result.IsBuyer = p13.IsBuyer; + result.ProductId = p13.ProductId; + result.UserId = p13.UserId; + result.Id = p13.Id; + return result; + + } + public static Expression> ProjectToSDto => p15 => new ReviewSDto() + { + Title = p15.Title, + Comment = p15.Comment, + Rate = p15.Rate, + IsBuyer = p15.IsBuyer, + ProductId = p15.ProductId, + UserId = p15.UserId, + Id = p15.Id }; } } \ No newline at end of file diff --git a/NetinaShop.Repository/Handlers/Products/CreateProductCommandHandler.cs b/NetinaShop.Repository/Handlers/Products/CreateProductCommandHandler.cs index f1ed718..3f53771 100644 --- a/NetinaShop.Repository/Handlers/Products/CreateProductCommandHandler.cs +++ b/NetinaShop.Repository/Handlers/Products/CreateProductCommandHandler.cs @@ -12,7 +12,8 @@ public class CreateProductCommandHandler : IRequestHandler Handle(CreateProductCommand request, CancellationToken cancellationToken) { var ent = Product.Create(request.PersianName, request.EnglishName, request.Summery, request.ExpertCheck, - request.Tags, request.Warranty,request.BeDisplayed,request.Cost,request.PackingCost, request.BrandId,request.CategoryId); + request.Tags, request.Warranty,request.BeDisplayed,request.Cost,request.PackingCost,0,0,0, + request.BrandId,request.CategoryId); foreach (var specification in request.Specifications) { ent.AddSpecification(specification.Title, specification.Detail, specification.Value, diff --git a/NetinaShop.Repository/Handlers/Products/GetProductsQueryHandler.cs b/NetinaShop.Repository/Handlers/Products/GetProductsQueryHandler.cs index 553267d..c9d87b2 100644 --- a/NetinaShop.Repository/Handlers/Products/GetProductsQueryHandler.cs +++ b/NetinaShop.Repository/Handlers/Products/GetProductsQueryHandler.cs @@ -10,8 +10,35 @@ public class GetProductsQueryHandler : IRequestHandler> Handle(GetProductsQuery request, CancellationToken cancellationToken) { - return await _repositoryWrapper.SetRepository().TableNoTracking - .OrderByDescending(b => b.CreatedAt).Skip(request.Page * 10) + var products = _repositoryWrapper.SetRepository().TableNoTracking; + if (request.CategoryId != default) + products = products.Where(p => p.CategoryId == request.CategoryId); + if (request.BrandId != default) + products = products.Where(p => p.BrandId == request.BrandId); + if (request.MinPrice > -1) + products = products.Where(p => p.Cost >= request.MinPrice); + if (request.MaxPrice > 0) + products = products.Where(p => p.Cost <= request.MaxPrice); + if (request.SortBy != QuerySortBy.None) + { + switch (request.SortBy) + { + case QuerySortBy.Cheapest: + products = products.OrderBy(p => p.Cost); + break; + case QuerySortBy.MostExpensive: + products = products.OrderByDescending(p => p.Cost); + break; + case QuerySortBy.MostPopular: + products = products.OrderByDescending(p => p.Rate); + break; + case QuerySortBy.MostViewed: + products = products.OrderByDescending(p => p.Viewed); + break; + } + } + + return await products.Skip(request.Page * 10) .Take(10) .Select(ProductMapper.ProjectToSDto) .ToListAsync(cancellationToken); diff --git a/NetinaShop.Repository/Handlers/Products/UpdateProductCommandHandler.cs b/NetinaShop.Repository/Handlers/Products/UpdateProductCommandHandler.cs index 9fdf251..98ca611 100644 --- a/NetinaShop.Repository/Handlers/Products/UpdateProductCommandHandler.cs +++ b/NetinaShop.Repository/Handlers/Products/UpdateProductCommandHandler.cs @@ -16,7 +16,16 @@ public class UpdateProductCommandHandler : IRequestHandler().TableNoTracking @@ -29,6 +38,7 @@ public class UpdateProductCommandHandler : IRequestHandler s.Id == default)) { newEnt.AddSpecification(specification.Title, specification.Detail, specification.Value, specification.IsFeature, specification.ParentId); diff --git a/NetinaShop.Repository/Handlers/Reviews/CreateReviewCommandHandler.cs b/NetinaShop.Repository/Handlers/Reviews/CreateReviewCommandHandler.cs new file mode 100644 index 0000000..16ff545 --- /dev/null +++ b/NetinaShop.Repository/Handlers/Reviews/CreateReviewCommandHandler.cs @@ -0,0 +1,33 @@ +using AppException = NetinaShop.Common.Models.Exception.AppException; + +namespace NetinaShop.Repository.Handlers.Reviews; + +public class CreateReviewCommandHandler : IRequestHandler +{ + private readonly IRepositoryWrapper _repositoryWrapper; + + public CreateReviewCommandHandler(IRepositoryWrapper repositoryWrapper) + { + _repositoryWrapper = repositoryWrapper; + } + public async Task Handle(CreateReviewCommand request, CancellationToken cancellationToken) + { + var review = Review.Create(request.Title, request.Comment, request.Rate, request.IsBuyer, request.ProductId, + request.UserId); + var product = await _repositoryWrapper.SetRepository() + .TableNoTracking + .FirstOrDefaultAsync(p => p.Id == request.ProductId, cancellationToken); + if (product == null) + throw new AppException("Product not found",ApiResultStatusCode.NotFound); + + product.AddRate(request.Rate); + + _repositoryWrapper.SetRepository().Update(product); + await _repositoryWrapper.SaveChangesAsync(cancellationToken); + + _repositoryWrapper.SetRepository().Add(review); + await _repositoryWrapper.SaveChangesAsync(cancellationToken); + + return review.AdaptToSDto(); + } +} \ No newline at end of file diff --git a/NetinaShop.Repository/Handlers/Reviews/DeleteReviewCommandHandler.cs b/NetinaShop.Repository/Handlers/Reviews/DeleteReviewCommandHandler.cs new file mode 100644 index 0000000..e838605 --- /dev/null +++ b/NetinaShop.Repository/Handlers/Reviews/DeleteReviewCommandHandler.cs @@ -0,0 +1,22 @@ +namespace NetinaShop.Repository.Handlers.Reviews; + +public class DeleteReviewCommandHandler : IRequestHandler +{ + private readonly IRepositoryWrapper _repositoryWrapper; + + public DeleteReviewCommandHandler(IRepositoryWrapper repositoryWrapper) + { + _repositoryWrapper = repositoryWrapper; + } + public async Task Handle(DeleteReviewCommand request, CancellationToken cancellationToken) + { + var review = await _repositoryWrapper.SetRepository().TableNoTracking + .FirstOrDefaultAsync(r => r.Id == request.Id, cancellationToken); + if (review == null) + throw new AppException("Review not found", ApiResultStatusCode.NotFound); + + _repositoryWrapper.SetRepository().Delete(review); + await _repositoryWrapper.SaveChangesAsync(cancellationToken); + return true; + } +} \ No newline at end of file diff --git a/NetinaShop.Repository/Handlers/Reviews/GetReviewQueryHandler.cs b/NetinaShop.Repository/Handlers/Reviews/GetReviewQueryHandler.cs new file mode 100644 index 0000000..85d018e --- /dev/null +++ b/NetinaShop.Repository/Handlers/Reviews/GetReviewQueryHandler.cs @@ -0,0 +1,23 @@ +namespace NetinaShop.Repository.Handlers.Reviews; + +public class GetReviewQueryHandler : IRequestHandler +{ + private readonly IRepositoryWrapper _repositoryWrapper; + + public GetReviewQueryHandler(IRepositoryWrapper repositoryWrapper) + { + _repositoryWrapper = repositoryWrapper; + } + public async Task Handle(GetReviewQuery request, CancellationToken cancellationToken) + { + var review = await _repositoryWrapper.SetRepository() + .TableNoTracking + .Where(r => r.Id == request.Id) + .Select(ReviewMapper.ProjectToLDto) + .FirstOrDefaultAsync(cancellationToken); + if (review == null) + throw new AppException("Review not found", ApiResultStatusCode.NotFound); + + return review; + } +} \ No newline at end of file diff --git a/NetinaShop.Repository/Handlers/Reviews/GetReviewsQueryHandler.cs b/NetinaShop.Repository/Handlers/Reviews/GetReviewsQueryHandler.cs new file mode 100644 index 0000000..bbb646e --- /dev/null +++ b/NetinaShop.Repository/Handlers/Reviews/GetReviewsQueryHandler.cs @@ -0,0 +1,21 @@ +namespace NetinaShop.Repository.Handlers.Reviews; + +public class GetReviewsQueryHandler : IRequestHandler> +{ + private readonly IRepositoryWrapper _repositoryWrapper; + + public GetReviewsQueryHandler(IRepositoryWrapper repositoryWrapper) + { + _repositoryWrapper = repositoryWrapper; + } + public async Task> Handle(GetReviewsQuery request, CancellationToken cancellationToken) + { + return await _repositoryWrapper.SetRepository() + .TableNoTracking + .OrderByDescending(r => r.CreatedAt) + .Skip(request.Page * 15) + .Take(15) + .Select(ReviewMapper.ProjectToSDto) + .ToListAsync(cancellationToken); + } +} \ No newline at end of file diff --git a/NetinaShop.Repository/Migrations/20231231111356_Init.Designer.cs b/NetinaShop.Repository/Migrations/20231231111356_Init.Designer.cs deleted file mode 100644 index ec778f0..0000000 --- a/NetinaShop.Repository/Migrations/20231231111356_Init.Designer.cs +++ /dev/null @@ -1,1568 +0,0 @@ -// -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("20231231111356_Init")] - partial class Init - { - /// - protected override void BuildTargetModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("public") - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("text"); - - b.Property("ClaimValue") - .HasColumnType("text"); - - b.Property("RoleId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("RoleClaims", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("text"); - - b.Property("ClaimValue") - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Claims", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("text"); - - b.Property("ProviderKey") - .HasColumnType("text"); - - b.Property("ProviderDisplayName") - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("Logins", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uuid"); - - b.Property("RoleId") - .HasColumnType("uuid"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("UserRoles", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("uuid"); - - b.Property("LoginProvider") - .HasColumnType("text"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("Value") - .HasColumnType("text"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("Tokens", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.Blog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.Property("Content") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("IsSuggested") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("ReadingTime") - .HasColumnType("integer"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.Property("Summery") - .IsRequired() - .HasColumnType("text"); - - b.Property("Tags") - .IsRequired() - .HasColumnType("text"); - - b.Property("Title") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId"); - - b.ToTable("Blogs", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.BlogCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("BlogCategories", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Brands.Brand", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("HasSpecialPage") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("PageUrl") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Brands", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Categories.Category", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("ParentId") - .HasColumnType("uuid"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("Categories", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.Discount", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AmountType") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasColumnType("text"); - - b.Property("Count") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("DiscountAmount") - .HasColumnType("bigint"); - - b.Property("DiscountPercent") - .HasColumnType("integer"); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("character varying(21)"); - - b.Property("ExpireDate") - .HasColumnType("timestamp without time zone"); - - b.Property("HasCode") - .HasColumnType("boolean"); - - b.Property("HasPriceCeiling") - .HasColumnType("boolean"); - - b.Property("HasPriceFloor") - .HasColumnType("boolean"); - - b.Property("IsForInvitation") - .HasColumnType("boolean"); - - b.Property("IsInfinity") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("PriceCeiling") - .HasColumnType("bigint"); - - b.Property("PriceFloor") - .HasColumnType("bigint"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.Property("StartDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("integer"); - - b.Property("UseCount") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.ToTable("Discounts", "public"); - - b.HasDiscriminator("Discriminator").HasValue("Discount"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("DeliveryPrice") - .HasColumnType("double precision"); - - b.Property("DiscountCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("DiscountId") - .HasColumnType("uuid"); - - b.Property("DiscountPrice") - .HasColumnType("double precision"); - - b.Property("DoneAt") - .HasColumnType("timestamp without time zone"); - - b.Property("IsPayed") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("OrderAt") - .HasColumnType("timestamp without time zone"); - - b.Property("OrderStatus") - .HasColumnType("integer"); - - b.Property("PackingPrice") - .HasColumnType("double precision"); - - b.Property("PayedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("PaymentMethod") - .HasColumnType("integer"); - - b.Property("PreparingMinute") - .HasColumnType("integer"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.Property("ServicePrice") - .HasColumnType("double precision"); - - b.Property("TaxesPrice") - .HasColumnType("double precision"); - - b.Property("TotalPrice") - .HasColumnType("double precision"); - - b.Property("TotalProductsPrice") - .HasColumnType("double precision"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("DiscountId"); - - b.HasIndex("UserId"); - - b.ToTable("Orders", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.OrderDelivery", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Address") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("DeliveryCost") - .HasColumnType("double precision"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("PostalCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("ReceiverFullName") - .IsRequired() - .HasColumnType("text"); - - b.Property("ReceiverPhoneNumber") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.Property("ShippingId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.HasIndex("ShippingId"); - - b.ToTable("OrderDeliveries", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.OrderProduct", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Count") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("OrderProductStatus") - .HasColumnType("integer"); - - b.Property("PackingCost") - .HasColumnType("double precision"); - - b.Property("PackingFee") - .HasColumnType("double precision"); - - b.Property("ProductCategoryId") - .HasColumnType("uuid"); - - b.Property("ProductCost") - .HasColumnType("double precision"); - - b.Property("ProductFee") - .HasColumnType("double precision"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.HasIndex("ProductId"); - - b.ToTable("OrderProducts", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("BeDisplayed") - .HasColumnType("boolean"); - - b.Property("BrandId") - .HasColumnType("uuid"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.Property("Cost") - .HasColumnType("double precision"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("EnglishName") - .IsRequired() - .HasColumnType("text"); - - b.Property("ExpertCheck") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsEnable") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("PackingCost") - .HasColumnType("double precision"); - - b.Property("PersianName") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.Property("Summery") - .IsRequired() - .HasColumnType("text"); - - b.Property("Tags") - .IsRequired() - .HasColumnType("text"); - - b.Property("Warranty") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.ToTable("Products", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Review", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("IsBuyer") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("Rate") - .HasColumnType("real"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.Property("Title") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ProductId"); - - b.HasIndex("UserId"); - - b.ToTable("Reviews", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Specification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("Detail") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsFeature") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("ParentId") - .HasColumnType("uuid"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.Property("Title") - .IsRequired() - .HasColumnType("text"); - - b.Property("Value") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.HasIndex("ProductId"); - - b.ToTable("Specifications", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.StorageFiles.StorageFile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("character varying(21)"); - - b.Property("FileLocation") - .IsRequired() - .HasColumnType("text"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("text"); - - b.Property("FileType") - .HasColumnType("integer"); - - b.Property("IsHeader") - .HasColumnType("boolean"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("StorageFiles", "public"); - - b.HasDiscriminator("Discriminator").HasValue("StorageFile"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("EnglishName") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("PersianName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("Roles", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.ApplicationUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AccessFailedCount") - .HasColumnType("integer"); - - b.Property("BirthDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("boolean"); - - b.Property("FirstName") - .IsRequired() - .HasColumnType("text"); - - b.Property("Gender") - .HasColumnType("integer"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("text"); - - b.Property("LockoutEnabled") - .HasColumnType("boolean"); - - b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("NationalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("PasswordHash") - .HasColumnType("text"); - - b.Property("PhoneNumber") - .HasColumnType("text"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("boolean"); - - b.Property("SecurityStamp") - .HasColumnType("text"); - - b.Property("SignUpStatus") - .HasColumnType("integer"); - - b.Property("TwoFactorEnabled") - .HasColumnType("boolean"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("Users", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.UserAddress", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Address") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("LocationLat") - .HasColumnType("real"); - - b.Property("LocationLong") - .HasColumnType("real"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("PostalCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("ReceiverFullName") - .IsRequired() - .HasColumnType("text"); - - b.Property("ReceiverPhoneNumber") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserAddresses", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.UserFavoriteProduct", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ProductId"); - - b.HasIndex("UserId"); - - b.ToTable("UserFavoriteProducts", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Warehouses.Shipping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("DeliveryCost") - .HasColumnType("double precision"); - - b.Property("IsFastShipping") - .HasColumnType("boolean"); - - b.Property("IsOriginalWarehouse") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("IsShipBySeller") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.Property("Title") - .IsRequired() - .HasColumnType("text"); - - b.Property("WarehouseName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Shippings", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.CategoryDiscount", b => - { - b.HasBaseType("NetinaShop.Domain.Entities.Discounts.Discount"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.HasIndex("CategoryId"); - - b.HasDiscriminator().HasValue("CategoryDiscount"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.ProductDiscount", b => - { - b.HasBaseType("NetinaShop.Domain.Entities.Discounts.Discount"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.HasIndex("ProductId"); - - b.HasDiscriminator().HasValue("ProductDiscount"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.BlogStorageFile", b => - { - b.HasBaseType("NetinaShop.Domain.Entities.StorageFiles.StorageFile"); - - b.Property("BlogId") - .HasColumnType("uuid"); - - b.HasIndex("BlogId"); - - b.HasDiscriminator().HasValue("BlogStorageFile"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Brands.BrandStorageFile", b => - { - b.HasBaseType("NetinaShop.Domain.Entities.StorageFiles.StorageFile"); - - b.Property("BrandId") - .HasColumnType("uuid"); - - b.HasIndex("BrandId"); - - b.HasDiscriminator().HasValue("BrandStorageFile"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Categories.CategoryStorageFile", b => - { - b.HasBaseType("NetinaShop.Domain.Entities.StorageFiles.StorageFile"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.HasIndex("CategoryId"); - - b.HasDiscriminator().HasValue("CategoryStorageFile"); - }); - - 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) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.Blog", b => - { - b.HasOne("NetinaShop.Domain.Entities.Blogs.BlogCategory", "Category") - .WithMany("Blogs") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Categories.Category", b => - { - b.HasOne("NetinaShop.Domain.Entities.Categories.Category", "Parent") - .WithMany("Children") - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Parent"); - }); - - 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) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.OrderDelivery", b => - { - b.HasOne("NetinaShop.Domain.Entities.Orders.Order", "Order") - .WithMany("OrderDeliveries") - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("NetinaShop.Domain.Entities.Warehouses.Shipping", "Shipping") - .WithMany() - .HasForeignKey("ShippingId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - 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) - .IsRequired(); - - b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") - .WithMany("OrderProducts") - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Order"); - - b.Navigation("Product"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Product", b => - { - b.HasOne("NetinaShop.Domain.Entities.Brands.Brand", "Brand") - .WithMany("Products") - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("NetinaShop.Domain.Entities.Categories.Category", "Category") - .WithMany("Products") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - 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) - .IsRequired(); - - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - 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") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") - .WithMany("Specifications") - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - 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) - .IsRequired(); - - 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) - .IsRequired(); - - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Product"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.CategoryDiscount", b => - { - b.HasOne("NetinaShop.Domain.Entities.Categories.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - 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) - .IsRequired(); - - 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) - .IsRequired(); - - 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) - .IsRequired(); - - b.Navigation("Brand"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Categories.CategoryStorageFile", b => - { - b.HasOne("NetinaShop.Domain.Entities.Categories.Category", "Category") - .WithMany("Files") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - 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) - .IsRequired(); - - 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.Categories.Category", b => - { - b.Navigation("Children"); - - b.Navigation("Files"); - - b.Navigation("Products"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.Discount", b => - { - b.Navigation("Orders"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.Order", b => - { - b.Navigation("OrderDeliveries"); - - b.Navigation("OrderProducts"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.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/20231231111356_Init.cs b/NetinaShop.Repository/Migrations/20231231111356_Init.cs deleted file mode 100644 index 200b322..0000000 --- a/NetinaShop.Repository/Migrations/20231231111356_Init.cs +++ /dev/null @@ -1,1023 +0,0 @@ -using System; -using Microsoft.EntityFrameworkCore.Migrations; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace NetinaShop.Repository.Migrations -{ - /// - public partial class Init : Migration - { - /// - protected override void Up(MigrationBuilder migrationBuilder) - { - migrationBuilder.EnsureSchema( - name: "public"); - - migrationBuilder.CreateTable( - name: "BlogCategories", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "text", nullable: false), - Description = table.Column(type: "text", nullable: false), - RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedBy = table.Column(type: "text", nullable: true), - IsRemoved = table.Column(type: "boolean", nullable: false), - RemovedBy = table.Column(type: "text", nullable: true), - ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), - ModifiedBy = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_BlogCategories", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Brands", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "text", nullable: false), - Description = table.Column(type: "text", nullable: false), - HasSpecialPage = table.Column(type: "boolean", nullable: false), - PageUrl = table.Column(type: "text", nullable: false), - RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedBy = table.Column(type: "text", nullable: true), - IsRemoved = table.Column(type: "boolean", nullable: false), - RemovedBy = table.Column(type: "text", nullable: true), - ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), - ModifiedBy = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Brands", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Categories", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "text", nullable: false), - Description = table.Column(type: "text", nullable: false), - ParentId = table.Column(type: "uuid", nullable: false), - RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedBy = table.Column(type: "text", nullable: true), - IsRemoved = table.Column(type: "boolean", nullable: false), - RemovedBy = table.Column(type: "text", nullable: true), - ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), - ModifiedBy = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Categories", x => x.Id); - table.ForeignKey( - name: "FK_Categories_Categories_ParentId", - column: x => x.ParentId, - principalSchema: "public", - principalTable: "Categories", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Roles", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Description = table.Column(type: "text", nullable: false), - EnglishName = table.Column(type: "text", nullable: false), - PersianName = table.Column(type: "text", nullable: false), - Name = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - NormalizedName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - ConcurrencyStamp = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Roles", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Shippings", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Title = table.Column(type: "text", nullable: false), - WarehouseName = table.Column(type: "text", nullable: false), - IsFastShipping = table.Column(type: "boolean", nullable: false), - IsShipBySeller = table.Column(type: "boolean", nullable: false), - IsOriginalWarehouse = table.Column(type: "boolean", nullable: false), - DeliveryCost = table.Column(type: "double precision", nullable: false), - RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedBy = table.Column(type: "text", nullable: true), - IsRemoved = table.Column(type: "boolean", nullable: false), - RemovedBy = table.Column(type: "text", nullable: true), - ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), - ModifiedBy = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Shippings", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Users", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - FirstName = table.Column(type: "text", nullable: false), - LastName = table.Column(type: "text", nullable: false), - NationalId = table.Column(type: "text", nullable: false), - BirthDate = table.Column(type: "timestamp without time zone", nullable: false), - Gender = table.Column(type: "integer", nullable: false), - SignUpStatus = table.Column(type: "integer", nullable: false), - UserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - NormalizedUserName = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - Email = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - NormalizedEmail = table.Column(type: "character varying(256)", maxLength: 256, nullable: true), - EmailConfirmed = table.Column(type: "boolean", nullable: false), - PasswordHash = table.Column(type: "text", nullable: true), - SecurityStamp = table.Column(type: "text", nullable: true), - ConcurrencyStamp = table.Column(type: "text", nullable: true), - PhoneNumber = table.Column(type: "text", nullable: true), - PhoneNumberConfirmed = table.Column(type: "boolean", nullable: false), - TwoFactorEnabled = table.Column(type: "boolean", nullable: false), - LockoutEnd = table.Column(type: "timestamp with time zone", nullable: true), - LockoutEnabled = table.Column(type: "boolean", nullable: false), - AccessFailedCount = table.Column(type: "integer", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Users", x => x.Id); - }); - - migrationBuilder.CreateTable( - name: "Blogs", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Title = table.Column(type: "text", nullable: false), - Content = table.Column(type: "text", nullable: false), - Tags = table.Column(type: "text", nullable: false), - ReadingTime = table.Column(type: "integer", nullable: false), - Summery = table.Column(type: "text", nullable: false), - IsSuggested = table.Column(type: "boolean", nullable: false), - CategoryId = table.Column(type: "uuid", nullable: false), - RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedBy = table.Column(type: "text", nullable: true), - IsRemoved = table.Column(type: "boolean", nullable: false), - RemovedBy = table.Column(type: "text", nullable: true), - ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), - ModifiedBy = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Blogs", x => x.Id); - table.ForeignKey( - name: "FK_Blogs_BlogCategories_CategoryId", - column: x => x.CategoryId, - principalSchema: "public", - principalTable: "BlogCategories", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Products", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - PersianName = table.Column(type: "text", nullable: false), - EnglishName = table.Column(type: "text", nullable: false), - Summery = table.Column(type: "text", nullable: false), - ExpertCheck = table.Column(type: "text", nullable: false), - Tags = table.Column(type: "text", nullable: false), - Warranty = table.Column(type: "text", nullable: false), - Cost = table.Column(type: "double precision", nullable: false), - IsEnable = table.Column(type: "boolean", nullable: false), - BeDisplayed = table.Column(type: "boolean", nullable: false), - PackingCost = table.Column(type: "double precision", nullable: false), - BrandId = table.Column(type: "uuid", nullable: false), - CategoryId = table.Column(type: "uuid", nullable: false), - RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedBy = table.Column(type: "text", nullable: true), - IsRemoved = table.Column(type: "boolean", nullable: false), - RemovedBy = table.Column(type: "text", nullable: true), - ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), - ModifiedBy = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Products", x => x.Id); - table.ForeignKey( - name: "FK_Products_Brands_BrandId", - column: x => x.BrandId, - principalSchema: "public", - principalTable: "Brands", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Products_Categories_CategoryId", - column: x => x.CategoryId, - principalSchema: "public", - principalTable: "Categories", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "RoleClaims", - schema: "public", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - RoleId = table.Column(type: "uuid", nullable: false), - ClaimType = table.Column(type: "text", nullable: true), - ClaimValue = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_RoleClaims", x => x.Id); - table.ForeignKey( - name: "FK_RoleClaims_Roles_RoleId", - column: x => x.RoleId, - principalSchema: "public", - principalTable: "Roles", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Claims", - schema: "public", - columns: table => new - { - Id = table.Column(type: "integer", nullable: false) - .Annotation("Npgsql:ValueGenerationStrategy", NpgsqlValueGenerationStrategy.IdentityByDefaultColumn), - UserId = table.Column(type: "uuid", nullable: false), - ClaimType = table.Column(type: "text", nullable: true), - ClaimValue = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Claims", x => x.Id); - table.ForeignKey( - name: "FK_Claims_Users_UserId", - column: x => x.UserId, - principalSchema: "public", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Logins", - schema: "public", - columns: table => new - { - LoginProvider = table.Column(type: "text", nullable: false), - ProviderKey = table.Column(type: "text", nullable: false), - ProviderDisplayName = table.Column(type: "text", nullable: true), - UserId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_Logins", x => new { x.LoginProvider, x.ProviderKey }); - table.ForeignKey( - name: "FK_Logins_Users_UserId", - column: x => x.UserId, - principalSchema: "public", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Tokens", - schema: "public", - columns: table => new - { - UserId = table.Column(type: "uuid", nullable: false), - LoginProvider = table.Column(type: "text", nullable: false), - Name = table.Column(type: "text", nullable: false), - Value = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Tokens", x => new { x.UserId, x.LoginProvider, x.Name }); - table.ForeignKey( - name: "FK_Tokens_Users_UserId", - column: x => x.UserId, - principalSchema: "public", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "UserAddresses", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Address = table.Column(type: "text", nullable: false), - PostalCode = table.Column(type: "text", nullable: false), - ReceiverFullName = table.Column(type: "text", nullable: false), - ReceiverPhoneNumber = table.Column(type: "text", nullable: false), - LocationLat = table.Column(type: "real", nullable: false), - LocationLong = table.Column(type: "real", nullable: false), - UserId = table.Column(type: "uuid", nullable: false), - RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedBy = table.Column(type: "text", nullable: true), - IsRemoved = table.Column(type: "boolean", nullable: false), - RemovedBy = table.Column(type: "text", nullable: true), - ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), - ModifiedBy = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_UserAddresses", x => x.Id); - table.ForeignKey( - name: "FK_UserAddresses_Users_UserId", - column: x => x.UserId, - principalSchema: "public", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "UserRoles", - schema: "public", - columns: table => new - { - UserId = table.Column(type: "uuid", nullable: false), - RoleId = table.Column(type: "uuid", nullable: false) - }, - constraints: table => - { - table.PrimaryKey("PK_UserRoles", x => new { x.UserId, x.RoleId }); - table.ForeignKey( - name: "FK_UserRoles_Roles_RoleId", - column: x => x.RoleId, - principalSchema: "public", - principalTable: "Roles", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_UserRoles_Users_UserId", - column: x => x.UserId, - principalSchema: "public", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Discounts", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Code = table.Column(type: "text", nullable: false), - DiscountPercent = table.Column(type: "integer", nullable: false), - DiscountAmount = table.Column(type: "bigint", nullable: false), - HasCode = table.Column(type: "boolean", nullable: false), - AmountType = table.Column(type: "integer", nullable: false), - Type = table.Column(type: "integer", nullable: false), - Count = table.Column(type: "integer", nullable: false), - StartDate = table.Column(type: "timestamp without time zone", nullable: false), - ExpireDate = table.Column(type: "timestamp without time zone", nullable: false), - PriceFloor = table.Column(type: "bigint", nullable: false), - HasPriceFloor = table.Column(type: "boolean", nullable: false), - PriceCeiling = table.Column(type: "bigint", nullable: false), - HasPriceCeiling = table.Column(type: "boolean", nullable: false), - IsInfinity = table.Column(type: "boolean", nullable: false), - UseCount = table.Column(type: "bigint", nullable: false), - IsForInvitation = table.Column(type: "boolean", nullable: false), - Discriminator = table.Column(type: "character varying(21)", maxLength: 21, nullable: false), - CategoryId = table.Column(type: "uuid", nullable: true), - ProductId = table.Column(type: "uuid", nullable: true), - RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedBy = table.Column(type: "text", nullable: true), - IsRemoved = table.Column(type: "boolean", nullable: false), - RemovedBy = table.Column(type: "text", nullable: true), - ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), - ModifiedBy = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Discounts", x => x.Id); - table.ForeignKey( - name: "FK_Discounts_Categories_CategoryId", - column: x => x.CategoryId, - principalSchema: "public", - principalTable: "Categories", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Discounts_Products_ProductId", - column: x => x.ProductId, - principalSchema: "public", - principalTable: "Products", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Reviews", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Title = table.Column(type: "text", nullable: false), - Comment = table.Column(type: "text", nullable: false), - Rate = table.Column(type: "real", nullable: false), - IsBuyer = table.Column(type: "boolean", nullable: false), - ProductId = table.Column(type: "uuid", nullable: false), - UserId = table.Column(type: "uuid", nullable: false), - RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedBy = table.Column(type: "text", nullable: true), - IsRemoved = table.Column(type: "boolean", nullable: false), - RemovedBy = table.Column(type: "text", nullable: true), - ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), - ModifiedBy = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Reviews", x => x.Id); - table.ForeignKey( - name: "FK_Reviews_Products_ProductId", - column: x => x.ProductId, - principalSchema: "public", - principalTable: "Products", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Reviews_Users_UserId", - column: x => x.UserId, - principalSchema: "public", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Specifications", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Title = table.Column(type: "text", nullable: false), - Detail = table.Column(type: "text", nullable: false), - Value = table.Column(type: "text", nullable: false), - IsFeature = table.Column(type: "boolean", nullable: false), - ProductId = table.Column(type: "uuid", nullable: false), - ParentId = table.Column(type: "uuid", nullable: false), - RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedBy = table.Column(type: "text", nullable: true), - IsRemoved = table.Column(type: "boolean", nullable: false), - RemovedBy = table.Column(type: "text", nullable: true), - ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), - ModifiedBy = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Specifications", x => x.Id); - table.ForeignKey( - name: "FK_Specifications_Products_ProductId", - column: x => x.ProductId, - principalSchema: "public", - principalTable: "Products", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_Specifications_Specifications_ParentId", - column: x => x.ParentId, - principalSchema: "public", - principalTable: "Specifications", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "StorageFiles", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Name = table.Column(type: "text", nullable: false), - FileLocation = table.Column(type: "text", nullable: false), - FileName = table.Column(type: "text", nullable: false), - IsHeader = table.Column(type: "boolean", nullable: false), - IsPrimary = table.Column(type: "boolean", nullable: false), - FileType = table.Column(type: "integer", nullable: false), - Discriminator = table.Column(type: "character varying(21)", maxLength: 21, nullable: false), - BlogId = table.Column(type: "uuid", nullable: true), - BrandId = table.Column(type: "uuid", nullable: true), - CategoryId = table.Column(type: "uuid", nullable: true), - ProductId = table.Column(type: "uuid", nullable: true), - RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedBy = table.Column(type: "text", nullable: true), - IsRemoved = table.Column(type: "boolean", nullable: false), - RemovedBy = table.Column(type: "text", nullable: true), - ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), - ModifiedBy = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_StorageFiles", x => x.Id); - table.ForeignKey( - name: "FK_StorageFiles_Blogs_BlogId", - column: x => x.BlogId, - principalSchema: "public", - principalTable: "Blogs", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_StorageFiles_Brands_BrandId", - column: x => x.BrandId, - principalSchema: "public", - principalTable: "Brands", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_StorageFiles_Categories_CategoryId", - column: x => x.CategoryId, - principalSchema: "public", - principalTable: "Categories", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_StorageFiles_Products_ProductId", - column: x => x.ProductId, - principalSchema: "public", - principalTable: "Products", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "UserFavoriteProducts", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - ProductId = table.Column(type: "uuid", nullable: false), - UserId = table.Column(type: "uuid", nullable: false), - RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedBy = table.Column(type: "text", nullable: true), - IsRemoved = table.Column(type: "boolean", nullable: false), - RemovedBy = table.Column(type: "text", nullable: true), - ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), - ModifiedBy = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_UserFavoriteProducts", x => x.Id); - table.ForeignKey( - name: "FK_UserFavoriteProducts_Products_ProductId", - column: x => x.ProductId, - principalSchema: "public", - principalTable: "Products", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_UserFavoriteProducts_Users_UserId", - column: x => x.UserId, - principalSchema: "public", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "Orders", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - TotalProductsPrice = table.Column(type: "double precision", nullable: false), - PackingPrice = table.Column(type: "double precision", nullable: false), - ServicePrice = table.Column(type: "double precision", nullable: false), - DeliveryPrice = table.Column(type: "double precision", nullable: false), - DiscountPrice = table.Column(type: "double precision", nullable: false), - TaxesPrice = table.Column(type: "double precision", nullable: false), - TotalPrice = table.Column(type: "double precision", nullable: false), - IsPayed = table.Column(type: "boolean", nullable: false), - PayedAt = table.Column(type: "timestamp without time zone", nullable: false), - PaymentMethod = table.Column(type: "integer", nullable: false), - OrderStatus = table.Column(type: "integer", nullable: false), - DoneAt = table.Column(type: "timestamp without time zone", nullable: false), - OrderAt = table.Column(type: "timestamp without time zone", nullable: false), - PreparingMinute = table.Column(type: "integer", nullable: false), - DiscountCode = table.Column(type: "text", nullable: false), - UserId = table.Column(type: "uuid", nullable: false), - DiscountId = table.Column(type: "uuid", nullable: true), - RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedBy = table.Column(type: "text", nullable: true), - IsRemoved = table.Column(type: "boolean", nullable: false), - RemovedBy = table.Column(type: "text", nullable: true), - ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), - ModifiedBy = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_Orders", x => x.Id); - table.ForeignKey( - name: "FK_Orders_Discounts_DiscountId", - column: x => x.DiscountId, - principalSchema: "public", - principalTable: "Discounts", - principalColumn: "Id"); - table.ForeignKey( - name: "FK_Orders_Users_UserId", - column: x => x.UserId, - principalSchema: "public", - principalTable: "Users", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "OrderDeliveries", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Address = table.Column(type: "text", nullable: false), - PostalCode = table.Column(type: "text", nullable: false), - ReceiverPhoneNumber = table.Column(type: "text", nullable: false), - ReceiverFullName = table.Column(type: "text", nullable: false), - DeliveryCost = table.Column(type: "double precision", nullable: false), - ShippingId = table.Column(type: "uuid", nullable: false), - OrderId = table.Column(type: "uuid", nullable: false), - RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedBy = table.Column(type: "text", nullable: true), - IsRemoved = table.Column(type: "boolean", nullable: false), - RemovedBy = table.Column(type: "text", nullable: true), - ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), - ModifiedBy = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_OrderDeliveries", x => x.Id); - table.ForeignKey( - name: "FK_OrderDeliveries_Orders_OrderId", - column: x => x.OrderId, - principalSchema: "public", - principalTable: "Orders", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_OrderDeliveries_Shippings_ShippingId", - column: x => x.ShippingId, - principalSchema: "public", - principalTable: "Shippings", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateTable( - name: "OrderProducts", - schema: "public", - columns: table => new - { - Id = table.Column(type: "uuid", nullable: false), - Count = table.Column(type: "integer", nullable: false), - ProductFee = table.Column(type: "double precision", nullable: false), - ProductCost = table.Column(type: "double precision", nullable: false), - PackingFee = table.Column(type: "double precision", nullable: false), - PackingCost = table.Column(type: "double precision", nullable: false), - OrderProductStatus = table.Column(type: "integer", nullable: false), - ProductId = table.Column(type: "uuid", nullable: false), - ProductCategoryId = table.Column(type: "uuid", nullable: false), - OrderId = table.Column(type: "uuid", nullable: false), - RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), - CreatedBy = table.Column(type: "text", nullable: true), - IsRemoved = table.Column(type: "boolean", nullable: false), - RemovedBy = table.Column(type: "text", nullable: true), - ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), - ModifiedBy = table.Column(type: "text", nullable: true) - }, - constraints: table => - { - table.PrimaryKey("PK_OrderProducts", x => x.Id); - table.ForeignKey( - name: "FK_OrderProducts_Orders_OrderId", - column: x => x.OrderId, - principalSchema: "public", - principalTable: "Orders", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - table.ForeignKey( - name: "FK_OrderProducts_Products_ProductId", - column: x => x.ProductId, - principalSchema: "public", - principalTable: "Products", - principalColumn: "Id", - onDelete: ReferentialAction.Restrict); - }); - - migrationBuilder.CreateIndex( - name: "IX_Blogs_CategoryId", - schema: "public", - table: "Blogs", - column: "CategoryId"); - - migrationBuilder.CreateIndex( - name: "IX_Categories_ParentId", - schema: "public", - table: "Categories", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_Claims_UserId", - schema: "public", - table: "Claims", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_Discounts_CategoryId", - schema: "public", - table: "Discounts", - column: "CategoryId"); - - migrationBuilder.CreateIndex( - name: "IX_Discounts_ProductId", - schema: "public", - table: "Discounts", - column: "ProductId"); - - migrationBuilder.CreateIndex( - name: "IX_Logins_UserId", - schema: "public", - table: "Logins", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_OrderDeliveries_OrderId", - schema: "public", - table: "OrderDeliveries", - column: "OrderId"); - - migrationBuilder.CreateIndex( - name: "IX_OrderDeliveries_ShippingId", - schema: "public", - table: "OrderDeliveries", - column: "ShippingId"); - - migrationBuilder.CreateIndex( - name: "IX_OrderProducts_OrderId", - schema: "public", - table: "OrderProducts", - column: "OrderId"); - - migrationBuilder.CreateIndex( - name: "IX_OrderProducts_ProductId", - schema: "public", - table: "OrderProducts", - column: "ProductId"); - - migrationBuilder.CreateIndex( - name: "IX_Orders_DiscountId", - schema: "public", - table: "Orders", - column: "DiscountId"); - - migrationBuilder.CreateIndex( - name: "IX_Orders_UserId", - schema: "public", - table: "Orders", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_Products_BrandId", - schema: "public", - table: "Products", - column: "BrandId"); - - migrationBuilder.CreateIndex( - name: "IX_Products_CategoryId", - schema: "public", - table: "Products", - column: "CategoryId"); - - migrationBuilder.CreateIndex( - name: "IX_Reviews_ProductId", - schema: "public", - table: "Reviews", - column: "ProductId"); - - migrationBuilder.CreateIndex( - name: "IX_Reviews_UserId", - schema: "public", - table: "Reviews", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_RoleClaims_RoleId", - schema: "public", - table: "RoleClaims", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "RoleNameIndex", - schema: "public", - table: "Roles", - column: "NormalizedName", - unique: true); - - migrationBuilder.CreateIndex( - name: "IX_Specifications_ParentId", - schema: "public", - table: "Specifications", - column: "ParentId"); - - migrationBuilder.CreateIndex( - name: "IX_Specifications_ProductId", - schema: "public", - table: "Specifications", - column: "ProductId"); - - migrationBuilder.CreateIndex( - name: "IX_StorageFiles_BlogId", - schema: "public", - table: "StorageFiles", - column: "BlogId"); - - migrationBuilder.CreateIndex( - name: "IX_StorageFiles_BrandId", - schema: "public", - table: "StorageFiles", - column: "BrandId"); - - migrationBuilder.CreateIndex( - name: "IX_StorageFiles_CategoryId", - schema: "public", - table: "StorageFiles", - column: "CategoryId"); - - migrationBuilder.CreateIndex( - name: "IX_StorageFiles_ProductId", - schema: "public", - table: "StorageFiles", - column: "ProductId"); - - migrationBuilder.CreateIndex( - name: "IX_UserAddresses_UserId", - schema: "public", - table: "UserAddresses", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_UserFavoriteProducts_ProductId", - schema: "public", - table: "UserFavoriteProducts", - column: "ProductId"); - - migrationBuilder.CreateIndex( - name: "IX_UserFavoriteProducts_UserId", - schema: "public", - table: "UserFavoriteProducts", - column: "UserId"); - - migrationBuilder.CreateIndex( - name: "IX_UserRoles_RoleId", - schema: "public", - table: "UserRoles", - column: "RoleId"); - - migrationBuilder.CreateIndex( - name: "EmailIndex", - schema: "public", - table: "Users", - column: "NormalizedEmail"); - - migrationBuilder.CreateIndex( - name: "UserNameIndex", - schema: "public", - table: "Users", - column: "NormalizedUserName", - unique: true); - } - - /// - protected override void Down(MigrationBuilder migrationBuilder) - { - migrationBuilder.DropTable( - name: "Claims", - schema: "public"); - - migrationBuilder.DropTable( - name: "Logins", - schema: "public"); - - migrationBuilder.DropTable( - name: "OrderDeliveries", - schema: "public"); - - migrationBuilder.DropTable( - name: "OrderProducts", - schema: "public"); - - migrationBuilder.DropTable( - name: "Reviews", - schema: "public"); - - migrationBuilder.DropTable( - name: "RoleClaims", - schema: "public"); - - migrationBuilder.DropTable( - name: "Specifications", - schema: "public"); - - migrationBuilder.DropTable( - name: "StorageFiles", - schema: "public"); - - migrationBuilder.DropTable( - name: "Tokens", - schema: "public"); - - migrationBuilder.DropTable( - name: "UserAddresses", - schema: "public"); - - migrationBuilder.DropTable( - name: "UserFavoriteProducts", - schema: "public"); - - migrationBuilder.DropTable( - name: "UserRoles", - schema: "public"); - - migrationBuilder.DropTable( - name: "Shippings", - schema: "public"); - - migrationBuilder.DropTable( - name: "Orders", - schema: "public"); - - migrationBuilder.DropTable( - name: "Blogs", - schema: "public"); - - migrationBuilder.DropTable( - name: "Roles", - schema: "public"); - - migrationBuilder.DropTable( - name: "Discounts", - schema: "public"); - - migrationBuilder.DropTable( - name: "Users", - schema: "public"); - - migrationBuilder.DropTable( - name: "BlogCategories", - schema: "public"); - - migrationBuilder.DropTable( - name: "Products", - schema: "public"); - - migrationBuilder.DropTable( - name: "Brands", - schema: "public"); - - migrationBuilder.DropTable( - name: "Categories", - schema: "public"); - } - } -} diff --git a/NetinaShop.Repository/Migrations/ApplicationContextModelSnapshot.cs b/NetinaShop.Repository/Migrations/ApplicationContextModelSnapshot.cs deleted file mode 100644 index dee1753..0000000 --- a/NetinaShop.Repository/Migrations/ApplicationContextModelSnapshot.cs +++ /dev/null @@ -1,1565 +0,0 @@ -// -using System; -using Microsoft.EntityFrameworkCore; -using Microsoft.EntityFrameworkCore.Infrastructure; -using Microsoft.EntityFrameworkCore.Storage.ValueConversion; -using NetinaShop.Repository.Models; -using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; - -#nullable disable - -namespace NetinaShop.Repository.Migrations -{ - [DbContext(typeof(ApplicationContext))] - partial class ApplicationContextModelSnapshot : ModelSnapshot - { - protected override void BuildModel(ModelBuilder modelBuilder) - { -#pragma warning disable 612, 618 - modelBuilder - .HasDefaultSchema("public") - .HasAnnotation("ProductVersion", "8.0.0") - .HasAnnotation("Relational:MaxIdentifierLength", 63); - - NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("text"); - - b.Property("ClaimValue") - .HasColumnType("text"); - - b.Property("RoleId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("RoleId"); - - b.ToTable("RoleClaims", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("integer"); - - NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); - - b.Property("ClaimType") - .HasColumnType("text"); - - b.Property("ClaimValue") - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("Claims", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.Property("LoginProvider") - .HasColumnType("text"); - - b.Property("ProviderKey") - .HasColumnType("text"); - - b.Property("ProviderDisplayName") - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("LoginProvider", "ProviderKey"); - - b.HasIndex("UserId"); - - b.ToTable("Logins", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.Property("UserId") - .HasColumnType("uuid"); - - b.Property("RoleId") - .HasColumnType("uuid"); - - b.HasKey("UserId", "RoleId"); - - b.HasIndex("RoleId"); - - b.ToTable("UserRoles", "public"); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.Property("UserId") - .HasColumnType("uuid"); - - b.Property("LoginProvider") - .HasColumnType("text"); - - b.Property("Name") - .HasColumnType("text"); - - b.Property("Value") - .HasColumnType("text"); - - b.HasKey("UserId", "LoginProvider", "Name"); - - b.ToTable("Tokens", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.Blog", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.Property("Content") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("IsSuggested") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("ReadingTime") - .HasColumnType("integer"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.Property("Summery") - .IsRequired() - .HasColumnType("text"); - - b.Property("Tags") - .IsRequired() - .HasColumnType("text"); - - b.Property("Title") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("CategoryId"); - - b.ToTable("Blogs", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.BlogCategory", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("BlogCategories", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Brands.Brand", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("HasSpecialPage") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("PageUrl") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Brands", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Categories.Category", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("ParentId") - .HasColumnType("uuid"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.ToTable("Categories", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.Discount", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AmountType") - .HasColumnType("integer"); - - b.Property("Code") - .IsRequired() - .HasColumnType("text"); - - b.Property("Count") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("DiscountAmount") - .HasColumnType("bigint"); - - b.Property("DiscountPercent") - .HasColumnType("integer"); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("character varying(21)"); - - b.Property("ExpireDate") - .HasColumnType("timestamp without time zone"); - - b.Property("HasCode") - .HasColumnType("boolean"); - - b.Property("HasPriceCeiling") - .HasColumnType("boolean"); - - b.Property("HasPriceFloor") - .HasColumnType("boolean"); - - b.Property("IsForInvitation") - .HasColumnType("boolean"); - - b.Property("IsInfinity") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("PriceCeiling") - .HasColumnType("bigint"); - - b.Property("PriceFloor") - .HasColumnType("bigint"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.Property("StartDate") - .HasColumnType("timestamp without time zone"); - - b.Property("Type") - .HasColumnType("integer"); - - b.Property("UseCount") - .HasColumnType("bigint"); - - b.HasKey("Id"); - - b.ToTable("Discounts", "public"); - - b.HasDiscriminator("Discriminator").HasValue("Discount"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.Order", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("DeliveryPrice") - .HasColumnType("double precision"); - - b.Property("DiscountCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("DiscountId") - .HasColumnType("uuid"); - - b.Property("DiscountPrice") - .HasColumnType("double precision"); - - b.Property("DoneAt") - .HasColumnType("timestamp without time zone"); - - b.Property("IsPayed") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("OrderAt") - .HasColumnType("timestamp without time zone"); - - b.Property("OrderStatus") - .HasColumnType("integer"); - - b.Property("PackingPrice") - .HasColumnType("double precision"); - - b.Property("PayedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("PaymentMethod") - .HasColumnType("integer"); - - b.Property("PreparingMinute") - .HasColumnType("integer"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.Property("ServicePrice") - .HasColumnType("double precision"); - - b.Property("TaxesPrice") - .HasColumnType("double precision"); - - b.Property("TotalPrice") - .HasColumnType("double precision"); - - b.Property("TotalProductsPrice") - .HasColumnType("double precision"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("DiscountId"); - - b.HasIndex("UserId"); - - b.ToTable("Orders", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.OrderDelivery", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Address") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("DeliveryCost") - .HasColumnType("double precision"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("PostalCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("ReceiverFullName") - .IsRequired() - .HasColumnType("text"); - - b.Property("ReceiverPhoneNumber") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.Property("ShippingId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.HasIndex("ShippingId"); - - b.ToTable("OrderDeliveries", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.OrderProduct", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Count") - .HasColumnType("integer"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("OrderId") - .HasColumnType("uuid"); - - b.Property("OrderProductStatus") - .HasColumnType("integer"); - - b.Property("PackingCost") - .HasColumnType("double precision"); - - b.Property("PackingFee") - .HasColumnType("double precision"); - - b.Property("ProductCategoryId") - .HasColumnType("uuid"); - - b.Property("ProductCost") - .HasColumnType("double precision"); - - b.Property("ProductFee") - .HasColumnType("double precision"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("OrderId"); - - b.HasIndex("ProductId"); - - b.ToTable("OrderProducts", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Product", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("BeDisplayed") - .HasColumnType("boolean"); - - b.Property("BrandId") - .HasColumnType("uuid"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.Property("Cost") - .HasColumnType("double precision"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("EnglishName") - .IsRequired() - .HasColumnType("text"); - - b.Property("ExpertCheck") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsEnable") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("PackingCost") - .HasColumnType("double precision"); - - b.Property("PersianName") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.Property("Summery") - .IsRequired() - .HasColumnType("text"); - - b.Property("Tags") - .IsRequired() - .HasColumnType("text"); - - b.Property("Warranty") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("BrandId"); - - b.HasIndex("CategoryId"); - - b.ToTable("Products", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Review", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("IsBuyer") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("Rate") - .HasColumnType("real"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.Property("Title") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ProductId"); - - b.HasIndex("UserId"); - - b.ToTable("Reviews", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Specification", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("Detail") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsFeature") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("ParentId") - .HasColumnType("uuid"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.Property("Title") - .IsRequired() - .HasColumnType("text"); - - b.Property("Value") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("ParentId"); - - b.HasIndex("ProductId"); - - b.ToTable("Specifications", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.StorageFiles.StorageFile", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("Discriminator") - .IsRequired() - .HasMaxLength(21) - .HasColumnType("character varying(21)"); - - b.Property("FileLocation") - .IsRequired() - .HasColumnType("text"); - - b.Property("FileName") - .IsRequired() - .HasColumnType("text"); - - b.Property("FileType") - .HasColumnType("integer"); - - b.Property("IsHeader") - .HasColumnType("boolean"); - - b.Property("IsPrimary") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("Name") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("StorageFiles", "public"); - - b.HasDiscriminator("Discriminator").HasValue("StorageFile"); - - b.UseTphMappingStrategy(); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.ApplicationRole", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text"); - - b.Property("Description") - .IsRequired() - .HasColumnType("text"); - - b.Property("EnglishName") - .IsRequired() - .HasColumnType("text"); - - b.Property("Name") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("NormalizedName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("PersianName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedName") - .IsUnique() - .HasDatabaseName("RoleNameIndex"); - - b.ToTable("Roles", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.ApplicationUser", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("AccessFailedCount") - .HasColumnType("integer"); - - b.Property("BirthDate") - .HasColumnType("timestamp without time zone"); - - b.Property("ConcurrencyStamp") - .IsConcurrencyToken() - .HasColumnType("text"); - - b.Property("Email") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("EmailConfirmed") - .HasColumnType("boolean"); - - b.Property("FirstName") - .IsRequired() - .HasColumnType("text"); - - b.Property("Gender") - .HasColumnType("integer"); - - b.Property("LastName") - .IsRequired() - .HasColumnType("text"); - - b.Property("LockoutEnabled") - .HasColumnType("boolean"); - - b.Property("LockoutEnd") - .HasColumnType("timestamp with time zone"); - - b.Property("NationalId") - .IsRequired() - .HasColumnType("text"); - - b.Property("NormalizedEmail") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("NormalizedUserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.Property("PasswordHash") - .HasColumnType("text"); - - b.Property("PhoneNumber") - .HasColumnType("text"); - - b.Property("PhoneNumberConfirmed") - .HasColumnType("boolean"); - - b.Property("SecurityStamp") - .HasColumnType("text"); - - b.Property("SignUpStatus") - .HasColumnType("integer"); - - b.Property("TwoFactorEnabled") - .HasColumnType("boolean"); - - b.Property("UserName") - .HasMaxLength(256) - .HasColumnType("character varying(256)"); - - b.HasKey("Id"); - - b.HasIndex("NormalizedEmail") - .HasDatabaseName("EmailIndex"); - - b.HasIndex("NormalizedUserName") - .IsUnique() - .HasDatabaseName("UserNameIndex"); - - b.ToTable("Users", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.UserAddress", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Address") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("LocationLat") - .HasColumnType("real"); - - b.Property("LocationLong") - .HasColumnType("real"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("PostalCode") - .IsRequired() - .HasColumnType("text"); - - b.Property("ReceiverFullName") - .IsRequired() - .HasColumnType("text"); - - b.Property("ReceiverPhoneNumber") - .IsRequired() - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("UserId"); - - b.ToTable("UserAddresses", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.UserFavoriteProduct", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ProductId"); - - b.HasIndex("UserId"); - - b.ToTable("UserFavoriteProducts", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Warehouses.Shipping", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .HasColumnType("text"); - - b.Property("DeliveryCost") - .HasColumnType("double precision"); - - b.Property("IsFastShipping") - .HasColumnType("boolean"); - - b.Property("IsOriginalWarehouse") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("IsShipBySeller") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .HasColumnType("text"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .HasColumnType("text"); - - b.Property("Title") - .IsRequired() - .HasColumnType("text"); - - b.Property("WarehouseName") - .IsRequired() - .HasColumnType("text"); - - b.HasKey("Id"); - - b.ToTable("Shippings", "public"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.CategoryDiscount", b => - { - b.HasBaseType("NetinaShop.Domain.Entities.Discounts.Discount"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.HasIndex("CategoryId"); - - b.HasDiscriminator().HasValue("CategoryDiscount"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.ProductDiscount", b => - { - b.HasBaseType("NetinaShop.Domain.Entities.Discounts.Discount"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.HasIndex("ProductId"); - - b.HasDiscriminator().HasValue("ProductDiscount"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.BlogStorageFile", b => - { - b.HasBaseType("NetinaShop.Domain.Entities.StorageFiles.StorageFile"); - - b.Property("BlogId") - .HasColumnType("uuid"); - - b.HasIndex("BlogId"); - - b.HasDiscriminator().HasValue("BlogStorageFile"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Brands.BrandStorageFile", b => - { - b.HasBaseType("NetinaShop.Domain.Entities.StorageFiles.StorageFile"); - - b.Property("BrandId") - .HasColumnType("uuid"); - - b.HasIndex("BrandId"); - - b.HasDiscriminator().HasValue("BrandStorageFile"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Categories.CategoryStorageFile", b => - { - b.HasBaseType("NetinaShop.Domain.Entities.StorageFiles.StorageFile"); - - b.Property("CategoryId") - .HasColumnType("uuid"); - - b.HasIndex("CategoryId"); - - b.HasDiscriminator().HasValue("CategoryStorageFile"); - }); - - 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) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => - { - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => - { - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => - { - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationRole", null) - .WithMany() - .HasForeignKey("RoleId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => - { - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.Blog", b => - { - b.HasOne("NetinaShop.Domain.Entities.Blogs.BlogCategory", "Category") - .WithMany("Blogs") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Category"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Categories.Category", b => - { - b.HasOne("NetinaShop.Domain.Entities.Categories.Category", "Parent") - .WithMany("Children") - .HasForeignKey("ParentId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Parent"); - }); - - 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) - .IsRequired(); - - b.Navigation("User"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.OrderDelivery", b => - { - b.HasOne("NetinaShop.Domain.Entities.Orders.Order", "Order") - .WithMany("OrderDeliveries") - .HasForeignKey("OrderId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("NetinaShop.Domain.Entities.Warehouses.Shipping", "Shipping") - .WithMany() - .HasForeignKey("ShippingId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - 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) - .IsRequired(); - - b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") - .WithMany("OrderProducts") - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Order"); - - b.Navigation("Product"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Product", b => - { - b.HasOne("NetinaShop.Domain.Entities.Brands.Brand", "Brand") - .WithMany("Products") - .HasForeignKey("BrandId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("NetinaShop.Domain.Entities.Categories.Category", "Category") - .WithMany("Products") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - 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) - .IsRequired(); - - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - 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") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") - .WithMany("Specifications") - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - 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) - .IsRequired(); - - 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) - .IsRequired(); - - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - b.Navigation("Product"); - - b.Navigation("User"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.CategoryDiscount", b => - { - b.HasOne("NetinaShop.Domain.Entities.Categories.Category", "Category") - .WithMany() - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - 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) - .IsRequired(); - - 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) - .IsRequired(); - - 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) - .IsRequired(); - - b.Navigation("Brand"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Categories.CategoryStorageFile", b => - { - b.HasOne("NetinaShop.Domain.Entities.Categories.Category", "Category") - .WithMany("Files") - .HasForeignKey("CategoryId") - .OnDelete(DeleteBehavior.Restrict) - .IsRequired(); - - 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) - .IsRequired(); - - 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.Categories.Category", b => - { - b.Navigation("Children"); - - b.Navigation("Files"); - - b.Navigation("Products"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.Discount", b => - { - b.Navigation("Orders"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.Order", b => - { - b.Navigation("OrderDeliveries"); - - b.Navigation("OrderProducts"); - }); - - modelBuilder.Entity("NetinaShop.Domain.Entities.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 - } - } -}