diff --git a/.version b/.version index e002a5f..9ab3fdc 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.22.25.45 \ No newline at end of file +0.23.26.46 \ No newline at end of file diff --git a/Netina.Api/AppSettings/Production/appsettings.Production.json b/Netina.Api/AppSettings/Production/appsettings.Production.json index 9144771..b8c9a7d 100644 --- a/Netina.Api/AppSettings/Production/appsettings.Production.json +++ b/Netina.Api/AppSettings/Production/appsettings.Production.json @@ -1,8 +1,8 @@ { "ConnectionStrings": { "PostgresServer": "User ID=postgres;Password=root;Host=localhost;Port=5432;Database=iGarsonDB;", - "Postgres": "Host=pg-0;Username=vesmmehAgent;Password=g05CTjK358Vx3Eoc9satsWyVwo+15UmsA2dnCrZRUYh1pLTe;Database=NetinaShopDB;Application Name=NetinaShopApi", - "MartenDB": "Host=pg-0;Username=vesmmehAgent;Password=g05CTjK358Vx3Eoc9satsWyVwo+15UmsA2dnCrZRUYh1pLTe;Database=NetinaShopMartenDB;" + "Postgres": "Host=pg-0;Username=visabarterAgent;Password=xHTpBf4wC+bPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=HamyanDB;Application Name=HamyanApi", + "MartenDB": "Host=pg-0;Username=visabarterAgent;Password=xHTpBf4wC+bPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=HamyanMartenDB;" }, "Logging": { "LogLevel": { @@ -17,38 +17,38 @@ "TaxesFee": 9 }, "SiteSettings": { - "BaseUrl": "https://api.vesmeh.com", - "WebSiteUrl": "https://vesmeh.com", - "AdminPanelBaseUrl": "https://admin.vesmeh.com", - "StorageBaseUrl": "https://storage.vesmeh.com", + "BaseUrl": "https://api.hamyan.visabartar.com", + "WebSiteUrl": "https://hamyan.visabartar.com", + "AdminPanelBaseUrl": "https://admin.hamyan.visabartar.com", + "StorageBaseUrl": "https://storage.visabartar.com", "KaveNegarApiKey": "3735494B4143727A794346457461576A2B4B6668414973424E333561505A694B", "UserSetting": { "Username": "09214802813", "Email": "avvampier@gmail.com", - "Password": "eF79o4P4BopCUbUK", + "Password": "2Tsr87RWRn5T", "Phone": "09214802813", "RoleName": "RootAdmin", "FirstName": "همه کاره", "LastName": "سیستم" }, "Manager": { - "Username": "09128387004", - "Email": "mahanmasiha6@gmail.com", - "Password": "eF79o4P4BopCUbUK", + "Username": "09122171024", + "Email": "kamran_mirzayi@gmail.com", + "Password": "YAWEheKEi7gh", "Phone": "09128387004", "RoleName": "Manager", - "FirstName": "ماهان", - "LastName": "" + "FirstName": "کامران", + "LastName": "میرزایی" }, "StorageSetting": { - "AccessKey": "979313b7-30fb-40ff-94d8-d0390d3fa876", - "SecretKey": "d37a1cc6acfea3a6f92c538ef0f6601f1edcdc9143942b6470e5d1032aa6bfe2", - "BucketKey": "vesmeh-content" + "AccessKey": "de129835-b43a-4552-8ed4-865e2635ab3d", + "SecretKey": "f00197a766336e818023f90408ba3b88b4fdc86d0e7180f74f199d9f03db7575", + "BucketKey": "hamyan-content" }, "JwtSettings": { - "SecretKey": "YAEMAMZAMAN_KHODET_NEGAHDAR_IN_KEY_BASH_nw+8E0EABj0Wg8c4mHg/bDBf5qGMhmBPb6u16DVe9/MzYva1e+/J1zImyIoQX2Lmra2kvzsIjGiwP7r3Znd_YA_JADE_NASABE_v+Ro/CDixScDv6EkpZnkBv9MFdPnSmFXNGMH9gA1BzQUoC1iSX9Aq+pMIw/cMKXI9WA==_YA_HUSEIN_SEYED_SHOHADA_BE_OMID_KHODET", - "Issuer": "Brizco", - "Audience": "Brizco", + "SecretKey": "YAEMAMZAMAN_KHODET_NEGAHDAR_IN_KEY_BASH_Co0F8AlDfth0PmBuY/0xZQX25iKGQsro5HNkm+gGto4ijSm3hJQ7SViLmR2/BtHN_YA_JADE_NASABE_MSwIOzaxUqn8awSbMx02MSwIOzaxUqn8awSbMx02_EegU4lf9LB5LOyZWXLzLCyXtAp0moUh0_YA_HUSEIN_SEYED_SHOHADA_BE_OMID_KHODET", + "Issuer": "Hamyan", + "Audience": "Hamyan", "ExpireAddDay": "15" } }, diff --git a/Netina.Api/AppSettings/appsettings.DevelopmentHamyan.json b/Netina.Api/AppSettings/appsettings.DevelopmentHamyan.json index 9a239fd..8d19279 100644 --- a/Netina.Api/AppSettings/appsettings.DevelopmentHamyan.json +++ b/Netina.Api/AppSettings/appsettings.DevelopmentHamyan.json @@ -17,15 +17,15 @@ "TaxesFee": 9 }, "SiteSettings": { - "BaseUrl": "http://192.168.1.12:32770", - "WebSiteUrl": "https://hamyanedalat.com", - "AdminPanelBaseUrl": "https://admin.hamyanedalat.com", - "StorageBaseUrl": "https://storage.hamyanedalat.com", + "BaseUrl": "https://api.hamyan.visabartar.com", + "WebSiteUrl": "https://hamyan.visabartar.com", + "AdminPanelBaseUrl": "https://admin.hamyan.visabartar.com", + "StorageBaseUrl": "https://storage.visabartar.com", "KaveNegarApiKey": "3735494B4143727A794346457461576A2B4B6668414973424E333561505A694B", "UserSetting": { "Username": "09214802813", "Email": "avvampier@gmail.com", - "Password": "eF79o4P4BopCUbUK", + "Password": "2Tsr87RWRn5T", "Phone": "09214802813", "RoleName": "RootAdmin", "FirstName": "همه کاره", @@ -33,9 +33,9 @@ }, "Manager": { "Username": "09122171024", - "Email": "info@hamyanedalat.com", - "Password": "eF79o4P4BopCUbUK", - "Phone": "09122171024", + "Email": "kamran_mirzayi@gmail.com", + "Password": "YAWEheKEi7gh", + "Phone": "09128387004", "RoleName": "Manager", "FirstName": "کامران", "LastName": "میرزایی" @@ -46,9 +46,9 @@ "BucketKey": "hamyan-content" }, "JwtSettings": { - "SecretKey": "YAEMAMZAMAN_KHODET_NEGAHDAR_IN_KEY_BASH_nw+8E0EABj0Wg8c4mHg/bDBf5qGMhmBPb6u16DVe9/MzYva1e+/J1zImyIoQX2Lmra2kvzsIjGiwP7r3Znd_YA_JADE_NASABE_v+Ro/CDixScDv6EkpZnkBv9MFdPnSmFXNGMH9gA1BzQUoC1iSX9Aq+pMIw/cMKXI9WA==_YA_HUSEIN_SEYED_SHOHADA_BE_OMID_KHODET", - "Issuer": "HamaynEdalat", - "Audience": "HamaynEdalat", + "SecretKey": "YAEMAMZAMAN_KHODET_NEGAHDAR_IN_KEY_BASH_Co0F8AlDfth0PmBuY/0xZQX25iKGQsro5HNkm+gGto4ijSm3hJQ7SViLmR2/BtHN_YA_JADE_NASABE_MSwIOzaxUqn8awSbMx02MSwIOzaxUqn8awSbMx02_EegU4lf9LB5LOyZWXLzLCyXtAp0moUh0_YA_HUSEIN_SEYED_SHOHADA_BE_OMID_KHODET", + "Issuer": "Hamyan", + "Audience": "Hamyan", "ExpireAddDay": "15" } }, diff --git a/Netina.Api/AppSettings/appsettings.DevelopmentVesmeh.json b/Netina.Api/AppSettings/appsettings.DevelopmentVesmeh.json index 885ee77..5222059 100644 --- a/Netina.Api/AppSettings/appsettings.DevelopmentVesmeh.json +++ b/Netina.Api/AppSettings/appsettings.DevelopmentVesmeh.json @@ -1,6 +1,6 @@ { "ConnectionStrings": { - "PostgresServer": "User ID=postgres;Password=root;Host=localhost;Port=5432;Database=iGarsonDB;", + "PostgresServer": "Host=185.220.227.88;Username=vesmmehAgent;Password=g05CTjK358Vx3Eoc9satsWyVwo+15UmsA2dnCrZRUYh1pLTe;Database=NetinaShopDB;Application Name=NetinaShopApi", "Postgres": "Host=pg-0,pg-1;Username=igarsonAgent;Password=xHTpBf4wC+bBeNg2pL6Ga7VEWKFJx7VPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=NetinaShopDB;Load Balance Hosts=true;Target Session Attributes=primary;Application Name=iGLS", "MartenDB": "Host=pg-0,pg-1;Username=igarsonAgent;Password=xHTpBf4wC+bBeNg2pL6Ga7VEWKFJx7VPEUpqxwPFfOc2YYTVwFQuHfsiqoVeT9+6;Database=NetinaShopMartenDB;" }, diff --git a/Netina.Api/Controller/SeedController.cs b/Netina.Api/Controller/SeedController.cs index 1a927f6..2d7ad55 100644 --- a/Netina.Api/Controller/SeedController.cs +++ b/Netina.Api/Controller/SeedController.cs @@ -34,7 +34,7 @@ public class SeedController : ICarterModule .WithDisplayName("SeedBlogsAsync") .HasApiVersion(1.0); - group.MapPost("blog/categories", SeedBlogCategoriesAsync) + group.MapPost("blog/categories", SeedBlogCategoriesSlugAsync) .WithDisplayName("SeedBlogCategoriesAsync") .HasApiVersion(1.0); } @@ -141,12 +141,34 @@ public class SeedController : ICarterModule categories.Add(0, baseCategory.Id); foreach (var requestDto in request) { - var ent = BlogCategory.Create(requestDto.Name, requestDto.Description); + var ent = BlogCategory.Create(requestDto.Name,requestDto.Slug, requestDto.Description); repositoryWrapper.SetRepository().Add(ent); await repositoryWrapper.SaveChangesAsync(cancellationToken); categories.Add(requestDto.BaseCategoryId, ent.Id); } + return TypedResults.Ok(categories); + } + public async Task SeedBlogCategoriesSlugAsync([FromBody] List request, [FromQuery] string key, [FromServices] IRepositoryWrapper repositoryWrapper, CancellationToken cancellationToken) + { + + if (key != "kKAYskyG8xPxKnJrHkuYxub4Ao2bnz7AOmNtwDT0RaqzaG7ZvbvaP29tCrC8wJ823RczJFXOIQT2bDOec4F38A==") + throw new AppException("Key is not valid", ApiResultStatusCode.UnAuthorized); + + Dictionary categories = new Dictionary(); + foreach (var requestDto in request) + { + var ent = await repositoryWrapper.SetRepository() + .TableNoTracking + .FirstOrDefaultAsync(bc=>bc.Name==requestDto.Name,cancellationToken); + if (ent == null) + continue; + ent.Slug = requestDto.Slug; + repositoryWrapper.SetRepository().Update(ent); + await repositoryWrapper.SaveChangesAsync(cancellationToken); + categories.Add(requestDto.BaseCategoryId, ent.Id); + } + return TypedResults.Ok(categories); } } \ No newline at end of file diff --git a/Netina.Api/Program.cs b/Netina.Api/Program.cs index b19f22a..3099ef6 100644 --- a/Netina.Api/Program.cs +++ b/Netina.Api/Program.cs @@ -6,7 +6,7 @@ builder.Host.UseSerilog(); LoggerConfig.ConfigureSerilog(); string env = builder.Environment.IsDevelopment() == true ? "Development" : "Production"; builder.Host.UseContentRoot(Directory.GetCurrentDirectory()); -string projectName = "Hamyan"; +string projectName = "Vesmeh"; if (builder.Environment.IsDevelopment()) builder.Configuration.AddJsonFile($"AppSettings/appsettings.json").AddJsonFile($"AppSettings/appsettings.{env}{projectName}.json"); diff --git a/Netina.Common/Extensions/StringExtensions.cs b/Netina.Common/Extensions/StringExtensions.cs index 549e98a..88f2fa1 100644 --- a/Netina.Common/Extensions/StringExtensions.cs +++ b/Netina.Common/Extensions/StringExtensions.cs @@ -1,7 +1,14 @@ -namespace Netina.Common.Extensions +using System.Web; +using System.Xml.Linq; + +namespace Netina.Common.Extensions { public static class StringExtensions { + public static string GetSlug(string title) + { + return HttpUtility.UrlEncode(title.Replace(' ', '-')); + } public static string ToPriceWhitPriceType(this long price, string priceType) { return price.ToString("N0") + " " + priceType; diff --git a/Netina.Domain/Dtos/RequestDtos/SeedDtos/SeedBlogRequestDto.cs b/Netina.Domain/Dtos/RequestDtos/SeedDtos/SeedBlogRequestDto.cs index f845d69..7c2504a 100644 --- a/Netina.Domain/Dtos/RequestDtos/SeedDtos/SeedBlogRequestDto.cs +++ b/Netina.Domain/Dtos/RequestDtos/SeedDtos/SeedBlogRequestDto.cs @@ -17,5 +17,6 @@ public class SeedBlogCategoryRequestDto { public int BaseCategoryId { get; set; } public string Description { get; set; } = string.Empty; + public string Slug { get; set; } = string.Empty; public string Name { 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 3ebe7c9..378f231 100644 --- a/Netina.Domain/Entities/Blogs/Blog.Aggregate.cs +++ b/Netina.Domain/Entities/Blogs/Blog.Aggregate.cs @@ -1,5 +1,4 @@ -using System.Web; -using Microsoft.IdentityModel.Tokens; +using Microsoft.IdentityModel.Tokens; namespace Netina.Domain.Entities.Blogs; @@ -7,14 +6,14 @@ public partial class Blog { public static Blog Create(string title, string content, string tags, int readingTime, string summery, bool isSuggested, Guid categoryId) { - var slug = HttpUtility.UrlEncode(title.Replace(' ', '-')); + var slug = StringExtensions.GetSlug(title); return new Blog(title, slug, content, tags, readingTime, summery, isSuggested, categoryId); } - 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) { - if(slug.IsNullOrEmpty()) - slug = HttpUtility.UrlEncode(title.Replace(' ', '-')); + if (slug.IsNullOrEmpty()) + slug = StringExtensions.GetSlug(title); return new Blog(title, slug, content, tags, readingTime, summery, isSuggested, categoryId); } public BlogStorageFile AddFile(string name, string fileLocation, string fileName, bool isHeader, bool isPrimary, StorageFileType fileType) @@ -35,8 +34,15 @@ public partial class BlogStorageFile public partial class BlogCategory { - public static BlogCategory Create(string name,string description) + public static BlogCategory Create(string name, string description) { - return new BlogCategory(name, description); + var slug = StringExtensions.GetSlug(name); + return new BlogCategory(name, slug, description); + } + public static BlogCategory Create(string name, string slug, string description) + { + if (slug.IsNullOrEmpty()) + slug = StringExtensions.GetSlug(name); + return new BlogCategory(name, slug, description); } } \ No newline at end of file diff --git a/Netina.Domain/Entities/Blogs/BlogCategory.cs b/Netina.Domain/Entities/Blogs/BlogCategory.cs index 6070526..689a319 100644 --- a/Netina.Domain/Entities/Blogs/BlogCategory.cs +++ b/Netina.Domain/Entities/Blogs/BlogCategory.cs @@ -10,12 +10,14 @@ public partial class BlogCategory : ApiEntity } - public BlogCategory(string name, string description) + public BlogCategory(string name,string slug, string description) { Name = name; + Slug = slug; Description = description; } public string Name { get; internal set; } = string.Empty; + public string Slug { get; set; } = string.Empty; public string Description { get; internal set; } = string.Empty; public List Blogs { get; internal set; } = new(); } \ No newline at end of file diff --git a/Netina.Domain/Entities/Brands/Brand.Aggregate.cs b/Netina.Domain/Entities/Brands/Brand.Aggregate.cs index 73c29e0..8f70678 100644 --- a/Netina.Domain/Entities/Brands/Brand.Aggregate.cs +++ b/Netina.Domain/Entities/Brands/Brand.Aggregate.cs @@ -4,7 +4,9 @@ public partial class Brand { public static Brand Create(string persianName, string englishName, string description, bool hasSpecialPage, string pageUrl) { - return new Brand(persianName,englishName, description, hasSpecialPage, pageUrl); + + var slug = StringExtensions.GetSlug(persianName); + return new Brand(persianName, slug, englishName, description, hasSpecialPage, pageUrl); } public BrandStorageFile AddFile(string name, string fileLocation, string fileName, bool isHeader, bool isPrimary, StorageFileType fileType) diff --git a/Netina.Domain/Entities/Brands/Brand.cs b/Netina.Domain/Entities/Brands/Brand.cs index 7f7a82f..c70ccc8 100644 --- a/Netina.Domain/Entities/Brands/Brand.cs +++ b/Netina.Domain/Entities/Brands/Brand.cs @@ -12,9 +12,10 @@ public partial class Brand : ApiEntity } - public Brand(string persianName,string englishName, string description, bool hasSpecialPage, string pageUrl) + public Brand(string persianName,string slug,string englishName, string description, bool hasSpecialPage, string pageUrl) { PersianName = persianName; + Slug = slug; EnglishName = englishName; Description = description; HasSpecialPage = hasSpecialPage; @@ -22,6 +23,7 @@ public partial class Brand : ApiEntity } public string PersianName { get; internal set; } = string.Empty; public string EnglishName { get; internal set; } = string.Empty; + public string Slug { get; set; } = string.Empty; public string Description { get; internal set; } = string.Empty; public bool HasSpecialPage { get; internal set; } public string PageUrl { get; internal set; } = string.Empty; diff --git a/Netina.Domain/Entities/ProductCategories/ProductCategory.Aggregate.cs b/Netina.Domain/Entities/ProductCategories/ProductCategory.Aggregate.cs index d0d944e..ddb03c3 100644 --- a/Netina.Domain/Entities/ProductCategories/ProductCategory.Aggregate.cs +++ b/Netina.Domain/Entities/ProductCategories/ProductCategory.Aggregate.cs @@ -1,10 +1,13 @@ -namespace Netina.Domain.Entities.ProductCategories; +using System.Web; + +namespace Netina.Domain.Entities.ProductCategories; public partial class ProductCategory { public static ProductCategory Create(string name, string description,bool isMain) { - return new ProductCategory(name, description, isMain); + var slug = StringExtensions.GetSlug(name); + return new ProductCategory(name, slug, description, isMain); } public void SetParent(Guid parentId) diff --git a/Netina.Domain/Entities/ProductCategories/ProductCategory.cs b/Netina.Domain/Entities/ProductCategories/ProductCategory.cs index dff77e3..fd3b5c5 100644 --- a/Netina.Domain/Entities/ProductCategories/ProductCategory.cs +++ b/Netina.Domain/Entities/ProductCategories/ProductCategory.cs @@ -1,4 +1,5 @@ namespace Netina.Domain.Entities.ProductCategories; + [AdaptTwoWays("[name]LDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget | MapType.Projection)] [AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)] [AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)] @@ -10,13 +11,15 @@ public partial class ProductCategory : ApiEntity } - public ProductCategory(string name, string description,bool isMain) + public ProductCategory(string name,string slug, string description,bool isMain) { Name = name; + Slug = slug; Description = description; IsMain = isMain; } public string Name { get; internal set; } = string.Empty; + public string Slug { get; set; } = string.Empty; public string Description { get; internal set; } = string.Empty; public bool IsMain { get; set; } diff --git a/Netina.Domain/Entities/Products/Product.Aggregate.cs b/Netina.Domain/Entities/Products/Product.Aggregate.cs index 3785021..4fd02e4 100644 --- a/Netina.Domain/Entities/Products/Product.Aggregate.cs +++ b/Netina.Domain/Entities/Products/Product.Aggregate.cs @@ -1,4 +1,5 @@ using System.Web; +using System.Xml.Linq; namespace Netina.Domain.Entities.Products; @@ -14,7 +15,7 @@ public partial class Product Guid brandId, Guid categoryId) { - var slug = HttpUtility.UrlEncode(persianName.Replace(' ', '-')); + var slug = StringExtensions.GetSlug(persianName); return new Product( persianName, englishName, diff --git a/Netina.Infrastructure/Services/Scrapers/DigikalaScraper.cs b/Netina.Infrastructure/Services/Scrapers/DigikalaScraper.cs index 7262b24..831d2e3 100644 --- a/Netina.Infrastructure/Services/Scrapers/DigikalaScraper.cs +++ b/Netina.Infrastructure/Services/Scrapers/DigikalaScraper.cs @@ -1,5 +1,6 @@ using MediatR; using Microsoft.EntityFrameworkCore; +using Microsoft.IdentityModel.Tokens; using Netina.Domain.CommandQueries.Commands; using Netina.Domain.Dtos.ScraperDtos.Response; using Netina.Domain.Dtos.SmallDtos; @@ -94,7 +95,8 @@ public class DigikalaScraper : IDigikalaScraper await _repositoryWrapper.SaveChangesAsync(cancellationToken); } - + if (digiProduct.product.title_en.IsNullOrEmpty()) + digiProduct.product.title_en = digiProduct.product.title_fa; var request = new CreateProductCommand(digiProduct.product.title_fa, digiProduct.product.title_en, newSummery, diff --git a/Netina.Repository/Handlers/Brands/CreateBrandCommandHandler.cs b/Netina.Repository/Handlers/Brands/CreateBrandCommandHandler.cs index f3c453e..7b7b4b9 100644 --- a/Netina.Repository/Handlers/Brands/CreateBrandCommandHandler.cs +++ b/Netina.Repository/Handlers/Brands/CreateBrandCommandHandler.cs @@ -1,7 +1,4 @@ -using Netina.Domain.CommandQueries.Commands; -using Netina.Domain.Dtos.SmallDtos; -using Netina.Domain.Entities.Brands; -using Netina.Repository.Repositories.Base.Contracts; +using Netina.Domain.Entities.Brands; namespace Netina.Repository.Handlers.Brands; diff --git a/Netina.Repository/Handlers/Brands/UpdateBrandCommandHandler.cs b/Netina.Repository/Handlers/Brands/UpdateBrandCommandHandler.cs index 099e611..8b62882 100644 --- a/Netina.Repository/Handlers/Brands/UpdateBrandCommandHandler.cs +++ b/Netina.Repository/Handlers/Brands/UpdateBrandCommandHandler.cs @@ -1,8 +1,5 @@ using Microsoft.EntityFrameworkCore; -using Netina.Common.Models.Exception; -using Netina.Domain.CommandQueries.Commands; using Netina.Domain.Entities.Brands; -using Netina.Repository.Repositories.Base.Contracts; namespace Netina.Repository.Handlers.Brands; diff --git a/Netina.Repository/Migrations/20240422113439_AddSlugCategoriesAndBrand.Designer.cs b/Netina.Repository/Migrations/20240422113439_AddSlugCategoriesAndBrand.Designer.cs new file mode 100644 index 0000000..2c497a6 --- /dev/null +++ b/Netina.Repository/Migrations/20240422113439_AddSlugCategoriesAndBrand.Designer.cs @@ -0,0 +1,2025 @@ +// +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("20240422113439_AddSlugCategoriesAndBrand")] + partial class AddSlugCategoriesAndBrand + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("public") + .HasAnnotation("ProductVersion", "8.0.4") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleClaims", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Claims", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("Logins", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("UserRoles", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("Tokens", "public"); + }); + + modelBuilder.Entity("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("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("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("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.Property("Slug") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + 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("Discriminator").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("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("BrandId"); + + b.HasIndex("CategoryId"); + + 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") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Detail") + .IsRequired() + .HasColumnType("text"); + + b.Property("IsFeature") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("ParentId") + .HasColumnType("uuid"); + + b.Property("ProductId") + .HasColumnType("uuid"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Title") + .IsRequired() + .HasColumnType("text"); + + b.Property("Value") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.HasIndex("ParentId"); + + b.HasIndex("ProductId"); + + b.ToTable("Specifications", "public"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.StorageFiles.StorageFile", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uuid"); + + b.Property("CreatedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("CreatedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Discriminator") + .IsRequired() + .HasMaxLength(34) + .HasColumnType("character varying(34)"); + + b.Property("FileLocation") + .IsRequired() + .HasColumnType("text"); + + b.Property("FileName") + .IsRequired() + .HasColumnType("text"); + + b.Property("FileType") + .HasColumnType("integer"); + + b.Property("IsHeader") + .HasColumnType("boolean"); + + b.Property("IsPrimary") + .HasColumnType("boolean"); + + b.Property("IsRemoved") + .HasColumnType("boolean"); + + b.Property("ModifiedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("ModifiedBy") + .IsRequired() + .HasColumnType("text"); + + b.Property("Name") + .IsRequired() + .HasColumnType("text"); + + b.Property("RemovedAt") + .HasColumnType("timestamp without time zone"); + + b.Property("RemovedBy") + .IsRequired() + .HasColumnType("text"); + + b.HasKey("Id"); + + b.ToTable("StorageFiles", "public"); + + b.HasDiscriminator("Discriminator").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("CustomerId") + .HasColumnType("uuid"); + + 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("CustomerId"); + + 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.Blogs.BlogCategory", "Category") + .WithMany("Blogs") + .HasForeignKey("CategoryId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Category"); + }); + + 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.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("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") + .WithMany("Children") + .HasForeignKey("ParentId"); + + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") + .WithMany("Specifications") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("Parent"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.Customer", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") + .WithOne("Customer") + .HasForeignKey("Netina.Domain.Entities.Users.Customer", "UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.Manager", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") + .WithOne("Manager") + .HasForeignKey("Netina.Domain.Entities.Users.Manager", "UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.Marketer", b => + { + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") + .WithOne("Marketer") + .HasForeignKey("Netina.Domain.Entities.Users.Marketer", "UserId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("User"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.UserAddress", b => + { + b.HasOne("Netina.Domain.Entities.Users.Customer", null) + .WithMany("Addresses") + .HasForeignKey("CustomerId"); + + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") + .WithMany() + .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("Customer"); + + b.Navigation("Manager"); + + b.Navigation("Marketer"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.Customer", b => + { + b.Navigation("Addresses"); + }); + + modelBuilder.Entity("Netina.Domain.Entities.Users.Marketer", b => + { + b.Navigation("Discount"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Netina.Repository/Migrations/20240422113439_AddSlugCategoriesAndBrand.cs b/Netina.Repository/Migrations/20240422113439_AddSlugCategoriesAndBrand.cs new file mode 100644 index 0000000..790fa70 --- /dev/null +++ b/Netina.Repository/Migrations/20240422113439_AddSlugCategoriesAndBrand.cs @@ -0,0 +1,57 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace NetinaShop.Repository.Migrations +{ + /// + public partial class AddSlugCategoriesAndBrand : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Slug", + schema: "public", + table: "ProductCategories", + type: "text", + nullable: false, + defaultValue: ""); + + migrationBuilder.AddColumn( + name: "Slug", + schema: "public", + table: "Brands", + type: "text", + nullable: false, + defaultValue: ""); + + migrationBuilder.AddColumn( + name: "Slug", + schema: "public", + table: "BlogCategories", + type: "text", + nullable: false, + defaultValue: ""); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Slug", + schema: "public", + table: "ProductCategories"); + + migrationBuilder.DropColumn( + name: "Slug", + schema: "public", + table: "Brands"); + + migrationBuilder.DropColumn( + name: "Slug", + schema: "public", + table: "BlogCategories"); + } + } +} diff --git a/Netina.Repository/Migrations/ApplicationContextModelSnapshot.cs b/Netina.Repository/Migrations/ApplicationContextModelSnapshot.cs index 01e2511..8861850 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.3") + .HasAnnotation("ProductVersion", "8.0.4") .HasAnnotation("Relational:MaxIdentifierLength", 63); NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); @@ -304,6 +304,10 @@ namespace NetinaShop.Repository.Migrations .IsRequired() .HasColumnType("text"); + b.Property("Slug") + .IsRequired() + .HasColumnType("text"); + b.HasKey("Id"); b.ToTable("BlogCategories", "public"); @@ -358,6 +362,10 @@ namespace NetinaShop.Repository.Migrations .IsRequired() .HasColumnType("text"); + b.Property("Slug") + .IsRequired() + .HasColumnType("text"); + b.HasKey("Id"); b.ToTable("Brands", "public"); @@ -756,6 +764,10 @@ namespace NetinaShop.Repository.Migrations .IsRequired() .HasColumnType("text"); + b.Property("Slug") + .IsRequired() + .HasColumnType("text"); + b.HasKey("Id"); b.HasIndex("ParentId"); diff --git a/Netina.Repository/Services/DbInitializerService.cs b/Netina.Repository/Services/DbInitializerService.cs index 23bff5c..b8fac99 100644 --- a/Netina.Repository/Services/DbInitializerService.cs +++ b/Netina.Repository/Services/DbInitializerService.cs @@ -1,6 +1,8 @@ using Microsoft.EntityFrameworkCore; using Microsoft.IdentityModel.Tokens; using System.Web; +using Netina.Domain.Entities.Blogs; +using Netina.Domain.Entities.Brands; namespace Netina.Repository.Services; @@ -186,21 +188,86 @@ public class DbInitializerService : IDbInitializerService public async Task Refactor() { - var noSlugProducts = await _repositoryWrapper.SetRepository() - .TableNoTracking - .Where(p => p.Slug==string.Empty) - .ToListAsync(); + //var noSlugProducts = await _repositoryWrapper.SetRepository() + // .TableNoTracking + // .Where(p => p.Slug==string.Empty) + // .ToListAsync(); - if (noSlugProducts.Count > 0) - { - noSlugProducts.ForEach(p => - { - var slug = HttpUtility.UrlEncode(p.PersianName.Replace(' ', '-')); - p.Slug = slug; - }); - _repositoryWrapper.SetRepository() - .UpdateRange(noSlugProducts); - await _repositoryWrapper.SaveChangesAsync(); - } + //if (noSlugProducts.Count > 0) + //{ + // noSlugProducts.ForEach(p => + // { + // var slug = StringExtensions.GetSlug(p.PersianName); + // p.Slug = slug; + // }); + // _repositoryWrapper.SetRepository() + // .UpdateRange(noSlugProducts); + // await _repositoryWrapper.SaveChangesAsync(); + //} + + //var noSlugProductCategories = await _repositoryWrapper.SetRepository() + // .TableNoTracking + // .Where(pc=>pc.Slug == string.Empty) + // .ToListAsync(); + //if (noSlugProductCategories.Count > 0) + //{ + // noSlugProductCategories.ForEach(p => + // { + // var slug = StringExtensions.GetSlug(p.Name); + // p.Slug = slug; + // }); + // _repositoryWrapper.SetRepository() + // .UpdateRange(noSlugProductCategories); + // await _repositoryWrapper.SaveChangesAsync(); + //} + + //var notSlugBrands = await _repositoryWrapper.SetRepository() + // .TableNoTracking + // .Where(pc => pc.Slug == string.Empty) + // .ToListAsync(); + //if (notSlugBrands.Count > 0) + //{ + // notSlugBrands.ForEach(p => + // { + // var slug = StringExtensions.GetSlug(p.PersianName); + // p.Slug = slug; + // }); + // _repositoryWrapper.SetRepository() + // .UpdateRange(notSlugBrands); + // await _repositoryWrapper.SaveChangesAsync(); + //} + + + + //var noSlugBlogs = await _repositoryWrapper.SetRepository() + // .TableNoTracking + // .Where(pc => pc.Slug == string.Empty) + // .ToListAsync(); + //if (noSlugBlogs.Count > 0) + //{ + // noSlugBlogs.ForEach(p => + // { + // var slug = StringExtensions.GetSlug(p.Title); + // p.Slug = slug; + // }); + // _repositoryWrapper.SetRepository() + // .UpdateRange(noSlugBlogs); + // await _repositoryWrapper.SaveChangesAsync(); + //} + //var noSlugBogCategories = await _repositoryWrapper.SetRepository() + // .TableNoTracking + // .Where(pc => pc.Slug == string.Empty) + // .ToListAsync(); + //if (noSlugBogCategories.Count > 0) + //{ + // noSlugBogCategories.ForEach(p => + // { + // var slug = StringExtensions.GetSlug(p.Name); + // p.Slug = slug; + // }); + // _repositoryWrapper.SetRepository() + // .UpdateRange(noSlugBogCategories); + // await _repositoryWrapper.SaveChangesAsync(); + //} } } \ No newline at end of file diff --git a/Tools/NetinaShop.WordPressDBConverter/Program.cs b/Tools/NetinaShop.WordPressDBConverter/Program.cs index 64b3f6d..4abd15c 100644 --- a/Tools/NetinaShop.WordPressDBConverter/Program.cs +++ b/Tools/NetinaShop.WordPressDBConverter/Program.cs @@ -64,6 +64,7 @@ foreach (var taxonomy in termTaxonomies) { BaseCategoryId = term.term_id.ToInt(), Description = taxonomy.description, + Slug = term.slug, Name = term.name }); } @@ -81,7 +82,7 @@ foreach (var taxonomy in termTaxonomies) } var categoriesRest = new Dictionary(); -//categoriesRest = await RestWrapper.Instance.SeedRestApi.SeedBlogCategoriesAsync(categories, "kKAYskyG8xPxKnJrHkuYxub4Ao2bnz7AOmNtwDT0RaqzaG7ZvbvaP29tCrC8wJ823RczJFXOIQT2bDOec4F38A=="); +categoriesRest = await RestWrapper.Instance.SeedRestApi.SeedBlogCategoriesAsync(categories, "kKAYskyG8xPxKnJrHkuYxub4Ao2bnz7AOmNtwDT0RaqzaG7ZvbvaP29tCrC8wJ823RczJFXOIQT2bDOec4F38A=="); Console.WriteLine($"{categories.Count} BlogCategory Added Success !");