From 908424f9bee780f8e8c33625f30994a8e0fbe85d Mon Sep 17 00:00:00 2001 From: "Amir.H Khademi" Date: Wed, 25 Sep 2024 17:08:35 +0330 Subject: [PATCH] change to comment --- ...mentController.cs => CommentController.cs} | 16 +- Netina.Api/Controllers/DashboardController.cs | 2 - Netina.Api/Controllers/ProductController.cs | 2 +- Netina.Domain/Dtos/LargDtos/CommentLDto.cs | 2 +- Netina.Domain/Dtos/LargDtos/ProductLDto.cs | 1 - Netina.Domain/Dtos/SmallDtos/CommentSDto.cs | 4 +- Netina.Domain/Entities/Products/Product.cs | 2 +- Netina.Domain/Mappers/CommentMapper.g.cs | 217 +- Netina.Domain/Mappers/ProductMapper.g.cs | 945 ++++---- Netina.Domain/MapsterRegister.cs | 32 +- .../Comments/CreateCommentCommandHandler.cs | 12 +- .../Comments/GetCommentsQueryHandler.cs | 2 + .../CreateCommentCommandValidator.cs | 5 - .../UpdateCommentCommandValidator.cs | 5 - ...20240924112404_ChangeToComment.Designer.cs | 2119 +++++++++++++++++ .../20240924112404_ChangeToComment.cs | 162 ++ .../ApplicationContextModelSnapshot.cs | 230 +- 17 files changed, 3014 insertions(+), 744 deletions(-) rename Netina.Api/Controllers/{ProductCommentController.cs => CommentController.cs} (85%) create mode 100644 Netina.Repository/Migrations/20240924112404_ChangeToComment.Designer.cs create mode 100644 Netina.Repository/Migrations/20240924112404_ChangeToComment.cs diff --git a/Netina.Api/Controllers/ProductCommentController.cs b/Netina.Api/Controllers/CommentController.cs similarity index 85% rename from Netina.Api/Controllers/ProductCommentController.cs rename to Netina.Api/Controllers/CommentController.cs index aaa76af..339c4f7 100644 --- a/Netina.Api/Controllers/ProductCommentController.cs +++ b/Netina.Api/Controllers/CommentController.cs @@ -1,34 +1,34 @@ namespace Netina.Api.Controllers; -public class ProductCommentController : ICarterModule +public class CommentController : ICarterModule { public void AddRoutes(IEndpointRouteBuilder app) { - var group = app.NewVersionedApi("ProductComment") - .MapGroup("api/product/comment"); + var group = app.NewVersionedApi("Comments") + .MapGroup("api/comment"); group.MapGet("{id}", GetAsync) - .WithDisplayName("Get Product Comment") + .WithDisplayName("Get Comment") .RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewAllReviews,ApplicationPermission.ManageReview)) .HasApiVersion(1.0); group.MapGet("", GetAllAsync) - .WithDisplayName("Get Product Comments") + .WithDisplayName("Get Comments") .RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ViewAllReviews, ApplicationPermission.ManageReview)) .HasApiVersion(1.0); group.MapPost("", PostAsync) - .WithDisplayName("Create Product Comment") + .WithDisplayName("Create Comment") .RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser()) .HasApiVersion(1.0); group.MapPut("confirm/{id}", ConfirmAsync) - .WithDisplayName("Confirm Product Comment") + .WithDisplayName("Confirm Comment") .RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ConfirmReview, ApplicationPermission.ManageReview)) .HasApiVersion(1.0); group.MapDelete("{id}", DeleteAsync) - .WithDisplayName("Delete Product Comment") + .WithDisplayName("Delete Comment") .RequireAuthorization(builder => builder.AddAuthenticationSchemes("Bearer").RequireAuthenticatedUser().RequireClaim(CustomClaimType.Permission, ApplicationPermission.ManageReview)) .HasApiVersion(1.0); } diff --git a/Netina.Api/Controllers/DashboardController.cs b/Netina.Api/Controllers/DashboardController.cs index c4196e9..67e2ee9 100644 --- a/Netina.Api/Controllers/DashboardController.cs +++ b/Netina.Api/Controllers/DashboardController.cs @@ -15,8 +15,6 @@ public class DashboardController : ICarterModule group.MapGet("orders", GetOrdersDashboardAsync) .WithDisplayName("Get Orders Dashboard") .HasApiVersion(1.0); - - } private async Task GetOrdersDashboardAsync([FromServices] IDashboardService dashboardService, CancellationToken cancellationToken) diff --git a/Netina.Api/Controllers/ProductController.cs b/Netina.Api/Controllers/ProductController.cs index 16d477a..43e4e05 100644 --- a/Netina.Api/Controllers/ProductController.cs +++ b/Netina.Api/Controllers/ProductController.cs @@ -39,7 +39,7 @@ public class ProductController : ICarterModule .HasApiVersion(1.0); group.MapGet("{productId}/comment",GetProductCommentsAsync) - .WithDisplayName("Get Product Reviews") + .WithDisplayName("Get Product Comments") .HasApiVersion(1.0); group.MapDelete("{id}", Delete) diff --git a/Netina.Domain/Dtos/LargDtos/CommentLDto.cs b/Netina.Domain/Dtos/LargDtos/CommentLDto.cs index f7438cd..4e0dd06 100644 --- a/Netina.Domain/Dtos/LargDtos/CommentLDto.cs +++ b/Netina.Domain/Dtos/LargDtos/CommentLDto.cs @@ -5,7 +5,7 @@ namespace Netina.Domain.Dtos.LargDtos; public class CommentLDto : BaseDto { public string Title { get; set; } = string.Empty; - public string Comment { get; set; } = string.Empty; + public string Content { get; set; } = string.Empty; public float Rate { get; set; } public bool IsBuyer { get; set; } public bool IsConfirmed { get; set; } diff --git a/Netina.Domain/Dtos/LargDtos/ProductLDto.cs b/Netina.Domain/Dtos/LargDtos/ProductLDto.cs index 6785f5e..810eada 100644 --- a/Netina.Domain/Dtos/LargDtos/ProductLDto.cs +++ b/Netina.Domain/Dtos/LargDtos/ProductLDto.cs @@ -27,7 +27,6 @@ public class ProductLDto : BaseDto public bool IsSpecialOffer { get; set; } public List Specifications { get; set; } = new(); - public List Reviews { get; set; } = new(); public List Files { get; set; } = new(); public DiscountSDto? SpecialOffer { get; set; } diff --git a/Netina.Domain/Dtos/SmallDtos/CommentSDto.cs b/Netina.Domain/Dtos/SmallDtos/CommentSDto.cs index 4016ee6..08c1152 100644 --- a/Netina.Domain/Dtos/SmallDtos/CommentSDto.cs +++ b/Netina.Domain/Dtos/SmallDtos/CommentSDto.cs @@ -6,9 +6,7 @@ public class CommentSDto : BaseDto { public string Title { get; set; } = string.Empty; public string Content { get; set; } = string.Empty; - public string FullName { get; set; } = string.Empty; - public string Email { get; set; } = string.Empty; - public string PhoneNumber { get; set; } = string.Empty; + public bool IsAdmin { get; internal set; } public bool IsConfirmed { get; set; } public Guid ParentId { get; set; } public Guid UserId { get; set; } diff --git a/Netina.Domain/Entities/Products/Product.cs b/Netina.Domain/Entities/Products/Product.cs index e326edb..62e4d3f 100644 --- a/Netina.Domain/Entities/Products/Product.cs +++ b/Netina.Domain/Entities/Products/Product.cs @@ -82,7 +82,7 @@ public partial class Product : ApiEntity public ProductCategory? Category { get; internal set; } public List Specifications { get; internal set; } = new(); - public List Reviews { get; internal set; } = new(); + public List Comments { get; internal set; } = new(); public List Files { get; internal set; } = new(); public List OrderProducts { get; internal set; } = new(); diff --git a/Netina.Domain/Mappers/CommentMapper.g.cs b/Netina.Domain/Mappers/CommentMapper.g.cs index 29d8681..5d6e51a 100644 --- a/Netina.Domain/Mappers/CommentMapper.g.cs +++ b/Netina.Domain/Mappers/CommentMapper.g.cs @@ -1,8 +1,10 @@ using System; using System.Linq.Expressions; +using Mapster.Models; using Netina.Domain.Dtos.LargDtos; using Netina.Domain.Dtos.SmallDtos; using Netina.Domain.Entities.Comments; +using Netina.Domain.Entities.Users; namespace Netina.Domain.Mappers { @@ -13,10 +15,13 @@ namespace Netina.Domain.Mappers return p1 == null ? null : new Comment() { Title = p1.Title, + Content = p1.Content, Rate = p1.Rate, IsConfirmed = p1.IsConfirmed, ParentId = (Guid?)p1.ParentId, + Parent = new Comment() {Id = p1.ParentId}, UserId = p1.UserId, + User = new ApplicationUser() {Id = p1.UserId}, Id = p1.Id, CreatedAt = p1.CreatedAt }; @@ -30,137 +35,197 @@ namespace Netina.Domain.Mappers Comment result = p3 ?? new Comment(); result.Title = p2.Title; + result.Content = p2.Content; result.Rate = p2.Rate; result.IsConfirmed = p2.IsConfirmed; result.ParentId = (Guid?)p2.ParentId; + result.Parent = funcMain1(new Never(), result.Parent, p2); result.UserId = p2.UserId; + result.User = funcMain2(new Never(), result.User, p2); result.Id = p2.Id; result.CreatedAt = p2.CreatedAt; return result; } - public static Expression> ProjectToComment => p4 => new Comment() - { - Title = p4.Title, - Rate = p4.Rate, - IsConfirmed = p4.IsConfirmed, - ParentId = (Guid?)p4.ParentId, - UserId = p4.UserId, - Id = p4.Id, - CreatedAt = p4.CreatedAt - }; - public static CommentLDto AdaptToLDto(this Comment p5) - { - return p5 == null ? null : new CommentLDto() - { - Title = p5.Title, - Rate = p5.Rate, - IsConfirmed = p5.IsConfirmed, - ParentId = p5.ParentId == null ? default(Guid) : (Guid)p5.ParentId, - UserId = p5.UserId, - Id = p5.Id, - CreatedAt = p5.CreatedAt - }; - } - public static CommentLDto AdaptTo(this Comment p6, CommentLDto p7) - { - if (p6 == null) - { - return null; - } - CommentLDto result = p7 ?? new CommentLDto(); - - result.Title = p6.Title; - result.Rate = p6.Rate; - result.IsConfirmed = p6.IsConfirmed; - result.ParentId = p6.ParentId == null ? default(Guid) : (Guid)p6.ParentId; - result.UserId = p6.UserId; - result.Id = p6.Id; - result.CreatedAt = p6.CreatedAt; - return result; - - } - public static Expression> ProjectToLDto => p8 => new CommentLDto() + public static Expression> ProjectToComment => p8 => new Comment() { Title = p8.Title, + Content = p8.Content, Rate = p8.Rate, IsConfirmed = p8.IsConfirmed, - ParentId = p8.ParentId == null ? default(Guid) : (Guid)p8.ParentId, + ParentId = (Guid?)p8.ParentId, + Parent = new Comment() {Id = p8.ParentId}, UserId = p8.UserId, + User = new ApplicationUser() {Id = p8.UserId}, Id = p8.Id, CreatedAt = p8.CreatedAt }; - public static Comment AdaptToComment(this CommentSDto p9) + public static CommentLDto AdaptToLDto(this Comment p9) { - return p9 == null ? null : new Comment() + return p9 == null ? null : new CommentLDto() { Title = p9.Title, Content = p9.Content, + Rate = p9.Rate, IsConfirmed = p9.IsConfirmed, - ParentId = (Guid?)p9.ParentId, + ParentId = p9.ParentId == null ? default(Guid) : (Guid)p9.ParentId, UserId = p9.UserId, + UserFullName = p9.User != null ? p9.User.FirstName + " " + p9.User.LastName : string.Empty, Id = p9.Id, CreatedAt = p9.CreatedAt }; } - public static Comment AdaptTo(this CommentSDto p10, Comment p11) + public static CommentLDto AdaptTo(this Comment p10, CommentLDto p11) { if (p10 == null) { return null; } - Comment result = p11 ?? new Comment(); + CommentLDto result = p11 ?? new CommentLDto(); result.Title = p10.Title; result.Content = p10.Content; + result.Rate = p10.Rate; result.IsConfirmed = p10.IsConfirmed; - result.ParentId = (Guid?)p10.ParentId; + result.ParentId = p10.ParentId == null ? default(Guid) : (Guid)p10.ParentId; result.UserId = p10.UserId; + result.UserFullName = p10.User != null ? p10.User.FirstName + " " + p10.User.LastName : string.Empty; result.Id = p10.Id; result.CreatedAt = p10.CreatedAt; return result; } - public static CommentSDto AdaptToSDto(this Comment p12) + public static Expression> ProjectToLDto => p12 => new CommentLDto() { - return p12 == null ? null : new CommentSDto() + Title = p12.Title, + Content = p12.Content, + Rate = p12.Rate, + IsConfirmed = p12.IsConfirmed, + ParentId = p12.ParentId == null ? default(Guid) : (Guid)p12.ParentId, + UserId = p12.UserId, + UserFullName = p12.User != null ? p12.User.FirstName + " " + p12.User.LastName : string.Empty, + Id = p12.Id, + CreatedAt = p12.CreatedAt + }; + public static Comment AdaptToComment(this CommentSDto p13) + { + return p13 == null ? null : new Comment() { - Title = p12.Title, - Content = p12.Content, - IsConfirmed = p12.IsConfirmed, - ParentId = p12.ParentId == null ? default(Guid) : (Guid)p12.ParentId, - UserId = p12.UserId, - Id = p12.Id, - CreatedAt = p12.CreatedAt + Title = p13.Title, + Content = p13.Content, + IsConfirmed = p13.IsConfirmed, + IsAdmin = p13.IsAdmin, + ParentId = (Guid?)p13.ParentId, + Parent = new Comment() {Id = p13.ParentId}, + UserId = p13.UserId, + User = new ApplicationUser() {Id = p13.UserId}, + Id = p13.Id, + CreatedAt = p13.CreatedAt }; } - public static CommentSDto AdaptTo(this Comment p13, CommentSDto p14) + public static Comment AdaptTo(this CommentSDto p14, Comment p15) { - if (p13 == null) + if (p14 == null) { return null; } - CommentSDto result = p14 ?? new CommentSDto(); + Comment result = p15 ?? new Comment(); - result.Title = p13.Title; - result.Content = p13.Content; - result.IsConfirmed = p13.IsConfirmed; - result.ParentId = p13.ParentId == null ? default(Guid) : (Guid)p13.ParentId; - result.UserId = p13.UserId; - result.Id = p13.Id; - result.CreatedAt = p13.CreatedAt; + result.Title = p14.Title; + result.Content = p14.Content; + result.IsConfirmed = p14.IsConfirmed; + result.IsAdmin = p14.IsAdmin; + result.ParentId = (Guid?)p14.ParentId; + result.Parent = funcMain3(new Never(), result.Parent, p14); + result.UserId = p14.UserId; + result.User = funcMain4(new Never(), result.User, p14); + result.Id = p14.Id; + result.CreatedAt = p14.CreatedAt; return result; } - public static Expression> ProjectToSDto => p15 => new CommentSDto() + public static CommentSDto AdaptToSDto(this Comment p20) { - Title = p15.Title, - Content = p15.Content, - IsConfirmed = p15.IsConfirmed, - ParentId = p15.ParentId == null ? default(Guid) : (Guid)p15.ParentId, - UserId = p15.UserId, - Id = p15.Id, - CreatedAt = p15.CreatedAt + return p20 == null ? null : new CommentSDto() + { + Title = p20.Title, + Content = p20.Content, + IsAdmin = p20.IsAdmin, + IsConfirmed = p20.IsConfirmed, + ParentId = p20.ParentId == null ? default(Guid) : (Guid)p20.ParentId, + UserId = p20.UserId, + UserFullName = p20.User != null ? p20.User.FirstName + " " + p20.User.LastName : string.Empty, + Id = p20.Id, + CreatedAt = p20.CreatedAt + }; + } + public static CommentSDto AdaptTo(this Comment p21, CommentSDto p22) + { + if (p21 == null) + { + return null; + } + CommentSDto result = p22 ?? new CommentSDto(); + + result.Title = p21.Title; + result.Content = p21.Content; + result.IsAdmin = p21.IsAdmin; + result.IsConfirmed = p21.IsConfirmed; + result.ParentId = p21.ParentId == null ? default(Guid) : (Guid)p21.ParentId; + result.UserId = p21.UserId; + result.UserFullName = p21.User != null ? p21.User.FirstName + " " + p21.User.LastName : string.Empty; + result.Id = p21.Id; + result.CreatedAt = p21.CreatedAt; + return result; + + } + public static Expression> ProjectToSDto => p23 => new CommentSDto() + { + Title = p23.Title, + Content = p23.Content, + IsAdmin = p23.IsAdmin, + IsConfirmed = p23.IsConfirmed, + ParentId = p23.ParentId == null ? default(Guid) : (Guid)p23.ParentId, + UserId = p23.UserId, + UserFullName = p23.User != null ? p23.User.FirstName + " " + p23.User.LastName : string.Empty, + Id = p23.Id, + CreatedAt = p23.CreatedAt }; + + private static Comment funcMain1(Never p4, Comment p5, CommentLDto p2) + { + Comment result = p5 ?? new Comment(); + + result.Id = p2.ParentId; + return result; + + } + + private static ApplicationUser funcMain2(Never p6, ApplicationUser p7, CommentLDto p2) + { + ApplicationUser result = p7 ?? new ApplicationUser(); + + result.Id = p2.UserId; + return result; + + } + + private static Comment funcMain3(Never p16, Comment p17, CommentSDto p14) + { + Comment result = p17 ?? new Comment(); + + result.Id = p14.ParentId; + return result; + + } + + private static ApplicationUser funcMain4(Never p18, ApplicationUser p19, CommentSDto p14) + { + ApplicationUser result = p19 ?? new ApplicationUser(); + + result.Id = p14.UserId; + return result; + + } } } \ No newline at end of file diff --git a/Netina.Domain/Mappers/ProductMapper.g.cs b/Netina.Domain/Mappers/ProductMapper.g.cs index 0c9bfec..71cebd1 100644 --- a/Netina.Domain/Mappers/ProductMapper.g.cs +++ b/Netina.Domain/Mappers/ProductMapper.g.cs @@ -7,7 +7,6 @@ using Netina.Domain.Dtos.LargDtos; using Netina.Domain.Dtos.ResponseDtos.Torob; using Netina.Domain.Dtos.SmallDtos; using Netina.Domain.Entities.Brands; -using Netina.Domain.Entities.Comments; using Netina.Domain.Entities.ProductCategories; using Netina.Domain.Entities.Products; using Netina.Domain.Entities.Users; @@ -44,401 +43,377 @@ namespace Netina.Domain.Mappers Id = p1.CategoryId }, Specifications = funcMain1(p1.Specifications), - Reviews = funcMain2(p1.Reviews), - Files = funcMain3(p1.Files), + Files = funcMain2(p1.Files), Id = p1.Id, CreatedAt = p1.CreatedAt }; } - public static Product AdaptTo(this ProductLDto p5, Product p6) + public static Product AdaptTo(this ProductLDto p4, Product p5) { - if (p5 == null) + if (p4 == null) { return null; } - Product result = p6 ?? new Product(); + Product result = p5 ?? new Product(); - result.PersianName = p5.PersianName; - result.EnglishName = p5.EnglishName; - result.Slug = p5.Slug; - result.Summery = p5.Summery; - result.ExpertCheck = p5.ExpertCheck; - result.Tags = p5.Tags; - result.Warranty = p5.Warranty; - result.Cost = p5.Cost; - result.BeDisplayed = p5.BeDisplayed; - result.PackingCost = p5.PackingCost; - result.Stock = p5.Stock; - result.HasExpressDelivery = p5.HasExpressDelivery; - result.MaxOrderCount = p5.MaxOrderCount; - result.BrandId = p5.BrandId; - result.Brand = funcMain4(new Never(), result.Brand, p5); - result.CategoryId = p5.CategoryId; - result.AuthorId = p5.AuthorId; - result.Author = funcMain5(new Never(), result.Author, p5); - result.Category = funcMain6(new Never(), result.Category, p5); - result.Specifications = funcMain7(p5.Specifications, result.Specifications); - result.Reviews = funcMain8(p5.Reviews, result.Reviews); - result.Files = funcMain9(p5.Files, result.Files); - result.Id = p5.Id; - result.CreatedAt = p5.CreatedAt; + result.PersianName = p4.PersianName; + result.EnglishName = p4.EnglishName; + result.Slug = p4.Slug; + result.Summery = p4.Summery; + result.ExpertCheck = p4.ExpertCheck; + result.Tags = p4.Tags; + result.Warranty = p4.Warranty; + result.Cost = p4.Cost; + result.BeDisplayed = p4.BeDisplayed; + result.PackingCost = p4.PackingCost; + result.Stock = p4.Stock; + result.HasExpressDelivery = p4.HasExpressDelivery; + result.MaxOrderCount = p4.MaxOrderCount; + result.BrandId = p4.BrandId; + result.Brand = funcMain3(new Never(), result.Brand, p4); + result.CategoryId = p4.CategoryId; + result.AuthorId = p4.AuthorId; + result.Author = funcMain4(new Never(), result.Author, p4); + result.Category = funcMain5(new Never(), result.Category, p4); + result.Specifications = funcMain6(p4.Specifications, result.Specifications); + result.Files = funcMain7(p4.Files, result.Files); + result.Id = p4.Id; + result.CreatedAt = p4.CreatedAt; return result; } - public static Expression> ProjectToProduct => p19 => new Product() + public static Expression> ProjectToProduct => p16 => new Product() { - PersianName = p19.PersianName, - EnglishName = p19.EnglishName, - Slug = p19.Slug, - Summery = p19.Summery, - ExpertCheck = p19.ExpertCheck, - Tags = p19.Tags, - Warranty = p19.Warranty, - Cost = p19.Cost, - BeDisplayed = p19.BeDisplayed, - PackingCost = p19.PackingCost, - Stock = p19.Stock, - HasExpressDelivery = p19.HasExpressDelivery, - MaxOrderCount = p19.MaxOrderCount, - BrandId = p19.BrandId, - Brand = new Brand() {Id = p19.BrandId}, - CategoryId = p19.CategoryId, - AuthorId = p19.AuthorId, - Author = new ApplicationUser() {Id = p19.AuthorId}, + PersianName = p16.PersianName, + EnglishName = p16.EnglishName, + Slug = p16.Slug, + Summery = p16.Summery, + ExpertCheck = p16.ExpertCheck, + Tags = p16.Tags, + Warranty = p16.Warranty, + Cost = p16.Cost, + BeDisplayed = p16.BeDisplayed, + PackingCost = p16.PackingCost, + Stock = p16.Stock, + HasExpressDelivery = p16.HasExpressDelivery, + MaxOrderCount = p16.MaxOrderCount, + BrandId = p16.BrandId, + Brand = new Brand() {Id = p16.BrandId}, + CategoryId = p16.CategoryId, + AuthorId = p16.AuthorId, + Author = new ApplicationUser() {Id = p16.AuthorId}, Category = new ProductCategory() { - Name = p19.CategoryName, - Id = p19.CategoryId + Name = p16.CategoryName, + Id = p16.CategoryId }, - Specifications = p19.Specifications.Select(p20 => new Specification() + Specifications = p16.Specifications.Select(p17 => new Specification() { - Title = p20.Title, - Detail = p20.Detail, - Value = p20.Value, - IsFeature = p20.IsFeature, - ProductId = p20.ProductId, - ParentId = (Guid?)p20.ParentId, - Id = p20.Id, - CreatedAt = p20.CreatedAt + Title = p17.Title, + Detail = p17.Detail, + Value = p17.Value, + IsFeature = p17.IsFeature, + ProductId = p17.ProductId, + ParentId = (Guid?)p17.ParentId, + Id = p17.Id, + CreatedAt = p17.CreatedAt }).ToList(), - Reviews = p19.Reviews.Select(p21 => new Comment() + Files = p16.Files.Select(p18 => new ProductStorageFile() { - Title = p21.Title, - Content = p21.Content, - IsConfirmed = p21.IsConfirmed, - ParentId = (Guid?)p21.ParentId, - UserId = p21.UserId, - Id = p21.Id, - CreatedAt = p21.CreatedAt - }).ToList(), - Files = p19.Files.Select(p22 => new ProductStorageFile() - { - Name = p22.Name, - FileLocation = p22.FileLocation, - FileName = p22.FileName, - IsHeader = p22.IsHeader, - IsPrimary = p22.IsPrimary, - FileType = p22.FileType, - Id = p22.Id, - CreatedAt = p22.CreatedAt + Name = p18.Name, + FileLocation = p18.FileLocation, + FileName = p18.FileName, + IsHeader = p18.IsHeader, + IsPrimary = p18.IsPrimary, + FileType = p18.FileType, + Id = p18.Id, + CreatedAt = p18.CreatedAt }).ToList(), - Id = p19.Id, - CreatedAt = p19.CreatedAt + Id = p16.Id, + CreatedAt = p16.CreatedAt }; - public static ProductLDto AdaptToLDto(this Product p23) + public static ProductLDto AdaptToLDto(this Product p19) { - return p23 == null ? null : new ProductLDto() + return p19 == null ? null : new ProductLDto() { - PersianName = p23.PersianName, - EnglishName = p23.EnglishName, - Summery = p23.Summery, - ExpertCheck = p23.ExpertCheck, - Tags = p23.Tags, - Slug = p23.Slug, - Warranty = p23.Warranty, - BeDisplayed = p23.BeDisplayed, - HasExpressDelivery = p23.HasExpressDelivery, - Cost = p23.Cost, - PackingCost = p23.PackingCost, - MaxOrderCount = p23.MaxOrderCount, - Stock = p23.Stock, - BrandId = p23.BrandId, - BrandName = p23.Brand == null ? null : p23.Brand.PersianName, - CategoryId = p23.CategoryId, - CategoryName = p23.Category == null ? null : p23.Category.Name, - Specifications = funcMain10(p23.Specifications), - Reviews = funcMain11(p23.Reviews), - Files = funcMain12(p23.Files), - AuthorId = p23.AuthorId, - AuthorFullName = p23.Author != null ? p23.Author.FirstName + " " + p23.Author.LastName : string.Empty, - Id = p23.Id, - CreatedAt = p23.CreatedAt + PersianName = p19.PersianName, + EnglishName = p19.EnglishName, + Summery = p19.Summery, + ExpertCheck = p19.ExpertCheck, + Tags = p19.Tags, + Slug = p19.Slug, + Warranty = p19.Warranty, + BeDisplayed = p19.BeDisplayed, + HasExpressDelivery = p19.HasExpressDelivery, + Cost = p19.Cost, + PackingCost = p19.PackingCost, + MaxOrderCount = p19.MaxOrderCount, + Stock = p19.Stock, + BrandId = p19.BrandId, + BrandName = p19.Brand == null ? null : p19.Brand.PersianName, + CategoryId = p19.CategoryId, + CategoryName = p19.Category == null ? null : p19.Category.Name, + Specifications = funcMain8(p19.Specifications), + Files = funcMain9(p19.Files), + AuthorId = p19.AuthorId, + AuthorFullName = p19.Author != null ? p19.Author.FirstName + " " + p19.Author.LastName : string.Empty, + Id = p19.Id, + CreatedAt = p19.CreatedAt }; } - public static ProductLDto AdaptTo(this Product p27, ProductLDto p28) + public static ProductLDto AdaptTo(this Product p22, ProductLDto p23) { - if (p27 == null) + if (p22 == null) { return null; } - ProductLDto result = p28 ?? new ProductLDto(); + ProductLDto result = p23 ?? new ProductLDto(); - result.PersianName = p27.PersianName; - result.EnglishName = p27.EnglishName; - result.Summery = p27.Summery; - result.ExpertCheck = p27.ExpertCheck; - result.Tags = p27.Tags; - result.Slug = p27.Slug; - result.Warranty = p27.Warranty; - result.BeDisplayed = p27.BeDisplayed; - result.HasExpressDelivery = p27.HasExpressDelivery; - result.Cost = p27.Cost; - result.PackingCost = p27.PackingCost; - result.MaxOrderCount = p27.MaxOrderCount; - result.Stock = p27.Stock; - result.BrandId = p27.BrandId; - result.BrandName = p27.Brand == null ? null : p27.Brand.PersianName; - result.CategoryId = p27.CategoryId; - result.CategoryName = p27.Category == null ? null : p27.Category.Name; - result.Specifications = funcMain13(p27.Specifications, result.Specifications); - result.Reviews = funcMain14(p27.Reviews, result.Reviews); - result.Files = funcMain15(p27.Files, result.Files); - result.AuthorId = p27.AuthorId; - result.AuthorFullName = p27.Author != null ? p27.Author.FirstName + " " + p27.Author.LastName : string.Empty; - result.Id = p27.Id; - result.CreatedAt = p27.CreatedAt; + result.PersianName = p22.PersianName; + result.EnglishName = p22.EnglishName; + result.Summery = p22.Summery; + result.ExpertCheck = p22.ExpertCheck; + result.Tags = p22.Tags; + result.Slug = p22.Slug; + result.Warranty = p22.Warranty; + result.BeDisplayed = p22.BeDisplayed; + result.HasExpressDelivery = p22.HasExpressDelivery; + result.Cost = p22.Cost; + result.PackingCost = p22.PackingCost; + result.MaxOrderCount = p22.MaxOrderCount; + result.Stock = p22.Stock; + result.BrandId = p22.BrandId; + result.BrandName = p22.Brand == null ? null : p22.Brand.PersianName; + result.CategoryId = p22.CategoryId; + result.CategoryName = p22.Category == null ? null : p22.Category.Name; + result.Specifications = funcMain10(p22.Specifications, result.Specifications); + result.Files = funcMain11(p22.Files, result.Files); + result.AuthorId = p22.AuthorId; + result.AuthorFullName = p22.Author != null ? p22.Author.FirstName + " " + p22.Author.LastName : string.Empty; + result.Id = p22.Id; + result.CreatedAt = p22.CreatedAt; return result; } - public static Expression> ProjectToLDto => p35 => new ProductLDto() + public static Expression> ProjectToLDto => p28 => new ProductLDto() { - PersianName = p35.PersianName, - EnglishName = p35.EnglishName, - Summery = p35.Summery, - ExpertCheck = p35.ExpertCheck, - Tags = p35.Tags, - Slug = p35.Slug, - Warranty = p35.Warranty, - BeDisplayed = p35.BeDisplayed, - HasExpressDelivery = p35.HasExpressDelivery, - Cost = p35.Cost, - PackingCost = p35.PackingCost, - MaxOrderCount = p35.MaxOrderCount, - Stock = p35.Stock, - BrandId = p35.BrandId, - BrandName = p35.Brand == null ? null : p35.Brand.PersianName, - CategoryId = p35.CategoryId, - CategoryName = p35.Category == null ? null : p35.Category.Name, - Specifications = p35.Specifications.Select(p36 => new SpecificationSDto() + PersianName = p28.PersianName, + EnglishName = p28.EnglishName, + Summery = p28.Summery, + ExpertCheck = p28.ExpertCheck, + Tags = p28.Tags, + Slug = p28.Slug, + Warranty = p28.Warranty, + BeDisplayed = p28.BeDisplayed, + HasExpressDelivery = p28.HasExpressDelivery, + Cost = p28.Cost, + PackingCost = p28.PackingCost, + MaxOrderCount = p28.MaxOrderCount, + Stock = p28.Stock, + BrandId = p28.BrandId, + BrandName = p28.Brand == null ? null : p28.Brand.PersianName, + CategoryId = p28.CategoryId, + CategoryName = p28.Category == null ? null : p28.Category.Name, + Specifications = p28.Specifications.Select(p29 => new SpecificationSDto() { - Title = p36.Title, - Detail = p36.Detail, - Value = p36.Value, - IsFeature = p36.IsFeature, - ProductId = p36.ProductId, - ParentId = p36.ParentId == null ? default(Guid) : (Guid)p36.ParentId, - Id = p36.Id, - CreatedAt = p36.CreatedAt + Title = p29.Title, + Detail = p29.Detail, + Value = p29.Value, + IsFeature = p29.IsFeature, + ProductId = p29.ProductId, + ParentId = p29.ParentId == null ? default(Guid) : (Guid)p29.ParentId, + Id = p29.Id, + CreatedAt = p29.CreatedAt }).ToList(), - Reviews = p35.Reviews.Select(p37 => new CommentSDto() + Files = p28.Files.Select(p30 => new StorageFileSDto() { - Title = p37.Title, - Content = p37.Content, - IsConfirmed = p37.IsConfirmed, - ParentId = p37.ParentId == null ? default(Guid) : (Guid)p37.ParentId, - UserId = p37.UserId, - Id = p37.Id, - CreatedAt = p37.CreatedAt - }).ToList(), - Files = p35.Files.Select(p38 => new StorageFileSDto() - { - Name = p38.Name, - FileLocation = p38.FileLocation, - FileName = p38.FileName, - IsHeader = p38.IsHeader, - IsPrimary = p38.IsPrimary, - FileType = p38.FileType, - Id = p38.Id + Name = p30.Name, + FileLocation = p30.FileLocation, + FileName = p30.FileName, + IsHeader = p30.IsHeader, + IsPrimary = p30.IsPrimary, + FileType = p30.FileType, + Id = p30.Id }).ToList(), - AuthorId = p35.AuthorId, - AuthorFullName = p35.Author != null ? p35.Author.FirstName + " " + p35.Author.LastName : string.Empty, - Id = p35.Id, - CreatedAt = p35.CreatedAt + AuthorId = p28.AuthorId, + AuthorFullName = p28.Author != null ? p28.Author.FirstName + " " + p28.Author.LastName : string.Empty, + Id = p28.Id, + CreatedAt = p28.CreatedAt }; - public static Product AdaptToProduct(this ProductSDto p39) + public static Product AdaptToProduct(this ProductSDto p31) { - return p39 == null ? null : new Product() + return p31 == null ? null : new Product() { - PersianName = p39.PersianName, - EnglishName = p39.EnglishName, - Slug = p39.Slug, - Summery = p39.Summery, - ExpertCheck = p39.ExpertCheck, - Tags = p39.Tags, - Warranty = p39.Warranty, - Cost = p39.Cost, - IsEnable = p39.IsEnable, - BeDisplayed = p39.BeDisplayed, - PackingCost = p39.PackingCost, - Stock = p39.Stock, - Rate = p39.Rate, - ReviewCount = p39.ReviewCount, - Viewed = p39.Viewed, - MaxOrderCount = p39.MaxOrderCount, - BrandId = p39.BrandId, - Brand = new Brand() {Id = p39.BrandId}, - CategoryId = p39.CategoryId, - AuthorId = p39.AuthorId, - Author = new ApplicationUser() {Id = p39.AuthorId}, + PersianName = p31.PersianName, + EnglishName = p31.EnglishName, + Slug = p31.Slug, + Summery = p31.Summery, + ExpertCheck = p31.ExpertCheck, + Tags = p31.Tags, + Warranty = p31.Warranty, + Cost = p31.Cost, + IsEnable = p31.IsEnable, + BeDisplayed = p31.BeDisplayed, + PackingCost = p31.PackingCost, + Stock = p31.Stock, + Rate = p31.Rate, + ReviewCount = p31.ReviewCount, + Viewed = p31.Viewed, + MaxOrderCount = p31.MaxOrderCount, + BrandId = p31.BrandId, + Brand = new Brand() {Id = p31.BrandId}, + CategoryId = p31.CategoryId, + AuthorId = p31.AuthorId, + Author = new ApplicationUser() {Id = p31.AuthorId}, Category = new ProductCategory() { - Name = p39.CategoryName, - Id = p39.CategoryId + Name = p31.CategoryName, + Id = p31.CategoryId }, - Id = p39.Id, - CreatedAt = p39.CreatedAt, - ModifiedAt = p39.ModifiedAt + Id = p31.Id, + CreatedAt = p31.CreatedAt, + ModifiedAt = p31.ModifiedAt }; } - public static Product AdaptTo(this ProductSDto p40, Product p41) + public static Product AdaptTo(this ProductSDto p32, Product p33) { - if (p40 == null) + if (p32 == null) { return null; } - Product result = p41 ?? new Product(); + Product result = p33 ?? new Product(); - result.PersianName = p40.PersianName; - result.EnglishName = p40.EnglishName; - result.Slug = p40.Slug; - result.Summery = p40.Summery; - result.ExpertCheck = p40.ExpertCheck; - result.Tags = p40.Tags; - result.Warranty = p40.Warranty; - result.Cost = p40.Cost; - result.IsEnable = p40.IsEnable; - result.BeDisplayed = p40.BeDisplayed; - result.PackingCost = p40.PackingCost; - result.Stock = p40.Stock; - result.Rate = p40.Rate; - result.ReviewCount = p40.ReviewCount; - result.Viewed = p40.Viewed; - result.MaxOrderCount = p40.MaxOrderCount; - result.BrandId = p40.BrandId; - result.Brand = funcMain16(new Never(), result.Brand, p40); - result.CategoryId = p40.CategoryId; - result.AuthorId = p40.AuthorId; - result.Author = funcMain17(new Never(), result.Author, p40); - result.Category = funcMain18(new Never(), result.Category, p40); - result.Id = p40.Id; - result.CreatedAt = p40.CreatedAt; - result.ModifiedAt = p40.ModifiedAt; + result.PersianName = p32.PersianName; + result.EnglishName = p32.EnglishName; + result.Slug = p32.Slug; + result.Summery = p32.Summery; + result.ExpertCheck = p32.ExpertCheck; + result.Tags = p32.Tags; + result.Warranty = p32.Warranty; + result.Cost = p32.Cost; + result.IsEnable = p32.IsEnable; + result.BeDisplayed = p32.BeDisplayed; + result.PackingCost = p32.PackingCost; + result.Stock = p32.Stock; + result.Rate = p32.Rate; + result.ReviewCount = p32.ReviewCount; + result.Viewed = p32.Viewed; + result.MaxOrderCount = p32.MaxOrderCount; + result.BrandId = p32.BrandId; + result.Brand = funcMain12(new Never(), result.Brand, p32); + result.CategoryId = p32.CategoryId; + result.AuthorId = p32.AuthorId; + result.Author = funcMain13(new Never(), result.Author, p32); + result.Category = funcMain14(new Never(), result.Category, p32); + result.Id = p32.Id; + result.CreatedAt = p32.CreatedAt; + result.ModifiedAt = p32.ModifiedAt; return result; } - public static ProductSDto AdaptToSDto(this Product p48) + public static ProductSDto AdaptToSDto(this Product p40) { - return p48 == null ? null : new ProductSDto() + return p40 == null ? null : new ProductSDto() { - PersianName = p48.PersianName, - Slug = p48.Slug, - EnglishName = p48.EnglishName, - Summery = p48.Summery, - ExpertCheck = p48.ExpertCheck, - Tags = p48.Tags, - Warranty = p48.Warranty, - Cost = p48.Cost, - IsEnable = p48.IsEnable, - Stock = p48.Stock, - MaxOrderCount = p48.MaxOrderCount, - BeDisplayed = p48.BeDisplayed, - PackingCost = p48.PackingCost, - Rate = p48.Rate, - ReviewCount = p48.ReviewCount, - Viewed = p48.Viewed, - MainImage = p48.Files.FirstOrDefault(funcMain19) != null ? p48.Files.FirstOrDefault(funcMain20).FileLocation : (p48.Files.Count > 0 ? p48.Files.FirstOrDefault().FileLocation : string.Empty), - CategoryId = p48.CategoryId, - BrandId = p48.BrandId, - BrandName = p48.Brand == null ? null : p48.Brand.PersianName, - CategoryName = p48.Category == null ? null : p48.Category.Name, - ModifiedAt = p48.ModifiedAt, - AuthorId = p48.AuthorId, - AuthorFullName = p48.Author != null ? p48.Author.FirstName + " " + p48.Author.LastName : string.Empty, - Id = p48.Id, - CreatedAt = p48.CreatedAt + PersianName = p40.PersianName, + Slug = p40.Slug, + EnglishName = p40.EnglishName, + Summery = p40.Summery, + ExpertCheck = p40.ExpertCheck, + Tags = p40.Tags, + Warranty = p40.Warranty, + Cost = p40.Cost, + IsEnable = p40.IsEnable, + Stock = p40.Stock, + MaxOrderCount = p40.MaxOrderCount, + BeDisplayed = p40.BeDisplayed, + PackingCost = p40.PackingCost, + Rate = p40.Rate, + ReviewCount = p40.ReviewCount, + Viewed = p40.Viewed, + MainImage = p40.Files.FirstOrDefault(funcMain15) != null ? p40.Files.FirstOrDefault(funcMain16).FileLocation : (p40.Files.Count > 0 ? p40.Files.FirstOrDefault().FileLocation : string.Empty), + CategoryId = p40.CategoryId, + BrandId = p40.BrandId, + BrandName = p40.Brand == null ? null : p40.Brand.PersianName, + CategoryName = p40.Category == null ? null : p40.Category.Name, + ModifiedAt = p40.ModifiedAt, + AuthorId = p40.AuthorId, + AuthorFullName = p40.Author != null ? p40.Author.FirstName + " " + p40.Author.LastName : string.Empty, + Id = p40.Id, + CreatedAt = p40.CreatedAt }; } - public static ProductSDto AdaptTo(this Product p49, ProductSDto p50) + public static ProductSDto AdaptTo(this Product p41, ProductSDto p42) { - if (p49 == null) + if (p41 == null) { return null; } - ProductSDto result = p50 ?? new ProductSDto(); + ProductSDto result = p42 ?? new ProductSDto(); - result.PersianName = p49.PersianName; - result.Slug = p49.Slug; - result.EnglishName = p49.EnglishName; - result.Summery = p49.Summery; - result.ExpertCheck = p49.ExpertCheck; - result.Tags = p49.Tags; - result.Warranty = p49.Warranty; - result.Cost = p49.Cost; - result.IsEnable = p49.IsEnable; - result.Stock = p49.Stock; - result.MaxOrderCount = p49.MaxOrderCount; - result.BeDisplayed = p49.BeDisplayed; - result.PackingCost = p49.PackingCost; - result.Rate = p49.Rate; - result.ReviewCount = p49.ReviewCount; - result.Viewed = p49.Viewed; - result.MainImage = p49.Files.FirstOrDefault(funcMain19) != null ? p49.Files.FirstOrDefault(funcMain20).FileLocation : (p49.Files.Count > 0 ? p49.Files.FirstOrDefault().FileLocation : string.Empty); - result.CategoryId = p49.CategoryId; - result.BrandId = p49.BrandId; - result.BrandName = p49.Brand == null ? null : p49.Brand.PersianName; - result.CategoryName = p49.Category == null ? null : p49.Category.Name; - result.ModifiedAt = p49.ModifiedAt; - result.AuthorId = p49.AuthorId; - result.AuthorFullName = p49.Author != null ? p49.Author.FirstName + " " + p49.Author.LastName : string.Empty; - result.Id = p49.Id; - result.CreatedAt = p49.CreatedAt; + result.PersianName = p41.PersianName; + result.Slug = p41.Slug; + result.EnglishName = p41.EnglishName; + result.Summery = p41.Summery; + result.ExpertCheck = p41.ExpertCheck; + result.Tags = p41.Tags; + result.Warranty = p41.Warranty; + result.Cost = p41.Cost; + result.IsEnable = p41.IsEnable; + result.Stock = p41.Stock; + result.MaxOrderCount = p41.MaxOrderCount; + result.BeDisplayed = p41.BeDisplayed; + result.PackingCost = p41.PackingCost; + result.Rate = p41.Rate; + result.ReviewCount = p41.ReviewCount; + result.Viewed = p41.Viewed; + result.MainImage = p41.Files.FirstOrDefault(funcMain15) != null ? p41.Files.FirstOrDefault(funcMain16).FileLocation : (p41.Files.Count > 0 ? p41.Files.FirstOrDefault().FileLocation : string.Empty); + result.CategoryId = p41.CategoryId; + result.BrandId = p41.BrandId; + result.BrandName = p41.Brand == null ? null : p41.Brand.PersianName; + result.CategoryName = p41.Category == null ? null : p41.Category.Name; + result.ModifiedAt = p41.ModifiedAt; + result.AuthorId = p41.AuthorId; + result.AuthorFullName = p41.Author != null ? p41.Author.FirstName + " " + p41.Author.LastName : string.Empty; + result.Id = p41.Id; + result.CreatedAt = p41.CreatedAt; return result; } - public static Expression> ProjectToSDto => p51 => new ProductSDto() + public static Expression> ProjectToSDto => p43 => new ProductSDto() { - PersianName = p51.PersianName, - Slug = p51.Slug, - EnglishName = p51.EnglishName, - Summery = p51.Summery, - ExpertCheck = p51.ExpertCheck, - Tags = p51.Tags, - Warranty = p51.Warranty, - Cost = p51.Cost, - IsEnable = p51.IsEnable, - Stock = p51.Stock, - MaxOrderCount = p51.MaxOrderCount, - BeDisplayed = p51.BeDisplayed, - PackingCost = p51.PackingCost, - Rate = p51.Rate, - ReviewCount = p51.ReviewCount, - Viewed = p51.Viewed, - MainImage = p51.Files.FirstOrDefault(f => f.IsPrimary) != null ? p51.Files.FirstOrDefault(f => f.IsPrimary).FileLocation : (p51.Files.Count > 0 ? p51.Files.FirstOrDefault().FileLocation : string.Empty), - CategoryId = p51.CategoryId, - BrandId = p51.BrandId, - BrandName = p51.Brand == null ? null : p51.Brand.PersianName, - CategoryName = p51.Category == null ? null : p51.Category.Name, - ModifiedAt = p51.ModifiedAt, - AuthorId = p51.AuthorId, - AuthorFullName = p51.Author != null ? p51.Author.FirstName + " " + p51.Author.LastName : string.Empty, - Id = p51.Id, - CreatedAt = p51.CreatedAt + PersianName = p43.PersianName, + Slug = p43.Slug, + EnglishName = p43.EnglishName, + Summery = p43.Summery, + ExpertCheck = p43.ExpertCheck, + Tags = p43.Tags, + Warranty = p43.Warranty, + Cost = p43.Cost, + IsEnable = p43.IsEnable, + Stock = p43.Stock, + MaxOrderCount = p43.MaxOrderCount, + BeDisplayed = p43.BeDisplayed, + PackingCost = p43.PackingCost, + Rate = p43.Rate, + ReviewCount = p43.ReviewCount, + Viewed = p43.Viewed, + MainImage = p43.Files.FirstOrDefault(f => f.IsPrimary) != null ? p43.Files.FirstOrDefault(f => f.IsPrimary).FileLocation : (p43.Files.Count > 0 ? p43.Files.FirstOrDefault().FileLocation : string.Empty), + CategoryId = p43.CategoryId, + BrandId = p43.BrandId, + BrandName = p43.Brand == null ? null : p43.Brand.PersianName, + CategoryName = p43.Category == null ? null : p43.Category.Name, + ModifiedAt = p43.ModifiedAt, + AuthorId = p43.AuthorId, + AuthorFullName = p43.Author != null ? p43.Author.FirstName + " " + p43.Author.LastName : string.Empty, + Id = p43.Id, + CreatedAt = p43.CreatedAt }; - public static Expression> ProjectToTorobResponseDto => p52 => new TorobProductResponseDto() + public static Expression> ProjectToTorobResponseDto => p44 => new TorobProductResponseDto() { - product_id = p52.Id.ToString(), - price = p52.Cost, - availibility = p52.IsEnable + product_id = p44.Id.ToString(), + price = p44.Cost, + availibility = p44.IsEnable }; private static List funcMain1(List p2) @@ -472,50 +447,20 @@ namespace Netina.Domain.Mappers } - private static List funcMain2(List p3) + private static List funcMain2(List p3) { if (p3 == null) { return null; } - List result = new List(p3.Count); + List result = new List(p3.Count); int i = 0; int len = p3.Count; while (i < len) { - CommentSDto item = p3[i]; - result.Add(item == null ? null : new Comment() - { - Title = item.Title, - Content = item.Content, - IsConfirmed = item.IsConfirmed, - ParentId = (Guid?)item.ParentId, - UserId = item.UserId, - Id = item.Id, - CreatedAt = item.CreatedAt - }); - i++; - } - return result; - - } - - private static List funcMain3(List p4) - { - if (p4 == null) - { - return null; - } - List result = new List(p4.Count); - - int i = 0; - int len = p4.Count; - - while (i < len) - { - StorageFileSDto item = p4[i]; + StorageFileSDto item = p3[i]; result.Add(item == null ? null : new ProductStorageFile() { Name = item.Name, @@ -533,48 +478,48 @@ namespace Netina.Domain.Mappers } - private static Brand funcMain4(Never p7, Brand p8, ProductLDto p5) + private static Brand funcMain3(Never p6, Brand p7, ProductLDto p4) { - Brand result = p8 ?? new Brand(); + Brand result = p7 ?? new Brand(); - result.Id = p5.BrandId; + result.Id = p4.BrandId; return result; } - private static ApplicationUser funcMain5(Never p9, ApplicationUser p10, ProductLDto p5) + private static ApplicationUser funcMain4(Never p8, ApplicationUser p9, ProductLDto p4) { - ApplicationUser result = p10 ?? new ApplicationUser(); + ApplicationUser result = p9 ?? new ApplicationUser(); - result.Id = p5.AuthorId; + result.Id = p4.AuthorId; return result; } - private static ProductCategory funcMain6(Never p11, ProductCategory p12, ProductLDto p5) + private static ProductCategory funcMain5(Never p10, ProductCategory p11, ProductLDto p4) { - ProductCategory result = p12 ?? new ProductCategory(); + ProductCategory result = p11 ?? new ProductCategory(); - result.Name = p5.CategoryName; - result.Id = p5.CategoryId; + result.Name = p4.CategoryName; + result.Id = p4.CategoryId; return result; } - private static List funcMain7(List p13, List p14) + private static List funcMain6(List p12, List p13) { - if (p13 == null) + if (p12 == null) { return null; } - List result = new List(p13.Count); + List result = new List(p12.Count); int i = 0; - int len = p13.Count; + int len = p12.Count; while (i < len) { - SpecificationSDto item = p13[i]; + SpecificationSDto item = p12[i]; result.Add(item == null ? null : new Specification() { Title = item.Title, @@ -592,50 +537,20 @@ namespace Netina.Domain.Mappers } - private static List funcMain8(List p15, List p16) + private static List funcMain7(List p14, List p15) { - if (p15 == null) + if (p14 == null) { return null; } - List result = new List(p15.Count); + List result = new List(p14.Count); int i = 0; - int len = p15.Count; + int len = p14.Count; while (i < len) { - CommentSDto item = p15[i]; - result.Add(item == null ? null : new Comment() - { - Title = item.Title, - Content = item.Content, - IsConfirmed = item.IsConfirmed, - ParentId = (Guid?)item.ParentId, - UserId = item.UserId, - Id = item.Id, - CreatedAt = item.CreatedAt - }); - i++; - } - return result; - - } - - private static List funcMain9(List p17, List p18) - { - if (p17 == null) - { - return null; - } - List result = new List(p17.Count); - - int i = 0; - int len = p17.Count; - - while (i < len) - { - StorageFileSDto item = p17[i]; + StorageFileSDto item = p14[i]; result.Add(item == null ? null : new ProductStorageFile() { Name = item.Name, @@ -653,7 +568,68 @@ namespace Netina.Domain.Mappers } - private static List funcMain10(List p24) + private static List funcMain8(List p20) + { + if (p20 == null) + { + return null; + } + List result = new List(p20.Count); + + int i = 0; + int len = p20.Count; + + while (i < len) + { + Specification item = p20[i]; + result.Add(item == null ? null : new SpecificationSDto() + { + Title = item.Title, + Detail = item.Detail, + Value = item.Value, + IsFeature = item.IsFeature, + ProductId = item.ProductId, + ParentId = item.ParentId == null ? default(Guid) : (Guid)item.ParentId, + Id = item.Id, + CreatedAt = item.CreatedAt + }); + i++; + } + return result; + + } + + private static List funcMain9(List p21) + { + if (p21 == null) + { + return null; + } + List result = new List(p21.Count); + + int i = 0; + int len = p21.Count; + + while (i < len) + { + ProductStorageFile item = p21[i]; + result.Add(item == null ? null : new StorageFileSDto() + { + Name = item.Name, + FileLocation = item.FileLocation, + FileName = item.FileName, + IsHeader = item.IsHeader, + IsPrimary = item.IsPrimary, + FileType = item.FileType, + Id = item.Id + }); + i++; + } + return result; + + } + + private static List funcMain10(List p24, List p25) { if (p24 == null) { @@ -684,37 +660,7 @@ namespace Netina.Domain.Mappers } - private static List funcMain11(List p25) - { - if (p25 == null) - { - return null; - } - List result = new List(p25.Count); - - int i = 0; - int len = p25.Count; - - while (i < len) - { - Comment item = p25[i]; - result.Add(item == null ? null : new CommentSDto() - { - Title = item.Title, - Content = item.Content, - IsConfirmed = item.IsConfirmed, - ParentId = item.ParentId == null ? default(Guid) : (Guid)item.ParentId, - UserId = item.UserId, - Id = item.Id, - CreatedAt = item.CreatedAt - }); - i++; - } - return result; - - } - - private static List funcMain12(List p26) + private static List funcMain11(List p26, List p27) { if (p26 == null) { @@ -744,131 +690,40 @@ namespace Netina.Domain.Mappers } - private static List funcMain13(List p29, List p30) + private static Brand funcMain12(Never p34, Brand p35, ProductSDto p32) { - if (p29 == null) - { - return null; - } - List result = new List(p29.Count); + Brand result = p35 ?? new Brand(); - int i = 0; - int len = p29.Count; - - while (i < len) - { - Specification item = p29[i]; - result.Add(item == null ? null : new SpecificationSDto() - { - Title = item.Title, - Detail = item.Detail, - Value = item.Value, - IsFeature = item.IsFeature, - ProductId = item.ProductId, - ParentId = item.ParentId == null ? default(Guid) : (Guid)item.ParentId, - Id = item.Id, - CreatedAt = item.CreatedAt - }); - i++; - } + result.Id = p32.BrandId; return result; } - private static List funcMain14(List p31, List p32) + private static ApplicationUser funcMain13(Never p36, ApplicationUser p37, ProductSDto p32) { - if (p31 == null) - { - return null; - } - List result = new List(p31.Count); + ApplicationUser result = p37 ?? new ApplicationUser(); - int i = 0; - int len = p31.Count; - - while (i < len) - { - Comment item = p31[i]; - result.Add(item == null ? null : new CommentSDto() - { - Title = item.Title, - Content = item.Content, - IsConfirmed = item.IsConfirmed, - ParentId = item.ParentId == null ? default(Guid) : (Guid)item.ParentId, - UserId = item.UserId, - Id = item.Id, - CreatedAt = item.CreatedAt - }); - i++; - } + result.Id = p32.AuthorId; return result; } - private static List funcMain15(List p33, List p34) + private static ProductCategory funcMain14(Never p38, ProductCategory p39, ProductSDto p32) { - if (p33 == null) - { - return null; - } - List result = new List(p33.Count); + ProductCategory result = p39 ?? new ProductCategory(); - int i = 0; - int len = p33.Count; - - while (i < len) - { - ProductStorageFile item = p33[i]; - result.Add(item == null ? null : new StorageFileSDto() - { - Name = item.Name, - FileLocation = item.FileLocation, - FileName = item.FileName, - IsHeader = item.IsHeader, - IsPrimary = item.IsPrimary, - FileType = item.FileType, - Id = item.Id - }); - i++; - } + result.Name = p32.CategoryName; + result.Id = p32.CategoryId; return result; } - private static Brand funcMain16(Never p42, Brand p43, ProductSDto p40) - { - Brand result = p43 ?? new Brand(); - - result.Id = p40.BrandId; - return result; - - } - - private static ApplicationUser funcMain17(Never p44, ApplicationUser p45, ProductSDto p40) - { - ApplicationUser result = p45 ?? new ApplicationUser(); - - result.Id = p40.AuthorId; - return result; - - } - - private static ProductCategory funcMain18(Never p46, ProductCategory p47, ProductSDto p40) - { - ProductCategory result = p47 ?? new ProductCategory(); - - result.Name = p40.CategoryName; - result.Id = p40.CategoryId; - return result; - - } - - private static bool funcMain19(ProductStorageFile f) + private static bool funcMain15(ProductStorageFile f) { return f.IsPrimary; } - private static bool funcMain20(ProductStorageFile f) + private static bool funcMain16(ProductStorageFile f) { return f.IsPrimary; } diff --git a/Netina.Domain/MapsterRegister.cs b/Netina.Domain/MapsterRegister.cs index 9a9845a..6294a06 100644 --- a/Netina.Domain/MapsterRegister.cs +++ b/Netina.Domain/MapsterRegister.cs @@ -1,5 +1,6 @@ using Netina.Domain.Dtos.ResponseDtos.Torob; using Netina.Domain.Entities.Accounting; +using Netina.Domain.Entities.Comments; namespace Netina.Domain; @@ -28,6 +29,26 @@ public class MapsterRegister : IRegister .Map("ShippingMethod", o => o.Shipping != null ? o.Shipping.Name : string.Empty) .TwoWays(); + config.NewConfig() + .Map(d => d.UserFullName, o => o.User != null ? o.User.FirstName + " " + o.User.LastName : string.Empty) + .TwoWays(); + + config.NewConfig() + .Map(d => d.UserFullName, o => o.User != null ? o.User.FirstName + " " + o.User.LastName : string.Empty) + .TwoWays(); + + + ConfigProductMappers(config); + + ConfigOrderMappers(config); + + ConfigUserMappers(config); + + } + + private void ConfigProductMappers(TypeAdapterConfig config) + { + config.NewConfig() .Map("MainImage", o => o.Files.FirstOrDefault(f => f.IsPrimary) != null ? o.Files.FirstOrDefault(f => f.IsPrimary).FileLocation : o.Files.Count > 0 ? o.Files.FirstOrDefault().FileLocation : string.Empty) .Map("ParentName", o => o.Parent != null ? o.Parent.Name : string.Empty) @@ -62,16 +83,11 @@ public class MapsterRegister : IRegister .TwoWays(); config.NewConfig() - .Map(s=>s.availibility,o=>o.IsEnable) - .Map(s=>s.price , o=>o.Cost) - .Map(s=>s.product_id,o=>o.Id.ToString()) + .Map(s => s.availibility, o => o.IsEnable) + .Map(s => s.price, o => o.Cost) + .Map(s => s.product_id, o => o.Id.ToString()) .IgnoreNullValues(false) .TwoWays(); - - ConfigOrderMappers(config); - - ConfigUserMappers(config); - } private void ConfigOrderMappers(TypeAdapterConfig config) diff --git a/Netina.Repository/Handlers/Comments/CreateCommentCommandHandler.cs b/Netina.Repository/Handlers/Comments/CreateCommentCommandHandler.cs index b1227b7..69e14f7 100644 --- a/Netina.Repository/Handlers/Comments/CreateCommentCommandHandler.cs +++ b/Netina.Repository/Handlers/Comments/CreateCommentCommandHandler.cs @@ -16,13 +16,15 @@ public class CreateCommentCommandHandler(IRepositoryWrapper repositoryWrapper, I else userId = request.UserId.Value; + if (request.BlogId != null) { - var entBlog = BlogComment.Create(request.Title, request.Content, request.Rate, request.IsAdmin, userId, - request.BlogId.Value); - + var entBlog = BlogComment.Create(request.Title, request.Content, request.Rate, request.IsAdmin, userId, request.BlogId.Value); + if (request.IsAdmin) + entBlog.ConfirmReview(); if (request.ParentId != null) entBlog.SetParent(request.ParentId.Value); + repositoryWrapper.SetRepository().Add(entBlog); await repositoryWrapper.SaveChangesAsync(cancellationToken); return entBlog.Id; @@ -33,6 +35,8 @@ public class CreateCommentCommandHandler(IRepositoryWrapper repositoryWrapper, I var entBlog = ProductComment.Create(request.Title, request.Content, request.Rate, request.IsBuyer, request.IsAdmin, userId, request.ProductId.Value); + if (request.IsAdmin) + entBlog.ConfirmReview(); if (request.ParentId != null) entBlog.SetParent(request.ParentId.Value); @@ -43,6 +47,8 @@ public class CreateCommentCommandHandler(IRepositoryWrapper repositoryWrapper, I } var ent = Comment.Create(request.Title, request.Content, request.Rate, request.IsAdmin, userId); + if (request.IsAdmin) + ent.ConfirmReview(); if (request.ParentId != null) ent.SetParent(request.ParentId.Value); repositoryWrapper.SetRepository().Add(ent); diff --git a/Netina.Repository/Handlers/Comments/GetCommentsQueryHandler.cs b/Netina.Repository/Handlers/Comments/GetCommentsQueryHandler.cs index 89662fb..892e8a3 100644 --- a/Netina.Repository/Handlers/Comments/GetCommentsQueryHandler.cs +++ b/Netina.Repository/Handlers/Comments/GetCommentsQueryHandler.cs @@ -19,6 +19,7 @@ public class GetCommentsQueryHandler(IRepositoryWrapper repositoryWrapper) var blogRoots = await blogQuery.ToListAsync(cancellationToken); foreach (var root in blogRoots) await LoadChildrenAsync(root, cancellationToken); + return blogRoots; } if (request.ProductId != null) @@ -32,6 +33,7 @@ public class GetCommentsQueryHandler(IRepositoryWrapper repositoryWrapper) var blogRoots = await blogQuery.ToListAsync(cancellationToken); foreach (var root in blogRoots) await LoadChildrenAsync(root, cancellationToken); + return blogRoots; } var query = repositoryWrapper.SetRepository().TableNoTracking diff --git a/Netina.Repository/Handlers/Comments/Validators/CreateCommentCommandValidator.cs b/Netina.Repository/Handlers/Comments/Validators/CreateCommentCommandValidator.cs index 5a6271a..92cb6d4 100644 --- a/Netina.Repository/Handlers/Comments/Validators/CreateCommentCommandValidator.cs +++ b/Netina.Repository/Handlers/Comments/Validators/CreateCommentCommandValidator.cs @@ -15,10 +15,5 @@ public class CreateCommentCommandValidator : AbstractValidator d.ProductId) - .NotEqual(Guid.Empty) - .NotEmpty() - .WithMessage("کالا مورد نظر را وارد کنید"); } } \ No newline at end of file diff --git a/Netina.Repository/Handlers/Comments/Validators/UpdateCommentCommandValidator.cs b/Netina.Repository/Handlers/Comments/Validators/UpdateCommentCommandValidator.cs index 8e8d4bb..7c23788 100644 --- a/Netina.Repository/Handlers/Comments/Validators/UpdateCommentCommandValidator.cs +++ b/Netina.Repository/Handlers/Comments/Validators/UpdateCommentCommandValidator.cs @@ -15,10 +15,5 @@ public class UpdateCommentCommandValidator : AbstractValidator d.ProductId) - .NotEqual(Guid.Empty) - .NotEmpty() - .WithMessage("کالا مورد نظر را وارد کنید"); } } \ No newline at end of file diff --git a/Netina.Repository/Migrations/20240924112404_ChangeToComment.Designer.cs b/Netina.Repository/Migrations/20240924112404_ChangeToComment.Designer.cs new file mode 100644 index 0000000..ee0bba8 --- /dev/null +++ b/Netina.Repository/Migrations/20240924112404_ChangeToComment.Designer.cs @@ -0,0 +1,2119 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Netina.Repository.Models; +using Npgsql.EntityFrameworkCore.PostgreSQL.Metadata; + +#nullable disable + +namespace NetinaShop.Repository.Migrations +{ + [DbContext(typeof(ApplicationContext))] + [Migration("20240924112404_ChangeToComment")] + partial class ChangeToComment + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("public") + .HasAnnotation("ProductVersion", "8.0.8") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "fuzzystrmatch"); + NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "pg_trgm"); + 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("Netina.Domain.Entities.Accounting.Payment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Amount") + .HasColumnType("double precision"); + + b.Property("Authority") + .IsRequired() + .HasColumnType("text"); + + b.Property("CardPan") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("FactorNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("OrderId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Status") + .HasColumnType("integer"); + + b.Property("TransactionCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("Type") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("OrderId"); + + b.ToTable("Payments", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Blogs.Blog", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AuthorId") + .HasColumnType("uuid"); + + b.Property("CategoryId") + .HasColumnType("uuid"); + + b.Property("Content") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("IsSuggested") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ReadingTime") + .HasColumnType("integer"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Slug") + .IsRequired() + .HasColumnType("text"); + + b.Property("Summery") + .IsRequired() + .HasColumnType("text"); + + b.Property("Tags") + .IsRequired() + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AuthorId"); + + b.HasIndex("CategoryId"); + + b.ToTable("Blogs", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsMain") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Slug") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.ToTable("BlogCategories", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Brands.Brand", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("EnglishName") + .IsRequired() + .HasColumnType("text"); + + b.Property("HasSpecialPage") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("PageUrl") + .IsRequired() + .HasColumnType("text"); + + b.Property("PersianName") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Slug") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("Brands", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Comments.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Content") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("character varying(21)"); + + b.Property("IsAdmin") + .HasColumnType("boolean"); + + b.Property("IsConfirmed") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("IsRoot") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("Rate") + .HasColumnType("real"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.HasIndex("UserId"); + + b.ToTable("Comments", "public"); + + b.HasDiscriminator().HasValue("Comment"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Netina.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") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("DiscountAmount") + .HasColumnType("bigint"); + + b.Property("DiscountPercent") + .HasColumnType("integer"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("character varying(21)"); + + b.Property("ExpireDate") + .HasColumnType("timestamp without time zone"); + + b.Property("HasCode") + .HasColumnType("boolean"); + + b.Property("HasPriceCeiling") + .HasColumnType("boolean"); + + b.Property("HasPriceFloor") + .HasColumnType("boolean"); + + b.Property("Immortal") + .HasColumnType("boolean"); + + b.Property("IsForFirstPurchase") + .HasColumnType("boolean"); + + b.Property("IsForInvitation") + .HasColumnType("boolean"); + + b.Property("IsForSaleCooperation") + .HasColumnType("boolean"); + + b.Property("IsInfinity") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("IsSpecialOffer") + .HasColumnType("boolean"); + + b.Property("MarketerId") + .HasColumnType("uuid"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("PriceCeiling") + .HasColumnType("bigint"); + + b.Property("PriceFloor") + .HasColumnType("bigint"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("StartDate") + .HasColumnType("timestamp without time zone"); + + b.Property("Type") + .HasColumnType("integer"); + + b.Property("UseCount") + .HasColumnType("bigint"); + + b.HasKey("Id"); + + b.HasIndex("MarketerId") + .IsUnique(); + + b.ToTable("Discounts", "public"); + + b.HasDiscriminator().HasValue("Discount"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Orders.Order", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("CustomerId") + .HasColumnType("uuid"); + + b.Property("DeliveredAt") + .HasColumnType("timestamp without time zone"); + + b.Property("DeliveryPrice") + .HasColumnType("double precision"); + + b.Property("DiscountCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("DiscountCodePrice") + .HasColumnType("double precision"); + + b.Property("DiscountId") + .HasColumnType("uuid"); + + b.Property("DiscountPrice") + .HasColumnType("double precision"); + + b.Property("DoneAt") + .HasColumnType("timestamp without time zone"); + + b.Property("FactorCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsPayed") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("OrderAt") + .HasColumnType("timestamp without time zone"); + + b.Property("OrderStatus") + .HasColumnType("integer"); + + b.Property("PackingPrice") + .HasColumnType("double precision"); + + b.Property("PayedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("PaymentMethod") + .HasColumnType("integer"); + + b.Property("PreparingMinute") + .HasColumnType("integer"); + + b.Property("ProductDiscountPrice") + .HasColumnType("double precision"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ServicePrice") + .HasColumnType("double precision"); + + b.Property("TaxesPrice") + .HasColumnType("double precision"); + + b.Property("TotalPrice") + .HasColumnType("double precision"); + + b.Property("TotalProductsPrice") + .HasColumnType("double precision"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.HasIndex("DiscountId"); + + b.ToTable("Orders", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Orders.OrderDelivery", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AddressId") + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("DeliveryCost") + .HasColumnType("double precision"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("OrderId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ShippingId") + .HasColumnType("uuid"); + + b.Property("TrackingCode") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AddressId"); + + b.HasIndex("OrderId") + .IsUnique(); + + b.HasIndex("ShippingId"); + + b.ToTable("OrderDeliveries", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Orders.OrderProduct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Count") + .HasColumnType("integer"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("HasDiscount") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("OrderId") + .HasColumnType("uuid"); + + b.Property("OrderProductStatus") + .HasColumnType("integer"); + + b.Property("PackingCost") + .HasColumnType("double precision"); + + b.Property("PackingFee") + .HasColumnType("double precision"); + + b.Property("ProductCategoryId") + .HasColumnType("uuid"); + + b.Property("ProductCost") + .HasColumnType("double precision"); + + b.Property("ProductFee") + .HasColumnType("double precision"); + + b.Property("ProductFeeWithDiscount") + .HasColumnType("double precision"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("OrderId"); + + b.HasIndex("ProductId"); + + b.ToTable("OrderProducts", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.ProductCategories.ProductCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Description") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsMain") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Slug") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.ToTable("ProductCategories", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("AuthorId") + .HasColumnType("uuid"); + + b.Property("BeDisplayed") + .HasColumnType("boolean"); + + b.Property("BrandId") + .HasColumnType("uuid"); + + b.Property("CategoryId") + .HasColumnType("uuid"); + + b.Property("Cost") + .HasColumnType("double precision"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("EnglishName") + .IsRequired() + .HasColumnType("text"); + + b.Property("ExpertCheck") + .IsRequired() + .HasColumnType("text"); + + b.Property("HasExpressDelivery") + .HasColumnType("boolean"); + + b.Property("IsEnable") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("MaxOrderCount") + .HasColumnType("integer"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("PackingCost") + .HasColumnType("double precision"); + + b.Property("PersianName") + .IsRequired() + .HasColumnType("text"); + + b.Property("Rate") + .HasColumnType("real"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ReviewCount") + .HasColumnType("integer"); + + b.Property("Slug") + .IsRequired() + .HasColumnType("text"); + + b.Property("Stock") + .HasColumnType("integer"); + + b.Property("Summery") + .IsRequired() + .HasColumnType("text"); + + b.Property("Tags") + .IsRequired() + .HasColumnType("text"); + + b.Property("Viewed") + .HasColumnType("integer"); + + b.Property("Warranty") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("AuthorId"); + + b.HasIndex("BrandId"); + + b.HasIndex("CategoryId"); + + b.ToTable("Products", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.Specification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Detail") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsFeature") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.Property("Value") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.HasIndex("ProductId"); + + b.ToTable("Specifications", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.StorageFiles.StorageFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(34) + .HasColumnType("character varying(34)"); + + b.Property("FileLocation") + .IsRequired() + .HasColumnType("text"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("text"); + + b.Property("FileType") + .HasColumnType("integer"); + + b.Property("IsHeader") + .HasColumnType("boolean"); + + b.Property("IsPrimary") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("StorageFiles", "public"); + + b.HasDiscriminator().HasValue("StorageFile"); + + b.UseTphMappingStrategy(); + }); + + modelBuilder.Entity("Netina.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("Netina.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("Netina.Domain.Entities.Users.Customer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("Customers", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.Manager", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("LatestVersionUsed") + .HasColumnType("double precision"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("Managers", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.Marketer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("FatherName") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("LastSettlement") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Shaba") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId") + .IsUnique(); + + b.ToTable("Marketers", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.NewsletterMember", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Email") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("PhoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("NewsletterMembers", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.UserAddress", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Address") + .IsRequired() + .HasColumnType("text"); + + b.Property("BuildingUnit") + .IsRequired() + .HasColumnType("text"); + + b.Property("City") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("LocationLat") + .HasColumnType("real"); + + b.Property("LocationLong") + .HasColumnType("real"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Plaque") + .IsRequired() + .HasColumnType("text"); + + b.Property("PostalCode") + .IsRequired() + .HasColumnType("text"); + + b.Property("Province") + .IsRequired() + .HasColumnType("text"); + + b.Property("ReceiverFullName") + .IsRequired() + .HasColumnType("text"); + + b.Property("ReceiverPhoneNumber") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("UserAddresses", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.UserFavoriteProduct", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ProductId"); + + b.HasIndex("UserId"); + + b.ToTable("UserFavoriteProducts", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Warehouses.Shipping", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("DeliveryCost") + .HasColumnType("double precision"); + + b.Property("IsExpressShipping") + .HasColumnType("boolean"); + + b.Property("IsOriginalWarehouse") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("IsShipBySeller") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("WarehouseName") + .IsRequired() + .HasColumnType("text"); + + b.Property("WorkingDays") + .HasColumnType("integer"); + + b.HasKey("Id"); + + b.ToTable("Shippings", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogComment", b => + { + b.HasBaseType("Netina.Domain.Entities.Comments.Comment"); + + b.Property("BlogId") + .HasColumnType("uuid"); + + b.HasIndex("BlogId"); + + b.HasDiscriminator().HasValue("BlogComment"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.ProductComment", b => + { + b.HasBaseType("Netina.Domain.Entities.Comments.Comment"); + + b.Property("IsBuyer") + .HasColumnType("boolean"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.HasIndex("ProductId"); + + b.HasDiscriminator().HasValue("ProductComment"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Discounts.CategoryDiscount", b => + { + b.HasBaseType("Netina.Domain.Entities.Discounts.Discount"); + + b.Property("CategoryId") + .HasColumnType("uuid"); + + b.HasIndex("CategoryId"); + + b.HasDiscriminator().HasValue("CategoryDiscount"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Discounts.ProductDiscount", b => + { + b.HasBaseType("Netina.Domain.Entities.Discounts.Discount"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.HasIndex("ProductId"); + + b.HasDiscriminator().HasValue("ProductDiscount"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogStorageFile", b => + { + b.HasBaseType("Netina.Domain.Entities.StorageFiles.StorageFile"); + + b.Property("BlogId") + .HasColumnType("uuid"); + + b.HasIndex("BlogId"); + + b.HasDiscriminator().HasValue("BlogStorageFile"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Brands.BrandStorageFile", b => + { + b.HasBaseType("Netina.Domain.Entities.StorageFiles.StorageFile"); + + b.Property("BrandId") + .HasColumnType("uuid"); + + b.HasIndex("BrandId"); + + b.HasDiscriminator().HasValue("BrandStorageFile"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.ProductCategories.ProductCategoryStorageFile", b => + { + b.HasBaseType("Netina.Domain.Entities.StorageFiles.StorageFile"); + + b.Property("CategoryId") + .HasColumnType("uuid"); + + b.HasIndex("CategoryId"); + + b.HasDiscriminator().HasValue("ProductCategoryStorageFile"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.ProductStorageFile", b => + { + b.HasBaseType("Netina.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("Netina.Domain.Entities.Users.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationRole", null) + .WithMany() + .HasForeignKey("RoleId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", null) + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Accounting.Payment", b => + { + b.HasOne("Netina.Domain.Entities.Users.Customer", "Customer") + .WithMany() + .HasForeignKey("CustomerId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Netina.Domain.Entities.Orders.Order", "Order") + .WithMany("Payments") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Customer"); + + b.Navigation("Order"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Blogs.Blog", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "Author") + .WithMany() + .HasForeignKey("AuthorId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Netina.Domain.Entities.Blogs.BlogCategory", "Category") + .WithMany("Blogs") + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Author"); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogCategory", b => + { + b.HasOne("Netina.Domain.Entities.Blogs.BlogCategory", "Parent") + .WithMany() + .HasForeignKey("ParentId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Comments.Comment", b => + { + b.HasOne("Netina.Domain.Entities.Comments.Comment", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId"); + + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Parent"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Discounts.Discount", b => + { + b.HasOne("Netina.Domain.Entities.Users.Marketer", "Marketer") + .WithOne("Discount") + .HasForeignKey("Netina.Domain.Entities.Discounts.Discount", "MarketerId"); + + b.Navigation("Marketer"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Orders.Order", b => + { + b.HasOne("Netina.Domain.Entities.Users.Customer", "Customer") + .WithMany() + .HasForeignKey("CustomerId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Netina.Domain.Entities.Discounts.Discount", null) + .WithMany("Orders") + .HasForeignKey("DiscountId"); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Orders.OrderDelivery", b => + { + b.HasOne("Netina.Domain.Entities.Users.UserAddress", "Address") + .WithMany() + .HasForeignKey("AddressId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Netina.Domain.Entities.Orders.Order", "Order") + .WithOne("OrderDelivery") + .HasForeignKey("Netina.Domain.Entities.Orders.OrderDelivery", "OrderId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Netina.Domain.Entities.Warehouses.Shipping", "Shipping") + .WithMany() + .HasForeignKey("ShippingId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Address"); + + b.Navigation("Order"); + + b.Navigation("Shipping"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Orders.OrderProduct", b => + { + b.HasOne("Netina.Domain.Entities.Orders.Order", "Order") + .WithMany("OrderProducts") + .HasForeignKey("OrderId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") + .WithMany("OrderProducts") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Order"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.ProductCategories.ProductCategory", b => + { + b.HasOne("Netina.Domain.Entities.ProductCategories.ProductCategory", "Parent") + .WithMany() + .HasForeignKey("ParentId"); + + b.Navigation("Parent"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.Product", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "Author") + .WithMany() + .HasForeignKey("AuthorId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Netina.Domain.Entities.Brands.Brand", "Brand") + .WithMany("Products") + .HasForeignKey("BrandId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Netina.Domain.Entities.ProductCategories.ProductCategory", "Category") + .WithMany("Products") + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Author"); + + b.Navigation("Brand"); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.Specification", b => + { + b.HasOne("Netina.Domain.Entities.Products.Specification", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId"); + + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") + .WithMany("Specifications") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Parent"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.Customer", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") + .WithOne("Customer") + .HasForeignKey("Netina.Domain.Entities.Users.Customer", "UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.Manager", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") + .WithOne("Manager") + .HasForeignKey("Netina.Domain.Entities.Users.Manager", "UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.Marketer", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") + .WithOne("Marketer") + .HasForeignKey("Netina.Domain.Entities.Users.Marketer", "UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.UserAddress", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") + .WithMany("Addresses") + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.UserFavoriteProduct", b => + { + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") + .WithMany() + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Product"); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogComment", b => + { + b.HasOne("Netina.Domain.Entities.Blogs.Blog", "Blog") + .WithMany() + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.ProductComment", b => + { + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") + .WithMany("Comments") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Discounts.CategoryDiscount", b => + { + b.HasOne("Netina.Domain.Entities.ProductCategories.ProductCategory", "Category") + .WithMany() + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Discounts.ProductDiscount", b => + { + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") + .WithMany() + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogStorageFile", b => + { + b.HasOne("Netina.Domain.Entities.Blogs.Blog", "Blog") + .WithMany("Files") + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Brands.BrandStorageFile", b => + { + b.HasOne("Netina.Domain.Entities.Brands.Brand", "Brand") + .WithMany("Files") + .HasForeignKey("BrandId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Brand"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.ProductCategories.ProductCategoryStorageFile", b => + { + b.HasOne("Netina.Domain.Entities.ProductCategories.ProductCategory", "Category") + .WithMany("Files") + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Category"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.ProductStorageFile", b => + { + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") + .WithMany("Files") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Blogs.Blog", b => + { + b.Navigation("Files"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogCategory", b => + { + b.Navigation("Blogs"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Brands.Brand", b => + { + b.Navigation("Files"); + + b.Navigation("Products"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Comments.Comment", b => + { + b.Navigation("Children"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Discounts.Discount", b => + { + b.Navigation("Orders"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Orders.Order", b => + { + b.Navigation("OrderDelivery"); + + b.Navigation("OrderProducts"); + + b.Navigation("Payments"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.ProductCategories.ProductCategory", b => + { + b.Navigation("Files"); + + b.Navigation("Products"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.Product", b => + { + b.Navigation("Comments"); + + b.Navigation("Files"); + + b.Navigation("OrderProducts"); + + b.Navigation("Specifications"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.Specification", b => + { + b.Navigation("Children"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.ApplicationUser", b => + { + b.Navigation("Addresses"); + + b.Navigation("Customer"); + + b.Navigation("Manager"); + + b.Navigation("Marketer"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.Marketer", b => + { + b.Navigation("Discount"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Netina.Repository/Migrations/20240924112404_ChangeToComment.cs b/Netina.Repository/Migrations/20240924112404_ChangeToComment.cs new file mode 100644 index 0000000..0eb82c5 --- /dev/null +++ b/Netina.Repository/Migrations/20240924112404_ChangeToComment.cs @@ -0,0 +1,162 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace NetinaShop.Repository.Migrations +{ + /// + public partial class ChangeToComment : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Reviews", + schema: "public"); + + migrationBuilder.CreateTable( + name: "Comments", + 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), + Rate = table.Column(type: "real", nullable: false), + IsConfirmed = table.Column(type: "boolean", nullable: false), + IsAdmin = table.Column(type: "boolean", nullable: false), + IsRoot = table.Column(type: "boolean", nullable: false), + ParentId = table.Column(type: "uuid", nullable: true), + UserId = table.Column(type: "uuid", nullable: false), + Discriminator = table.Column(type: "character varying(21)", maxLength: 21, nullable: false), + BlogId = table.Column(type: "uuid", nullable: true), + IsBuyer = table.Column(type: "boolean", 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: false), + IsRemoved = table.Column(type: "boolean", nullable: false), + RemovedBy = table.Column(type: "text", nullable: false), + ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), + ModifiedBy = table.Column(type: "text", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Comments", x => x.Id); + table.ForeignKey( + name: "FK_Comments_Blogs_BlogId", + column: x => x.BlogId, + principalSchema: "public", + principalTable: "Blogs", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Comments_Comments_ParentId", + column: x => x.ParentId, + principalSchema: "public", + principalTable: "Comments", + principalColumn: "Id"); + table.ForeignKey( + name: "FK_Comments_Products_ProductId", + column: x => x.ProductId, + principalSchema: "public", + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Comments_Users_UserId", + column: x => x.UserId, + principalSchema: "public", + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateIndex( + name: "IX_Comments_BlogId", + schema: "public", + table: "Comments", + column: "BlogId"); + + migrationBuilder.CreateIndex( + name: "IX_Comments_ParentId", + schema: "public", + table: "Comments", + column: "ParentId"); + + migrationBuilder.CreateIndex( + name: "IX_Comments_ProductId", + schema: "public", + table: "Comments", + column: "ProductId"); + + migrationBuilder.CreateIndex( + name: "IX_Comments_UserId", + schema: "public", + table: "Comments", + column: "UserId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Comments", + schema: "public"); + + migrationBuilder.CreateTable( + name: "Reviews", + 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), + Comment = table.Column(type: "text", nullable: false), + CreatedAt = table.Column(type: "timestamp without time zone", nullable: false), + CreatedBy = table.Column(type: "text", nullable: false), + IsAdmin = table.Column(type: "boolean", nullable: false), + IsBuyer = table.Column(type: "boolean", nullable: false), + IsConfirmed = table.Column(type: "boolean", nullable: false), + IsRemoved = table.Column(type: "boolean", nullable: false), + ModifiedAt = table.Column(type: "timestamp without time zone", nullable: false), + ModifiedBy = table.Column(type: "text", nullable: false), + Rate = table.Column(type: "real", nullable: false), + RemovedAt = table.Column(type: "timestamp without time zone", nullable: false), + RemovedBy = table.Column(type: "text", nullable: false), + Title = table.Column(type: "text", nullable: false) + }, + 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.CreateIndex( + name: "IX_Reviews_ProductId", + schema: "public", + table: "Reviews", + column: "ProductId"); + + migrationBuilder.CreateIndex( + name: "IX_Reviews_UserId", + schema: "public", + table: "Reviews", + column: "UserId"); + } + } +} diff --git a/Netina.Repository/Migrations/ApplicationContextModelSnapshot.cs b/Netina.Repository/Migrations/ApplicationContextModelSnapshot.cs index 0561cb7..663ef67 100644 --- a/Netina.Repository/Migrations/ApplicationContextModelSnapshot.cs +++ b/Netina.Repository/Migrations/ApplicationContextModelSnapshot.cs @@ -18,7 +18,7 @@ namespace NetinaShop.Repository.Migrations #pragma warning disable 612, 618 modelBuilder .HasDefaultSchema("public") - .HasAnnotation("ProductVersion", "8.0.7") + .HasAnnotation("ProductVersion", "8.0.8") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "fuzzystrmatch"); @@ -386,6 +386,80 @@ namespace NetinaShop.Repository.Migrations b.ToTable("Brands", "public"); }); + modelBuilder.Entity("Netina.Domain.Entities.Comments.Comment", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("Content") + .IsRequired() + .HasColumnType("text"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(21) + .HasColumnType("character varying(21)"); + + b.Property("IsAdmin") + .HasColumnType("boolean"); + + b.Property("IsConfirmed") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("IsRoot") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("Rate") + .HasColumnType("real"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.HasIndex("UserId"); + + b.ToTable("Comments", "public"); + + b.HasDiscriminator().HasValue("Comment"); + + b.UseTphMappingStrategy(); + }); + modelBuilder.Entity("Netina.Domain.Entities.Discounts.Discount", b => { b.Property("Id") @@ -958,71 +1032,6 @@ namespace NetinaShop.Repository.Migrations b.ToTable("Specifications", "public"); }); - modelBuilder.Entity("Netina.Domain.Entities.Reviews.Review", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsAdmin") - .HasColumnType("boolean"); - - b.Property("IsBuyer") - .HasColumnType("boolean"); - - b.Property("IsConfirmed") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("Rate") - .HasColumnType("real"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Title") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ProductId"); - - b.HasIndex("UserId"); - - b.ToTable("Reviews", "public"); - }); - modelBuilder.Entity("Netina.Domain.Entities.StorageFiles.StorageFile", b => { b.Property("Id") @@ -1574,6 +1583,33 @@ namespace NetinaShop.Repository.Migrations b.ToTable("Shippings", "public"); }); + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogComment", b => + { + b.HasBaseType("Netina.Domain.Entities.Comments.Comment"); + + b.Property("BlogId") + .HasColumnType("uuid"); + + b.HasIndex("BlogId"); + + b.HasDiscriminator().HasValue("BlogComment"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.ProductComment", b => + { + b.HasBaseType("Netina.Domain.Entities.Comments.Comment"); + + b.Property("IsBuyer") + .HasColumnType("boolean"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.HasIndex("ProductId"); + + b.HasDiscriminator().HasValue("ProductComment"); + }); + modelBuilder.Entity("Netina.Domain.Entities.Discounts.CategoryDiscount", b => { b.HasBaseType("Netina.Domain.Entities.Discounts.Discount"); @@ -1734,6 +1770,22 @@ namespace NetinaShop.Repository.Migrations b.Navigation("Parent"); }); + modelBuilder.Entity("Netina.Domain.Entities.Comments.Comment", b => + { + b.HasOne("Netina.Domain.Entities.Comments.Comment", "Parent") + .WithMany("Children") + .HasForeignKey("ParentId"); + + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") + .WithMany() + .HasForeignKey("UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Parent"); + + b.Navigation("User"); + }); + modelBuilder.Entity("Netina.Domain.Entities.Discounts.Discount", b => { b.HasOne("Netina.Domain.Entities.Users.Marketer", "Marketer") @@ -1847,23 +1899,6 @@ namespace NetinaShop.Repository.Migrations b.Navigation("Product"); }); - modelBuilder.Entity("Netina.Domain.Entities.Reviews.Review", b => - { - b.HasOne("Netina.Domain.Entities.Products.Product", "Product") - .WithMany("Reviews") - .HasForeignKey("ProductId") - .OnDelete(DeleteBehavior.Restrict); - - b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") - .WithMany() - .HasForeignKey("UserId") - .OnDelete(DeleteBehavior.Restrict); - - b.Navigation("Product"); - - b.Navigation("User"); - }); - modelBuilder.Entity("Netina.Domain.Entities.Users.Customer", b => { b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") @@ -1921,6 +1956,26 @@ namespace NetinaShop.Repository.Migrations b.Navigation("User"); }); + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogComment", b => + { + b.HasOne("Netina.Domain.Entities.Blogs.Blog", "Blog") + .WithMany() + .HasForeignKey("BlogId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Blog"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Products.ProductComment", b => + { + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") + .WithMany("Comments") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Product"); + }); + modelBuilder.Entity("Netina.Domain.Entities.Discounts.CategoryDiscount", b => { b.HasOne("Netina.Domain.Entities.ProductCategories.ProductCategory", "Category") @@ -1998,6 +2053,11 @@ namespace NetinaShop.Repository.Migrations b.Navigation("Products"); }); + modelBuilder.Entity("Netina.Domain.Entities.Comments.Comment", b => + { + b.Navigation("Children"); + }); + modelBuilder.Entity("Netina.Domain.Entities.Discounts.Discount", b => { b.Navigation("Orders"); @@ -2021,12 +2081,12 @@ namespace NetinaShop.Repository.Migrations modelBuilder.Entity("Netina.Domain.Entities.Products.Product", b => { + b.Navigation("Comments"); + b.Navigation("Files"); b.Navigation("OrderProducts"); - b.Navigation("Reviews"); - b.Navigation("Specifications"); });