From 00ca32d32f4ccfd2a9967e98ed3c3aec933137ae Mon Sep 17 00:00:00 2001 From: "Amir.H Khademi" Date: Thu, 18 Apr 2024 19:19:54 +0330 Subject: [PATCH] fix orderSubName issue , add version 0.22.25.44 --- .version | 2 +- .../appsettings.DevelopmentVesmeh.json | 4 +- Netina.Api/Controller/PaymentController.cs | 10 +- Netina.Api/Controller/SearchController.cs | 17 + Netina.Api/Netina.Api.csproj | 4 +- Netina.Api/Program.cs | 2 +- .../CoreServices/Abstracts/ISearchService.cs | 5 +- Netina.Core/CoreServices/SearchService.cs | 15 +- .../GetOrderInvoiceCommandHandler.cs | 4 +- Netina.Domain/Dtos/LargDtos/OrderLDto.cs | 11 +- .../Zarehbin/ZarehbinPagedResponseDto.cs | 26 + .../Entities/Discounts/Discount.Aggregate.cs | 4 +- Netina.Domain/Entities/Discounts/Discount.cs | 4 +- Netina.Domain/Entities/Users/Marketer.cs | 8 +- Netina.Domain/Mappers/OrderMapper.g.cs | 6 + .../Settings/MarketerSetting.cs | 7 + .../CreateSaleCooperationDiscountHandler.cs | 22 +- ...115609_EditDiscountAndMarketer.Designer.cs | 2005 +++++++++++++++++ .../20240418115609_EditDiscountAndMarketer.cs | 1295 +++++++++++ .../ApplicationContextModelSnapshot.cs | 295 ++- .../Models/ApplicationContext.cs | 2 +- 21 files changed, 3589 insertions(+), 159 deletions(-) create mode 100644 Netina.Domain/Dtos/ResponseDtos/Zarehbin/ZarehbinPagedResponseDto.cs create mode 100644 Netina.Domain/MartenEntities/Settings/MarketerSetting.cs create mode 100644 Netina.Repository/Migrations/20240418115609_EditDiscountAndMarketer.Designer.cs create mode 100644 Netina.Repository/Migrations/20240418115609_EditDiscountAndMarketer.cs diff --git a/.version b/.version index 1c6f6f4..cc4ce69 100644 --- a/.version +++ b/.version @@ -1 +1 @@ -0.22.25.43 \ No newline at end of file +0.22.25.44 \ No newline at end of file diff --git a/Netina.Api/AppSettings/appsettings.DevelopmentVesmeh.json b/Netina.Api/AppSettings/appsettings.DevelopmentVesmeh.json index e27f4ae..4a20ce6 100644 --- a/Netina.Api/AppSettings/appsettings.DevelopmentVesmeh.json +++ b/Netina.Api/AppSettings/appsettings.DevelopmentVesmeh.json @@ -47,8 +47,8 @@ }, "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": "NetinaShop", - "Audience": "NetinaShop", + "Issuer": "Vesmeh", + "Audience": "Vesmeh", "ExpireAddDay": "15" } }, diff --git a/Netina.Api/Controller/PaymentController.cs b/Netina.Api/Controller/PaymentController.cs index b1ab01e..1e58e62 100644 --- a/Netina.Api/Controller/PaymentController.cs +++ b/Netina.Api/Controller/PaymentController.cs @@ -1,4 +1,5 @@ -using Netina.Core.Abstracts; +using Microsoft.Extensions.Options; +using Netina.Core.Abstracts; using Netina.Domain.CommandQueries.Queries; using Netina.Domain.Models.Claims; using TypedResults = Microsoft.AspNetCore.Http.TypedResults; @@ -36,16 +37,17 @@ public class PaymentController : ICarterModule => TypedResults.Ok(await mediator.Send(new GetShippingQuery(id), cancellationToken)); // POST:Create Entity - public async Task VerifyPaymentAsync([FromQuery] string Authority, [FromQuery] string Status, IPaymentService paymentService, ILogger logger, CancellationToken cancellationToken) + public async Task VerifyPaymentAsync([FromQuery] string Authority, [FromQuery] string Status, IPaymentService paymentService, IOptionsSnapshot optionsSnapshot, ILogger logger, CancellationToken cancellationToken) { + var siteUrl = optionsSnapshot.Value.WebSiteUrl; if (Status == "OK") { var result = await paymentService.VerifyPaymentAsync(authority: Authority, cancellationToken); - return TypedResults.Redirect($"https://vesmeh.com/purchase-callback?refid={result.Item1}&paymentStatus=true&factorNumber={result.Item2}", true); + return TypedResults.Redirect($"{siteUrl}/purchase-callback?refid={result.Item1}&paymentStatus=true&factorNumber={result.Item2}", true); } else { - return TypedResults.Redirect($"https://vesmeh.com/purchase-callback?refid=0&paymentStatus=false&factorNumber=0", true); + return TypedResults.Redirect($"{siteUrl}/purchase-callback?refid=0&paymentStatus=false&factorNumber=0", true); } } diff --git a/Netina.Api/Controller/SearchController.cs b/Netina.Api/Controller/SearchController.cs index ca37a04..61c92a1 100644 --- a/Netina.Api/Controller/SearchController.cs +++ b/Netina.Api/Controller/SearchController.cs @@ -11,8 +11,25 @@ public class SearchController : ICarterModule group.MapGet("", SearchAsync) .WithDisplayName("Search Async") .HasApiVersion(1.0); + + group.MapGet("zarehbin", ZarehbinAsync) + .WithDisplayName("Search Async") + .HasApiVersion(1.0); } private async Task SearchAsync([FromQuery] string name, [FromServices] ISearchService searchService, CancellationToken cancellationToken) => TypedResults.Ok(await searchService.SearchAsync(name, cancellationToken)); + + private async Task ZarehbinAsync([FromQuery] string? product_id, [FromQuery] int? page, [FromServices] ISearchService searchService, CancellationToken cancellationToken) + { + if (product_id == null) + { + if (page == null) + return TypedResults.Ok(await searchService.ZarehbinAsync(0, cancellationToken)); + else + return TypedResults.Ok(await searchService.ZarehbinAsync(page.Value, cancellationToken)); + } + else + return TypedResults.Ok(await searchService.ZarehbinAsync(Guid.Parse(product_id), cancellationToken)); + } } \ No newline at end of file diff --git a/Netina.Api/Netina.Api.csproj b/Netina.Api/Netina.Api.csproj index d734689..76c107a 100644 --- a/Netina.Api/Netina.Api.csproj +++ b/Netina.Api/Netina.Api.csproj @@ -6,8 +6,8 @@ enable true Linux - 0.22.25.43 - 0.22.25.43 + 0.22.25.44 + 0.22.25.44 diff --git a/Netina.Api/Program.cs b/Netina.Api/Program.cs index ee51792..70e76bd 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.Core/CoreServices/Abstracts/ISearchService.cs b/Netina.Core/CoreServices/Abstracts/ISearchService.cs index 62aeb4c..195275b 100644 --- a/Netina.Core/CoreServices/Abstracts/ISearchService.cs +++ b/Netina.Core/CoreServices/Abstracts/ISearchService.cs @@ -1,9 +1,10 @@ -using Netina.Common.Models; -using Netina.Domain.Dtos.ResponseDtos; +using Netina.Domain.Dtos.ResponseDtos.Zarehbin; namespace Netina.Core.CoreServices.Abstracts; public interface ISearchService : IScopedDependency { public Task SearchAsync(string name,CancellationToken cancellationToken = default); + public Task ZarehbinAsync(int page,CancellationToken cancellationToken = default); + public Task ZarehbinAsync(Guid productId,CancellationToken cancellationToken = default); } \ No newline at end of file diff --git a/Netina.Core/CoreServices/SearchService.cs b/Netina.Core/CoreServices/SearchService.cs index 6ed4643..920a522 100644 --- a/Netina.Core/CoreServices/SearchService.cs +++ b/Netina.Core/CoreServices/SearchService.cs @@ -1,8 +1,5 @@ -using Netina.Core.CoreServices.Abstracts; -using Netina.Domain.Dtos.ResponseDtos; +using Netina.Domain.Dtos.ResponseDtos.Zarehbin; using Netina.Domain.Entities.ProductCategories; -using Netina.Domain.Entities.Products; -using Netina.Repository.Repositories.Base.Contracts; namespace Netina.Core.CoreServices; @@ -34,4 +31,14 @@ public class SearchService : ISearchService Categories = categories.Select(c => c.Adapt()).ToList() }; } + + public Task ZarehbinAsync(int page, CancellationToken cancellationToken = default) + { + throw new NotImplementedException(); + } + + public Task ZarehbinAsync(Guid productId, CancellationToken cancellationToken = default) + { + throw new NotImplementedException(); + } } \ No newline at end of file diff --git a/Netina.Core/EntityServices/OrderHandlers/GetOrderInvoiceCommandHandler.cs b/Netina.Core/EntityServices/OrderHandlers/GetOrderInvoiceCommandHandler.cs index 02e1232..579b8af 100644 --- a/Netina.Core/EntityServices/OrderHandlers/GetOrderInvoiceCommandHandler.cs +++ b/Netina.Core/EntityServices/OrderHandlers/GetOrderInvoiceCommandHandler.cs @@ -104,11 +104,11 @@ public class GetOrderInvoiceCommandHandler : IRequestHandler { public string FactorCode { get; set; } = string.Empty; @@ -24,8 +19,8 @@ public class OrderLDto : BaseDto public string DiscountCode { get; set; } = string.Empty; public long TotalPriceWithoutDiscount => TotalPrice + DiscountPrice; - public string UserFullName { get; set; } = string.Empty; - public string UserPhoneNumber { get; set; } = string.Empty; + public string CustomerFullName { get; set; } = string.Empty; + public string CustomerPhoneNumber { get; set; } = string.Empty; public List OrderProducts { get; set; } = new(); diff --git a/Netina.Domain/Dtos/ResponseDtos/Zarehbin/ZarehbinPagedResponseDto.cs b/Netina.Domain/Dtos/ResponseDtos/Zarehbin/ZarehbinPagedResponseDto.cs new file mode 100644 index 0000000..f8eab50 --- /dev/null +++ b/Netina.Domain/Dtos/ResponseDtos/Zarehbin/ZarehbinPagedResponseDto.cs @@ -0,0 +1,26 @@ +namespace Netina.Domain.Dtos.ResponseDtos.Zarehbin; + +public class ZarehbinPagedResponseDto +{ + public int count { get; set; } + public int total_pages_count { get; set; } + public List products { get; set; } = new(); +} + +public class ZarehbinProductResponseDto +{ + public string title { get; set; } = string.Empty; + public string subtitle { get; set; } = string.Empty; + public string id { get; set; } = string.Empty; + public string current_price { get; set; } = string.Empty; + public string old_price { get; set; } = string.Empty; + public string availability { get; set; } = string.Empty; + public List categories { get; set; } = new(); + public string image_link { get; set; } = string.Empty; + public List image_links { get; set; } = new(); + public string page_url { get; set; } = string.Empty; + public string short_desc { get; set; } = string.Empty; + public List> spec { get; set; } = new(); + public string registry { get; set; } = string.Empty; + public string guarantee { get; set; } = string.Empty; +} \ No newline at end of file diff --git a/Netina.Domain/Entities/Discounts/Discount.Aggregate.cs b/Netina.Domain/Entities/Discounts/Discount.Aggregate.cs index 10f3176..6106c47 100644 --- a/Netina.Domain/Entities/Discounts/Discount.Aggregate.cs +++ b/Netina.Domain/Entities/Discounts/Discount.Aggregate.cs @@ -34,10 +34,10 @@ public partial class Discount public bool IsExpired() => !Immortal && ExpireDate.Date < DateTime.Today.Date; - public void SetCorporate(Guid userId) + public void SetCorporate(Guid marketerId) { IsForSaleCooperation = true; - CorporateUserId = userId; + MarketerId = marketerId; } } diff --git a/Netina.Domain/Entities/Discounts/Discount.cs b/Netina.Domain/Entities/Discounts/Discount.cs index 5d270c4..2ecd27b 100644 --- a/Netina.Domain/Entities/Discounts/Discount.cs +++ b/Netina.Domain/Entities/Discounts/Discount.cs @@ -82,8 +82,8 @@ public partial class Discount : ApiEntity public bool IsForFirstPurchase { get; internal set; } - public Guid? CorporateUserId { get; internal set; } - public ApplicationUser? CorporateUser { get; internal set; } + public Guid? MarketerId { get; internal set; } + public Marketer? Marketer { get; internal set; } public List Orders { get; internal set; } = new(); } \ No newline at end of file diff --git a/Netina.Domain/Entities/Users/Marketer.cs b/Netina.Domain/Entities/Users/Marketer.cs index 1c6ceda..ac23542 100644 --- a/Netina.Domain/Entities/Users/Marketer.cs +++ b/Netina.Domain/Entities/Users/Marketer.cs @@ -1,6 +1,4 @@ -using Netina.Common.Models.Entity; - -namespace Netina.Domain.Entities.Users; +namespace Netina.Domain.Entities.Users; [AdaptTwoWays("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Map | MapType.MapToTarget)] [AdaptTo("[name]SDto", IgnoreAttributes = new[] { typeof(AdaptIgnoreAttribute) }, MapType = MapType.Projection)] @@ -9,6 +7,10 @@ public class Marketer : ApiEntity { public string FatherName { get; set; } = string.Empty; public string Shaba { get; set; } = string.Empty; + public DateTime LastSettlement { get; set; } + public Guid UserId { get; set; } public ApplicationUser? User { get; set; } + + public Discount? Discount { get; set; } } \ No newline at end of file diff --git a/Netina.Domain/Mappers/OrderMapper.g.cs b/Netina.Domain/Mappers/OrderMapper.g.cs index e0fbfaa..d3234ac 100644 --- a/Netina.Domain/Mappers/OrderMapper.g.cs +++ b/Netina.Domain/Mappers/OrderMapper.g.cs @@ -178,6 +178,8 @@ namespace Netina.Domain.Mappers OrderAt = p19.OrderAt, PreparingMinute = p19.PreparingMinute, DiscountCode = p19.DiscountCode, + CustomerFullName = p19.Customer != null && p19.Customer.User != null ? p19.Customer.User.FirstName + " " + p19.Customer.User.LastName : string.Empty, + CustomerPhoneNumber = p19.Customer != null && p19.Customer.User != null ? p19.Customer.User.PhoneNumber : string.Empty, OrderProducts = funcMain8(p19.OrderProducts), Payments = funcMain9(p19.Payments), OrderDelivery = p19.OrderDelivery == null ? null : new OrderDeliverySDto() @@ -228,6 +230,8 @@ namespace Netina.Domain.Mappers result.OrderAt = p22.OrderAt; result.PreparingMinute = p22.PreparingMinute; result.DiscountCode = p22.DiscountCode; + result.CustomerFullName = p22.Customer != null && p22.Customer.User != null ? p22.Customer.User.FirstName + " " + p22.Customer.User.LastName : string.Empty; + result.CustomerPhoneNumber = p22.Customer != null && p22.Customer.User != null ? p22.Customer.User.PhoneNumber : string.Empty; result.OrderProducts = funcMain10(p22.OrderProducts, result.OrderProducts); result.Payments = funcMain11(p22.Payments, result.Payments); result.OrderDelivery = funcMain12(p22.OrderDelivery, result.OrderDelivery); @@ -254,6 +258,8 @@ namespace Netina.Domain.Mappers OrderAt = p30.OrderAt, PreparingMinute = p30.PreparingMinute, DiscountCode = p30.DiscountCode, + CustomerFullName = p30.Customer != null && p30.Customer.User != null ? p30.Customer.User.FirstName + " " + p30.Customer.User.LastName : string.Empty, + CustomerPhoneNumber = p30.Customer != null && p30.Customer.User != null ? p30.Customer.User.PhoneNumber : string.Empty, OrderProducts = p30.OrderProducts.Select(p31 => new OrderProductSDto() { Count = p31.Count, diff --git a/Netina.Domain/MartenEntities/Settings/MarketerSetting.cs b/Netina.Domain/MartenEntities/Settings/MarketerSetting.cs new file mode 100644 index 0000000..5f05cb9 --- /dev/null +++ b/Netina.Domain/MartenEntities/Settings/MarketerSetting.cs @@ -0,0 +1,7 @@ +namespace Netina.Domain.MartenEntities.Settings; + +public class MarketerSetting +{ + public int ProfitPercent { get; set; } + public string ContractTerms { get; set; } = string.Empty; +} \ No newline at end of file diff --git a/Netina.Repository/Handlers/Discounts/CreateSaleCooperationDiscountHandler.cs b/Netina.Repository/Handlers/Discounts/CreateSaleCooperationDiscountHandler.cs index 34ad05b..a661311 100644 --- a/Netina.Repository/Handlers/Discounts/CreateSaleCooperationDiscountHandler.cs +++ b/Netina.Repository/Handlers/Discounts/CreateSaleCooperationDiscountHandler.cs @@ -1,13 +1,4 @@ using Microsoft.EntityFrameworkCore; -using Netina.Common.Extensions; -using Netina.Common.Models.Api; -using Netina.Common.Models.Exception; -using Netina.Domain.CommandQueries.Commands; -using Netina.Domain.Entities.Discounts; -using Netina.Domain.Entities.Users; -using Netina.Domain.Enums; -using Netina.Repository.Abstracts; -using Netina.Repository.Repositories.Base.Contracts; namespace Netina.Repository.Handlers.Discounts; @@ -33,20 +24,27 @@ public class CreateSaleCooperationDiscountHandler : IRequestHandler() + .TableNoTracking + .FirstOrDefaultAsync(m => m.UserId == user.Id, cancellationToken); + + if (marketer == null) + throw new AppException("Marketer not found", ApiResultStatusCode.NotFound); + var foundedDiscount = await _repositoryWrapper.SetRepository() .TableNoTracking - .FirstOrDefaultAsync(d => d.IsForSaleCooperation && d.CorporateUserId == userId, cancellationToken); + .FirstOrDefaultAsync(d => d.IsForSaleCooperation && d.MarketerId == marketer.Id, cancellationToken); if (foundedDiscount == null) { var code = StringExtensions.GetId(); foundedDiscount = Discount.Create(code,$"کد مخصوص همکاری در فروش برای کاربر - {user.FirstName} {user.LastName}", 10, 0, true, DiscountAmountType.Percent, DiscountType.All, 0, true, DateTime.Today, DateTime.Today.AddYears(10), 0, false, 0, false, true, 0, false, false,false); - foundedDiscount.SetCorporate(userId); + foundedDiscount.SetCorporate(marketer.Id); _repositoryWrapper.SetRepository().Add(foundedDiscount); await _repositoryWrapper.SaveChangesAsync(cancellationToken); diff --git a/Netina.Repository/Migrations/20240418115609_EditDiscountAndMarketer.Designer.cs b/Netina.Repository/Migrations/20240418115609_EditDiscountAndMarketer.Designer.cs new file mode 100644 index 0000000..3721137 --- /dev/null +++ b/Netina.Repository/Migrations/20240418115609_EditDiscountAndMarketer.Designer.cs @@ -0,0 +1,2005 @@ +// +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("20240418115609_EditDiscountAndMarketer")] + partial class EditDiscountAndMarketer + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("public") + .HasAnnotation("ProductVersion", "8.0.3") + .HasAnnotation("Relational:MaxIdentifierLength", 63); + + NpgsqlModelBuilderExtensions.UseIdentityByDefaultColumns(modelBuilder); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("RoleId"); + + b.ToTable("RoleClaims", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("integer"); + + NpgsqlPropertyBuilderExtensions.UseIdentityByDefaultColumn(b.Property("Id")); + + b.Property("ClaimType") + .HasColumnType("text"); + + b.Property("ClaimValue") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("Id"); + + b.HasIndex("UserId"); + + b.ToTable("Claims", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => + { + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("ProviderKey") + .HasColumnType("text"); + + b.Property("ProviderDisplayName") + .HasColumnType("text"); + + b.Property("UserId") + .HasColumnType("uuid"); + + b.HasKey("LoginProvider", "ProviderKey"); + + b.HasIndex("UserId"); + + b.ToTable("Logins", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("RoleId") + .HasColumnType("uuid"); + + b.HasKey("UserId", "RoleId"); + + b.HasIndex("RoleId"); + + b.ToTable("UserRoles", "public"); + }); + + modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => + { + b.Property("UserId") + .HasColumnType("uuid"); + + b.Property("LoginProvider") + .HasColumnType("text"); + + b.Property("Name") + .HasColumnType("text"); + + b.Property("Value") + .HasColumnType("text"); + + b.HasKey("UserId", "LoginProvider", "Name"); + + b.ToTable("Tokens", "public"); + }); + + modelBuilder.Entity("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("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.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.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.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("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/20240418115609_EditDiscountAndMarketer.cs b/Netina.Repository/Migrations/20240418115609_EditDiscountAndMarketer.cs new file mode 100644 index 0000000..a753566 --- /dev/null +++ b/Netina.Repository/Migrations/20240418115609_EditDiscountAndMarketer.cs @@ -0,0 +1,1295 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace NetinaShop.Repository.Migrations +{ + /// + public partial class EditDiscountAndMarketer : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Discounts_Users_CorporateUserId", + schema: "public", + table: "Discounts"); + + migrationBuilder.DropIndex( + name: "IX_Discounts_CorporateUserId", + schema: "public", + table: "Discounts"); + + migrationBuilder.RenameColumn( + name: "CorporateUserId", + schema: "public", + table: "Discounts", + newName: "MarketerId"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "UserFavoriteProducts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "UserFavoriteProducts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "UserFavoriteProducts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "UserAddresses", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "UserAddresses", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "UserAddresses", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "StorageFiles", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "StorageFiles", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "StorageFiles", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Specifications", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Specifications", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Specifications", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Shippings", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Shippings", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Shippings", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Reviews", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Reviews", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Reviews", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Products", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Products", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Products", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "ProductCategories", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "ProductCategories", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "ProductCategories", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Payments", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Payments", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Payments", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Orders", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Orders", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Orders", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "OrderProducts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "OrderProducts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "OrderProducts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "OrderDeliveries", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "OrderDeliveries", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "OrderDeliveries", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "NewsletterMembers", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "NewsletterMembers", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "NewsletterMembers", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Marketers", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Marketers", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Marketers", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AddColumn( + name: "LastSettlement", + schema: "public", + table: "Marketers", + type: "timestamp without time zone", + nullable: false, + defaultValue: new DateTime(1, 1, 1, 0, 0, 0, 0, DateTimeKind.Unspecified)); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Managers", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Managers", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Managers", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Discounts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Discounts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Discounts", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Customers", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Customers", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Customers", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Brands", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Brands", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Brands", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Blogs", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Blogs", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Blogs", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "BlogCategories", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "BlogCategories", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "BlogCategories", + type: "text", + nullable: false, + defaultValue: "", + oldClrType: typeof(string), + oldType: "text", + oldNullable: true); + + migrationBuilder.CreateIndex( + name: "IX_Discounts_MarketerId", + schema: "public", + table: "Discounts", + column: "MarketerId", + unique: true); + + migrationBuilder.AddForeignKey( + name: "FK_Discounts_Marketers_MarketerId", + schema: "public", + table: "Discounts", + column: "MarketerId", + principalSchema: "public", + principalTable: "Marketers", + principalColumn: "Id"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropForeignKey( + name: "FK_Discounts_Marketers_MarketerId", + schema: "public", + table: "Discounts"); + + migrationBuilder.DropIndex( + name: "IX_Discounts_MarketerId", + schema: "public", + table: "Discounts"); + + migrationBuilder.DropColumn( + name: "LastSettlement", + schema: "public", + table: "Marketers"); + + migrationBuilder.RenameColumn( + name: "MarketerId", + schema: "public", + table: "Discounts", + newName: "CorporateUserId"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "UserFavoriteProducts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "UserFavoriteProducts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "UserFavoriteProducts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "UserAddresses", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "UserAddresses", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "UserAddresses", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "StorageFiles", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "StorageFiles", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "StorageFiles", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Specifications", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Specifications", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Specifications", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Shippings", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Shippings", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Shippings", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Reviews", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Reviews", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Reviews", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Products", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Products", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Products", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "ProductCategories", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "ProductCategories", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "ProductCategories", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Payments", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Payments", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Payments", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Orders", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Orders", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Orders", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "OrderProducts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "OrderProducts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "OrderProducts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "OrderDeliveries", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "OrderDeliveries", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "OrderDeliveries", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "NewsletterMembers", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "NewsletterMembers", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "NewsletterMembers", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Marketers", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Marketers", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Marketers", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Managers", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Managers", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Managers", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Discounts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Discounts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Discounts", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Customers", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Customers", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Customers", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Brands", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Brands", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Brands", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "Blogs", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "Blogs", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "Blogs", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "RemovedBy", + schema: "public", + table: "BlogCategories", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "ModifiedBy", + schema: "public", + table: "BlogCategories", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.AlterColumn( + name: "CreatedBy", + schema: "public", + table: "BlogCategories", + type: "text", + nullable: true, + oldClrType: typeof(string), + oldType: "text"); + + migrationBuilder.CreateIndex( + name: "IX_Discounts_CorporateUserId", + schema: "public", + table: "Discounts", + column: "CorporateUserId"); + + migrationBuilder.AddForeignKey( + name: "FK_Discounts_Users_CorporateUserId", + schema: "public", + table: "Discounts", + column: "CorporateUserId", + principalSchema: "public", + principalTable: "Users", + principalColumn: "Id"); + } + } +} diff --git a/Netina.Repository/Migrations/ApplicationContextModelSnapshot.cs b/Netina.Repository/Migrations/ApplicationContextModelSnapshot.cs index f78b991..05d2438 100644 --- a/Netina.Repository/Migrations/ApplicationContextModelSnapshot.cs +++ b/Netina.Repository/Migrations/ApplicationContextModelSnapshot.cs @@ -126,7 +126,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("Tokens", "public"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Accounting.Payment", b => + modelBuilder.Entity("Netina.Domain.Entities.Accounting.Payment", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -147,6 +147,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("CustomerId") @@ -167,6 +168,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("OrderId") @@ -176,6 +178,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("Status") @@ -197,7 +200,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("Payments", "public"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.Blog", b => + modelBuilder.Entity("Netina.Domain.Entities.Blogs.Blog", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -214,6 +217,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("IsRemoved") @@ -226,6 +230,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("ReadingTime") @@ -235,6 +240,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("Summery") @@ -256,7 +262,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("Blogs", "public"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.BlogCategory", b => + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogCategory", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -266,6 +272,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("Description") @@ -279,6 +286,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("Name") @@ -289,6 +297,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.HasKey("Id"); @@ -296,7 +305,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("BlogCategories", "public"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Brands.Brand", b => + modelBuilder.Entity("Netina.Domain.Entities.Brands.Brand", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -306,6 +315,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("Description") @@ -326,6 +336,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("PageUrl") @@ -340,6 +351,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.HasKey("Id"); @@ -347,7 +359,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("Brands", "public"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.Discount", b => + modelBuilder.Entity("Netina.Domain.Entities.Discounts.Discount", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -360,9 +372,6 @@ namespace NetinaShop.Repository.Migrations .IsRequired() .HasColumnType("text"); - b.Property("CorporateUserId") - .HasColumnType("uuid"); - b.Property("Count") .HasColumnType("integer"); @@ -370,6 +379,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("Description") @@ -420,10 +430,14 @@ namespace NetinaShop.Repository.Migrations 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") @@ -436,6 +450,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("StartDate") @@ -449,7 +464,8 @@ namespace NetinaShop.Repository.Migrations b.HasKey("Id"); - b.HasIndex("CorporateUserId"); + b.HasIndex("MarketerId") + .IsUnique(); b.ToTable("Discounts", "public"); @@ -458,7 +474,7 @@ namespace NetinaShop.Repository.Migrations b.UseTphMappingStrategy(); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.Order", b => + modelBuilder.Entity("Netina.Domain.Entities.Orders.Order", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -468,6 +484,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("CustomerId") @@ -509,6 +526,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("OrderAt") @@ -536,6 +554,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("ServicePrice") @@ -559,7 +578,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("Orders", "public"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.OrderDelivery", b => + modelBuilder.Entity("Netina.Domain.Entities.Orders.OrderDelivery", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -572,6 +591,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("DeliveryCost") @@ -584,6 +604,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("OrderId") @@ -593,6 +614,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("ShippingId") @@ -614,7 +636,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("OrderDeliveries", "public"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.OrderProduct", b => + modelBuilder.Entity("Netina.Domain.Entities.Orders.OrderProduct", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -627,6 +649,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("HasDiscount") @@ -639,6 +662,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("OrderId") @@ -672,6 +696,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.HasKey("Id"); @@ -683,7 +708,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("OrderProducts", "public"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", b => + modelBuilder.Entity("Netina.Domain.Entities.ProductCategories.ProductCategory", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -693,6 +718,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("Description") @@ -709,6 +735,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("Name") @@ -722,6 +749,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.HasKey("Id"); @@ -731,7 +759,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("ProductCategories", "public"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Product", b => + modelBuilder.Entity("Netina.Domain.Entities.Products.Product", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -753,6 +781,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("EnglishName") @@ -779,6 +808,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("PackingCost") @@ -795,6 +825,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("ReviewCount") @@ -827,7 +858,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("Products", "public"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Review", b => + modelBuilder.Entity("Netina.Domain.Entities.Products.Review", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -841,6 +872,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("IsBuyer") @@ -856,6 +888,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("ProductId") @@ -868,6 +901,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("Title") @@ -886,7 +920,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("Reviews", "public"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Specification", b => + modelBuilder.Entity("Netina.Domain.Entities.Products.Specification", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -896,6 +930,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("Detail") @@ -912,6 +947,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("ParentId") @@ -924,6 +960,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("Title") @@ -943,7 +980,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("Specifications", "public"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.StorageFiles.StorageFile", b => + modelBuilder.Entity("Netina.Domain.Entities.StorageFiles.StorageFile", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -953,6 +990,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("Discriminator") @@ -984,6 +1022,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("Name") @@ -994,6 +1033,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.HasKey("Id"); @@ -1005,7 +1045,7 @@ namespace NetinaShop.Repository.Migrations b.UseTphMappingStrategy(); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.ApplicationRole", b => + modelBuilder.Entity("Netina.Domain.Entities.Users.ApplicationRole", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -1044,7 +1084,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("Roles", "public"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.ApplicationUser", b => + modelBuilder.Entity("Netina.Domain.Entities.Users.ApplicationUser", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -1130,7 +1170,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("Users", "public"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.Customer", b => + modelBuilder.Entity("Netina.Domain.Entities.Users.Customer", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -1140,6 +1180,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("IsRemoved") @@ -1149,12 +1190,14 @@ namespace NetinaShop.Repository.Migrations .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") @@ -1168,7 +1211,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("Customers", "public"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.Manager", b => + modelBuilder.Entity("Netina.Domain.Entities.Users.Manager", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -1178,6 +1221,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("IsRemoved") @@ -1190,12 +1234,14 @@ namespace NetinaShop.Repository.Migrations .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") @@ -1209,7 +1255,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("Managers", "public"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.Marketer", b => + modelBuilder.Entity("Netina.Domain.Entities.Users.Marketer", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -1219,6 +1265,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("FatherName") @@ -1228,16 +1275,21 @@ namespace NetinaShop.Repository.Migrations 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") @@ -1255,7 +1307,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("Marketers", "public"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.NewsletterMember", b => + modelBuilder.Entity("Netina.Domain.Entities.Users.NewsletterMember", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -1265,6 +1317,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("Email") @@ -1278,6 +1331,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("PhoneNumber") @@ -1288,6 +1342,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.HasKey("Id"); @@ -1295,7 +1350,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("NewsletterMembers", "public"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.UserAddress", b => + modelBuilder.Entity("Netina.Domain.Entities.Users.UserAddress", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -1317,6 +1372,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("CustomerId") @@ -1335,6 +1391,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("Plaque") @@ -1361,6 +1418,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("UserId") @@ -1375,7 +1433,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("UserAddresses", "public"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.UserFavoriteProduct", b => + modelBuilder.Entity("Netina.Domain.Entities.Users.UserFavoriteProduct", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -1385,6 +1443,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("IsRemoved") @@ -1394,6 +1453,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("ProductId") @@ -1403,6 +1463,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("UserId") @@ -1417,7 +1478,7 @@ namespace NetinaShop.Repository.Migrations b.ToTable("UserFavoriteProducts", "public"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Warehouses.Shipping", b => + modelBuilder.Entity("Netina.Domain.Entities.Warehouses.Shipping", b => { b.Property("Id") .ValueGeneratedOnAdd() @@ -1427,6 +1488,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("CreatedBy") + .IsRequired() .HasColumnType("text"); b.Property("DeliveryCost") @@ -1448,6 +1510,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("ModifiedBy") + .IsRequired() .HasColumnType("text"); b.Property("Name") @@ -1458,6 +1521,7 @@ namespace NetinaShop.Repository.Migrations .HasColumnType("timestamp without time zone"); b.Property("RemovedBy") + .IsRequired() .HasColumnType("text"); b.Property("WarehouseName") @@ -1472,9 +1536,9 @@ namespace NetinaShop.Repository.Migrations b.ToTable("Shippings", "public"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.CategoryDiscount", b => + modelBuilder.Entity("Netina.Domain.Entities.Discounts.CategoryDiscount", b => { - b.HasBaseType("NetinaShop.Domain.Entities.Discounts.Discount"); + b.HasBaseType("Netina.Domain.Entities.Discounts.Discount"); b.Property("CategoryId") .HasColumnType("uuid"); @@ -1484,9 +1548,9 @@ namespace NetinaShop.Repository.Migrations b.HasDiscriminator().HasValue("CategoryDiscount"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.ProductDiscount", b => + modelBuilder.Entity("Netina.Domain.Entities.Discounts.ProductDiscount", b => { - b.HasBaseType("NetinaShop.Domain.Entities.Discounts.Discount"); + b.HasBaseType("Netina.Domain.Entities.Discounts.Discount"); b.Property("ProductId") .HasColumnType("uuid"); @@ -1496,9 +1560,9 @@ namespace NetinaShop.Repository.Migrations b.HasDiscriminator().HasValue("ProductDiscount"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.BlogStorageFile", b => + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogStorageFile", b => { - b.HasBaseType("NetinaShop.Domain.Entities.StorageFiles.StorageFile"); + b.HasBaseType("Netina.Domain.Entities.StorageFiles.StorageFile"); b.Property("BlogId") .HasColumnType("uuid"); @@ -1508,9 +1572,9 @@ namespace NetinaShop.Repository.Migrations b.HasDiscriminator().HasValue("BlogStorageFile"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Brands.BrandStorageFile", b => + modelBuilder.Entity("Netina.Domain.Entities.Brands.BrandStorageFile", b => { - b.HasBaseType("NetinaShop.Domain.Entities.StorageFiles.StorageFile"); + b.HasBaseType("Netina.Domain.Entities.StorageFiles.StorageFile"); b.Property("BrandId") .HasColumnType("uuid"); @@ -1520,9 +1584,9 @@ namespace NetinaShop.Repository.Migrations b.HasDiscriminator().HasValue("BrandStorageFile"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.ProductCategories.ProductCategoryStorageFile", b => + modelBuilder.Entity("Netina.Domain.Entities.ProductCategories.ProductCategoryStorageFile", b => { - b.HasBaseType("NetinaShop.Domain.Entities.StorageFiles.StorageFile"); + b.HasBaseType("Netina.Domain.Entities.StorageFiles.StorageFile"); b.Property("CategoryId") .HasColumnType("uuid"); @@ -1532,9 +1596,9 @@ namespace NetinaShop.Repository.Migrations b.HasDiscriminator().HasValue("ProductCategoryStorageFile"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Products.ProductStorageFile", b => + modelBuilder.Entity("Netina.Domain.Entities.Products.ProductStorageFile", b => { - b.HasBaseType("NetinaShop.Domain.Entities.StorageFiles.StorageFile"); + b.HasBaseType("Netina.Domain.Entities.StorageFiles.StorageFile"); b.Property("ProductId") .HasColumnType("uuid"); @@ -1546,7 +1610,7 @@ namespace NetinaShop.Repository.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityRoleClaim", b => { - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationRole", null) + b.HasOne("Netina.Domain.Entities.Users.ApplicationRole", null) .WithMany() .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Restrict); @@ -1554,7 +1618,7 @@ namespace NetinaShop.Repository.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserClaim", b => { - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Restrict); @@ -1562,7 +1626,7 @@ namespace NetinaShop.Repository.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserLogin", b => { - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Restrict); @@ -1570,12 +1634,12 @@ namespace NetinaShop.Repository.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserRole", b => { - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationRole", null) + b.HasOne("Netina.Domain.Entities.Users.ApplicationRole", null) .WithMany() .HasForeignKey("RoleId") .OnDelete(DeleteBehavior.Restrict); - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Restrict); @@ -1583,20 +1647,20 @@ namespace NetinaShop.Repository.Migrations modelBuilder.Entity("Microsoft.AspNetCore.Identity.IdentityUserToken", b => { - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", null) + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", null) .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Restrict); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Accounting.Payment", b => + modelBuilder.Entity("Netina.Domain.Entities.Accounting.Payment", b => { - b.HasOne("NetinaShop.Domain.Entities.Users.Customer", "Customer") + b.HasOne("Netina.Domain.Entities.Users.Customer", "Customer") .WithMany() .HasForeignKey("CustomerId") .OnDelete(DeleteBehavior.Restrict); - b.HasOne("NetinaShop.Domain.Entities.Orders.Order", "Order") + b.HasOne("Netina.Domain.Entities.Orders.Order", "Order") .WithMany("Payments") .HasForeignKey("OrderId") .OnDelete(DeleteBehavior.Restrict); @@ -1606,9 +1670,9 @@ namespace NetinaShop.Repository.Migrations b.Navigation("Order"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.Blog", b => + modelBuilder.Entity("Netina.Domain.Entities.Blogs.Blog", b => { - b.HasOne("NetinaShop.Domain.Entities.Blogs.BlogCategory", "Category") + b.HasOne("Netina.Domain.Entities.Blogs.BlogCategory", "Category") .WithMany("Blogs") .HasForeignKey("CategoryId") .OnDelete(DeleteBehavior.Restrict); @@ -1616,42 +1680,42 @@ namespace NetinaShop.Repository.Migrations b.Navigation("Category"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.Discount", b => + modelBuilder.Entity("Netina.Domain.Entities.Discounts.Discount", b => { - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "CorporateUser") - .WithMany() - .HasForeignKey("CorporateUserId"); + b.HasOne("Netina.Domain.Entities.Users.Marketer", "Marketer") + .WithOne("Discount") + .HasForeignKey("Netina.Domain.Entities.Discounts.Discount", "MarketerId"); - b.Navigation("CorporateUser"); + b.Navigation("Marketer"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.Order", b => + modelBuilder.Entity("Netina.Domain.Entities.Orders.Order", b => { - b.HasOne("NetinaShop.Domain.Entities.Users.Customer", "Customer") + b.HasOne("Netina.Domain.Entities.Users.Customer", "Customer") .WithMany() .HasForeignKey("CustomerId") .OnDelete(DeleteBehavior.Restrict); - b.HasOne("NetinaShop.Domain.Entities.Discounts.Discount", null) + b.HasOne("Netina.Domain.Entities.Discounts.Discount", null) .WithMany("Orders") .HasForeignKey("DiscountId"); b.Navigation("Customer"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.OrderDelivery", b => + modelBuilder.Entity("Netina.Domain.Entities.Orders.OrderDelivery", b => { - b.HasOne("NetinaShop.Domain.Entities.Users.UserAddress", "Address") + b.HasOne("Netina.Domain.Entities.Users.UserAddress", "Address") .WithMany() .HasForeignKey("AddressId") .OnDelete(DeleteBehavior.Restrict); - b.HasOne("NetinaShop.Domain.Entities.Orders.Order", "Order") + b.HasOne("Netina.Domain.Entities.Orders.Order", "Order") .WithOne("OrderDelivery") - .HasForeignKey("NetinaShop.Domain.Entities.Orders.OrderDelivery", "OrderId") + .HasForeignKey("Netina.Domain.Entities.Orders.OrderDelivery", "OrderId") .OnDelete(DeleteBehavior.Restrict); - b.HasOne("NetinaShop.Domain.Entities.Warehouses.Shipping", "Shipping") + b.HasOne("Netina.Domain.Entities.Warehouses.Shipping", "Shipping") .WithMany() .HasForeignKey("ShippingId") .OnDelete(DeleteBehavior.Restrict); @@ -1663,14 +1727,14 @@ namespace NetinaShop.Repository.Migrations b.Navigation("Shipping"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.OrderProduct", b => + modelBuilder.Entity("Netina.Domain.Entities.Orders.OrderProduct", b => { - b.HasOne("NetinaShop.Domain.Entities.Orders.Order", "Order") + b.HasOne("Netina.Domain.Entities.Orders.Order", "Order") .WithMany("OrderProducts") .HasForeignKey("OrderId") .OnDelete(DeleteBehavior.Restrict); - b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") .WithMany("OrderProducts") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Restrict); @@ -1680,23 +1744,23 @@ namespace NetinaShop.Repository.Migrations b.Navigation("Product"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", b => + modelBuilder.Entity("Netina.Domain.Entities.ProductCategories.ProductCategory", b => { - b.HasOne("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", "Parent") + b.HasOne("Netina.Domain.Entities.ProductCategories.ProductCategory", "Parent") .WithMany() .HasForeignKey("ParentId"); b.Navigation("Parent"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Product", b => + modelBuilder.Entity("Netina.Domain.Entities.Products.Product", b => { - b.HasOne("NetinaShop.Domain.Entities.Brands.Brand", "Brand") + b.HasOne("Netina.Domain.Entities.Brands.Brand", "Brand") .WithMany("Products") .HasForeignKey("BrandId") .OnDelete(DeleteBehavior.Restrict); - b.HasOne("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", "Category") + b.HasOne("Netina.Domain.Entities.ProductCategories.ProductCategory", "Category") .WithMany("Products") .HasForeignKey("CategoryId") .OnDelete(DeleteBehavior.Restrict); @@ -1706,14 +1770,14 @@ namespace NetinaShop.Repository.Migrations b.Navigation("Category"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Review", b => + modelBuilder.Entity("Netina.Domain.Entities.Products.Review", b => { - b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") .WithMany("Reviews") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Restrict); - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Restrict); @@ -1723,13 +1787,13 @@ namespace NetinaShop.Repository.Migrations b.Navigation("User"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Specification", b => + modelBuilder.Entity("Netina.Domain.Entities.Products.Specification", b => { - b.HasOne("NetinaShop.Domain.Entities.Products.Specification", "Parent") + b.HasOne("Netina.Domain.Entities.Products.Specification", "Parent") .WithMany("Children") .HasForeignKey("ParentId"); - b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") .WithMany("Specifications") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Restrict); @@ -1739,43 +1803,43 @@ namespace NetinaShop.Repository.Migrations b.Navigation("Product"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.Customer", b => + modelBuilder.Entity("Netina.Domain.Entities.Users.Customer", b => { - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") .WithOne("Customer") - .HasForeignKey("NetinaShop.Domain.Entities.Users.Customer", "UserId") + .HasForeignKey("Netina.Domain.Entities.Users.Customer", "UserId") .OnDelete(DeleteBehavior.Restrict); b.Navigation("User"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.Manager", b => + modelBuilder.Entity("Netina.Domain.Entities.Users.Manager", b => { - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") .WithOne("Manager") - .HasForeignKey("NetinaShop.Domain.Entities.Users.Manager", "UserId") + .HasForeignKey("Netina.Domain.Entities.Users.Manager", "UserId") .OnDelete(DeleteBehavior.Restrict); b.Navigation("User"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.Marketer", b => + modelBuilder.Entity("Netina.Domain.Entities.Users.Marketer", b => { - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") .WithOne("Marketer") - .HasForeignKey("NetinaShop.Domain.Entities.Users.Marketer", "UserId") + .HasForeignKey("Netina.Domain.Entities.Users.Marketer", "UserId") .OnDelete(DeleteBehavior.Restrict); b.Navigation("User"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.UserAddress", b => + modelBuilder.Entity("Netina.Domain.Entities.Users.UserAddress", b => { - b.HasOne("NetinaShop.Domain.Entities.Users.Customer", null) + b.HasOne("Netina.Domain.Entities.Users.Customer", null) .WithMany("Addresses") .HasForeignKey("CustomerId"); - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Restrict); @@ -1783,14 +1847,14 @@ namespace NetinaShop.Repository.Migrations b.Navigation("User"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.UserFavoriteProduct", b => + modelBuilder.Entity("Netina.Domain.Entities.Users.UserFavoriteProduct", b => { - b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") .WithMany() .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Restrict); - b.HasOne("NetinaShop.Domain.Entities.Users.ApplicationUser", "User") + b.HasOne("Netina.Domain.Entities.Users.ApplicationUser", "User") .WithMany() .HasForeignKey("UserId") .OnDelete(DeleteBehavior.Restrict); @@ -1800,9 +1864,9 @@ namespace NetinaShop.Repository.Migrations b.Navigation("User"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.CategoryDiscount", b => + modelBuilder.Entity("Netina.Domain.Entities.Discounts.CategoryDiscount", b => { - b.HasOne("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", "Category") + b.HasOne("Netina.Domain.Entities.ProductCategories.ProductCategory", "Category") .WithMany() .HasForeignKey("CategoryId") .OnDelete(DeleteBehavior.Restrict); @@ -1810,9 +1874,9 @@ namespace NetinaShop.Repository.Migrations b.Navigation("Category"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.ProductDiscount", b => + modelBuilder.Entity("Netina.Domain.Entities.Discounts.ProductDiscount", b => { - b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") .WithMany() .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Restrict); @@ -1820,9 +1884,9 @@ namespace NetinaShop.Repository.Migrations b.Navigation("Product"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.BlogStorageFile", b => + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogStorageFile", b => { - b.HasOne("NetinaShop.Domain.Entities.Blogs.Blog", "Blog") + b.HasOne("Netina.Domain.Entities.Blogs.Blog", "Blog") .WithMany("Files") .HasForeignKey("BlogId") .OnDelete(DeleteBehavior.Restrict); @@ -1830,9 +1894,9 @@ namespace NetinaShop.Repository.Migrations b.Navigation("Blog"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Brands.BrandStorageFile", b => + modelBuilder.Entity("Netina.Domain.Entities.Brands.BrandStorageFile", b => { - b.HasOne("NetinaShop.Domain.Entities.Brands.Brand", "Brand") + b.HasOne("Netina.Domain.Entities.Brands.Brand", "Brand") .WithMany("Files") .HasForeignKey("BrandId") .OnDelete(DeleteBehavior.Restrict); @@ -1840,9 +1904,9 @@ namespace NetinaShop.Repository.Migrations b.Navigation("Brand"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.ProductCategories.ProductCategoryStorageFile", b => + modelBuilder.Entity("Netina.Domain.Entities.ProductCategories.ProductCategoryStorageFile", b => { - b.HasOne("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", "Category") + b.HasOne("Netina.Domain.Entities.ProductCategories.ProductCategory", "Category") .WithMany("Files") .HasForeignKey("CategoryId") .OnDelete(DeleteBehavior.Restrict); @@ -1850,9 +1914,9 @@ namespace NetinaShop.Repository.Migrations b.Navigation("Category"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Products.ProductStorageFile", b => + modelBuilder.Entity("Netina.Domain.Entities.Products.ProductStorageFile", b => { - b.HasOne("NetinaShop.Domain.Entities.Products.Product", "Product") + b.HasOne("Netina.Domain.Entities.Products.Product", "Product") .WithMany("Files") .HasForeignKey("ProductId") .OnDelete(DeleteBehavior.Restrict); @@ -1860,29 +1924,29 @@ namespace NetinaShop.Repository.Migrations b.Navigation("Product"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.Blog", b => + modelBuilder.Entity("Netina.Domain.Entities.Blogs.Blog", b => { b.Navigation("Files"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Blogs.BlogCategory", b => + modelBuilder.Entity("Netina.Domain.Entities.Blogs.BlogCategory", b => { b.Navigation("Blogs"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Brands.Brand", b => + modelBuilder.Entity("Netina.Domain.Entities.Brands.Brand", b => { b.Navigation("Files"); b.Navigation("Products"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Discounts.Discount", b => + modelBuilder.Entity("Netina.Domain.Entities.Discounts.Discount", b => { b.Navigation("Orders"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Orders.Order", b => + modelBuilder.Entity("Netina.Domain.Entities.Orders.Order", b => { b.Navigation("OrderDelivery"); @@ -1891,14 +1955,14 @@ namespace NetinaShop.Repository.Migrations b.Navigation("Payments"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.ProductCategories.ProductCategory", b => + modelBuilder.Entity("Netina.Domain.Entities.ProductCategories.ProductCategory", b => { b.Navigation("Files"); b.Navigation("Products"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Product", b => + modelBuilder.Entity("Netina.Domain.Entities.Products.Product", b => { b.Navigation("Files"); @@ -1909,12 +1973,12 @@ namespace NetinaShop.Repository.Migrations b.Navigation("Specifications"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Products.Specification", b => + modelBuilder.Entity("Netina.Domain.Entities.Products.Specification", b => { b.Navigation("Children"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.ApplicationUser", b => + modelBuilder.Entity("Netina.Domain.Entities.Users.ApplicationUser", b => { b.Navigation("Customer"); @@ -1923,10 +1987,15 @@ namespace NetinaShop.Repository.Migrations b.Navigation("Marketer"); }); - modelBuilder.Entity("NetinaShop.Domain.Entities.Users.Customer", b => + 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/Models/ApplicationContext.cs b/Netina.Repository/Models/ApplicationContext.cs index 5d67b60..0e3e81b 100644 --- a/Netina.Repository/Models/ApplicationContext.cs +++ b/Netina.Repository/Models/ApplicationContext.cs @@ -40,9 +40,9 @@ public class ApplicationContext : IdentityDbContext().ToTable("Users"); builder.Entity().ToTable("Roles"); + builder.Entity>().ToTable("RoleClaims"); builder.Entity>().ToTable("UserRoles"); builder.Entity>().ToTable("Claims");