From cb0dcf02b789b5b8b70e4e78777ffdef8551df32 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=ABl=20Mugnier?= Date: Sat, 7 Nov 2020 13:09:13 +0100 Subject: [PATCH] =?UTF-8?q?New=20-=20Ajout=20d'une=20condition=20pour=20v?= =?UTF-8?q?=C3=A9rifier=20si=20les=20documents=20l=C3=A9gaux=20sont=20requ?= =?UTF-8?q?is=20ou=20non=20(150=E2=82=AC/mois)=20de=20CA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../EnsureDeclarationIsValidatedCommand.cs | 2 +- .../CheckLegalsDeclarationRequiredCommand.cs | 16 + .../Commands/DeclarationCommandsHandler.cs | 2 +- .../Commands/LegalCommandsHandler.cs | 36 +- .../Commands/PayoutCommandsHandler.cs | 16 +- .../Commands/PurchaseOrderCommandsHandler.cs | 5 +- Sheaft.Domain/BusinessLegal.cs | 13 + Sheaft.Exceptions/Enums/MessageKind.cs | 1 + .../BusinessLegalConfiguration.cs | 1 + ...810_Legals_DeclarationRequired.Designer.cs | 3269 +++++++++++++++++ ...201107100810_Legals_DeclarationRequired.cs | 26 + .../Migrations/AppDbContextModelSnapshot.cs | 3 + .../Resources/MessageResources.Designer.cs | 9 + .../Resources/MessageResources.resx | 83 +- 14 files changed, 3432 insertions(+), 50 deletions(-) create mode 100644 Sheaft.Application.Commands/Legal/CheckLegalsDeclarationRequiredCommand.cs create mode 100644 Sheaft.Infrastructure.Persistence/Migrations/20201107100810_Legals_DeclarationRequired.Designer.cs create mode 100644 Sheaft.Infrastructure.Persistence/Migrations/20201107100810_Legals_DeclarationRequired.cs diff --git a/Sheaft.Application.Commands/Declaration/EnsureDeclarationIsValidatedCommand.cs b/Sheaft.Application.Commands/Declaration/EnsureDeclarationIsValidatedCommand.cs index 1068c0ebf..f8a9ec3dc 100644 --- a/Sheaft.Application.Commands/Declaration/EnsureDeclarationIsValidatedCommand.cs +++ b/Sheaft.Application.Commands/Declaration/EnsureDeclarationIsValidatedCommand.cs @@ -11,6 +11,6 @@ public EnsureDeclarationIsValidatedCommand(RequestUser requestUser) : base(reque { } - public Guid UserId { get; set; } + public Guid ProducerId { get; set; } } } diff --git a/Sheaft.Application.Commands/Legal/CheckLegalsDeclarationRequiredCommand.cs b/Sheaft.Application.Commands/Legal/CheckLegalsDeclarationRequiredCommand.cs new file mode 100644 index 000000000..019ebad1d --- /dev/null +++ b/Sheaft.Application.Commands/Legal/CheckLegalsDeclarationRequiredCommand.cs @@ -0,0 +1,16 @@ +using System; +using Sheaft.Core; +using Newtonsoft.Json; + +namespace Sheaft.Application.Commands +{ + public class CheckLegalsDeclarationRequiredCommand : Command + { + [JsonConstructor] + public CheckLegalsDeclarationRequiredCommand(RequestUser requestUser) : base(requestUser) + { + } + + public Guid UserId { get; set; } + } +} diff --git a/Sheaft.Application.Handlers/Commands/DeclarationCommandsHandler.cs b/Sheaft.Application.Handlers/Commands/DeclarationCommandsHandler.cs index cc89bf062..514407370 100644 --- a/Sheaft.Application.Handlers/Commands/DeclarationCommandsHandler.cs +++ b/Sheaft.Application.Handlers/Commands/DeclarationCommandsHandler.cs @@ -136,7 +136,7 @@ public async Task> Handle(EnsureDeclarationIsValidatedCommand reque { return await ExecuteAsync(request, async () => { - var legal = await _context.GetSingleAsync(bl => bl.User.Id == request.UserId, token); + var legal = await _context.GetSingleAsync(bl => bl.User.Id == request.ProducerId, token); if (legal.Declaration == null) { var result = await _mediatr.Process(new CreateDeclarationCommand(request.RequestUser) diff --git a/Sheaft.Application.Handlers/Commands/LegalCommandsHandler.cs b/Sheaft.Application.Handlers/Commands/LegalCommandsHandler.cs index 86bb3396d..dff77cb36 100644 --- a/Sheaft.Application.Handlers/Commands/LegalCommandsHandler.cs +++ b/Sheaft.Application.Handlers/Commands/LegalCommandsHandler.cs @@ -8,6 +8,8 @@ using System.Threading; using Sheaft.Domain.Models; using Sheaft.Domain.Enums; +using System.Linq; +using Microsoft.EntityFrameworkCore; namespace Sheaft.Application.Handlers { @@ -17,7 +19,8 @@ public class LegalCommandsHandler : ResultsHandler, IRequestHandler>, IRequestHandler>, IRequestHandler>, - IRequestHandler> + IRequestHandler>, + IRequestHandler> { private readonly IPspService _pspService; @@ -234,5 +237,36 @@ public async Task> Handle(CheckConsumerLegalConfigurationCommand re return Ok(true); }); } + + public async Task> Handle(CheckLegalsDeclarationRequiredCommand request, CancellationToken token) + { + return await ExecuteAsync(request, async () => + { + var legal = await _context.GetSingleAsync(b => b.User.Id == request.UserId, token); + if (legal.User.Kind != ProfileKind.Producer) + return Ok(false); + + if (legal.DeclarationRequired) + return Ok(legal.DeclarationRequired); + + var currentMonth = DateTimeOffset.UtcNow.Month; + var cumulatedMonthAmount = await _context.PurchaseOrders + .Get(po => + po.Vendor.Id == request.UserId && + po.Sender.Kind == ProfileKind.Consumer && + po.Status == PurchaseOrderStatus.Delivered && + po.DeliveredOn.HasValue && + po.DeliveredOn.Value.Month == currentMonth) + .SumAsync(po => po.TotalOnSalePrice, token); + + if (cumulatedMonthAmount >= 150) + { + legal.SetDeclarationRequired(true); + await _context.SaveChangesAsync(token); + } + + return Ok(legal.DeclarationRequired); + }); + } } } \ No newline at end of file diff --git a/Sheaft.Application.Handlers/Commands/PayoutCommandsHandler.cs b/Sheaft.Application.Handlers/Commands/PayoutCommandsHandler.cs index 17533bdd3..86e2fdfac 100644 --- a/Sheaft.Application.Handlers/Commands/PayoutCommandsHandler.cs +++ b/Sheaft.Application.Handlers/Commands/PayoutCommandsHandler.cs @@ -148,13 +148,17 @@ public async Task> Handle(CreatePayoutCommand request, Cancellation if (!checkConfigurationResult.Success) return Failed(checkConfigurationResult.Exception); - var checkDocumentsResult = await _mediatr.Process(new EnsureProducerDocumentsValidatedCommand(request.RequestUser) { ProducerId = request.ProducerId }, token); - if (!checkDocumentsResult.Success) - return Failed(checkDocumentsResult.Exception); + var producerLegals = await _context.GetSingleAsync(c => c.User.Id == request.ProducerId, token); + if (producerLegals.DeclarationRequired) + { + var checkDocumentsResult = await _mediatr.Process(new EnsureProducerDocumentsValidatedCommand(request.RequestUser) { ProducerId = request.ProducerId }, token); + if (!checkDocumentsResult.Success) + return Failed(checkDocumentsResult.Exception); - var checkDeclarationResult = await _mediatr.Process(new EnsureDeclarationIsValidatedCommand(request.RequestUser) { UserId = request.ProducerId }, token); - if (!checkDeclarationResult.Success) - return Failed(checkDeclarationResult.Exception); + var checkDeclarationResult = await _mediatr.Process(new EnsureDeclarationIsValidatedCommand(request.RequestUser) { ProducerId = request.ProducerId }, token); + if (!checkDeclarationResult.Success) + return Failed(checkDeclarationResult.Exception); + } var wallet = await _context.GetSingleAsync(c => c.User.Id == request.ProducerId, token); var bankAccount = await _context.GetSingleAsync(c => c.User.Id == request.ProducerId && c.IsActive, token); diff --git a/Sheaft.Application.Handlers/Commands/PurchaseOrderCommandsHandler.cs b/Sheaft.Application.Handlers/Commands/PurchaseOrderCommandsHandler.cs index b2e556335..7ef969472 100644 --- a/Sheaft.Application.Handlers/Commands/PurchaseOrderCommandsHandler.cs +++ b/Sheaft.Application.Handlers/Commands/PurchaseOrderCommandsHandler.cs @@ -10,7 +10,6 @@ using Sheaft.Application.Events; using Microsoft.Extensions.Logging; using Microsoft.EntityFrameworkCore; -using Sheaft.Domain.Enums; namespace Sheaft.Application.Handlers { @@ -240,6 +239,10 @@ public async Task> Handle(DeliverPurchaseOrderCommand request, Canc await _context.SaveChangesAsync(token); + var producerLegals = await _context.GetSingleAsync(c => c.User.Id == purchaseOrder.Vendor.Id, token); + if(!producerLegals.DeclarationRequired) + _mediatr.Post(new CheckLegalsDeclarationRequiredCommand(request.RequestUser) { UserId = purchaseOrder.Vendor.Id }); + _mediatr.Schedule(new CreateTransferCommand(request.RequestUser) { PurchaseOrderId = purchaseOrder.Id }, TimeSpan.FromDays(7)); return Ok(true); }); diff --git a/Sheaft.Domain/BusinessLegal.cs b/Sheaft.Domain/BusinessLegal.cs index 3987ffe9f..8a7d8bbeb 100644 --- a/Sheaft.Domain/BusinessLegal.cs +++ b/Sheaft.Domain/BusinessLegal.cs @@ -2,6 +2,7 @@ using Sheaft.Domains.Extensions; using Sheaft.Exceptions; using System; +using System.Linq; namespace Sheaft.Domain.Models { @@ -18,6 +19,7 @@ public BusinessLegal(Guid id, Business business, LegalKind kind, string email, s SetAddress(address); SetSiret(siret); SetVatIdentifier(vatIdentifier); + DeclarationRequired = false; } public string Email { get; private set; } @@ -25,6 +27,8 @@ public BusinessLegal(Guid id, Business business, LegalKind kind, string email, s public string VatIdentifier { get; private set; } public virtual LegalAddress Address { get; private set; } public virtual Declaration Declaration { get; private set; } + public bool DeclarationRequired { get; private set; } + public bool IsComplete => !DeclarationRequired || (DeclarationRequired && Declaration?.Status == DeclarationStatus.Validated && Documents.All(d => d.Status == DocumentStatus.Validated)); public void SetDeclaration() { @@ -34,6 +38,15 @@ public void SetDeclaration() Declaration = new Declaration(Guid.NewGuid()); } + + public void SetDeclarationRequired(bool validationRequired) + { + if (DeclarationRequired) + throw new ValidationException(MessageKind.Legal_Cannot_Unrequire_Declaration); + + DeclarationRequired = validationRequired; + } + public void SetSiret(string siret) { if (siret.IsNotNullAndIsEmptyOrWhiteSpace()) diff --git a/Sheaft.Exceptions/Enums/MessageKind.cs b/Sheaft.Exceptions/Enums/MessageKind.cs index a7b99c715..7cd75cf3a 100644 --- a/Sheaft.Exceptions/Enums/MessageKind.cs +++ b/Sheaft.Exceptions/Enums/MessageKind.cs @@ -151,6 +151,7 @@ public enum MessageKind Legal_Vat_Required = 28101, Legal_Kind_Cannot_Be_Natural = 28102, Legal_Email_Required = 28103, + Legal_Cannot_Unrequire_Declaration = 28104, Payin = 29000, Payin_CannotSet_Already_Succeeded = 29101, Payin_CannotAdd_Refund_PurchaseOrderRefund_AlreadySucceeded = 29102, diff --git a/Sheaft.Infrastructure.Persistence/Configurations/BusinessLegalConfiguration.cs b/Sheaft.Infrastructure.Persistence/Configurations/BusinessLegalConfiguration.cs index 672003c0d..78589f228 100644 --- a/Sheaft.Infrastructure.Persistence/Configurations/BusinessLegalConfiguration.cs +++ b/Sheaft.Infrastructure.Persistence/Configurations/BusinessLegalConfiguration.cs @@ -10,6 +10,7 @@ public void Configure(EntityTypeBuilder entity) { entity.Property(c => c.Siret).IsRequired(); entity.Property(c => c.VatIdentifier); + entity.Ignore(c => c.IsComplete); entity.OwnsOne(c => c.Address, e => { e.ToTable("BusinessLegalAddresses"); diff --git a/Sheaft.Infrastructure.Persistence/Migrations/20201107100810_Legals_DeclarationRequired.Designer.cs b/Sheaft.Infrastructure.Persistence/Migrations/20201107100810_Legals_DeclarationRequired.Designer.cs new file mode 100644 index 000000000..ee0db1341 --- /dev/null +++ b/Sheaft.Infrastructure.Persistence/Migrations/20201107100810_Legals_DeclarationRequired.Designer.cs @@ -0,0 +1,3269 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Sheaft.Domain.Enums; +using Sheaft.Infrastructure.Persistence; + +namespace Sheaft.Infrastructure.Persistence.Migrations +{ + [DbContext(typeof(AppDbContext))] + [Migration("20201107100810_Legals_DeclarationRequired")] + partial class Legals_DeclarationRequired + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("app") + .HasAnnotation("ProductVersion", "3.1.9") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Sheaft.Domain.Models.Agreement", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CreatedByUid") + .HasColumnType("bigint"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("DeliveryModeUid") + .HasColumnType("bigint"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Reason") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("StoreUid") + .HasColumnType("bigint"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("CreatedByUid"); + + b.HasIndex("DeliveryModeUid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("StoreUid"); + + b.HasIndex("Uid", "Id", "StoreUid", "DeliveryModeUid", "RemovedOn"); + + b.ToTable("Agreements"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Country", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Alpha2") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Uid"); + + b.HasIndex("Alpha2") + .IsUnique(); + + b.HasIndex("Uid", "Id", "Alpha2"); + + b.ToTable("Countries"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.DeliveryMode", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Available") + .HasColumnType("bit"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("LockOrderHoursBeforeDelivery") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("ProducerUid") + .HasColumnType("bigint"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("ProducerUid"); + + b.HasIndex("Uid", "Id", "ProducerUid", "RemovedOn"); + + b.ToTable("DeliveryModes"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Department", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Code") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ConsumersCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("LevelUid") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Points") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("Position") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("ProducersCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("RegionUid") + .HasColumnType("bigint"); + + b.Property("RequiredProducers") + .HasColumnType("int"); + + b.Property("StoresCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("Code") + .IsUnique(); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("LevelUid"); + + b.HasIndex("RegionUid"); + + b.HasIndex("Uid", "Id", "RegionUid", "LevelUid"); + + b.ToTable("Departments"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Donation", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AuthorUid") + .HasColumnType("bigint"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Credited") + .HasColumnType("decimal(10,2)"); + + b.Property("CreditedWalletUid") + .HasColumnType("bigint"); + + b.Property("Debited") + .HasColumnType("decimal(10,2)"); + + b.Property("DebitedWalletUid") + .HasColumnType("bigint"); + + b.Property("ExecutedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Fees") + .HasColumnType("decimal(10,2)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Identifier") + .HasColumnType("nvarchar(450)"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("OrderUid") + .HasColumnType("bigint"); + + b.Property("Reference") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("ResultCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ResultMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("AuthorUid"); + + b.HasIndex("CreditedWalletUid"); + + b.HasIndex("DebitedWalletUid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Identifier"); + + b.HasIndex("OrderUid"); + + b.HasIndex("Uid", "Id", "AuthorUid", "OrderUid", "CreditedWalletUid", "DebitedWalletUid", "RemovedOn"); + + b.ToTable("Donations"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Job", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Archived") + .HasColumnType("bit"); + + b.Property("Command") + .HasColumnType("nvarchar(max)"); + + b.Property("CompletedOn") + .HasColumnType("datetimeoffset"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("File") + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("Message") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Queue") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Retried") + .HasColumnType("int"); + + b.Property("StartedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("UserUid") + .HasColumnType("bigint"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("UserUid"); + + b.HasIndex("Uid", "Id", "UserUid", "RemovedOn"); + + b.ToTable("Jobs"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Legal", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("UserKind") + .HasColumnType("int"); + + b.Property("UserUid") + .HasColumnType("bigint"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("UserUid") + .IsUnique(); + + b.HasIndex("Uid", "Id"); + + b.ToTable("Legals"); + + b.HasDiscriminator("UserKind"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Level", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("RequiredPoints") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Uid", "Id", "RemovedOn"); + + b.ToTable("Levels"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Nationality", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Alpha2") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Uid"); + + b.HasIndex("Alpha2") + .IsUnique(); + + b.HasIndex("Uid", "Id", "Alpha2"); + + b.ToTable("Nationalities"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Notification", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Content") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("Method") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Unread") + .HasColumnType("bit"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("UserUid") + .HasColumnType("bigint"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("UserUid"); + + b.HasIndex("Uid", "Id", "UserUid", "RemovedOn"); + + b.ToTable("Notifications"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Order", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Donate") + .HasColumnType("decimal(10,2)"); + + b.Property("DonationKind") + .HasColumnType("int"); + + b.Property("DonationUid") + .HasColumnType("bigint"); + + b.Property("ExpiredOn") + .HasColumnType("datetimeoffset"); + + b.Property("FeesFixedAmount") + .HasColumnType("decimal(10,2)"); + + b.Property("FeesPercent") + .HasColumnType("decimal(10,4)"); + + b.Property("FeesPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalFeesPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("LinesCount") + .HasColumnType("int"); + + b.Property("PayinUid") + .HasColumnType("bigint"); + + b.Property("ProductsCount") + .HasColumnType("int"); + + b.Property("Reference") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("ReturnablesCount") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("TotalOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalWeight") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("UserUid") + .HasColumnType("bigint"); + + b.HasKey("Uid"); + + b.HasIndex("DonationUid") + .IsUnique() + .HasFilter("[DonationUid] IS NOT NULL"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("PayinUid") + .IsUnique() + .HasFilter("[PayinUid] IS NOT NULL"); + + b.HasIndex("UserUid"); + + b.HasIndex("Uid", "Id", "UserUid", "RemovedOn"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.OrderDelivery", b => + { + b.Property("OrderUid") + .HasColumnType("bigint"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Comment") + .HasColumnType("nvarchar(max)"); + + b.Property("DeliveryModeUid") + .HasColumnType("bigint"); + + b.Property("ExpectedDeliveryDate") + .HasColumnType("datetimeoffset"); + + b.HasKey("OrderUid", "Id"); + + b.HasIndex("DeliveryModeUid"); + + b.ToTable("OrderDeliveries"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.OrderProduct", b => + { + b.Property("OrderUid") + .HasColumnType("bigint"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProducerUid") + .HasColumnType("bigint"); + + b.Property("Quantity") + .IsConcurrencyToken() + .HasColumnType("int"); + + b.Property("Reference") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ReturnableName") + .HasColumnType("nvarchar(max)"); + + b.Property("ReturnableOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("ReturnableVat") + .HasColumnType("decimal(10,2)"); + + b.Property("ReturnableVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("ReturnableWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("ReturnablesCount") + .HasColumnType("int"); + + b.Property("TotalOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalWeight") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("UnitOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("UnitVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("UnitWeight") + .HasColumnType("decimal(10,2)"); + + b.Property("UnitWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("Vat") + .HasColumnType("decimal(10,2)"); + + b.HasKey("OrderUid", "Id"); + + b.HasIndex("ProducerUid"); + + b.ToTable("OrderProducts"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Payin", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AuthorUid") + .HasColumnType("bigint"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Credited") + .HasColumnType("decimal(10,2)"); + + b.Property("CreditedWalletUid") + .HasColumnType("bigint"); + + b.Property("Debited") + .HasColumnType("decimal(10,2)"); + + b.Property("ExecutedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Fees") + .HasColumnType("decimal(10,2)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Identifier") + .HasColumnType("nvarchar(450)"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("OrderUid") + .HasColumnType("bigint"); + + b.Property("Reference") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("ResultCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ResultMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("AuthorUid"); + + b.HasIndex("CreditedWalletUid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Identifier"); + + b.HasIndex("OrderUid"); + + b.HasIndex("Uid", "Id", "AuthorUid", "OrderUid", "CreditedWalletUid", "RemovedOn"); + + b.ToTable("Payins"); + + b.HasDiscriminator("Kind"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.PaymentMethod", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Identifier") + .HasColumnType("nvarchar(450)"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("UserUid") + .HasColumnType("bigint"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Identifier"); + + b.HasIndex("UserUid"); + + b.HasIndex("Uid", "Id", "Identifier", "UserUid", "RemovedOn"); + + b.ToTable("PaymentMethods"); + + b.HasDiscriminator("Kind"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Payout", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AuthorUid") + .HasColumnType("bigint"); + + b.Property("BankAccountUid") + .HasColumnType("bigint"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Credited") + .HasColumnType("decimal(10,2)"); + + b.Property("Debited") + .HasColumnType("decimal(10,2)"); + + b.Property("DebitedWalletUid") + .HasColumnType("bigint"); + + b.Property("ExecutedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Fees") + .HasColumnType("decimal(10,2)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Identifier") + .HasColumnType("nvarchar(450)"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("Reference") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("ResultCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ResultMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("AuthorUid"); + + b.HasIndex("BankAccountUid"); + + b.HasIndex("DebitedWalletUid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Identifier"); + + b.HasIndex("Uid", "Id", "AuthorUid", "BankAccountUid", "DebitedWalletUid", "RemovedOn"); + + b.ToTable("Payouts"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.ProducerTag", b => + { + b.Property("ProducerUid") + .HasColumnType("bigint"); + + b.Property("TagUid") + .HasColumnType("bigint"); + + b.HasKey("ProducerUid", "TagUid"); + + b.HasIndex("TagUid"); + + b.ToTable("ProducerTags"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Product", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Available") + .HasColumnType("bit"); + + b.Property("Conditioning") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("OnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("OnSalePricePerUnit") + .HasColumnType("decimal(10,2)"); + + b.Property("Picture") + .HasColumnType("nvarchar(max)"); + + b.Property("ProducerUid") + .HasColumnType("bigint"); + + b.Property("QuantityPerUnit") + .HasColumnType("decimal(10,3)"); + + b.Property("Rating") + .HasColumnType("decimal(10,2)"); + + b.Property("RatingsCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("Reference") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("ReturnableUid") + .HasColumnType("bigint"); + + b.Property("Unit") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("Vat") + .HasColumnType("decimal(10,2)"); + + b.Property("VatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("VatPricePerUnit") + .HasColumnType("decimal(10,2)"); + + b.Property("VisibleToConsumers") + .HasColumnType("bit"); + + b.Property("VisibleToStores") + .HasColumnType("bit"); + + b.Property("Weight") + .HasColumnType("decimal(10,2)"); + + b.Property("WholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("WholeSalePricePerUnit") + .HasColumnType("decimal(10,2)"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("ProducerUid"); + + b.HasIndex("ReturnableUid"); + + b.HasIndex("ProducerUid", "Reference") + .IsUnique(); + + b.HasIndex("Uid", "Id", "ProducerUid", "ReturnableUid", "RemovedOn"); + + b.ToTable("Products"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.ProductTag", b => + { + b.Property("ProductUid") + .HasColumnType("bigint"); + + b.Property("TagUid") + .HasColumnType("bigint"); + + b.HasKey("ProductUid", "TagUid"); + + b.HasIndex("TagUid"); + + b.ToTable("ProductTags"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.PurchaseOrder", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AcceptedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Comment") + .HasColumnType("nvarchar(max)"); + + b.Property("CompletedOn") + .HasColumnType("datetimeoffset"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("DeliveredOn") + .HasColumnType("datetimeoffset"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("LinesCount") + .HasColumnType("int"); + + b.Property("OrderUid") + .HasColumnType("bigint"); + + b.Property("ProductsCount") + .HasColumnType("int"); + + b.Property("PurchaseOrderSenderUid") + .HasColumnType("bigint"); + + b.Property("PurchaseOrderVendorUid") + .HasColumnType("bigint"); + + b.Property("Reason") + .HasColumnType("nvarchar(max)"); + + b.Property("Reference") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("ReturnablesCount") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("TotalOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalWeight") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TransferUid") + .HasColumnType("bigint"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("WithdrawnOn") + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("OrderUid"); + + b.HasIndex("PurchaseOrderSenderUid") + .IsUnique(); + + b.HasIndex("PurchaseOrderVendorUid") + .IsUnique(); + + b.HasIndex("TransferUid") + .IsUnique() + .HasFilter("[TransferUid] IS NOT NULL"); + + b.HasIndex("PurchaseOrderVendorUid", "Reference") + .IsUnique(); + + b.HasIndex("OrderUid", "Uid", "Id", "PurchaseOrderVendorUid", "PurchaseOrderSenderUid", "RemovedOn"); + + b.ToTable("PurchaseOrders"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.PurchaseOrderProduct", b => + { + b.Property("PurchaseOrderUid") + .HasColumnType("bigint"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Quantity") + .IsConcurrencyToken() + .HasColumnType("int"); + + b.Property("Reference") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ReturnableName") + .HasColumnType("nvarchar(max)"); + + b.Property("ReturnableOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("ReturnableVat") + .HasColumnType("decimal(10,2)"); + + b.Property("ReturnableVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("ReturnableWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("ReturnablesCount") + .HasColumnType("int"); + + b.Property("TotalOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalWeight") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("UnitOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("UnitVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("UnitWeight") + .HasColumnType("decimal(10,2)"); + + b.Property("UnitWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("Vat") + .HasColumnType("decimal(10,2)"); + + b.HasKey("PurchaseOrderUid", "Id"); + + b.ToTable("PurchaseOrderProducts"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.PurchaseOrderSender", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Phone") + .HasColumnType("nvarchar(max)"); + + b.Property("Picture") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Uid"); + + b.HasIndex("Id"); + + b.ToTable("PurchaseOrderSenders"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.PurchaseOrderVendor", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Phone") + .HasColumnType("nvarchar(max)"); + + b.Property("Picture") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Uid"); + + b.HasIndex("Id"); + + b.ToTable("PurchaseOrderVendors"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.QuickOrder", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDefault") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("UserUid") + .HasColumnType("bigint"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("UserUid"); + + b.HasIndex("Uid", "Id", "UserUid", "RemovedOn"); + + b.ToTable("QuickOrders"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.QuickOrderProduct", b => + { + b.Property("QuickOrderUid") + .HasColumnType("bigint"); + + b.Property("ProductUid") + .HasColumnType("bigint"); + + b.Property("Quantity") + .IsConcurrencyToken() + .HasColumnType("int"); + + b.HasKey("QuickOrderUid", "ProductUid"); + + b.HasIndex("ProductUid"); + + b.ToTable("QuickOrderProducts"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Rating", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Comment") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ProductUid") + .HasColumnType("bigint"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("UserUid") + .HasColumnType("bigint"); + + b.Property("Value") + .HasColumnType("decimal(10,2)"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("ProductUid"); + + b.HasIndex("UserUid"); + + b.HasIndex("Uid", "Id", "ProductUid", "UserUid", "RemovedOn"); + + b.ToTable("Ratings"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Refund", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AuthorUid") + .HasColumnType("bigint"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Credited") + .HasColumnType("decimal(10,2)"); + + b.Property("Debited") + .HasColumnType("decimal(10,2)"); + + b.Property("DebitedWalletUid") + .HasColumnType("bigint"); + + b.Property("ExecutedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Fees") + .HasColumnType("decimal(10,2)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Identifier") + .HasColumnType("nvarchar(450)"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("Reference") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("ResultCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ResultMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("AuthorUid"); + + b.HasIndex("DebitedWalletUid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Identifier"); + + b.HasIndex("Uid", "Id", "AuthorUid", "DebitedWalletUid", "RemovedOn"); + + b.ToTable("Refunds"); + + b.HasDiscriminator("Kind"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Region", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Code") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ConsumersCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Points") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("Position") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("ProducersCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("RequiredProducers") + .HasColumnType("int"); + + b.Property("StoresCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("Code") + .IsUnique(); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Uid", "Id"); + + b.ToTable("Regions"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Returnable", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Kind") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("OnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("ProducerUid") + .HasColumnType("bigint"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("Vat") + .HasColumnType("decimal(10,2)"); + + b.Property("VatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("WholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("ProducerUid"); + + b.HasIndex("Uid", "Id", "RemovedOn"); + + b.ToTable("Returnables"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Reward", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Contact") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("DepartmentUid") + .HasColumnType("bigint"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("LevelUid") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Phone") + .HasColumnType("nvarchar(max)"); + + b.Property("Picture") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("Url") + .HasColumnType("nvarchar(max)"); + + b.Property("WinnerUid") + .HasColumnType("bigint"); + + b.HasKey("Uid"); + + b.HasIndex("DepartmentUid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("LevelUid"); + + b.HasIndex("WinnerUid"); + + b.HasIndex("Uid", "Id", "DepartmentUid", "LevelUid", "RemovedOn"); + + b.ToTable("Rewards"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Sponsoring", b => + { + b.Property("SponsorUid") + .HasColumnType("bigint"); + + b.Property("SponsoredUid") + .HasColumnType("bigint"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.HasKey("SponsorUid", "SponsoredUid"); + + b.HasIndex("SponsoredUid"); + + b.ToTable("Sponsorings"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.StoreTag", b => + { + b.Property("StoreUid") + .HasColumnType("bigint"); + + b.Property("TagUid") + .HasColumnType("bigint"); + + b.HasKey("StoreUid", "TagUid"); + + b.HasIndex("TagUid"); + + b.ToTable("StoreTags"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Tag", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Available") + .HasColumnType("bit"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Icon") + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Picture") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Uid", "Id", "RemovedOn"); + + b.ToTable("Tags"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Transfer", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AuthorUid") + .HasColumnType("bigint"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Credited") + .HasColumnType("decimal(10,2)"); + + b.Property("CreditedWalletUid") + .HasColumnType("bigint"); + + b.Property("Debited") + .HasColumnType("decimal(10,2)"); + + b.Property("DebitedWalletUid") + .HasColumnType("bigint"); + + b.Property("ExecutedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Fees") + .HasColumnType("decimal(10,2)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Identifier") + .HasColumnType("nvarchar(450)"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("PayoutUid") + .HasColumnType("bigint"); + + b.Property("PurchaseOrderUid") + .HasColumnType("bigint"); + + b.Property("Reference") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("ResultCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ResultMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("AuthorUid"); + + b.HasIndex("CreditedWalletUid"); + + b.HasIndex("DebitedWalletUid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Identifier"); + + b.HasIndex("PayoutUid"); + + b.HasIndex("PurchaseOrderUid"); + + b.HasIndex("Uid", "Id", "AuthorUid", "PurchaseOrderUid", "CreditedWalletUid", "DebitedWalletUid", "RemovedOn"); + + b.ToTable("Transfers"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.User", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Identifier") + .HasColumnType("nvarchar(450)"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Phone") + .HasColumnType("nvarchar(max)"); + + b.Property("Picture") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("SponsorshipCode") + .HasColumnType("nvarchar(max)"); + + b.Property("TotalPoints") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("Email") + .IsUnique(); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Identifier"); + + b.HasIndex("Uid", "Id", "RemovedOn"); + + b.ToTable("Users"); + + b.HasDiscriminator("Kind"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Wallet", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Balance") + .HasColumnType("decimal(10,2)"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("ExternalUpdatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Identifier") + .HasColumnType("nvarchar(450)"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("UserUid") + .HasColumnType("bigint"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Identifier"); + + b.HasIndex("UserUid"); + + b.HasIndex("Uid", "Id", "UserUid", "RemovedOn"); + + b.ToTable("Wallets"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.BusinessLegal", b => + { + b.HasBaseType("Sheaft.Domain.Models.Legal"); + + b.Property("DeclarationRequired") + .HasColumnType("bit"); + + b.Property("Email") + .HasColumnType("nvarchar(max)"); + + b.Property("Siret") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("VatIdentifier") + .HasColumnType("nvarchar(max)"); + + b.HasDiscriminator().HasValue(1); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.ConsumerLegal", b => + { + b.HasBaseType("Sheaft.Domain.Models.Legal"); + + b.HasDiscriminator().HasValue(0); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.CardPayin", b => + { + b.HasBaseType("Sheaft.Domain.Models.Payin"); + + b.Property("CardUid") + .HasColumnType("bigint"); + + b.HasIndex("CardUid"); + + b.HasDiscriminator().HasValue(1); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.WebPayin", b => + { + b.HasBaseType("Sheaft.Domain.Models.Payin"); + + b.Property("RedirectUrl") + .HasColumnType("nvarchar(max)"); + + b.HasDiscriminator().HasValue(0); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.BankAccount", b => + { + b.HasBaseType("Sheaft.Domain.Models.PaymentMethod"); + + b.Property("BIC") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("City") + .HasColumnType("nvarchar(max)"); + + b.Property("Country") + .HasColumnType("int"); + + b.Property("IBAN") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Line1") + .HasColumnType("nvarchar(max)"); + + b.Property("Line2") + .HasColumnType("nvarchar(max)"); + + b.Property("Owner") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Zipcode") + .HasColumnType("nvarchar(max)"); + + b.HasDiscriminator().HasValue(0); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Card", b => + { + b.HasBaseType("Sheaft.Domain.Models.PaymentMethod"); + + b.HasDiscriminator().HasValue(1); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.PayinRefund", b => + { + b.HasBaseType("Sheaft.Domain.Models.Refund"); + + b.Property("PayinUid") + .HasColumnType("bigint"); + + b.Property("PurchaseOrderUid") + .HasColumnType("bigint"); + + b.HasIndex("PayinUid"); + + b.HasIndex("PurchaseOrderUid"); + + b.HasDiscriminator().HasValue(300); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Admin", b => + { + b.HasBaseType("Sheaft.Domain.Models.User"); + + b.HasDiscriminator().HasValue(4); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Business", b => + { + b.HasBaseType("Sheaft.Domain.Models.User"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("OpenForNewBusiness") + .HasColumnType("bit"); + + b.HasDiscriminator(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Consumer", b => + { + b.HasBaseType("Sheaft.Domain.Models.User"); + + b.Property("Anonymous") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.HasDiscriminator().HasValue(2); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Support", b => + { + b.HasBaseType("Sheaft.Domain.Models.User"); + + b.HasDiscriminator().HasValue(3); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Producer", b => + { + b.HasBaseType("Sheaft.Domain.Models.Business"); + + b.Property("CanDirectSell") + .HasColumnType("bit"); + + b.HasDiscriminator().HasValue(0); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Store", b => + { + b.HasBaseType("Sheaft.Domain.Models.Business"); + + b.HasDiscriminator().HasValue(1); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Agreement", b => + { + b.HasOne("Sheaft.Domain.Models.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedByUid"); + + b.HasOne("Sheaft.Domain.Models.DeliveryMode", "Delivery") + .WithMany() + .HasForeignKey("DeliveryModeUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Store", "Store") + .WithMany() + .HasForeignKey("StoreUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Sheaft.Domain.Models.TimeSlotHour", "SelectedHours", b1 => + { + b1.Property("AgreementUid") + .HasColumnType("bigint"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b1.Property("Day") + .HasColumnType("int"); + + b1.Property("From") + .HasColumnType("time"); + + b1.Property("To") + .HasColumnType("time"); + + b1.HasKey("AgreementUid", "Id"); + + b1.ToTable("AgreementSelectedHours"); + + b1.WithOwner() + .HasForeignKey("AgreementUid"); + }); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.DeliveryMode", b => + { + b.HasOne("Sheaft.Domain.Models.Producer", "Producer") + .WithMany() + .HasForeignKey("ProducerUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Sheaft.Domain.Models.DeliveryAddress", "Address", b1 => + { + b1.Property("DeliveryModeUid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b1.Property("City") + .HasColumnType("nvarchar(max)"); + + b1.Property("Country") + .HasColumnType("int"); + + b1.Property("Latitude") + .HasColumnType("float"); + + b1.Property("Line1") + .HasColumnType("nvarchar(max)"); + + b1.Property("Line2") + .HasColumnType("nvarchar(max)"); + + b1.Property("Longitude") + .HasColumnType("float"); + + b1.Property("Zipcode") + .HasColumnType("nvarchar(max)"); + + b1.HasKey("DeliveryModeUid"); + + b1.ToTable("DeliveryModes"); + + b1.WithOwner() + .HasForeignKey("DeliveryModeUid"); + }); + + b.OwnsMany("Sheaft.Domain.Models.TimeSlotHour", "OpeningHours", b1 => + { + b1.Property("DeliveryModeUid") + .HasColumnType("bigint"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b1.Property("Day") + .HasColumnType("int"); + + b1.Property("From") + .HasColumnType("time"); + + b1.Property("To") + .HasColumnType("time"); + + b1.HasKey("DeliveryModeUid", "Id"); + + b1.ToTable("DeliveryModeOpeningHours"); + + b1.WithOwner() + .HasForeignKey("DeliveryModeUid"); + }); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Department", b => + { + b.HasOne("Sheaft.Domain.Models.Level", "Level") + .WithMany() + .HasForeignKey("LevelUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Region", "Region") + .WithMany() + .HasForeignKey("RegionUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Donation", b => + { + b.HasOne("Sheaft.Domain.Models.User", "Author") + .WithMany() + .HasForeignKey("AuthorUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Wallet", "CreditedWallet") + .WithMany() + .HasForeignKey("CreditedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Wallet", "DebitedWallet") + .WithMany() + .HasForeignKey("DebitedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Order", "Order") + .WithMany() + .HasForeignKey("OrderUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Job", b => + { + b.HasOne("Sheaft.Domain.Models.User", "User") + .WithMany() + .HasForeignKey("UserUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Legal", b => + { + b.HasOne("Sheaft.Domain.Models.User", "User") + .WithOne() + .HasForeignKey("Sheaft.Domain.Models.Legal", "UserUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Sheaft.Domain.Models.Document", "Documents", b1 => + { + b1.Property("LegalUid") + .HasColumnType("bigint"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b1.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b1.Property("Identifier") + .HasColumnType("nvarchar(450)"); + + b1.Property("Kind") + .HasColumnType("int"); + + b1.Property("Name") + .HasColumnType("nvarchar(max)"); + + b1.Property("ProcessedOn") + .HasColumnType("datetimeoffset"); + + b1.Property("ResultCode") + .HasColumnType("nvarchar(max)"); + + b1.Property("ResultMessage") + .HasColumnType("nvarchar(max)"); + + b1.Property("Status") + .HasColumnType("int"); + + b1.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b1.HasKey("LegalUid", "Id"); + + b1.HasIndex("Id") + .IsUnique(); + + b1.HasIndex("Identifier"); + + b1.ToTable("Documents"); + + b1.WithOwner() + .HasForeignKey("LegalUid"); + + b1.OwnsMany("Sheaft.Domain.Models.Page", "Pages", b2 => + { + b2.Property("DocumentLegalUid") + .HasColumnType("bigint"); + + b2.Property("DocumentId") + .HasColumnType("uniqueidentifier"); + + b2.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b2.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b2.Property("Extension") + .HasColumnType("nvarchar(max)"); + + b2.Property("Filename") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b2.Property("Size") + .HasColumnType("bigint"); + + b2.Property("UploadedOn") + .HasColumnType("datetimeoffset"); + + b2.HasKey("DocumentLegalUid", "DocumentId", "Id"); + + b2.HasIndex("Id") + .IsUnique(); + + b2.ToTable("DocumentPages"); + + b2.WithOwner() + .HasForeignKey("DocumentLegalUid", "DocumentId"); + }); + }); + + b.OwnsOne("Sheaft.Domain.Models.Owner", "Owner", b1 => + { + b1.Property("LegalUid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b1.Property("BirthDate") + .HasColumnType("datetimeoffset"); + + b1.Property("CountryOfResidence") + .HasColumnType("int"); + + b1.Property("Email") + .HasColumnType("nvarchar(max)"); + + b1.Property("FirstName") + .HasColumnType("nvarchar(max)"); + + b1.Property("Id") + .HasColumnType("uniqueidentifier"); + + b1.Property("LastName") + .HasColumnType("nvarchar(max)"); + + b1.Property("Nationality") + .HasColumnType("int"); + + b1.HasKey("LegalUid"); + + b1.ToTable("Legals"); + + b1.WithOwner() + .HasForeignKey("LegalUid"); + + b1.OwnsOne("Sheaft.Domain.Models.OwnerAddress", "Address", b2 => + { + b2.Property("OwnerLegalUid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b2.Property("City") + .HasColumnType("nvarchar(max)"); + + b2.Property("Country") + .HasColumnType("int"); + + b2.Property("Line1") + .HasColumnType("nvarchar(max)"); + + b2.Property("Line2") + .HasColumnType("nvarchar(max)"); + + b2.Property("Zipcode") + .HasColumnType("nvarchar(max)"); + + b2.HasKey("OwnerLegalUid"); + + b2.ToTable("Legals"); + + b2.WithOwner() + .HasForeignKey("OwnerLegalUid"); + }); + }); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Notification", b => + { + b.HasOne("Sheaft.Domain.Models.User", "User") + .WithMany() + .HasForeignKey("UserUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Order", b => + { + b.HasOne("Sheaft.Domain.Models.Donation", "Donation") + .WithOne() + .HasForeignKey("Sheaft.Domain.Models.Order", "DonationUid") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Sheaft.Domain.Models.Payin", "Payin") + .WithOne() + .HasForeignKey("Sheaft.Domain.Models.Order", "PayinUid") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Sheaft.Domain.Models.User", "User") + .WithMany() + .HasForeignKey("UserUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.OrderDelivery", b => + { + b.HasOne("Sheaft.Domain.Models.DeliveryMode", "DeliveryMode") + .WithMany() + .HasForeignKey("DeliveryModeUid"); + + b.HasOne("Sheaft.Domain.Models.Order", null) + .WithMany("Deliveries") + .HasForeignKey("OrderUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.OrderProduct", b => + { + b.HasOne("Sheaft.Domain.Models.Order", null) + .WithMany("Products") + .HasForeignKey("OrderUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.User", "Producer") + .WithMany() + .HasForeignKey("ProducerUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Payin", b => + { + b.HasOne("Sheaft.Domain.Models.User", "Author") + .WithMany() + .HasForeignKey("AuthorUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Wallet", "CreditedWallet") + .WithMany() + .HasForeignKey("CreditedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Order", "Order") + .WithMany() + .HasForeignKey("OrderUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.PaymentMethod", b => + { + b.HasOne("Sheaft.Domain.Models.User", "User") + .WithMany() + .HasForeignKey("UserUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Payout", b => + { + b.HasOne("Sheaft.Domain.Models.User", "Author") + .WithMany() + .HasForeignKey("AuthorUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.BankAccount", "BankAccount") + .WithMany() + .HasForeignKey("BankAccountUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Wallet", "DebitedWallet") + .WithMany() + .HasForeignKey("DebitedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.ProducerTag", b => + { + b.HasOne("Sheaft.Domain.Models.Producer", null) + .WithMany("Tags") + .HasForeignKey("ProducerUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Tag", "Tag") + .WithMany() + .HasForeignKey("TagUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Product", b => + { + b.HasOne("Sheaft.Domain.Models.Producer", "Producer") + .WithMany() + .HasForeignKey("ProducerUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Returnable", "Returnable") + .WithMany() + .HasForeignKey("ReturnableUid") + .OnDelete(DeleteBehavior.NoAction); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.ProductTag", b => + { + b.HasOne("Sheaft.Domain.Models.Product", null) + .WithMany("Tags") + .HasForeignKey("ProductUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Tag", "Tag") + .WithMany() + .HasForeignKey("TagUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.PurchaseOrder", b => + { + b.HasOne("Sheaft.Domain.Models.Order", null) + .WithMany("PurchaseOrders") + .HasForeignKey("OrderUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.PurchaseOrderSender", "Sender") + .WithOne() + .HasForeignKey("Sheaft.Domain.Models.PurchaseOrder", "PurchaseOrderSenderUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.PurchaseOrderVendor", "Vendor") + .WithOne() + .HasForeignKey("Sheaft.Domain.Models.PurchaseOrder", "PurchaseOrderVendorUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Transfer", "Transfer") + .WithOne() + .HasForeignKey("Sheaft.Domain.Models.PurchaseOrder", "TransferUid") + .OnDelete(DeleteBehavior.NoAction); + + b.OwnsOne("Sheaft.Domain.Models.ExpectedDelivery", "ExpectedDelivery", b1 => + { + b1.Property("PurchaseOrderUid") + .HasColumnType("bigint"); + + b1.Property("DeliveredOn") + .HasColumnType("datetimeoffset"); + + b1.Property("DeliveryStartedOn") + .HasColumnType("datetimeoffset"); + + b1.Property("ExpectedDeliveryDate") + .HasColumnType("datetimeoffset"); + + b1.Property("From") + .HasColumnType("time"); + + b1.Property("Kind") + .HasColumnType("int"); + + b1.Property("Name") + .HasColumnType("nvarchar(max)"); + + b1.Property("To") + .HasColumnType("time"); + + b1.HasKey("PurchaseOrderUid"); + + b1.ToTable("ExpectedDeliveries"); + + b1.WithOwner() + .HasForeignKey("PurchaseOrderUid"); + + b1.OwnsOne("Sheaft.Domain.Models.ExpectedAddress", "Address", b2 => + { + b2.Property("ExpectedDeliveryPurchaseOrderUid") + .HasColumnType("bigint"); + + b2.Property("City") + .HasColumnType("nvarchar(max)"); + + b2.Property("Country") + .HasColumnType("int"); + + b2.Property("Latitude") + .HasColumnType("float"); + + b2.Property("Line1") + .HasColumnType("nvarchar(max)"); + + b2.Property("Line2") + .HasColumnType("nvarchar(max)"); + + b2.Property("Longitude") + .HasColumnType("float"); + + b2.Property("Zipcode") + .HasColumnType("nvarchar(max)"); + + b2.HasKey("ExpectedDeliveryPurchaseOrderUid"); + + b2.ToTable("ExpectedDeliveries"); + + b2.WithOwner() + .HasForeignKey("ExpectedDeliveryPurchaseOrderUid"); + }); + }); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.PurchaseOrderProduct", b => + { + b.HasOne("Sheaft.Domain.Models.PurchaseOrder", null) + .WithMany("Products") + .HasForeignKey("PurchaseOrderUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.QuickOrder", b => + { + b.HasOne("Sheaft.Domain.Models.User", "User") + .WithMany() + .HasForeignKey("UserUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.QuickOrderProduct", b => + { + b.HasOne("Sheaft.Domain.Models.Product", "Product") + .WithMany() + .HasForeignKey("ProductUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.QuickOrder", null) + .WithMany("Products") + .HasForeignKey("QuickOrderUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Rating", b => + { + b.HasOne("Sheaft.Domain.Models.Product", null) + .WithMany("Ratings") + .HasForeignKey("ProductUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.User", "User") + .WithMany() + .HasForeignKey("UserUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Refund", b => + { + b.HasOne("Sheaft.Domain.Models.User", "Author") + .WithMany() + .HasForeignKey("AuthorUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Wallet", "DebitedWallet") + .WithMany() + .HasForeignKey("DebitedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Returnable", b => + { + b.HasOne("Sheaft.Domain.Models.Producer", "Producer") + .WithMany() + .HasForeignKey("ProducerUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Reward", b => + { + b.HasOne("Sheaft.Domain.Models.Department", "Department") + .WithMany() + .HasForeignKey("DepartmentUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Level", "Level") + .WithMany("Rewards") + .HasForeignKey("LevelUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Consumer", "Winner") + .WithMany() + .HasForeignKey("WinnerUid"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Sponsoring", b => + { + b.HasOne("Sheaft.Domain.Models.User", "Sponsor") + .WithMany() + .HasForeignKey("SponsorUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.User", "Sponsored") + .WithMany() + .HasForeignKey("SponsoredUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.StoreTag", b => + { + b.HasOne("Sheaft.Domain.Models.Store", null) + .WithMany("Tags") + .HasForeignKey("StoreUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Tag", "Tag") + .WithMany() + .HasForeignKey("TagUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Transfer", b => + { + b.HasOne("Sheaft.Domain.Models.User", "Author") + .WithMany() + .HasForeignKey("AuthorUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Wallet", "CreditedWallet") + .WithMany() + .HasForeignKey("CreditedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Wallet", "DebitedWallet") + .WithMany() + .HasForeignKey("DebitedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Payout", "Payout") + .WithMany("Transfers") + .HasForeignKey("PayoutUid") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Sheaft.Domain.Models.PurchaseOrder", "PurchaseOrder") + .WithMany() + .HasForeignKey("PurchaseOrderUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.User", b => + { + b.OwnsMany("Sheaft.Domain.Models.Points", "Points", b1 => + { + b1.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b1.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b1.Property("Id") + .HasColumnType("uniqueidentifier"); + + b1.Property("Kind") + .HasColumnType("int"); + + b1.Property("Quantity") + .HasColumnType("int"); + + b1.Property("UserUid") + .HasColumnType("bigint"); + + b1.HasKey("Uid"); + + b1.HasIndex("Id") + .IsUnique(); + + b1.HasIndex("UserUid"); + + b1.ToTable("UserPoints"); + + b1.WithOwner() + .HasForeignKey("UserUid"); + }); + + b.OwnsOne("Sheaft.Domain.Models.UserAddress", "Address", b1 => + { + b1.Property("UserUid") + .HasColumnType("bigint"); + + b1.Property("City") + .HasColumnType("nvarchar(max)"); + + b1.Property("Country") + .HasColumnType("int"); + + b1.Property("DepartmentUid") + .HasColumnType("bigint"); + + b1.Property("Latitude") + .HasColumnType("float"); + + b1.Property("Line1") + .HasColumnType("nvarchar(max)"); + + b1.Property("Line2") + .HasColumnType("nvarchar(max)"); + + b1.Property("Longitude") + .HasColumnType("float"); + + b1.Property("Zipcode") + .HasColumnType("nvarchar(max)"); + + b1.HasKey("UserUid"); + + b1.HasIndex("DepartmentUid"); + + b1.ToTable("UserAddresses"); + + b1.HasOne("Sheaft.Domain.Models.Department", "Department") + .WithMany() + .HasForeignKey("DepartmentUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b1.WithOwner() + .HasForeignKey("UserUid"); + }); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Wallet", b => + { + b.HasOne("Sheaft.Domain.Models.User", "User") + .WithMany() + .HasForeignKey("UserUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.BusinessLegal", b => + { + b.OwnsOne("Sheaft.Domain.Models.Declaration", "Declaration", b1 => + { + b1.Property("BusinessLegalUid") + .HasColumnType("bigint"); + + b1.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b1.Property("Id") + .HasColumnType("uniqueidentifier"); + + b1.Property("Identifier") + .HasColumnType("nvarchar(max)"); + + b1.Property("ProcessedOn") + .HasColumnType("datetimeoffset"); + + b1.Property("ReasonCode") + .HasColumnType("nvarchar(max)"); + + b1.Property("ReasonMessage") + .HasColumnType("nvarchar(max)"); + + b1.Property("Status") + .HasColumnType("int"); + + b1.Property("UpdatedOn") + .HasColumnType("datetimeoffset"); + + b1.HasKey("BusinessLegalUid"); + + b1.ToTable("Declarations"); + + b1.WithOwner() + .HasForeignKey("BusinessLegalUid"); + + b1.OwnsMany("Sheaft.Domain.Models.Ubo", "Ubos", b2 => + { + b2.Property("DeclarationBusinessLegalUid") + .HasColumnType("bigint"); + + b2.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b2.Property("BirthDate") + .HasColumnType("datetimeoffset"); + + b2.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b2.Property("FirstName") + .HasColumnType("nvarchar(max)"); + + b2.Property("Identifier") + .HasColumnType("nvarchar(450)"); + + b2.Property("LastName") + .HasColumnType("nvarchar(max)"); + + b2.Property("Nationality") + .HasColumnType("int"); + + b2.Property("UpdatedOn") + .HasColumnType("datetimeoffset"); + + b2.HasKey("DeclarationBusinessLegalUid", "Id"); + + b2.HasIndex("Id") + .IsUnique(); + + b2.HasIndex("Identifier"); + + b2.ToTable("DeclarationUbos"); + + b2.WithOwner() + .HasForeignKey("DeclarationBusinessLegalUid"); + + b2.OwnsOne("Sheaft.Domain.Models.BirthAddress", "BirthPlace", b3 => + { + b3.Property("UboDeclarationBusinessLegalUid") + .HasColumnType("bigint"); + + b3.Property("UboId") + .HasColumnType("uniqueidentifier"); + + b3.Property("City") + .HasColumnType("nvarchar(max)"); + + b3.Property("Country") + .HasColumnType("int"); + + b3.HasKey("UboDeclarationBusinessLegalUid", "UboId"); + + b3.ToTable("DeclarationUbos"); + + b3.WithOwner() + .HasForeignKey("UboDeclarationBusinessLegalUid", "UboId"); + }); + + b2.OwnsOne("Sheaft.Domain.Models.UboAddress", "Address", b3 => + { + b3.Property("UboDeclarationBusinessLegalUid") + .HasColumnType("bigint"); + + b3.Property("UboId") + .HasColumnType("uniqueidentifier"); + + b3.Property("City") + .HasColumnType("nvarchar(max)"); + + b3.Property("Country") + .HasColumnType("int"); + + b3.Property("Line1") + .HasColumnType("nvarchar(max)"); + + b3.Property("Line2") + .HasColumnType("nvarchar(max)"); + + b3.Property("Zipcode") + .HasColumnType("nvarchar(max)"); + + b3.HasKey("UboDeclarationBusinessLegalUid", "UboId"); + + b3.ToTable("DeclarationUbos"); + + b3.WithOwner() + .HasForeignKey("UboDeclarationBusinessLegalUid", "UboId"); + }); + }); + }); + + b.OwnsOne("Sheaft.Domain.Models.LegalAddress", "Address", b1 => + { + b1.Property("BusinessLegalUid") + .HasColumnType("bigint"); + + b1.Property("City") + .HasColumnType("nvarchar(max)"); + + b1.Property("Country") + .HasColumnType("int"); + + b1.Property("Line1") + .HasColumnType("nvarchar(max)"); + + b1.Property("Line2") + .HasColumnType("nvarchar(max)"); + + b1.Property("Zipcode") + .HasColumnType("nvarchar(max)"); + + b1.HasKey("BusinessLegalUid"); + + b1.ToTable("BusinessLegalAddresses"); + + b1.WithOwner() + .HasForeignKey("BusinessLegalUid"); + }); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.CardPayin", b => + { + b.HasOne("Sheaft.Domain.Models.Card", "Card") + .WithMany() + .HasForeignKey("CardUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.PayinRefund", b => + { + b.HasOne("Sheaft.Domain.Models.Payin", "Payin") + .WithMany("Refunds") + .HasForeignKey("PayinUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.PurchaseOrder", "PurchaseOrder") + .WithMany() + .HasForeignKey("PurchaseOrderUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Store", b => + { + b.OwnsMany("Sheaft.Domain.Models.TimeSlotHour", "OpeningHours", b1 => + { + b1.Property("StoreUid") + .HasColumnType("bigint"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b1.Property("Day") + .HasColumnType("int"); + + b1.Property("From") + .HasColumnType("time"); + + b1.Property("To") + .HasColumnType("time"); + + b1.HasKey("StoreUid", "Id"); + + b1.ToTable("StoreOpeningHours"); + + b1.WithOwner() + .HasForeignKey("StoreUid"); + }); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Sheaft.Infrastructure.Persistence/Migrations/20201107100810_Legals_DeclarationRequired.cs b/Sheaft.Infrastructure.Persistence/Migrations/20201107100810_Legals_DeclarationRequired.cs new file mode 100644 index 000000000..1374b2cb0 --- /dev/null +++ b/Sheaft.Infrastructure.Persistence/Migrations/20201107100810_Legals_DeclarationRequired.cs @@ -0,0 +1,26 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Sheaft.Infrastructure.Persistence.Migrations +{ + public partial class Legals_DeclarationRequired : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "DeclarationRequired", + schema: "app", + table: "Legals", + nullable: true); + + migrationBuilder.Sql("update app.Legals set DeclarationRequired = 0"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "DeclarationRequired", + schema: "app", + table: "Legals"); + } + } +} diff --git a/Sheaft.Infrastructure.Persistence/Migrations/AppDbContextModelSnapshot.cs b/Sheaft.Infrastructure.Persistence/Migrations/AppDbContextModelSnapshot.cs index f2d4d209c..948b2aaa1 100644 --- a/Sheaft.Infrastructure.Persistence/Migrations/AppDbContextModelSnapshot.cs +++ b/Sheaft.Infrastructure.Persistence/Migrations/AppDbContextModelSnapshot.cs @@ -2062,6 +2062,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasBaseType("Sheaft.Domain.Models.Legal"); + b.Property("DeclarationRequired") + .HasColumnType("bit"); + b.Property("Email") .HasColumnType("nvarchar(max)"); diff --git a/Sheaft.Localization/Resources/MessageResources.Designer.cs b/Sheaft.Localization/Resources/MessageResources.Designer.cs index e21f454cc..ffda064af 100644 --- a/Sheaft.Localization/Resources/MessageResources.Designer.cs +++ b/Sheaft.Localization/Resources/MessageResources.Designer.cs @@ -735,6 +735,15 @@ internal static string Legal { } } + /// + /// Looks up a localized string similar to Il n'est pas possible de basculer la déclaration en non requise. + /// + internal static string Legal_Cannot_Unrequire_Declaration { + get { + return ResourceManager.GetString("Legal_Cannot_Unrequire_Declaration", resourceCulture); + } + } + /// /// Looks up a localized string similar to L'email de contact de votre entreprise est requis. /// diff --git a/Sheaft.Localization/Resources/MessageResources.resx b/Sheaft.Localization/Resources/MessageResources.resx index 7a6d74170..23c2762a3 100644 --- a/Sheaft.Localization/Resources/MessageResources.resx +++ b/Sheaft.Localization/Resources/MessageResources.resx @@ -742,123 +742,126 @@ La mise à jour de votre profile sur notre fournisseur d'identité à échouée - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + - + + + + Il n'est pas possible de basculer la déclaration en non requise \ No newline at end of file