diff --git a/.version b/.version index d02979a..c972caa 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -1.3.12.16 \ No newline at end of file +1.4.12.17 \ No newline at end of file diff --git a/Netina.Api/Controllers/BlogController.cs b/Netina.Api/Controllers/BlogController.cs index 48a69f7..dcb26ed 100644 --- a/Netina.Api/Controllers/BlogController.cs +++ b/Netina.Api/Controllers/BlogController.cs @@ -1,6 +1,8 @@ using Microsoft.Extensions.Options; +using Netina.Api.Services; using Netina.Domain.Entities.Blogs; using System.Web; +using Netina.Repository.Abstracts; namespace Netina.Api.Controllers; @@ -77,9 +79,13 @@ public class BlogController : ICarterModule } // POST:Create Entity - public async Task Post([FromBody] BlogLDto dto, IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken) + public async Task Post([FromBody] BlogLDto dto, IRepositoryWrapper repositoryWrapper,ICurrentUserService currentUserService, CancellationToken cancellationToken) { - var ent = Blog.Create(dto.Title, dto.Content, dto.Tags, dto.ReadingTime, dto.Summery, dto.IsSuggested,dto.CategoryId); + if (currentUserService.UserId == null) + throw new BaseApiException(ApiResultStatusCode.UnAuthorized, "User id is wrong"); + if (!Guid.TryParse(currentUserService.UserId, out Guid userId)) + throw new BaseApiException(ApiResultStatusCode.UnAuthorized, "User id is wrong"); + var ent = Blog.Create(dto.Title, dto.Content, dto.Tags, dto.ReadingTime, dto.Summery, dto.IsSuggested,dto.CategoryId, userId); foreach (var file in dto.Files) { ent.AddFile(file.Name, file.FileLocation, file.FileName, file.IsHeader, file.IsPrimary, file.FileType); @@ -91,13 +97,17 @@ public class BlogController : ICarterModule } // PUT:Update Entity - public async Task Put([FromBody] BlogLDto dto, IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken) + public async Task Put([FromBody] BlogLDto dto, IRepositoryWrapper repositoryWrapper, ICurrentUserService currentUserService, CancellationToken cancellationToken) { var ent = await repositoryWrapper.SetRepository().TableNoTracking .FirstOrDefaultAsync(b => b.Id == dto.Id, cancellationToken); if (ent == null) throw new AppException("Blog not found"); - var newEnt = Blog.Create(dto.Title, dto.Content, dto.Tags, dto.ReadingTime, dto.Summery, dto.IsSuggested, dto.CategoryId); + if (currentUserService.UserId == null) + throw new BaseApiException(ApiResultStatusCode.UnAuthorized, "User id is wrong"); + if (!Guid.TryParse(currentUserService.UserId, out Guid userId)) + throw new BaseApiException(ApiResultStatusCode.UnAuthorized, "User id is wrong"); + var newEnt = Blog.Create(dto.Title, dto.Content, dto.Tags, dto.ReadingTime, dto.Summery, dto.IsSuggested, dto.CategoryId, userId); newEnt.Id = ent.Id; newEnt.CreatedAt = ent.CreatedAt; newEnt.CreatedBy = ent.CreatedBy; diff --git a/Netina.Api/Controllers/SeedController.cs b/Netina.Api/Controllers/SeedController.cs index b614ab9..45dd52e 100644 --- a/Netina.Api/Controllers/SeedController.cs +++ b/Netina.Api/Controllers/SeedController.cs @@ -126,7 +126,7 @@ public class SeedController(IWebHostEnvironment environment) : ICarterModule seedBlogRequestDto.CategoryId = noCategory.Id; } var ent = Blog.Create(seedBlogRequestDto.Title, seedBlogRequestDto.Slug, seedBlogRequestDto.Content, seedBlogRequestDto.Tags, seedBlogRequestDto.ReadingTime, - seedBlogRequestDto.Summery, seedBlogRequestDto.IsSuggested, seedBlogRequestDto.CategoryId); + seedBlogRequestDto.Summery, seedBlogRequestDto.IsSuggested, seedBlogRequestDto.CategoryId,default); foreach (var storageFileSDto in seedBlogRequestDto.Files) { diff --git a/Netina.Api/Netina.Api.csproj b/Netina.Api/Netina.Api.csproj index c8d0b93..3099c36 100644 --- a/Netina.Api/Netina.Api.csproj +++ b/Netina.Api/Netina.Api.csproj @@ -6,8 +6,8 @@ enable true Linux - 1.3.12.16 - 1.3.12.16 + 1.4.12.17 + 1.4.12.17do diff --git a/Netina.Common/Models/Entity/PageClassDisplay.cs b/Netina.Common/Models/Entity/PageClassDisplay.cs index 450ea17..e2c6e1b 100644 --- a/Netina.Common/Models/Entity/PageClassDisplay.cs +++ b/Netina.Common/Models/Entity/PageClassDisplay.cs @@ -1,16 +1,24 @@ namespace Netina.Common.Models.Entity { [AttributeUsage(AttributeTargets.Class)] - public class PageClassDisplay(string name, string description) : Attribute + public class PageClassDisplay : Attribute { + private readonly string _name; + private readonly string _description; + + public PageClassDisplay(string name, string description) + { + _name = name; + _description = description; + } public string GetName() { - return name; + return _name; } public string GetDescription() { - return description; + return _description; } } } \ No newline at end of file diff --git a/Netina.Domain/Dtos/LargDtos/BlogLDto.cs b/Netina.Domain/Dtos/LargDtos/BlogLDto.cs index 5bad642..e060c2b 100644 --- a/Netina.Domain/Dtos/LargDtos/BlogLDto.cs +++ b/Netina.Domain/Dtos/LargDtos/BlogLDto.cs @@ -12,5 +12,7 @@ public class BlogLDto : BaseDto public bool IsSuggested { get; set; } public Guid CategoryId { get; set; } public string CategoryName { get; set; } = string.Empty; + public Guid AuthorId { get; set; } + public string AuthorFullName { get; set; } = string.Empty; public List Files { get; set; } = new(); } \ No newline at end of file diff --git a/Netina.Domain/Dtos/LargDtos/ProductLDto.cs b/Netina.Domain/Dtos/LargDtos/ProductLDto.cs index cc84cfc..1fbd3de 100644 --- a/Netina.Domain/Dtos/LargDtos/ProductLDto.cs +++ b/Netina.Domain/Dtos/LargDtos/ProductLDto.cs @@ -31,4 +31,6 @@ public class ProductLDto : BaseDto public List Files { get; set; } = new(); public DiscountSDto? SpecialOffer { get; set; } + public Guid AuthorId { get; set; } + public string AuthorFullName { get; set; } = string.Empty; } \ No newline at end of file diff --git a/Netina.Domain/Dtos/SmallDtos/BlogSDto.cs b/Netina.Domain/Dtos/SmallDtos/BlogSDto.cs index e4df409..5caa123 100644 --- a/Netina.Domain/Dtos/SmallDtos/BlogSDto.cs +++ b/Netina.Domain/Dtos/SmallDtos/BlogSDto.cs @@ -12,4 +12,6 @@ public class BlogSDto : BaseDto public string CategoryName { get; set; } = string.Empty; public string MainImage { get; set; } = string.Empty; public DateTime ModifiedAt { get; set; } + public Guid AuthorId { get; set; } + public string AuthorFullName { get; set; } = string.Empty; } \ No newline at end of file diff --git a/Netina.Domain/Dtos/SmallDtos/ProductSDto.cs b/Netina.Domain/Dtos/SmallDtos/ProductSDto.cs index 1a7e5be..ffabb05 100644 --- a/Netina.Domain/Dtos/SmallDtos/ProductSDto.cs +++ b/Netina.Domain/Dtos/SmallDtos/ProductSDto.cs @@ -30,4 +30,6 @@ public class ProductSDto : BaseDto public string BrandName { get; set; } = string.Empty; public string CategoryName { get; set; } = string.Empty; public DateTime ModifiedAt { get; set; } + public Guid AuthorId { get; set; } + public string AuthorFullName { get; set; } = string.Empty; } \ No newline at end of file diff --git a/Netina.Domain/Entities/Blogs/Blog.Aggregate.cs b/Netina.Domain/Entities/Blogs/Blog.Aggregate.cs index 34a9f8c..60d13d3 100644 --- a/Netina.Domain/Entities/Blogs/Blog.Aggregate.cs +++ b/Netina.Domain/Entities/Blogs/Blog.Aggregate.cs @@ -2,17 +2,17 @@ public partial class Blog { - public static Blog Create(string title, string content, string tags, int readingTime, string summery, bool isSuggested, Guid categoryId) + public static Blog Create(string title, string content, string tags, int readingTime, string summery, bool isSuggested, Guid categoryId, Guid authorId) { var slug = StringExtensions.GetSlug(title); - return new Blog(title, slug, content, tags, readingTime, summery, isSuggested, categoryId); + return new Blog(title, slug, content, tags, readingTime, summery, isSuggested, categoryId,authorId); } - public static Blog Create(string title, string slug, string content, string tags, int readingTime, string summery, bool isSuggested, Guid categoryId) + public static Blog Create(string title, string slug, string content, string tags, int readingTime, string summery, bool isSuggested, Guid categoryId, Guid authorId) { if (slug.IsNullOrEmpty()) slug = StringExtensions.GetSlug(title); - return new Blog(title, slug, content, tags, readingTime, summery, isSuggested, categoryId); + return new Blog(title, slug, content, tags, readingTime, summery, isSuggested, categoryId, authorId); } public BlogStorageFile AddFile(string name, string fileLocation, string fileName, bool isHeader, bool isPrimary, StorageFileType fileType) { diff --git a/Netina.Domain/Entities/Blogs/Blog.cs b/Netina.Domain/Entities/Blogs/Blog.cs index c6f5bc6..f16710f 100644 --- a/Netina.Domain/Entities/Blogs/Blog.cs +++ b/Netina.Domain/Entities/Blogs/Blog.cs @@ -11,7 +11,7 @@ public partial class Blog : ApiEntity { } - public Blog(string title,string slug,string content,string tags, int readingTime,string summery, bool isSuggested, Guid categoryId) + public Blog(string title,string slug,string content,string tags, int readingTime,string summery, bool isSuggested, Guid categoryId,Guid authorId) { Title = title; Content = content; @@ -20,6 +20,7 @@ public partial class Blog : ApiEntity Summery = summery; IsSuggested = isSuggested; CategoryId = categoryId; + AuthorId = authorId; Slug = slug; } public string Title { get; internal set; } = string.Empty; @@ -32,5 +33,7 @@ public partial class Blog : ApiEntity public Guid CategoryId { get; internal set; } public BlogCategory? Category { get; internal set; } public List Files { get; internal set; } = new(); + public Guid AuthorId { get; internal set; } + public ApplicationUser? Author { get; internal set; } } \ No newline at end of file diff --git a/Netina.Domain/Entities/Brands/Brand.cs b/Netina.Domain/Entities/Brands/Brand.cs index d9c3967..ee7ca54 100644 --- a/Netina.Domain/Entities/Brands/Brand.cs +++ b/Netina.Domain/Entities/Brands/Brand.cs @@ -5,7 +5,7 @@ [AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)] [GenerateMapper] -[Index(nameof(Slug), IsUnique = true)] +//[Index(nameof(Slug), IsUnique = true)] public partial class Brand : ApiEntity { public Brand() diff --git a/Netina.Domain/Entities/Products/Product.Aggregate.cs b/Netina.Domain/Entities/Products/Product.Aggregate.cs index 45d6e96..7978bce 100644 --- a/Netina.Domain/Entities/Products/Product.Aggregate.cs +++ b/Netina.Domain/Entities/Products/Product.Aggregate.cs @@ -10,7 +10,7 @@ public partial class Product int stock, int maxOrderCount, Guid brandId, - Guid categoryId) + Guid categoryId, Guid authorId) { var slug = StringExtensions.GetSlug(persianName); return new Product( @@ -29,7 +29,7 @@ public partial class Product maxOrderCount, stock > 0, brandId, - categoryId); + categoryId,authorId); } public void AddRate(float rate) diff --git a/Netina.Domain/Entities/Products/Product.cs b/Netina.Domain/Entities/Products/Product.cs index f1fb47e..fb662df 100644 --- a/Netina.Domain/Entities/Products/Product.cs +++ b/Netina.Domain/Entities/Products/Product.cs @@ -8,7 +8,7 @@ [GenerateMapper] -[Index(nameof(Slug), IsUnique = true)] +//[Index(nameof(Slug), IsUnique = true)] public partial class Product : ApiEntity { public Product() @@ -32,7 +32,8 @@ public partial class Product : ApiEntity int maxOrderCount, bool isEnable, Guid brandId, - Guid categoryId) + Guid categoryId, + Guid authorId) { PersianName = persianName; EnglishName = englishName; @@ -50,6 +51,7 @@ public partial class Product : ApiEntity IsEnable = isEnable; BrandId = brandId; CategoryId = categoryId; + AuthorId = authorId; } public string PersianName { get; internal set; } = string.Empty; public string EnglishName { get; internal set; } = string.Empty; @@ -73,6 +75,8 @@ public partial class Product : ApiEntity public Brand? Brand { get; internal set; } public Guid CategoryId { get; internal set; } + public Guid AuthorId { get; internal set; } + public ApplicationUser? Author { get; internal set; } public ProductCategory? Category { get; internal set; } public List Specifications { get; internal set; } = new(); diff --git a/Netina.Domain/Mappers/BlogCategoryMapper.g.cs b/Netina.Domain/Mappers/BlogCategoryMapper.g.cs index 1e06ac9..02e27a2 100644 --- a/Netina.Domain/Mappers/BlogCategoryMapper.g.cs +++ b/Netina.Domain/Mappers/BlogCategoryMapper.g.cs @@ -2,9 +2,11 @@ using System; using System.Collections.Generic; using System.Linq; using System.Linq.Expressions; +using Mapster.Models; using Netina.Domain.Dtos.LargDtos; using Netina.Domain.Dtos.SmallDtos; using Netina.Domain.Entities.Blogs; +using Netina.Domain.Entities.Users; namespace Netina.Domain.Mappers { @@ -55,6 +57,8 @@ namespace Netina.Domain.Mappers Name = p8.CategoryName, Id = p8.CategoryId }, + AuthorId = p8.AuthorId, + Author = new ApplicationUser() {Id = p8.AuthorId}, Id = p8.Id, CreatedAt = p8.CreatedAt, ModifiedAt = p8.ModifiedAt @@ -105,6 +109,7 @@ namespace Netina.Domain.Mappers CategoryName = p16.Category.Name, MainImage = p16.Files.Count > 0 && p16.Files.Any(f => f.IsPrimary) ? p16.Files.FirstOrDefault(f => f.IsPrimary).FileName : string.Empty, ModifiedAt = p16.ModifiedAt, + AuthorId = p16.AuthorId, Id = p16.Id, CreatedAt = p16.CreatedAt }).ToList(), @@ -118,6 +123,9 @@ namespace Netina.Domain.Mappers Name = p17.Name, Slug = p17.Slug, Description = p17.Description, + IsMain = p17.IsMain, + ParentId = (Guid?)p17.ParentId, + Parent = new BlogCategory() {Id = p17.ParentId}, Id = p17.Id, CreatedAt = p17.CreatedAt }; @@ -133,48 +141,57 @@ namespace Netina.Domain.Mappers result.Name = p18.Name; result.Slug = p18.Slug; result.Description = p18.Description; + result.IsMain = p18.IsMain; + result.ParentId = (Guid?)p18.ParentId; + result.Parent = funcMain7(new Never(), result.Parent, p18); result.Id = p18.Id; result.CreatedAt = p18.CreatedAt; return result; } - public static BlogCategorySDto AdaptToSDto(this BlogCategory p20) + public static BlogCategorySDto AdaptToSDto(this BlogCategory p22) { - return p20 == null ? null : new BlogCategorySDto() + return p22 == null ? null : new BlogCategorySDto() { - Name = p20.Name, - BlogCount = funcMain7(p20.Blogs == null ? null : (int?)p20.Blogs.Count), - Description = p20.Description, - Slug = p20.Slug, - Id = p20.Id, - CreatedAt = p20.CreatedAt + Name = p22.Name, + BlogCount = funcMain8(p22.Blogs == null ? null : (int?)p22.Blogs.Count), + Description = p22.Description, + Slug = p22.Slug, + IsMain = p22.IsMain, + ParentId = p22.ParentId == null ? default(Guid) : (Guid)p22.ParentId, + Id = p22.Id, + CreatedAt = p22.CreatedAt }; } - public static BlogCategorySDto AdaptTo(this BlogCategory p22, BlogCategorySDto p23) + public static BlogCategorySDto AdaptTo(this BlogCategory p24, BlogCategorySDto p25) { - if (p22 == null) + if (p24 == null) { return null; } - BlogCategorySDto result = p23 ?? new BlogCategorySDto(); + BlogCategorySDto result = p25 ?? new BlogCategorySDto(); - result.Name = p22.Name; - result.BlogCount = funcMain8(p22.Blogs == null ? null : (int?)p22.Blogs.Count, result.BlogCount); - result.Description = p22.Description; - result.Slug = p22.Slug; - result.Id = p22.Id; - result.CreatedAt = p22.CreatedAt; + result.Name = p24.Name; + result.BlogCount = funcMain9(p24.Blogs == null ? null : (int?)p24.Blogs.Count, result.BlogCount); + result.Description = p24.Description; + result.Slug = p24.Slug; + result.IsMain = p24.IsMain; + result.ParentId = p24.ParentId == null ? default(Guid) : (Guid)p24.ParentId; + result.Id = p24.Id; + result.CreatedAt = p24.CreatedAt; return result; } - public static Expression> ProjectToSDto => p26 => new BlogCategorySDto() + public static Expression> ProjectToSDto => p28 => new BlogCategorySDto() { - Name = p26.Name, - BlogCount = p26.Blogs.Count, - Description = p26.Description, - Slug = p26.Slug, - Id = p26.Id, - CreatedAt = p26.CreatedAt + Name = p28.Name, + BlogCount = p28.Blogs.Count, + Description = p28.Description, + Slug = p28.Slug, + IsMain = p28.IsMain, + ParentId = p28.ParentId == null ? default(Guid) : (Guid)p28.ParentId, + Id = p28.Id, + CreatedAt = p28.CreatedAt }; private static List funcMain1(List p2) @@ -205,6 +222,8 @@ namespace Netina.Domain.Mappers Name = item.CategoryName, Id = item.CategoryId }, + AuthorId = item.AuthorId, + Author = new ApplicationUser() {Id = item.AuthorId}, Id = item.Id, CreatedAt = item.CreatedAt, ModifiedAt = item.ModifiedAt @@ -243,6 +262,8 @@ namespace Netina.Domain.Mappers Name = item.CategoryName, Id = item.CategoryId }, + AuthorId = item.AuthorId, + Author = new ApplicationUser() {Id = item.AuthorId}, Id = item.Id, CreatedAt = item.CreatedAt, ModifiedAt = item.ModifiedAt @@ -279,6 +300,7 @@ namespace Netina.Domain.Mappers CategoryName = item.Category == null ? null : item.Category.Name, MainImage = item.Files.Count > 0 && item.Files.Any(funcMain4) ? item.Files.FirstOrDefault(funcMain5).FileName : string.Empty, ModifiedAt = item.ModifiedAt, + AuthorId = item.AuthorId, Id = item.Id, CreatedAt = item.CreatedAt }); @@ -314,6 +336,7 @@ namespace Netina.Domain.Mappers CategoryName = item.Category == null ? null : item.Category.Name, MainImage = item.Files.Count > 0 && item.Files.Any(funcMain4) ? item.Files.FirstOrDefault(funcMain5).FileName : string.Empty, ModifiedAt = item.ModifiedAt, + AuthorId = item.AuthorId, Id = item.Id, CreatedAt = item.CreatedAt }); @@ -323,14 +346,23 @@ namespace Netina.Domain.Mappers } - private static int funcMain7(int? p21) + private static BlogCategory funcMain7(Never p20, BlogCategory p21, BlogCategorySDto p18) { - return p21 == null ? 0 : (int)p21; + BlogCategory result = p21 ?? new BlogCategory(); + + result.Id = p18.ParentId; + return result; + } - private static int funcMain8(int? p24, int p25) + private static int funcMain8(int? p23) { - return p24 == null ? 0 : (int)p24; + return p23 == null ? 0 : (int)p23; + } + + private static int funcMain9(int? p26, int p27) + { + return p26 == null ? 0 : (int)p26; } private static bool funcMain4(BlogStorageFile f) diff --git a/Netina.Domain/Mappers/BlogMapper.g.cs b/Netina.Domain/Mappers/BlogMapper.g.cs index 966c0e8..b204207 100644 --- a/Netina.Domain/Mappers/BlogMapper.g.cs +++ b/Netina.Domain/Mappers/BlogMapper.g.cs @@ -6,6 +6,7 @@ using Mapster.Models; using Netina.Domain.Dtos.LargDtos; using Netina.Domain.Dtos.SmallDtos; using Netina.Domain.Entities.Blogs; +using Netina.Domain.Entities.Users; namespace Netina.Domain.Mappers { @@ -29,6 +30,8 @@ namespace Netina.Domain.Mappers Id = p1.CategoryId }, Files = funcMain1(p1.Files), + AuthorId = p1.AuthorId, + Author = new ApplicationUser() {Id = p1.AuthorId}, Id = p1.Id, CreatedAt = p1.CreatedAt }; @@ -51,206 +54,223 @@ namespace Netina.Domain.Mappers result.CategoryId = p3.CategoryId; result.Category = funcMain2(new Never(), result.Category, p3); result.Files = funcMain3(p3.Files, result.Files); + result.AuthorId = p3.AuthorId; + result.Author = funcMain4(new Never(), result.Author, p3); result.Id = p3.Id; result.CreatedAt = p3.CreatedAt; return result; } - public static Expression> ProjectToBlog => p9 => new Blog() + public static Expression> ProjectToBlog => p11 => new Blog() { - Title = p9.Title, - Content = p9.Content, - Slug = p9.Slug, - Tags = p9.Tags, - ReadingTime = p9.ReadingTime, - Summery = p9.Summery, - IsSuggested = p9.IsSuggested, - CategoryId = p9.CategoryId, + Title = p11.Title, + Content = p11.Content, + Slug = p11.Slug, + Tags = p11.Tags, + ReadingTime = p11.ReadingTime, + Summery = p11.Summery, + IsSuggested = p11.IsSuggested, + CategoryId = p11.CategoryId, Category = new BlogCategory() { - Name = p9.CategoryName, - Id = p9.CategoryId + Name = p11.CategoryName, + Id = p11.CategoryId }, - Files = p9.Files.Select(p10 => new BlogStorageFile() + Files = p11.Files.Select(p12 => new BlogStorageFile() { - Name = p10.Name, - FileLocation = p10.FileLocation, - FileName = p10.FileName, - IsHeader = p10.IsHeader, - IsPrimary = p10.IsPrimary, - FileType = p10.FileType, - Id = p10.Id, - CreatedAt = p10.CreatedAt + Name = p12.Name, + FileLocation = p12.FileLocation, + FileName = p12.FileName, + IsHeader = p12.IsHeader, + IsPrimary = p12.IsPrimary, + FileType = p12.FileType, + Id = p12.Id, + CreatedAt = p12.CreatedAt }).ToList(), - Id = p9.Id, - CreatedAt = p9.CreatedAt + AuthorId = p11.AuthorId, + Author = new ApplicationUser() {Id = p11.AuthorId}, + Id = p11.Id, + CreatedAt = p11.CreatedAt }; - public static BlogLDto AdaptToLDto(this Blog p11) + public static BlogLDto AdaptToLDto(this Blog p13) { - return p11 == null ? null : new BlogLDto() + return p13 == null ? null : new BlogLDto() { - Title = p11.Title, - Content = p11.Content, - Tags = p11.Tags, - Slug = p11.Slug, - ReadingTime = p11.ReadingTime, - Summery = p11.Summery, - MainImage = p11.Files.Count > 0 && p11.Files.Any(funcMain4) ? p11.Files.FirstOrDefault(funcMain5).FileName : string.Empty, - IsSuggested = p11.IsSuggested, - CategoryId = p11.CategoryId, - CategoryName = p11.Category == null ? null : p11.Category.Name, - Files = funcMain6(p11.Files), - Id = p11.Id, - CreatedAt = p11.CreatedAt + Title = p13.Title, + Content = p13.Content, + Tags = p13.Tags, + Slug = p13.Slug, + ReadingTime = p13.ReadingTime, + Summery = p13.Summery, + MainImage = p13.Files.Count > 0 && p13.Files.Any(funcMain5) ? p13.Files.FirstOrDefault(funcMain6).FileName : string.Empty, + IsSuggested = p13.IsSuggested, + CategoryId = p13.CategoryId, + CategoryName = p13.Category == null ? null : p13.Category.Name, + AuthorId = p13.AuthorId, + AuthorFullName = p13.Author != null ? p13.Author.FirstName + " " + p13.Author.LastName : string.Empty, + Files = funcMain7(p13.Files), + Id = p13.Id, + CreatedAt = p13.CreatedAt }; } - public static BlogLDto AdaptTo(this Blog p13, BlogLDto p14) + public static BlogLDto AdaptTo(this Blog p15, BlogLDto p16) { - if (p13 == null) + if (p15 == null) { return null; } - BlogLDto result = p14 ?? new BlogLDto(); + BlogLDto result = p16 ?? new BlogLDto(); - result.Title = p13.Title; - result.Content = p13.Content; - result.Tags = p13.Tags; - result.Slug = p13.Slug; - result.ReadingTime = p13.ReadingTime; - result.Summery = p13.Summery; - result.MainImage = p13.Files.Count > 0 && p13.Files.Any(funcMain4) ? p13.Files.FirstOrDefault(funcMain5).FileName : string.Empty; - result.IsSuggested = p13.IsSuggested; - result.CategoryId = p13.CategoryId; - result.CategoryName = p13.Category == null ? null : p13.Category.Name; - result.Files = funcMain7(p13.Files, result.Files); - result.Id = p13.Id; - result.CreatedAt = p13.CreatedAt; + result.Title = p15.Title; + result.Content = p15.Content; + result.Tags = p15.Tags; + result.Slug = p15.Slug; + result.ReadingTime = p15.ReadingTime; + result.Summery = p15.Summery; + result.MainImage = p15.Files.Count > 0 && p15.Files.Any(funcMain5) ? p15.Files.FirstOrDefault(funcMain6).FileName : string.Empty; + result.IsSuggested = p15.IsSuggested; + result.CategoryId = p15.CategoryId; + result.CategoryName = p15.Category == null ? null : p15.Category.Name; + result.AuthorId = p15.AuthorId; + result.AuthorFullName = p15.Author != null ? p15.Author.FirstName + " " + p15.Author.LastName : string.Empty; + result.Files = funcMain8(p15.Files, result.Files); + result.Id = p15.Id; + result.CreatedAt = p15.CreatedAt; return result; } - public static Expression> ProjectToLDto => p17 => new BlogLDto() + public static Expression> ProjectToLDto => p19 => new BlogLDto() { - Title = p17.Title, - Content = p17.Content, - Tags = p17.Tags, - Slug = p17.Slug, - ReadingTime = p17.ReadingTime, - Summery = p17.Summery, - MainImage = p17.Files.Count > 0 && p17.Files.Any(f => f.IsPrimary) ? p17.Files.FirstOrDefault(f => f.IsPrimary).FileName : string.Empty, - IsSuggested = p17.IsSuggested, - CategoryId = p17.CategoryId, - CategoryName = p17.Category.Name, - Files = p17.Files.Select(p18 => new StorageFileSDto() + Title = p19.Title, + Content = p19.Content, + Tags = p19.Tags, + Slug = p19.Slug, + ReadingTime = p19.ReadingTime, + Summery = p19.Summery, + MainImage = p19.Files.Count > 0 && p19.Files.Any(f => f.IsPrimary) ? p19.Files.FirstOrDefault(f => f.IsPrimary).FileName : string.Empty, + IsSuggested = p19.IsSuggested, + CategoryId = p19.CategoryId, + CategoryName = p19.Category.Name, + AuthorId = p19.AuthorId, + AuthorFullName = p19.Author != null ? p19.Author.FirstName + " " + p19.Author.LastName : string.Empty, + Files = p19.Files.Select(p20 => new StorageFileSDto() { - Name = p18.Name, - FileLocation = p18.FileLocation, - FileName = p18.FileName, - IsHeader = p18.IsHeader, - IsPrimary = p18.IsPrimary, - FileType = p18.FileType, - Id = p18.Id + Name = p20.Name, + FileLocation = p20.FileLocation, + FileName = p20.FileName, + IsHeader = p20.IsHeader, + IsPrimary = p20.IsPrimary, + FileType = p20.FileType, + Id = p20.Id }).ToList(), - Id = p17.Id, - CreatedAt = p17.CreatedAt + Id = p19.Id, + CreatedAt = p19.CreatedAt }; - public static Blog AdaptToBlog(this BlogSDto p19) + public static Blog AdaptToBlog(this BlogSDto p21) { - return p19 == null ? null : new Blog() + return p21 == null ? null : new Blog() { - Title = p19.Title, - Slug = p19.Slug, - Tags = p19.Tags, - ReadingTime = p19.ReadingTime, - Summery = p19.Summery, - IsSuggested = p19.IsSuggested, - CategoryId = p19.CategoryId, + Title = p21.Title, + Slug = p21.Slug, + Tags = p21.Tags, + ReadingTime = p21.ReadingTime, + Summery = p21.Summery, + IsSuggested = p21.IsSuggested, + CategoryId = p21.CategoryId, Category = new BlogCategory() { - Name = p19.CategoryName, - Id = p19.CategoryId + Name = p21.CategoryName, + Id = p21.CategoryId }, - Id = p19.Id, - CreatedAt = p19.CreatedAt, - ModifiedAt = p19.ModifiedAt + AuthorId = p21.AuthorId, + Author = new ApplicationUser() {Id = p21.AuthorId}, + Id = p21.Id, + CreatedAt = p21.CreatedAt, + ModifiedAt = p21.ModifiedAt }; } - public static Blog AdaptTo(this BlogSDto p20, Blog p21) + public static Blog AdaptTo(this BlogSDto p22, Blog p23) { - if (p20 == null) + if (p22 == null) { return null; } - Blog result = p21 ?? new Blog(); + Blog result = p23 ?? new Blog(); - result.Title = p20.Title; - result.Slug = p20.Slug; - result.Tags = p20.Tags; - result.ReadingTime = p20.ReadingTime; - result.Summery = p20.Summery; - result.IsSuggested = p20.IsSuggested; - result.CategoryId = p20.CategoryId; - result.Category = funcMain8(new Never(), result.Category, p20); - result.Id = p20.Id; - result.CreatedAt = p20.CreatedAt; - result.ModifiedAt = p20.ModifiedAt; + result.Title = p22.Title; + result.Slug = p22.Slug; + result.Tags = p22.Tags; + result.ReadingTime = p22.ReadingTime; + result.Summery = p22.Summery; + result.IsSuggested = p22.IsSuggested; + result.CategoryId = p22.CategoryId; + result.Category = funcMain9(new Never(), result.Category, p22); + result.AuthorId = p22.AuthorId; + result.Author = funcMain10(new Never(), result.Author, p22); + result.Id = p22.Id; + result.CreatedAt = p22.CreatedAt; + result.ModifiedAt = p22.ModifiedAt; return result; } - public static BlogSDto AdaptToSDto(this Blog p24) + public static BlogSDto AdaptToSDto(this Blog p28) { - return p24 == null ? null : new BlogSDto() + return p28 == null ? null : new BlogSDto() { - Title = p24.Title, - Slug = p24.Slug, - Tags = p24.Tags, - ReadingTime = p24.ReadingTime, - Summery = p24.Summery, - IsSuggested = p24.IsSuggested, - CategoryId = p24.CategoryId, - CategoryName = p24.Category == null ? null : p24.Category.Name, - MainImage = p24.Files.Count > 0 && p24.Files.Any(funcMain9) ? p24.Files.FirstOrDefault(funcMain10).FileName : string.Empty, - ModifiedAt = p24.ModifiedAt, - Id = p24.Id, - CreatedAt = p24.CreatedAt + Title = p28.Title, + Slug = p28.Slug, + Tags = p28.Tags, + ReadingTime = p28.ReadingTime, + Summery = p28.Summery, + IsSuggested = p28.IsSuggested, + CategoryId = p28.CategoryId, + CategoryName = p28.Category == null ? null : p28.Category.Name, + MainImage = p28.Files.Count > 0 && p28.Files.Any(funcMain11) ? p28.Files.FirstOrDefault(funcMain12).FileName : string.Empty, + ModifiedAt = p28.ModifiedAt, + AuthorId = p28.AuthorId, + Id = p28.Id, + CreatedAt = p28.CreatedAt }; } - public static BlogSDto AdaptTo(this Blog p25, BlogSDto p26) + public static BlogSDto AdaptTo(this Blog p29, BlogSDto p30) { - if (p25 == null) + if (p29 == null) { return null; } - BlogSDto result = p26 ?? new BlogSDto(); + BlogSDto result = p30 ?? new BlogSDto(); - result.Title = p25.Title; - result.Slug = p25.Slug; - result.Tags = p25.Tags; - result.ReadingTime = p25.ReadingTime; - result.Summery = p25.Summery; - result.IsSuggested = p25.IsSuggested; - result.CategoryId = p25.CategoryId; - result.CategoryName = p25.Category == null ? null : p25.Category.Name; - result.MainImage = p25.Files.Count > 0 && p25.Files.Any(funcMain9) ? p25.Files.FirstOrDefault(funcMain10).FileName : string.Empty; - result.ModifiedAt = p25.ModifiedAt; - result.Id = p25.Id; - result.CreatedAt = p25.CreatedAt; + result.Title = p29.Title; + result.Slug = p29.Slug; + result.Tags = p29.Tags; + result.ReadingTime = p29.ReadingTime; + result.Summery = p29.Summery; + result.IsSuggested = p29.IsSuggested; + result.CategoryId = p29.CategoryId; + result.CategoryName = p29.Category == null ? null : p29.Category.Name; + result.MainImage = p29.Files.Count > 0 && p29.Files.Any(funcMain11) ? p29.Files.FirstOrDefault(funcMain12).FileName : string.Empty; + result.ModifiedAt = p29.ModifiedAt; + result.AuthorId = p29.AuthorId; + result.Id = p29.Id; + result.CreatedAt = p29.CreatedAt; return result; } - public static Expression> ProjectToSDto => p27 => new BlogSDto() + public static Expression> ProjectToSDto => p31 => new BlogSDto() { - Title = p27.Title, - Slug = p27.Slug, - Tags = p27.Tags, - ReadingTime = p27.ReadingTime, - Summery = p27.Summery, - IsSuggested = p27.IsSuggested, - CategoryId = p27.CategoryId, - CategoryName = p27.Category.Name, - MainImage = p27.Files.Count > 0 && p27.Files.Any(f => f.IsPrimary) ? p27.Files.FirstOrDefault(f => f.IsPrimary).FileName : string.Empty, - ModifiedAt = p27.ModifiedAt, - Id = p27.Id, - CreatedAt = p27.CreatedAt + Title = p31.Title, + Slug = p31.Slug, + Tags = p31.Tags, + ReadingTime = p31.ReadingTime, + Summery = p31.Summery, + IsSuggested = p31.IsSuggested, + CategoryId = p31.CategoryId, + CategoryName = p31.Category.Name, + MainImage = p31.Files.Count > 0 && p31.Files.Any(f => f.IsPrimary) ? p31.Files.FirstOrDefault(f => f.IsPrimary).FileName : string.Empty, + ModifiedAt = p31.ModifiedAt, + AuthorId = p31.AuthorId, + Id = p31.Id, + CreatedAt = p31.CreatedAt }; private static List funcMain1(List p2) @@ -325,9 +345,13 @@ namespace Netina.Domain.Mappers } - private static bool funcMain4(BlogStorageFile f) + private static ApplicationUser funcMain4(Never p9, ApplicationUser p10, BlogLDto p3) { - return f.IsPrimary; + ApplicationUser result = p10 ?? new ApplicationUser(); + + result.Id = p3.AuthorId; + return result; + } private static bool funcMain5(BlogStorageFile f) @@ -335,82 +359,96 @@ namespace Netina.Domain.Mappers return f.IsPrimary; } - private static List funcMain6(List p12) - { - if (p12 == null) - { - return null; - } - List result = new List(p12.Count); - - int i = 0; - int len = p12.Count; - - while (i < len) - { - BlogStorageFile item = p12[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 funcMain7(List p15, List p16) - { - if (p15 == null) - { - return null; - } - List result = new List(p15.Count); - - int i = 0; - int len = p15.Count; - - while (i < len) - { - BlogStorageFile item = p15[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 BlogCategory funcMain8(Never p22, BlogCategory p23, BlogSDto p20) - { - BlogCategory result = p23 ?? new BlogCategory(); - - result.Name = p20.CategoryName; - result.Id = p20.CategoryId; - return result; - - } - - private static bool funcMain9(BlogStorageFile f) + private static bool funcMain6(BlogStorageFile f) { return f.IsPrimary; } - private static bool funcMain10(BlogStorageFile f) + private static List funcMain7(List p14) + { + if (p14 == null) + { + return null; + } + List result = new List(p14.Count); + + int i = 0; + int len = p14.Count; + + while (i < len) + { + BlogStorageFile item = p14[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 funcMain8(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) + { + BlogStorageFile item = p17[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 BlogCategory funcMain9(Never p24, BlogCategory p25, BlogSDto p22) + { + BlogCategory result = p25 ?? new BlogCategory(); + + result.Name = p22.CategoryName; + result.Id = p22.CategoryId; + return result; + + } + + private static ApplicationUser funcMain10(Never p26, ApplicationUser p27, BlogSDto p22) + { + ApplicationUser result = p27 ?? new ApplicationUser(); + + result.Id = p22.AuthorId; + return result; + + } + + private static bool funcMain11(BlogStorageFile f) + { + return f.IsPrimary; + } + + private static bool funcMain12(BlogStorageFile f) { return f.IsPrimary; } diff --git a/Netina.Domain/Mappers/BrandMapper.g.cs b/Netina.Domain/Mappers/BrandMapper.g.cs index dd5b117..131a4be 100644 --- a/Netina.Domain/Mappers/BrandMapper.g.cs +++ b/Netina.Domain/Mappers/BrandMapper.g.cs @@ -16,6 +16,7 @@ namespace Netina.Domain.Mappers { PersianName = p1.PersianName, EnglishName = p1.EnglishName, + Slug = p1.Slug, Description = p1.Description, HasSpecialPage = p1.HasSpecialPage, PageUrl = p1.PageUrl, @@ -34,6 +35,7 @@ namespace Netina.Domain.Mappers result.PersianName = p3.PersianName; result.EnglishName = p3.EnglishName; + result.Slug = p3.Slug; result.Description = p3.Description; result.HasSpecialPage = p3.HasSpecialPage; result.PageUrl = p3.PageUrl; @@ -47,6 +49,7 @@ namespace Netina.Domain.Mappers { PersianName = p7.PersianName, EnglishName = p7.EnglishName, + Slug = p7.Slug, Description = p7.Description, HasSpecialPage = p7.HasSpecialPage, PageUrl = p7.PageUrl, @@ -72,6 +75,7 @@ namespace Netina.Domain.Mappers EnglishName = p9.EnglishName, Description = p9.Description, HasSpecialPage = p9.HasSpecialPage, + Slug = p9.Slug, PageUrl = p9.PageUrl, Files = funcMain3(p9.Files), Id = p9.Id, @@ -90,6 +94,7 @@ namespace Netina.Domain.Mappers result.EnglishName = p11.EnglishName; result.Description = p11.Description; result.HasSpecialPage = p11.HasSpecialPage; + result.Slug = p11.Slug; result.PageUrl = p11.PageUrl; result.Files = funcMain4(p11.Files, result.Files); result.Id = p11.Id; @@ -103,6 +108,7 @@ namespace Netina.Domain.Mappers EnglishName = p15.EnglishName, Description = p15.Description, HasSpecialPage = p15.HasSpecialPage, + Slug = p15.Slug, PageUrl = p15.PageUrl, Files = p15.Files.Select(p16 => new StorageFileSDto() { @@ -123,6 +129,7 @@ namespace Netina.Domain.Mappers { PersianName = p17.PersianName, EnglishName = p17.EnglishName, + Slug = p17.Slug, Description = p17.Description, HasSpecialPage = p17.HasSpecialPage, PageUrl = p17.PageUrl, @@ -140,6 +147,7 @@ namespace Netina.Domain.Mappers result.PersianName = p18.PersianName; result.EnglishName = p18.EnglishName; + result.Slug = p18.Slug; result.Description = p18.Description; result.HasSpecialPage = p18.HasSpecialPage; result.PageUrl = p18.PageUrl; @@ -155,6 +163,7 @@ namespace Netina.Domain.Mappers PersianName = p20.PersianName, EnglishName = p20.EnglishName, Description = p20.Description, + Slug = p20.Slug, HasSpecialPage = p20.HasSpecialPage, PageUrl = p20.PageUrl, Id = p20.Id, @@ -172,6 +181,7 @@ namespace Netina.Domain.Mappers result.PersianName = p21.PersianName; result.EnglishName = p21.EnglishName; result.Description = p21.Description; + result.Slug = p21.Slug; result.HasSpecialPage = p21.HasSpecialPage; result.PageUrl = p21.PageUrl; result.Id = p21.Id; @@ -184,6 +194,7 @@ namespace Netina.Domain.Mappers PersianName = p23.PersianName, EnglishName = p23.EnglishName, Description = p23.Description, + Slug = p23.Slug, HasSpecialPage = p23.HasSpecialPage, PageUrl = p23.PageUrl, Id = p23.Id, diff --git a/Netina.Domain/Mappers/ProductCategoryMapper.g.cs b/Netina.Domain/Mappers/ProductCategoryMapper.g.cs index 7e4c9b8..fd53984 100644 --- a/Netina.Domain/Mappers/ProductCategoryMapper.g.cs +++ b/Netina.Domain/Mappers/ProductCategoryMapper.g.cs @@ -16,6 +16,7 @@ namespace Netina.Domain.Mappers return p1 == null ? null : new ProductCategory() { Name = p1.Name, + Slug = p1.Slug, Description = p1.Description, IsMain = p1.IsMain, ParentId = (Guid?)p1.ParentId, @@ -38,6 +39,7 @@ namespace Netina.Domain.Mappers ProductCategory result = p4 ?? new ProductCategory(); result.Name = p3.Name; + result.Slug = p3.Slug; result.Description = p3.Description; result.IsMain = p3.IsMain; result.ParentId = (Guid?)p3.ParentId; @@ -51,6 +53,7 @@ namespace Netina.Domain.Mappers public static Expression> ProjectToProductCategory => p9 => new ProductCategory() { Name = p9.Name, + Slug = p9.Slug, Description = p9.Description, IsMain = p9.IsMain, ParentId = (Guid?)p9.ParentId, @@ -81,6 +84,7 @@ namespace Netina.Domain.Mappers Description = p11.Description, ParentId = p11.ParentId == null ? default(Guid) : (Guid)p11.ParentId, ParentName = p11.Parent != null ? p11.Parent.Name : string.Empty, + Slug = p11.Slug, IsMain = p11.IsMain, Files = funcMain4(p11.Files), Id = p11.Id, @@ -99,6 +103,7 @@ namespace Netina.Domain.Mappers result.Description = p13.Description; result.ParentId = p13.ParentId == null ? default(Guid) : (Guid)p13.ParentId; result.ParentName = p13.Parent != null ? p13.Parent.Name : string.Empty; + result.Slug = p13.Slug; result.IsMain = p13.IsMain; result.Files = funcMain5(p13.Files, result.Files); result.Id = p13.Id; @@ -112,6 +117,7 @@ namespace Netina.Domain.Mappers Description = p17.Description, ParentId = p17.ParentId == null ? default(Guid) : (Guid)p17.ParentId, ParentName = p17.Parent != null ? p17.Parent.Name : string.Empty, + Slug = p17.Slug, IsMain = p17.IsMain, Files = p17.Files.Select(p18 => new StorageFileSDto() { diff --git a/Netina.Domain/Mappers/ProductMapper.g.cs b/Netina.Domain/Mappers/ProductMapper.g.cs index 86b1314..807434d 100644 --- a/Netina.Domain/Mappers/ProductMapper.g.cs +++ b/Netina.Domain/Mappers/ProductMapper.g.cs @@ -9,7 +9,8 @@ using Netina.Domain.Dtos.SmallDtos; using Netina.Domain.Entities.Brands; using Netina.Domain.Entities.ProductCategories; using Netina.Domain.Entities.Products; -using Review = Netina.Domain.Entities.Reviews.Review; +using Netina.Domain.Entities.Reviews; +using Netina.Domain.Entities.Users; namespace Netina.Domain.Mappers { @@ -35,6 +36,8 @@ namespace Netina.Domain.Mappers BrandId = p1.BrandId, Brand = new Brand() {Id = p1.BrandId}, CategoryId = p1.CategoryId, + AuthorId = p1.AuthorId, + Author = new ApplicationUser() {Id = p1.AuthorId}, Category = new ProductCategory() { Name = p1.CategoryName, @@ -71,350 +74,373 @@ namespace Netina.Domain.Mappers result.BrandId = p5.BrandId; result.Brand = funcMain4(new Never(), result.Brand, p5); result.CategoryId = p5.CategoryId; - result.Category = funcMain5(new Never(), result.Category, p5); - result.Specifications = funcMain6(p5.Specifications, result.Specifications); - result.Reviews = funcMain7(p5.Reviews, result.Reviews); - result.Files = funcMain8(p5.Files, result.Files); + 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; return result; } - public static Expression> ProjectToProduct => p17 => new Product() + public static Expression> ProjectToProduct => p19 => new Product() { - PersianName = p17.PersianName, - EnglishName = p17.EnglishName, - Slug = p17.Slug, - Summery = p17.Summery, - ExpertCheck = p17.ExpertCheck, - Tags = p17.Tags, - Warranty = p17.Warranty, - Cost = p17.Cost, - BeDisplayed = p17.BeDisplayed, - PackingCost = p17.PackingCost, - Stock = p17.Stock, - HasExpressDelivery = p17.HasExpressDelivery, - MaxOrderCount = p17.MaxOrderCount, - BrandId = p17.BrandId, - Brand = new Brand() {Id = p17.BrandId}, - CategoryId = p17.CategoryId, + 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}, Category = new ProductCategory() { - Name = p17.CategoryName, - Id = p17.CategoryId + Name = p19.CategoryName, + Id = p19.CategoryId }, - Specifications = p17.Specifications.Select(p18 => new Specification() + Specifications = p19.Specifications.Select(p20 => new Specification() { - Title = p18.Title, - Detail = p18.Detail, - Value = p18.Value, - IsFeature = p18.IsFeature, - ProductId = p18.ProductId, - ParentId = (Guid?)p18.ParentId, - Id = p18.Id, - CreatedAt = p18.CreatedAt - }).ToList(), - Reviews = p17.Reviews.Select(p19 => new Review() - { - Title = p19.Title, - Comment = p19.Comment, - Rate = p19.Rate, - IsBuyer = p19.IsBuyer, - ProductId = p19.ProductId, - UserId = p19.UserId, - Id = p19.Id, - CreatedAt = p19.CreatedAt - }).ToList(), - Files = p17.Files.Select(p20 => new ProductStorageFile() - { - Name = p20.Name, - FileLocation = p20.FileLocation, - FileName = p20.FileName, - IsHeader = p20.IsHeader, - IsPrimary = p20.IsPrimary, - FileType = p20.FileType, + 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 - }).ToList(), - Id = p17.Id, - CreatedAt = p17.CreatedAt - }; - public static ProductLDto AdaptToLDto(this Product p21) - { - return p21 == null ? null : new ProductLDto() + }).ToList(), + Reviews = p19.Reviews.Select(p21 => new Review() { - PersianName = p21.PersianName, - EnglishName = p21.EnglishName, - Summery = p21.Summery, - ExpertCheck = p21.ExpertCheck, - Tags = p21.Tags, - Slug = p21.Slug, - Warranty = p21.Warranty, - BeDisplayed = p21.BeDisplayed, - HasExpressDelivery = p21.HasExpressDelivery, - Cost = p21.Cost, - PackingCost = p21.PackingCost, - MaxOrderCount = p21.MaxOrderCount, - Stock = p21.Stock, - BrandId = p21.BrandId, - BrandName = p21.Brand == null ? null : p21.Brand.PersianName, - CategoryId = p21.CategoryId, - CategoryName = p21.Category == null ? null : p21.Category.Name, - Specifications = funcMain9(p21.Specifications), - Reviews = funcMain10(p21.Reviews), - Files = funcMain11(p21.Files), + Title = p21.Title, + Comment = p21.Comment, + Rate = p21.Rate, + IsBuyer = p21.IsBuyer, + ProductId = p21.ProductId, + 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 + }).ToList(), + Id = p19.Id, + CreatedAt = p19.CreatedAt + }; + public static ProductLDto AdaptToLDto(this Product p23) + { + return p23 == 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 }; } - public static ProductLDto AdaptTo(this Product p25, ProductLDto p26) + public static ProductLDto AdaptTo(this Product p27, ProductLDto p28) { - if (p25 == null) + if (p27 == null) { return null; } - ProductLDto result = p26 ?? new ProductLDto(); + ProductLDto result = p28 ?? new ProductLDto(); - result.PersianName = p25.PersianName; - result.EnglishName = p25.EnglishName; - result.Summery = p25.Summery; - result.ExpertCheck = p25.ExpertCheck; - result.Tags = p25.Tags; - result.Slug = p25.Slug; - result.Warranty = p25.Warranty; - result.BeDisplayed = p25.BeDisplayed; - result.HasExpressDelivery = p25.HasExpressDelivery; - result.Cost = p25.Cost; - result.PackingCost = p25.PackingCost; - result.MaxOrderCount = p25.MaxOrderCount; - result.Stock = p25.Stock; - result.BrandId = p25.BrandId; - result.BrandName = p25.Brand == null ? null : p25.Brand.PersianName; - result.CategoryId = p25.CategoryId; - result.CategoryName = p25.Category == null ? null : p25.Category.Name; - result.Specifications = funcMain12(p25.Specifications, result.Specifications); - result.Reviews = funcMain13(p25.Reviews, result.Reviews); - result.Files = funcMain14(p25.Files, result.Files); - result.Id = p25.Id; - result.CreatedAt = p25.CreatedAt; + 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; return result; } - public static Expression> ProjectToLDto => p33 => new ProductLDto() + public static Expression> ProjectToLDto => p35 => new ProductLDto() { - PersianName = p33.PersianName, - EnglishName = p33.EnglishName, - Summery = p33.Summery, - ExpertCheck = p33.ExpertCheck, - Tags = p33.Tags, - Slug = p33.Slug, - Warranty = p33.Warranty, - BeDisplayed = p33.BeDisplayed, - HasExpressDelivery = p33.HasExpressDelivery, - Cost = p33.Cost, - PackingCost = p33.PackingCost, - MaxOrderCount = p33.MaxOrderCount, - Stock = p33.Stock, - BrandId = p33.BrandId, - BrandName = p33.Brand == null ? null : p33.Brand.PersianName, - CategoryId = p33.CategoryId, - CategoryName = p33.Category == null ? null : p33.Category.Name, - Specifications = p33.Specifications.Select(p34 => new SpecificationSDto() + 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() { - Title = p34.Title, - Detail = p34.Detail, - Value = p34.Value, - IsFeature = p34.IsFeature, - ProductId = p34.ProductId, - ParentId = p34.ParentId == null ? default(Guid) : (Guid)p34.ParentId, - Id = p34.Id, - CreatedAt = p34.CreatedAt + 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 }).ToList(), - Reviews = p33.Reviews.Select(p35 => new ReviewSDto() + Reviews = p35.Reviews.Select(p37 => new ReviewSDto() { - Title = p35.Title, - Comment = p35.Comment, - Rate = p35.Rate, - IsBuyer = p35.IsBuyer, - ProductId = p35.ProductId, - UserId = p35.UserId, - Id = p35.Id, - CreatedAt = p35.CreatedAt - }).ToList(), - Files = p33.Files.Select(p36 => new StorageFileSDto() - { - Name = p36.Name, - FileLocation = p36.FileLocation, - FileName = p36.FileName, - IsHeader = p36.IsHeader, - IsPrimary = p36.IsPrimary, - FileType = p36.FileType, - Id = p36.Id - }).ToList(), - Id = p33.Id, - CreatedAt = p33.CreatedAt - }; - public static Product AdaptToProduct(this ProductSDto p37) - { - return p37 == null ? null : new Product() - { - PersianName = p37.PersianName, - EnglishName = p37.EnglishName, - Slug = p37.Slug, - Summery = p37.Summery, - ExpertCheck = p37.ExpertCheck, - Tags = p37.Tags, - Warranty = p37.Warranty, - Cost = p37.Cost, - IsEnable = p37.IsEnable, - BeDisplayed = p37.BeDisplayed, - PackingCost = p37.PackingCost, - Stock = p37.Stock, + Title = p37.Title, + Comment = p37.Comment, Rate = p37.Rate, - ReviewCount = p37.ReviewCount, - Viewed = p37.Viewed, - MaxOrderCount = p37.MaxOrderCount, - BrandId = p37.BrandId, - Brand = new Brand() {Id = p37.BrandId}, - CategoryId = p37.CategoryId, + IsBuyer = p37.IsBuyer, + ProductId = p37.ProductId, + 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 + }).ToList(), + AuthorId = p35.AuthorId, + AuthorFullName = p35.Author != null ? p35.Author.FirstName + " " + p35.Author.LastName : string.Empty, + Id = p35.Id, + CreatedAt = p35.CreatedAt + }; + public static Product AdaptToProduct(this ProductSDto p39) + { + return p39 == 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}, Category = new ProductCategory() { - Name = p37.CategoryName, - Id = p37.CategoryId + Name = p39.CategoryName, + Id = p39.CategoryId }, - Id = p37.Id, - CreatedAt = p37.CreatedAt, - ModifiedAt = p37.ModifiedAt + Id = p39.Id, + CreatedAt = p39.CreatedAt, + ModifiedAt = p39.ModifiedAt }; } - public static Product AdaptTo(this ProductSDto p38, Product p39) + public static Product AdaptTo(this ProductSDto p40, Product p41) { - if (p38 == null) + if (p40 == null) { return null; } - Product result = p39 ?? new Product(); + Product result = p41 ?? new Product(); - result.PersianName = p38.PersianName; - result.EnglishName = p38.EnglishName; - result.Slug = p38.Slug; - result.Summery = p38.Summery; - result.ExpertCheck = p38.ExpertCheck; - result.Tags = p38.Tags; - result.Warranty = p38.Warranty; - result.Cost = p38.Cost; - result.IsEnable = p38.IsEnable; - result.BeDisplayed = p38.BeDisplayed; - result.PackingCost = p38.PackingCost; - result.Stock = p38.Stock; - result.Rate = p38.Rate; - result.ReviewCount = p38.ReviewCount; - result.Viewed = p38.Viewed; - result.MaxOrderCount = p38.MaxOrderCount; - result.BrandId = p38.BrandId; - result.Brand = funcMain15(new Never(), result.Brand, p38); - result.CategoryId = p38.CategoryId; - result.Category = funcMain16(new Never(), result.Category, p38); - result.Id = p38.Id; - result.CreatedAt = p38.CreatedAt; - result.ModifiedAt = p38.ModifiedAt; + 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; return result; } - public static ProductSDto AdaptToSDto(this Product p44) + public static ProductSDto AdaptToSDto(this Product p48) { - return p44 == null ? null : new ProductSDto() + return p48 == null ? null : new ProductSDto() { - PersianName = p44.PersianName, - Slug = p44.Slug, - EnglishName = p44.EnglishName, - Summery = p44.Summery, - ExpertCheck = p44.ExpertCheck, - Tags = p44.Tags, - Warranty = p44.Warranty, - Cost = p44.Cost, - IsEnable = p44.IsEnable, - Stock = p44.Stock, - MaxOrderCount = p44.MaxOrderCount, - BeDisplayed = p44.BeDisplayed, - PackingCost = p44.PackingCost, - Rate = p44.Rate, - ReviewCount = p44.ReviewCount, - Viewed = p44.Viewed, - MainImage = p44.Files.FirstOrDefault(funcMain17) != null ? p44.Files.FirstOrDefault(funcMain18).FileLocation : (p44.Files.Count > 0 ? p44.Files.FirstOrDefault().FileLocation : string.Empty), - CategoryId = p44.CategoryId, - BrandId = p44.BrandId, - CategoryName = p44.Category == null ? null : p44.Category.Name, - ModifiedAt = p44.ModifiedAt, - Id = p44.Id, - CreatedAt = p44.CreatedAt + 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 }; } - public static ProductSDto AdaptTo(this Product p45, ProductSDto p46) + public static ProductSDto AdaptTo(this Product p49, ProductSDto p50) { - if (p45 == null) + if (p49 == null) { return null; } - ProductSDto result = p46 ?? new ProductSDto(); + ProductSDto result = p50 ?? new ProductSDto(); - result.PersianName = p45.PersianName; - result.Slug = p45.Slug; - result.EnglishName = p45.EnglishName; - result.Summery = p45.Summery; - result.ExpertCheck = p45.ExpertCheck; - result.Tags = p45.Tags; - result.Warranty = p45.Warranty; - result.Cost = p45.Cost; - result.IsEnable = p45.IsEnable; - result.Stock = p45.Stock; - result.MaxOrderCount = p45.MaxOrderCount; - result.BeDisplayed = p45.BeDisplayed; - result.PackingCost = p45.PackingCost; - result.Rate = p45.Rate; - result.ReviewCount = p45.ReviewCount; - result.Viewed = p45.Viewed; - result.MainImage = p45.Files.FirstOrDefault(funcMain17) != null ? p45.Files.FirstOrDefault(funcMain18).FileLocation : (p45.Files.Count > 0 ? p45.Files.FirstOrDefault().FileLocation : string.Empty); - result.CategoryId = p45.CategoryId; - result.BrandId = p45.BrandId; - result.CategoryName = p45.Category == null ? null : p45.Category.Name; - result.ModifiedAt = p45.ModifiedAt; - result.Id = p45.Id; - result.CreatedAt = p45.CreatedAt; + 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; return result; } - public static Expression> ProjectToSDto => p47 => new ProductSDto() + public static Expression> ProjectToSDto => p51 => new ProductSDto() { - PersianName = p47.PersianName, - Slug = p47.Slug, - EnglishName = p47.EnglishName, - Summery = p47.Summery, - ExpertCheck = p47.ExpertCheck, - Tags = p47.Tags, - Warranty = p47.Warranty, - Cost = p47.Cost, - IsEnable = p47.IsEnable, - Stock = p47.Stock, - MaxOrderCount = p47.MaxOrderCount, - BeDisplayed = p47.BeDisplayed, - PackingCost = p47.PackingCost, - Rate = p47.Rate, - ReviewCount = p47.ReviewCount, - Viewed = p47.Viewed, - MainImage = p47.Files.FirstOrDefault(f => f.IsPrimary) != null ? p47.Files.FirstOrDefault(f => f.IsPrimary).FileLocation : (p47.Files.Count > 0 ? p47.Files.FirstOrDefault().FileLocation : string.Empty), - CategoryId = p47.CategoryId, - BrandId = p47.BrandId, - CategoryName = p47.Category.Name, - ModifiedAt = p47.ModifiedAt, - Id = p47.Id, - CreatedAt = p47.CreatedAt + 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 }; - public static Expression> ProjectToTorobResponseDto => p48 => new TorobProductResponseDto() + public static Expression> ProjectToTorobResponseDto => p52 => new TorobProductResponseDto() { - product_id = p48.Id.ToString(), - price = p48.Cost, - availibility = p48.IsEnable + product_id = p52.Id.ToString(), + price = p52.Cost, + availibility = p52.IsEnable }; private static List funcMain1(List p2) @@ -519,9 +545,18 @@ namespace Netina.Domain.Mappers } - private static ProductCategory funcMain5(Never p9, ProductCategory p10, ProductLDto p5) + private static ApplicationUser funcMain5(Never p9, ApplicationUser p10, ProductLDto p5) { - ProductCategory result = p10 ?? new ProductCategory(); + ApplicationUser result = p10 ?? new ApplicationUser(); + + result.Id = p5.AuthorId; + return result; + + } + + private static ProductCategory funcMain6(Never p11, ProductCategory p12, ProductLDto p5) + { + ProductCategory result = p12 ?? new ProductCategory(); result.Name = p5.CategoryName; result.Id = p5.CategoryId; @@ -529,20 +564,20 @@ namespace Netina.Domain.Mappers } - private static List funcMain6(List p11, List p12) + private static List funcMain7(List p13, List p14) { - if (p11 == null) + if (p13 == null) { return null; } - List result = new List(p11.Count); + List result = new List(p13.Count); int i = 0; - int len = p11.Count; + int len = p13.Count; while (i < len) { - SpecificationSDto item = p11[i]; + SpecificationSDto item = p13[i]; result.Add(item == null ? null : new Specification() { Title = item.Title, @@ -560,20 +595,20 @@ namespace Netina.Domain.Mappers } - private static List funcMain7(List p13, List p14) + private static List funcMain8(List p15, List p16) { - if (p13 == null) + if (p15 == null) { return null; } - List result = new List(p13.Count); + List result = new List(p15.Count); int i = 0; - int len = p13.Count; + int len = p15.Count; while (i < len) { - ReviewSDto item = p13[i]; + ReviewSDto item = p15[i]; result.Add(item == null ? null : new Review() { Title = item.Title, @@ -591,20 +626,20 @@ namespace Netina.Domain.Mappers } - private static List funcMain8(List p15, List p16) + private static List funcMain9(List p17, List p18) { - if (p15 == null) + if (p17 == null) { return null; } - List result = new List(p15.Count); + List result = new List(p17.Count); int i = 0; - int len = p15.Count; + int len = p17.Count; while (i < len) { - StorageFileSDto item = p15[i]; + StorageFileSDto item = p17[i]; result.Add(item == null ? null : new ProductStorageFile() { Name = item.Name, @@ -622,112 +657,20 @@ namespace Netina.Domain.Mappers } - private static List funcMain9(List p22) - { - if (p22 == null) - { - return null; - } - List result = new List(p22.Count); - - int i = 0; - int len = p22.Count; - - while (i < len) - { - Specification item = p22[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 funcMain10(List p23) - { - if (p23 == null) - { - return null; - } - List result = new List(p23.Count); - - int i = 0; - int len = p23.Count; - - while (i < len) - { - Review item = p23[i]; - result.Add(item == null ? null : new ReviewSDto() - { - Title = item.Title, - Comment = item.Comment, - Rate = item.Rate, - IsBuyer = item.IsBuyer, - ProductId = item.ProductId, - UserId = item.UserId, - Id = item.Id, - CreatedAt = item.CreatedAt - }); - i++; - } - return result; - - } - - private static List funcMain11(List p24) + private static List funcMain10(List p24) { if (p24 == null) { return null; } - List result = new List(p24.Count); + List result = new List(p24.Count); int i = 0; int len = p24.Count; while (i < len) { - ProductStorageFile item = p24[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 funcMain12(List p27, List p28) - { - if (p27 == null) - { - return null; - } - List result = new List(p27.Count); - - int i = 0; - int len = p27.Count; - - while (i < len) - { - Specification item = p27[i]; + Specification item = p24[i]; result.Add(item == null ? null : new SpecificationSDto() { Title = item.Title, @@ -745,20 +688,20 @@ namespace Netina.Domain.Mappers } - private static List funcMain13(List p29, List p30) + private static List funcMain11(List p25) { - if (p29 == null) + if (p25 == null) { return null; } - List result = new List(p29.Count); + List result = new List(p25.Count); int i = 0; - int len = p29.Count; + int len = p25.Count; while (i < len) { - Review item = p29[i]; + Review item = p25[i]; result.Add(item == null ? null : new ReviewSDto() { Title = item.Title, @@ -776,20 +719,20 @@ namespace Netina.Domain.Mappers } - private static List funcMain14(List p31, List p32) + private static List funcMain12(List p26) { - if (p31 == null) + if (p26 == null) { return null; } - List result = new List(p31.Count); + List result = new List(p26.Count); int i = 0; - int len = p31.Count; + int len = p26.Count; while (i < len) { - ProductStorageFile item = p31[i]; + ProductStorageFile item = p26[i]; result.Add(item == null ? null : new StorageFileSDto() { Name = item.Name, @@ -806,31 +749,132 @@ namespace Netina.Domain.Mappers } - private static Brand funcMain15(Never p40, Brand p41, ProductSDto p38) + private static List funcMain13(List p29, List p30) { - Brand result = p41 ?? new Brand(); + if (p29 == null) + { + return null; + } + List result = new List(p29.Count); - result.Id = p38.BrandId; + 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++; + } return result; } - private static ProductCategory funcMain16(Never p42, ProductCategory p43, ProductSDto p38) + private static List funcMain14(List p31, List p32) { - ProductCategory result = p43 ?? new ProductCategory(); + if (p31 == null) + { + return null; + } + List result = new List(p31.Count); - result.Name = p38.CategoryName; - result.Id = p38.CategoryId; + int i = 0; + int len = p31.Count; + + while (i < len) + { + Review item = p31[i]; + result.Add(item == null ? null : new ReviewSDto() + { + Title = item.Title, + Comment = item.Comment, + Rate = item.Rate, + IsBuyer = item.IsBuyer, + ProductId = item.ProductId, + UserId = item.UserId, + Id = item.Id, + CreatedAt = item.CreatedAt + }); + i++; + } return result; } - private static bool funcMain17(ProductStorageFile f) + private static List funcMain15(List p33, List p34) + { + if (p33 == null) + { + return null; + } + List result = new List(p33.Count); + + 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++; + } + 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) { return f.IsPrimary; } - private static bool funcMain18(ProductStorageFile f) + private static bool funcMain20(ProductStorageFile f) { return f.IsPrimary; } diff --git a/Netina.Domain/Mappers/ReviewMapper.g.cs b/Netina.Domain/Mappers/ReviewMapper.g.cs index fbb915a..b924018 100644 --- a/Netina.Domain/Mappers/ReviewMapper.g.cs +++ b/Netina.Domain/Mappers/ReviewMapper.g.cs @@ -2,8 +2,7 @@ using System; using System.Linq.Expressions; using Netina.Domain.Dtos.LargDtos; using Netina.Domain.Dtos.SmallDtos; -using Netina.Domain.Entities.Products; -using Review = Netina.Domain.Entities.Reviews.Review; +using Netina.Domain.Entities.Reviews; namespace Netina.Domain.Mappers { diff --git a/Netina.Domain/MapsterRegister.cs b/Netina.Domain/MapsterRegister.cs index 6030982..9a9845a 100644 --- a/Netina.Domain/MapsterRegister.cs +++ b/Netina.Domain/MapsterRegister.cs @@ -12,6 +12,7 @@ public class MapsterRegister : IRegister .TwoWays(); config.NewConfig() + .Map(o=>o.AuthorFullName , d=>d.Author!=null ? d.Author.FirstName + " " + d.Author.LastName : string.Empty) .Map("MainImage", o => o.Files.Count > 0 && o.Files.Any(f => f.IsPrimary) ? o.Files.FirstOrDefault(f => f.IsPrimary)!.FileName : string.Empty) .TwoWays(); @@ -37,6 +38,7 @@ public class MapsterRegister : IRegister .TwoWays(); config.NewConfig() + .Map(o => o.AuthorFullName, d => d.Author != null ? d.Author.FirstName + " " + d.Author.LastName : string.Empty) .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("CategoryName", o => o.Category == null ? null : o.Category.Name) .Map("BrandName", o => o.Brand == null ? null : o.Brand.PersianName) @@ -53,14 +55,12 @@ public class MapsterRegister : IRegister config.NewConfig() + .Map(o => o.AuthorFullName, d => d.Author != null ? d.Author.FirstName + " " + d.Author.LastName : string.Empty) .Map("CategoryName", o => o.Category == null ? null : o.Category.Name) .Map("BrandName", o => o.Brand == null ? null : o.Brand.PersianName) .IgnoreNullValues(false) .TwoWays(); - 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) - .IgnoreNullValues(false) - .TwoWays(); + config.NewConfig() .Map(s=>s.availibility,o=>o.IsEnable) .Map(s=>s.price , o=>o.Cost) diff --git a/Netina.Repository/Handlers/Products/ChangeProductCostCommandHandler.cs b/Netina.Repository/Handlers/Products/ChangeProductCostCommandHandler.cs index aa80221..7c6bcab 100644 --- a/Netina.Repository/Handlers/Products/ChangeProductCostCommandHandler.cs +++ b/Netina.Repository/Handlers/Products/ChangeProductCostCommandHandler.cs @@ -15,7 +15,8 @@ public class ChangeProductCostCommandHandler(IRepositoryWrapper repositoryWrappe ent.Warranty, ent.BeDisplayed, request.Cost, ent.PackingCost, ent.HasExpressDelivery, ent.Stock, ent.MaxOrderCount, ent.BrandId, - ent.CategoryId); + ent.CategoryId, + ent.AuthorId); newEnt.CreatedAt = ent.CreatedAt; newEnt.CreatedBy = ent.CreatedBy; newEnt.Id = ent.Id; diff --git a/Netina.Repository/Handlers/Products/ChangeProductDisplayedCommandHandler.cs b/Netina.Repository/Handlers/Products/ChangeProductDisplayedCommandHandler.cs index a812c07..7105454 100644 --- a/Netina.Repository/Handlers/Products/ChangeProductDisplayedCommandHandler.cs +++ b/Netina.Repository/Handlers/Products/ChangeProductDisplayedCommandHandler.cs @@ -14,7 +14,8 @@ public class ChangeProductDisplayedCommandHandler(IRepositoryWrapper repositoryW ent.Warranty, request.BeDisplayed, ent.Cost, ent.PackingCost, ent.HasExpressDelivery, ent.Stock, ent.MaxOrderCount, ent.BrandId, - ent.CategoryId); + ent.CategoryId, + ent.AuthorId); newEnt.CreatedAt = ent.CreatedAt; newEnt.CreatedBy = ent.CreatedBy; newEnt.Id = ent.Id; diff --git a/Netina.Repository/Handlers/Products/CreateProductCommandHandler.cs b/Netina.Repository/Handlers/Products/CreateProductCommandHandler.cs index 6c57899..fd48efd 100644 --- a/Netina.Repository/Handlers/Products/CreateProductCommandHandler.cs +++ b/Netina.Repository/Handlers/Products/CreateProductCommandHandler.cs @@ -1,17 +1,22 @@ namespace Netina.Repository.Handlers.Products; -public class CreateProductCommandHandler(IRepositoryWrapper repositoryWrapper,IMartenRepositoryWrapper martenRepositoryWrapper, IMediator mediator) +public class CreateProductCommandHandler(IRepositoryWrapper repositoryWrapper,IMartenRepositoryWrapper martenRepositoryWrapper, IMediator mediator,ICurrentUserService currentUserService) : IRequestHandler { public async Task Handle(CreateProductCommand request, CancellationToken cancellationToken) { + if (currentUserService.UserId == null) + throw new BaseApiException(ApiResultStatusCode.UnAuthorized, "User id is wrong"); + if (!Guid.TryParse(currentUserService.UserId, out Guid userId)) + throw new BaseApiException(ApiResultStatusCode.UnAuthorized, "User id is wrong"); + var ent = Product.Create(request.PersianName, request.EnglishName, request.Summery, request.ExpertCheck, request.Tags, request.Warranty,request.BeDisplayed,request.Cost,request.PackingCost, request.HasExpressDelivery, request.Stock, request.MaxOrderCount, - request.BrandId,request.CategoryId); + request.BrandId,request.CategoryId, userId); foreach (var specification in request.Specifications) { diff --git a/Netina.Repository/Handlers/Products/UpdateProductCommandHandler.cs b/Netina.Repository/Handlers/Products/UpdateProductCommandHandler.cs index 556803d..90e2240 100644 --- a/Netina.Repository/Handlers/Products/UpdateProductCommandHandler.cs +++ b/Netina.Repository/Handlers/Products/UpdateProductCommandHandler.cs @@ -1,6 +1,6 @@ namespace Netina.Repository.Handlers.Products; -public class UpdateProductCommandHandler(IRepositoryWrapper repositoryWrapper,IMartenRepositoryWrapper martenRepositoryWrapper, IMediator mediator) +public class UpdateProductCommandHandler(IRepositoryWrapper repositoryWrapper,IMartenRepositoryWrapper martenRepositoryWrapper, IMediator mediator,ICurrentUserService currentUserService) : IRequestHandler { public async Task Handle(UpdateProductCommand request, CancellationToken cancellationToken) @@ -9,7 +9,10 @@ public class UpdateProductCommandHandler(IRepositoryWrapper repositoryWrapper,IM .FirstOrDefaultAsync(e => e.Id == request.Id, cancellationToken); if (ent == null) throw new AppException("Product not found", ApiResultStatusCode.NotFound); - + if (currentUserService.UserId == null) + throw new BaseApiException(ApiResultStatusCode.UnAuthorized, "User id is wrong"); + if(!Guid.TryParse(currentUserService.UserId,out Guid userId)) + throw new BaseApiException(ApiResultStatusCode.UnAuthorized, "User id is wrong"); var newEnt = Product.Create(request.PersianName, request.EnglishName, request.Summery, request.ExpertCheck, request.Tags, request.Warranty, @@ -20,7 +23,8 @@ public class UpdateProductCommandHandler(IRepositoryWrapper repositoryWrapper,IM request.Stock, request.MaxOrderCount, request.BrandId, - request.CategoryId); + request.CategoryId, + userId); newEnt.Id = ent.Id; newEnt.CreatedAt = ent.CreatedAt; newEnt.CreatedBy = ent.CreatedBy; diff --git a/Netina.Repository/Migrations/20240905093846_AddAuthor.Designer.cs b/Netina.Repository/Migrations/20240905093846_AddAuthor.Designer.cs new file mode 100644 index 0000000..5176f22 --- /dev/null +++ b/Netina.Repository/Migrations/20240905093846_AddAuthor.Designer.cs @@ -0,0 +1,2056 @@ +// +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("20240905093846_AddAuthor")] + partial class AddAuthor + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("public") + .HasAnnotation("ProductVersion", "8.0.7") + .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.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.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("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") + .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.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.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.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") + .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.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.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("Files"); + + b.Navigation("OrderProducts"); + + b.Navigation("Reviews"); + + 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/20240905093846_AddAuthor.cs b/Netina.Repository/Migrations/20240905093846_AddAuthor.cs new file mode 100644 index 0000000..0a423de --- /dev/null +++ b/Netina.Repository/Migrations/20240905093846_AddAuthor.cs @@ -0,0 +1,97 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace NetinaShop.Repository.Migrations +{ + /// + public partial class AddAuthor : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "AuthorId", + schema: "public", + table: "Products", + type: "uuid", + nullable: false, + defaultValue: new Guid("8723f1d2-e091-4812-9110-5161c9e23586")); + + migrationBuilder.AddColumn( + name: "AuthorId", + schema: "public", + table: "Blogs", + type: "uuid", + nullable: false, + defaultValue: new Guid("8723f1d2-e091-4812-9110-5161c9e23586")); + + migrationBuilder.CreateIndex( + name: "IX_Products_AuthorId", + schema: "public", + table: "Products", + column: "AuthorId"); + + migrationBuilder.CreateIndex( + name: "IX_Blogs_AuthorId", + schema: "public", + table: "Blogs", + column: "AuthorId"); + + migrationBuilder.AddForeignKey( + name: "FK_Blogs_Users_AuthorId", + schema: "public", + table: "Blogs", + column: "AuthorId", + principalSchema: "public", + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + + migrationBuilder.AddForeignKey( + name: "FK_Products_Users_AuthorId", + schema: "public", + table: "Products", + column: "AuthorId", + principalSchema: "public", + principalTable: "Users", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Blogs_Users_AuthorId", + schema: "public", + table: "Blogs"); + + migrationBuilder.DropForeignKey( + name: "FK_Products_Users_AuthorId", + schema: "public", + table: "Products"); + + migrationBuilder.DropIndex( + name: "IX_Products_AuthorId", + schema: "public", + table: "Products"); + + migrationBuilder.DropIndex( + name: "IX_Blogs_AuthorId", + schema: "public", + table: "Blogs"); + + migrationBuilder.DropColumn( + name: "AuthorId", + schema: "public", + table: "Products"); + + migrationBuilder.DropColumn( + name: "AuthorId", + schema: "public", + table: "Blogs"); + } + } +} diff --git a/Netina.Repository/Migrations/ApplicationContextModelSnapshot.cs b/Netina.Repository/Migrations/ApplicationContextModelSnapshot.cs index 47b53aa..28371db 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.4") + .HasAnnotation("ProductVersion", "8.0.7") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.HasPostgresExtension(modelBuilder, "fuzzystrmatch"); @@ -208,6 +208,9 @@ namespace NetinaShop.Repository.Migrations .ValueGeneratedOnAdd() .HasColumnType("uuid"); + b.Property("AuthorId") + .HasColumnType("uuid"); + b.Property("CategoryId") .HasColumnType("uuid"); @@ -263,6 +266,8 @@ namespace NetinaShop.Repository.Migrations b.HasKey("Id"); + b.HasIndex("AuthorId"); + b.HasIndex("CategoryId"); b.ToTable("Blogs", "public"); @@ -491,7 +496,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("Discounts", "public"); - b.HasDiscriminator("Discriminator").HasValue("Discount"); + b.HasDiscriminator().HasValue("Discount"); b.UseTphMappingStrategy(); }); @@ -791,6 +796,9 @@ namespace NetinaShop.Repository.Migrations .ValueGeneratedOnAdd() .HasColumnType("uuid"); + b.Property("AuthorId") + .HasColumnType("uuid"); + b.Property("BeDisplayed") .HasColumnType("boolean"); @@ -881,6 +889,8 @@ namespace NetinaShop.Repository.Migrations b.HasKey("Id"); + b.HasIndex("AuthorId"); + b.HasIndex("BrandId"); b.HasIndex("CategoryId"); @@ -888,68 +898,6 @@ namespace NetinaShop.Repository.Migrations b.ToTable("Products", "public"); }); - modelBuilder.Entity("Netina.Domain.Entities.Products.Review", b => - { - b.Property("Id") - .ValueGeneratedOnAdd() - .HasColumnType("uuid"); - - b.Property("Comment") - .IsRequired() - .HasColumnType("text"); - - b.Property("CreatedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("CreatedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("IsBuyer") - .HasColumnType("boolean"); - - b.Property("IsConfirmed") - .HasColumnType("boolean"); - - b.Property("IsRemoved") - .HasColumnType("boolean"); - - b.Property("ModifiedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("ModifiedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("ProductId") - .HasColumnType("uuid"); - - b.Property("Rate") - .HasColumnType("real"); - - b.Property("RemovedAt") - .HasColumnType("timestamp without time zone"); - - b.Property("RemovedBy") - .IsRequired() - .HasColumnType("text"); - - b.Property("Title") - .IsRequired() - .HasColumnType("text"); - - b.Property("UserId") - .HasColumnType("uuid"); - - b.HasKey("Id"); - - b.HasIndex("ProductId"); - - b.HasIndex("UserId"); - - b.ToTable("Reviews", "public"); - }); - modelBuilder.Entity("Netina.Domain.Entities.Products.Specification", b => { b.Property("Id") @@ -1010,6 +958,68 @@ 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("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") @@ -1070,7 +1080,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("StorageFiles", "public"); - b.HasDiscriminator("Discriminator").HasValue("StorageFile"); + b.HasDiscriminator().HasValue("StorageFile"); b.UseTphMappingStrategy(); }); @@ -1697,11 +1707,18 @@ namespace NetinaShop.Repository.Migrations 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"); }); @@ -1789,6 +1806,11 @@ namespace NetinaShop.Repository.Migrations 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") @@ -1799,28 +1821,13 @@ namespace NetinaShop.Repository.Migrations .HasForeignKey("CategoryId") .OnDelete(DeleteBehavior.Restrict); + b.Navigation("Author"); + b.Navigation("Brand"); b.Navigation("Category"); }); - modelBuilder.Entity("Netina.Domain.Entities.Products.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.Products.Specification", b => { b.HasOne("Netina.Domain.Entities.Products.Specification", "Parent") @@ -1837,6 +1844,23 @@ 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")