diff --git a/Sheaft.Application.Commands/Producer/RegisterProducerCommand.cs b/Sheaft.Application.Commands/Producer/RegisterProducerCommand.cs index bfc6d8426..5e131224e 100644 --- a/Sheaft.Application.Commands/Producer/RegisterProducerCommand.cs +++ b/Sheaft.Application.Commands/Producer/RegisterProducerCommand.cs @@ -24,6 +24,7 @@ public RegisterProducerCommand(RequestUser requestUser) : base(requestUser) public BusinessLegalInput Legals { get; set; } public FullAddressInput Address { get; set; } public bool OpenForNewBusiness { get; set; } + public bool NotSubjectToVat { get; set; } public IEnumerable Tags { get; set; } } } diff --git a/Sheaft.Application.Commands/Producer/SetProducerProductsWithNoVatCommand.cs b/Sheaft.Application.Commands/Producer/SetProducerProductsWithNoVatCommand.cs new file mode 100644 index 000000000..d608e0ce2 --- /dev/null +++ b/Sheaft.Application.Commands/Producer/SetProducerProductsWithNoVatCommand.cs @@ -0,0 +1,16 @@ +using System; +using Sheaft.Core; +using Newtonsoft.Json; + +namespace Sheaft.Application.Commands +{ + public class SetProducerProductsWithNoVatCommand : Command + { + [JsonConstructor] + public SetProducerProductsWithNoVatCommand(RequestUser requestUser) : base(requestUser) + { + } + + public Guid ProducerId { get; set; } + } +} diff --git a/Sheaft.Application.Commands/Product/ProductCommand.cs b/Sheaft.Application.Commands/Product/ProductCommand.cs index 49a3f18f4..77b723eda 100644 --- a/Sheaft.Application.Commands/Product/ProductCommand.cs +++ b/Sheaft.Application.Commands/Product/ProductCommand.cs @@ -20,7 +20,7 @@ protected ProductCommand(RequestUser requestUser) : base(requestUser) public decimal QuantityPerUnit { get; set; } public UnitKind Unit { get; set; } public ConditioningKind Conditioning { get; set; } - public decimal Vat { get; set; } + public decimal? Vat { get; set; } public decimal? Weight { get; set; } public string Description { get; set; } public bool? Available { get; set; } diff --git a/Sheaft.Application.Handlers/Commands/ProducerCommandsHandler.cs b/Sheaft.Application.Handlers/Commands/ProducerCommandsHandler.cs index 736192b5d..b50be154d 100644 --- a/Sheaft.Application.Handlers/Commands/ProducerCommandsHandler.cs +++ b/Sheaft.Application.Handlers/Commands/ProducerCommandsHandler.cs @@ -24,7 +24,8 @@ public class ProducerCommandsHandler : ResultsHandler, IRequestHandler>, IRequestHandler>, IRequestHandler>, - IRequestHandler> + IRequestHandler>, + IRequestHandler> { private readonly RoleOptions _roleOptions; @@ -58,6 +59,7 @@ public async Task> Handle(RegisterProducerCommand request, Cancella producer = new Producer(request.RequestUser.Id, request.Name, request.FirstName, request.LastName, request.Email, address, request.OpenForNewBusiness, request.Phone, request.Description); + producer.SetNotSubjectToVat(request.NotSubjectToVat); if (request.Tags != null && request.Tags.Any()) { @@ -215,12 +217,31 @@ public async Task> Handle(UpdateProducerTagsCommand request, Cancel { var producer = await _context.GetByIdAsync(request.ProducerId, token); - var productTags = await _context.Products.Where(p => p.Producer.Id == producer.Id).SelectMany(p => p.Tags).Select(p => p.Tag).Distinct().ToListAsync(token); + var productTags = await _context.Products.Get(p => p.Producer.Id == producer.Id).SelectMany(p => p.Tags).Select(p => p.Tag).Distinct().ToListAsync(token); producer.SetTags(productTags); await _context.SaveChangesAsync(token); return Ok(true); }); } + + public async Task> Handle(SetProducerProductsWithNoVatCommand request, CancellationToken token) + { + return await ExecuteAsync(request, async () => + { + var producer = await _context.GetByIdAsync(request.ProducerId, token); + if (!producer.NotSubjectToVat) + return Ok(false); + + var products = await _context.FindAsync(p => p.Producer.Id == producer.Id, token); + foreach(var product in products) + { + product.SetVat(0); + await _context.SaveChangesAsync(token); + } + + return Ok(true); + }); + } } } \ No newline at end of file diff --git a/Sheaft.Application.Handlers/Commands/ProductCommandsHandler.cs b/Sheaft.Application.Handlers/Commands/ProductCommandsHandler.cs index 00f719ca0..c0dc0328f 100644 --- a/Sheaft.Application.Handlers/Commands/ProductCommandsHandler.cs +++ b/Sheaft.Application.Handlers/Commands/ProductCommandsHandler.cs @@ -65,8 +65,9 @@ public async Task> Handle(CreateProductCommand request, Cancellatio } var producer = await _context.GetByIdAsync(request.RequestUser.Id, token); - var entity = new Product(Guid.NewGuid(), request.Reference, request.Name, request.WholeSalePricePerUnit, request.Conditioning, request.Unit, request.QuantityPerUnit, request.Vat, producer); + var entity = new Product(Guid.NewGuid(), request.Reference, request.Name, request.WholeSalePricePerUnit, request.Conditioning, request.Unit, request.QuantityPerUnit, producer); + entity.SetVat(request.Vat); entity.SetDescription(request.Description); entity.SetAvailable(request.Available ?? true); entity.SetStoreVisibility(request.VisibleToStores ?? false); @@ -102,6 +103,7 @@ public async Task> Handle(UpdateProductCommand request, Cancellatio { var entity = await _context.GetByIdAsync(request.Id, token); + entity.SetVat(request.Vat); entity.SetName(request.Name); entity.SetDescription(request.Description); entity.SetVat(request.Vat); diff --git a/Sheaft.Application.Models/Dto/ProducerDto.cs b/Sheaft.Application.Models/Dto/ProducerDto.cs index 7f7f28f99..a726cbcb3 100644 --- a/Sheaft.Application.Models/Dto/ProducerDto.cs +++ b/Sheaft.Application.Models/Dto/ProducerDto.cs @@ -17,6 +17,7 @@ public class ProducerDto public string VatIdentifier { get; set; } public string Siret { get; set; } public bool OpenForNewBusiness { get; set; } + public bool NotSubjectToVat { get; set; } public AddressDto Address { get; set; } public IEnumerable Tags { get; set; } } diff --git a/Sheaft.Application.Models/Inputs/BusinessInput.cs b/Sheaft.Application.Models/Inputs/BusinessInput.cs index 19399e8fe..06e71eb06 100644 --- a/Sheaft.Application.Models/Inputs/BusinessInput.cs +++ b/Sheaft.Application.Models/Inputs/BusinessInput.cs @@ -14,6 +14,7 @@ public class BusinessInput public string Picture { get; set; } public FullAddressInput Address { get; set; } public bool OpenForNewBusiness { get; set; } + public bool NotSubjectToVat { get; set; } public IEnumerable Tags { get; set; } } } \ No newline at end of file diff --git a/Sheaft.Application.Models/Inputs/ProductInput.cs b/Sheaft.Application.Models/Inputs/ProductInput.cs index 2f8d09306..f10cbaf29 100644 --- a/Sheaft.Application.Models/Inputs/ProductInput.cs +++ b/Sheaft.Application.Models/Inputs/ProductInput.cs @@ -13,7 +13,7 @@ public class CreateProductInput public decimal QuantityPerUnit { get; set; } public UnitKind Unit { get; set; } public ConditioningKind Conditioning { get; set; } - public decimal Vat { get; set; } + public decimal? Vat { get; set; } public decimal? Weight { get; set; } public string Description { get; set; } public bool? Available { get; set; } diff --git a/Sheaft.Domain/Producer.cs b/Sheaft.Domain/Producer.cs index ed7a719d1..6dbc378fd 100644 --- a/Sheaft.Domain/Producer.cs +++ b/Sheaft.Domain/Producer.cs @@ -21,6 +21,7 @@ public Producer(Guid id, string name, string firstname, string lastname, string public virtual IReadOnlyCollection Tags => _tags?.AsReadOnly(); public bool CanDirectSell { get; set; } + public bool NotSubjectToVat { get; set; } public void SetTags(IEnumerable tags) { @@ -32,5 +33,10 @@ public void SetTags(IEnumerable tags) _tags = tags.Select(t => new ProducerTag(t)).ToList(); } + + public void SetNotSubjectToVat(bool notSubjectToVat) + { + NotSubjectToVat = notSubjectToVat; + } } } \ No newline at end of file diff --git a/Sheaft.Domain/Product.cs b/Sheaft.Domain/Product.cs index 03bbc6de5..92b56eede 100644 --- a/Sheaft.Domain/Product.cs +++ b/Sheaft.Domain/Product.cs @@ -19,7 +19,7 @@ protected Product() { } - public Product(Guid id, string reference, string name, decimal price, ConditioningKind conditioning, UnitKind unit, decimal quantityPerUnit, decimal vat, Producer producer) + public Product(Guid id, string reference, string name, decimal price, ConditioningKind conditioning, UnitKind unit, decimal quantityPerUnit, Producer producer) { Id = id; Producer = producer ?? throw new ValidationException(MessageKind.Product_Producer_Required); @@ -28,7 +28,6 @@ public Product(Guid id, string reference, string name, decimal price, Conditioni SetReference(reference); SetConditioning(conditioning, quantityPerUnit, unit); SetWholeSalePricePerUnit(price); - SetVat(vat); _tags = new List(); _ratings = new List(); @@ -136,15 +135,20 @@ public void SetWeight(decimal? newWeight) Weight = Math.Round(newWeight.Value, DIGITS_COUNT); } - public void SetVat(decimal newVat) + public void SetVat(decimal? newVat) { + if (Producer.NotSubjectToVat) + newVat = 0; + else if(!newVat.HasValue) + throw new ValidationException(MessageKind.Product_Vat_Required); + if (newVat < 0) throw new ValidationException(MessageKind.Product_Vat_CannotBe_LowerThan, 0); if (newVat > 100) throw new ValidationException(MessageKind.Product_Vat_CannotBe_GreaterThan, 100); - Vat = newVat; + Vat = newVat.Value; RefreshPrices(); } diff --git a/Sheaft.Exceptions/Enums/MessageKind.cs b/Sheaft.Exceptions/Enums/MessageKind.cs index 27b5c675b..f7565326a 100644 --- a/Sheaft.Exceptions/Enums/MessageKind.cs +++ b/Sheaft.Exceptions/Enums/MessageKind.cs @@ -50,6 +50,7 @@ public enum MessageKind Product_TagNotFound = 6110, Product_CannotRate_AlreadyRated = 6111, Product_BulkConditioning_Requires_Unit_ToBe_Specified = 6112, + Product_Vat_Required = 6113, Consumer = 7000, Consumer_Id_Invalid = 7101, Consumer_Email_Required = 7102, diff --git a/Sheaft.GraphQL.Types/Inputs/RegisterProducerInputType.cs b/Sheaft.GraphQL.Types/Inputs/RegisterProducerInputType.cs index a5785d5c9..5fc1973d5 100644 --- a/Sheaft.GraphQL.Types/Inputs/RegisterProducerInputType.cs +++ b/Sheaft.GraphQL.Types/Inputs/RegisterProducerInputType.cs @@ -8,6 +8,7 @@ public class RegisterProducerInputType : SheaftInputType protected override void Configure(IInputObjectTypeDescriptor descriptor) { descriptor.Field(c => c.OpenForNewBusiness); + descriptor.Field(c => c.NotSubjectToVat); descriptor.Field(c => c.Description); descriptor.Field(c => c.Phone); descriptor.Field(c => c.Picture); diff --git a/Sheaft.GraphQL.Types/Outputs/ProducerType.cs b/Sheaft.GraphQL.Types/Outputs/ProducerType.cs index 22f148f22..8377b3048 100644 --- a/Sheaft.GraphQL.Types/Outputs/ProducerType.cs +++ b/Sheaft.GraphQL.Types/Outputs/ProducerType.cs @@ -14,6 +14,7 @@ protected override void Configure(IObjectTypeDescriptor descriptor) descriptor.Field(c => c.Description); descriptor.Field(c => c.VatIdentifier); descriptor.Field(c => c.OpenForNewBusiness); + descriptor.Field(c => c.NotSubjectToVat); descriptor.Field(c => c.FirstName); descriptor.Field(c => c.LastName); descriptor.Field(c => c.Email); diff --git a/Sheaft.Infrastructure.Persistence/Migrations/20201108211137_Producer_NotSubjectToVat.Designer.cs b/Sheaft.Infrastructure.Persistence/Migrations/20201108211137_Producer_NotSubjectToVat.Designer.cs new file mode 100644 index 000000000..c85df6627 --- /dev/null +++ b/Sheaft.Infrastructure.Persistence/Migrations/20201108211137_Producer_NotSubjectToVat.Designer.cs @@ -0,0 +1,3272 @@ +// +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("20201108211137_Producer_NotSubjectToVat")] + partial class Producer_NotSubjectToVat + { + 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.Property("NotSubjectToVat") + .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/20201108211137_Producer_NotSubjectToVat.cs b/Sheaft.Infrastructure.Persistence/Migrations/20201108211137_Producer_NotSubjectToVat.cs new file mode 100644 index 000000000..d1cc21762 --- /dev/null +++ b/Sheaft.Infrastructure.Persistence/Migrations/20201108211137_Producer_NotSubjectToVat.cs @@ -0,0 +1,26 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Sheaft.Infrastructure.Persistence.Migrations +{ + public partial class Producer_NotSubjectToVat : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "NotSubjectToVat", + schema: "app", + table: "Users", + nullable: true); + + migrationBuilder.Sql("update app.users set NotSubjectToVat = 0 where Kind = 0"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "NotSubjectToVat", + schema: "app", + table: "Users"); + } + } +} diff --git a/Sheaft.Infrastructure.Persistence/Migrations/AppDbContextModelSnapshot.cs b/Sheaft.Infrastructure.Persistence/Migrations/AppDbContextModelSnapshot.cs index 948b2aaa1..b40d0c142 100644 --- a/Sheaft.Infrastructure.Persistence/Migrations/AppDbContextModelSnapshot.cs +++ b/Sheaft.Infrastructure.Persistence/Migrations/AppDbContextModelSnapshot.cs @@ -2211,6 +2211,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.Property("CanDirectSell") .HasColumnType("bit"); + b.Property("NotSubjectToVat") + .HasColumnType("bit"); + b.HasDiscriminator().HasValue(0); }); diff --git a/Sheaft.Localization/Resources/MessageResources.Designer.cs b/Sheaft.Localization/Resources/MessageResources.Designer.cs index 46ebe386d..ff50a0ab5 100644 --- a/Sheaft.Localization/Resources/MessageResources.Designer.cs +++ b/Sheaft.Localization/Resources/MessageResources.Designer.cs @@ -1293,6 +1293,15 @@ internal static string Product_Vat_CannotBe_LowerThan { } } + /// + /// Looks up a localized string similar to La TVA du produit est requise. + /// + internal static string Product_Vat_Required { + get { + return ResourceManager.GetString("Product_Vat_Required", resourceCulture); + } + } + /// /// Looks up a localized string similar to Le poids ne peut pas être inférieur ou égal à {0}. /// diff --git a/Sheaft.Localization/Resources/MessageResources.resx b/Sheaft.Localization/Resources/MessageResources.resx index c61ed1a69..877d3d71c 100644 --- a/Sheaft.Localization/Resources/MessageResources.resx +++ b/Sheaft.Localization/Resources/MessageResources.resx @@ -870,4 +870,7 @@ Impossible de créer un remboursement pour la commande, un remboursement est a déjà été effectué + + La TVA du produit est requise + \ No newline at end of file