From ad2a7f0161c9141054242ca631f0ea185cb07dcb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=ABl=20Mugnier?= <46538060+noelmugnier@users.noreply.github.com> Date: Thu, 11 Feb 2021 19:20:41 +0100 Subject: [PATCH] New - Ajout d'une property HasProducts aux producteurs pour affiner la map landing (#10) * New - Ajout d'une property HasProducts aux producteurs pour affiner la map du site landing * Fix - Correction SQL --- .../Commands/CreateDeliveryModeCommand.cs | 8 +- .../Commands/DeleteDeliveryModeCommand.cs | 10 +- .../Commands/RestoreDeliveryModeCommand.cs | 10 +- .../Commands/UpdateDeliveryModeCommand.cs | 14 +- .../Commands/CreateBusinessOrderCommand.cs | 2 +- .../Commands/GenerateProducersFileCommand.cs | 4 +- .../UpdateProducerAvailabilityCommand.cs | 55 + .../Commands/UpdateProducerProductsCommand.cs | 52 + .../Product/Commands/CreateProductCommand.cs | 3 + .../Product/Commands/DeleteProductCommand.cs | 5 +- .../Product/Commands/RestoreProductCommand.cs | 5 +- Sheaft.Domain/Producer.cs | 1 + ...215510_Add_ProducerHasProducts.Designer.cs | 3422 +++++++++++++++++ .../20210210215510_Add_ProducerHasProducts.cs | 26 + .../Migrations/AppDbContextModelSnapshot.cs | 380 +- 15 files changed, 3777 insertions(+), 220 deletions(-) create mode 100644 Sheaft.Application/Producer/Commands/UpdateProducerAvailabilityCommand.cs create mode 100644 Sheaft.Application/Producer/Commands/UpdateProducerProductsCommand.cs create mode 100644 Sheaft.Infrastructure/Persistence/Migrations/20210210215510_Add_ProducerHasProducts.Designer.cs create mode 100644 Sheaft.Infrastructure/Persistence/Migrations/20210210215510_Add_ProducerHasProducts.cs diff --git a/Sheaft.Application/DeliveryMode/Commands/CreateDeliveryModeCommand.cs b/Sheaft.Application/DeliveryMode/Commands/CreateDeliveryModeCommand.cs index ba2eb41bb..60d458556 100644 --- a/Sheaft.Application/DeliveryMode/Commands/CreateDeliveryModeCommand.cs +++ b/Sheaft.Application/DeliveryMode/Commands/CreateDeliveryModeCommand.cs @@ -12,6 +12,7 @@ using Sheaft.Application.Common.Interfaces.Services; using Sheaft.Application.Common.Models; using Sheaft.Application.Common.Models.Inputs; +using Sheaft.Application.Producer.Commands; using Sheaft.Domain; using Sheaft.Domain.Enum; @@ -76,13 +77,10 @@ public async Task> Handle(CreateDeliveryModeCommand request, Cancel entity.SetAutoCompleteRelatedPurchaseOrders(request.AutoCompleteRelatedPurchaseOrder); entity.SetMaxPurchaseOrdersPerTimeSlot(request.MaxPurchaseOrdersPerTimeSlot); - if (request.Kind == DeliveryKind.Collective || request.Kind == DeliveryKind.Farm || - request.Kind == DeliveryKind.Market) - producer.CanDirectSell = true; - await _context.AddAsync(entity, token); await _context.SaveChangesAsync(token); - + + _mediatr.Post(new UpdateProducerAvailabilityCommand(request.RequestUser) {ProducerId = entity.Producer.Id}); return Success(entity.Id); } } diff --git a/Sheaft.Application/DeliveryMode/Commands/DeleteDeliveryModeCommand.cs b/Sheaft.Application/DeliveryMode/Commands/DeleteDeliveryModeCommand.cs index 36226d1e5..1f54abfba 100644 --- a/Sheaft.Application/DeliveryMode/Commands/DeleteDeliveryModeCommand.cs +++ b/Sheaft.Application/DeliveryMode/Commands/DeleteDeliveryModeCommand.cs @@ -10,6 +10,7 @@ using Sheaft.Application.Common.Interfaces; using Sheaft.Application.Common.Interfaces.Services; using Sheaft.Application.Common.Models; +using Sheaft.Application.Producer.Commands; using Sheaft.Domain; using Sheaft.Domain.Enum; @@ -45,13 +46,10 @@ public async Task Handle(DeleteDeliveryModeCommand request, Cancellation return Failure(MessageKind.DeliveryMode_CannotRemove_With_Active_Agreements, entity.Name, activeAgreements); - _context.Remove(entity); - entity.Producer.CanDirectSell = await _context.DeliveryModes.AnyAsync( - c => !c.RemovedOn.HasValue && c.Producer.Id == entity.Producer.Id && - (c.Kind == DeliveryKind.Collective || c.Kind == DeliveryKind.Farm || - c.Kind == DeliveryKind.Market), token); - + _context.Remove(entity); await _context.SaveChangesAsync(token); + + _mediatr.Post(new UpdateProducerAvailabilityCommand(request.RequestUser) {ProducerId = entity.Producer.Id}); return Success(); } } diff --git a/Sheaft.Application/DeliveryMode/Commands/RestoreDeliveryModeCommand.cs b/Sheaft.Application/DeliveryMode/Commands/RestoreDeliveryModeCommand.cs index 7fb3d3fd2..833103634 100644 --- a/Sheaft.Application/DeliveryMode/Commands/RestoreDeliveryModeCommand.cs +++ b/Sheaft.Application/DeliveryMode/Commands/RestoreDeliveryModeCommand.cs @@ -10,6 +10,7 @@ using Sheaft.Application.Common.Interfaces; using Sheaft.Application.Common.Interfaces.Services; using Sheaft.Application.Common.Models; +using Sheaft.Application.Producer.Commands; using Sheaft.Domain; using Sheaft.Domain.Enum; @@ -42,13 +43,10 @@ public async Task Handle(RestoreDeliveryModeCommand request, Cancellatio await _context.DeliveryModes.SingleOrDefaultAsync(a => a.Id == request.DeliveryModeId && a.RemovedOn.HasValue, token); - _context.Restore(entity); - entity.Producer.CanDirectSell = await _context.DeliveryModes.AnyAsync( - c => !c.RemovedOn.HasValue && c.Producer.Id == entity.Producer.Id && - (c.Kind == DeliveryKind.Collective || c.Kind == DeliveryKind.Farm || - c.Kind == DeliveryKind.Market), token); - + _context.Restore(entity); await _context.SaveChangesAsync(token); + + _mediatr.Post(new UpdateProducerAvailabilityCommand(request.RequestUser) {ProducerId = entity.Producer.Id}); return Success(); } } diff --git a/Sheaft.Application/DeliveryMode/Commands/UpdateDeliveryModeCommand.cs b/Sheaft.Application/DeliveryMode/Commands/UpdateDeliveryModeCommand.cs index 15937f8d9..25647db81 100644 --- a/Sheaft.Application/DeliveryMode/Commands/UpdateDeliveryModeCommand.cs +++ b/Sheaft.Application/DeliveryMode/Commands/UpdateDeliveryModeCommand.cs @@ -13,6 +13,7 @@ using Sheaft.Application.Common.Interfaces.Services; using Sheaft.Application.Common.Models; using Sheaft.Application.Common.Models.Inputs; +using Sheaft.Application.Producer.Commands; using Sheaft.Domain; using Sheaft.Domain.Enum; @@ -77,18 +78,9 @@ public async Task Handle(UpdateDeliveryModeCommand request, Cancellation entity.SetOpeningHours(openingHours); } - if (request.Kind == DeliveryKind.Collective || request.Kind == DeliveryKind.Farm || - request.Kind == DeliveryKind.Market) - entity.Producer.CanDirectSell = true; - else - { - entity.Producer.CanDirectSell = await _context.DeliveryModes.AnyAsync( - c => !c.RemovedOn.HasValue && c.Producer.Id == entity.Producer.Id && - (c.Kind == DeliveryKind.Collective || c.Kind == DeliveryKind.Farm || - c.Kind == DeliveryKind.Market), token); - } - await _context.SaveChangesAsync(token); + + _mediatr.Post(new UpdateProducerAvailabilityCommand(request.RequestUser) {ProducerId = entity.Producer.Id}); return Success(); } } diff --git a/Sheaft.Application/Order/Commands/CreateBusinessOrderCommand.cs b/Sheaft.Application/Order/Commands/CreateBusinessOrderCommand.cs index 5eb336ff6..7ead6cd4e 100644 --- a/Sheaft.Application/Order/Commands/CreateBusinessOrderCommand.cs +++ b/Sheaft.Application/Order/Commands/CreateBusinessOrderCommand.cs @@ -66,7 +66,7 @@ public async Task>> Handle(CreateBusinessOrderCommand r var invalidProductIds = products .Where(p => p.RemovedOn.HasValue || !p.Available || !p.VisibleToStores || - p.Producer.RemovedOn.HasValue || !p.Producer.CanDirectSell) + p.Producer.RemovedOn.HasValue) .Select(p => p.Id.ToString("N")); if (invalidProductIds.Any()) return Failure>(MessageKind.Order_CannotCreate_Some_Products_Invalid, diff --git a/Sheaft.Application/Producer/Commands/GenerateProducersFileCommand.cs b/Sheaft.Application/Producer/Commands/GenerateProducersFileCommand.cs index f7dd80eed..add92cc8f 100644 --- a/Sheaft.Application/Producer/Commands/GenerateProducersFileCommand.cs +++ b/Sheaft.Application/Producer/Commands/GenerateProducersFileCommand.cs @@ -61,17 +61,19 @@ public async Task Handle(GenerateProducersFileCommand request, Cancellat internal class ProducerListItem { - internal ProducerListItem(Domain.User user) + internal ProducerListItem(Domain.Producer user) { Address = new AddressItem(user.Address); Id = user.Id.ToString("N"); Name = user.Name; Picture = user.Picture; + HasProducts = user.HasProducts; } public string Id { get; set; } public string Name { get; set; } public string Picture { get; set; } + public bool HasProducts { get; set; } public AddressItem Address { get; set; } } diff --git a/Sheaft.Application/Producer/Commands/UpdateProducerAvailabilityCommand.cs b/Sheaft.Application/Producer/Commands/UpdateProducerAvailabilityCommand.cs new file mode 100644 index 000000000..56a2c8ea1 --- /dev/null +++ b/Sheaft.Application/Producer/Commands/UpdateProducerAvailabilityCommand.cs @@ -0,0 +1,55 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using MediatR; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using Newtonsoft.Json; +using Sheaft.Application.Common; +using Sheaft.Application.Common.Handlers; +using Sheaft.Application.Common.Interfaces; +using Sheaft.Application.Common.Interfaces.Services; +using Sheaft.Application.Common.Models; +using Sheaft.Application.Common.Options; +using Sheaft.Application.Legal.Commands; +using Sheaft.Application.Wallet.Commands; +using Sheaft.Domain; +using Sheaft.Domain.Enum; + +namespace Sheaft.Application.Producer.Commands +{ + public class UpdateProducerAvailabilityCommand : Command + { + [JsonConstructor] + public UpdateProducerAvailabilityCommand(RequestUser requestUser) : base(requestUser) + { + } + + public Guid ProducerId { get; set; } + } + + public class UpdateProducerAvailabilityCommandHandler : CommandsHandler, + IRequestHandler + { + public UpdateProducerAvailabilityCommandHandler( + IAppDbContext context, + ISheaftMediatr mediatr, + ILogger logger) + : base(mediatr, context, logger) + { + } + + public async Task Handle(UpdateProducerAvailabilityCommand request, CancellationToken token) + { + var producer = await _context.FindByIdAsync(request.ProducerId, token); + producer.CanDirectSell = await _context.DeliveryModes.AnyAsync( + c => !c.RemovedOn.HasValue && c.Producer.Id == producer.Id && + (c.Kind == DeliveryKind.Collective || c.Kind == DeliveryKind.Farm || + c.Kind == DeliveryKind.Market), token); + + await _context.SaveChangesAsync(token); + return Success(); + } + } +} \ No newline at end of file diff --git a/Sheaft.Application/Producer/Commands/UpdateProducerProductsCommand.cs b/Sheaft.Application/Producer/Commands/UpdateProducerProductsCommand.cs new file mode 100644 index 000000000..2db468d97 --- /dev/null +++ b/Sheaft.Application/Producer/Commands/UpdateProducerProductsCommand.cs @@ -0,0 +1,52 @@ +using System; +using System.Threading; +using System.Threading.Tasks; +using MediatR; +using Microsoft.EntityFrameworkCore; +using Microsoft.Extensions.Logging; +using Microsoft.Extensions.Options; +using Newtonsoft.Json; +using Sheaft.Application.Common; +using Sheaft.Application.Common.Handlers; +using Sheaft.Application.Common.Interfaces; +using Sheaft.Application.Common.Interfaces.Services; +using Sheaft.Application.Common.Models; +using Sheaft.Application.Common.Options; +using Sheaft.Application.Legal.Commands; +using Sheaft.Application.Wallet.Commands; +using Sheaft.Domain; +using Sheaft.Domain.Enum; + +namespace Sheaft.Application.Producer.Commands +{ + public class UpdateProducerProductsCommand : Command + { + [JsonConstructor] + public UpdateProducerProductsCommand(RequestUser requestUser) : base(requestUser) + { + } + + public Guid ProducerId { get; set; } + } + + public class UpdateProducerProductsCommandHandler : CommandsHandler, + IRequestHandler + { + public UpdateProducerProductsCommandHandler( + IAppDbContext context, + ISheaftMediatr mediatr, + ILogger logger) + : base(mediatr, context, logger) + { + } + + public async Task Handle(UpdateProducerProductsCommand request, CancellationToken token) + { + var producer = await _context.FindByIdAsync(request.ProducerId, token); + producer.HasProducts = await _context.Products.AnyAsync(p => p.Producer.Id == producer.Id, token); + + await _context.SaveChangesAsync(token); + return Success(); + } + } +} \ No newline at end of file diff --git a/Sheaft.Application/Product/Commands/CreateProductCommand.cs b/Sheaft.Application/Product/Commands/CreateProductCommand.cs index 0a28aabe0..8dbad9045 100644 --- a/Sheaft.Application/Product/Commands/CreateProductCommand.cs +++ b/Sheaft.Application/Product/Commands/CreateProductCommand.cs @@ -121,6 +121,9 @@ public async Task> Handle(CreateProductCommand request, Cancellatio _mediatr.Post(new UpdateProducerTagsCommand(request.RequestUser) {ProducerId = request.ProducerId}); + _mediatr.Post(new UpdateProducerProductsCommand(request.RequestUser) + {ProducerId = request.ProducerId}); + return Success(entity.Id); } } diff --git a/Sheaft.Application/Product/Commands/DeleteProductCommand.cs b/Sheaft.Application/Product/Commands/DeleteProductCommand.cs index 87d974ab4..22f7e6ebe 100644 --- a/Sheaft.Application/Product/Commands/DeleteProductCommand.cs +++ b/Sheaft.Application/Product/Commands/DeleteProductCommand.cs @@ -9,6 +9,7 @@ using Sheaft.Application.Common.Interfaces; using Sheaft.Application.Common.Interfaces.Services; using Sheaft.Application.Common.Models; +using Sheaft.Application.Producer.Commands; using Sheaft.Domain; namespace Sheaft.Application.Product.Commands @@ -37,9 +38,11 @@ public DeleteProductCommandHandler( public async Task Handle(DeleteProductCommand request, CancellationToken token) { var entity = await _context.GetByIdAsync(request.ProductId, token); + _context.Remove(entity); - await _context.SaveChangesAsync(token); + + _mediatr.Post(new UpdateProducerProductsCommand(request.RequestUser) {ProducerId = entity.Producer.Id}); return Success(); } } diff --git a/Sheaft.Application/Product/Commands/RestoreProductCommand.cs b/Sheaft.Application/Product/Commands/RestoreProductCommand.cs index 5ebca83fb..8f534d20b 100644 --- a/Sheaft.Application/Product/Commands/RestoreProductCommand.cs +++ b/Sheaft.Application/Product/Commands/RestoreProductCommand.cs @@ -10,6 +10,7 @@ using Sheaft.Application.Common.Interfaces; using Sheaft.Application.Common.Interfaces.Services; using Sheaft.Application.Common.Models; +using Sheaft.Application.Producer.Commands; using Sheaft.Domain; namespace Sheaft.Application.Product.Commands @@ -39,9 +40,11 @@ public async Task Handle(RestoreProductCommand request, CancellationToke { var entity = await _context.Products.SingleOrDefaultAsync(a => a.Id == request.ProductId && a.RemovedOn.HasValue, token); + _context.Restore(entity); - await _context.SaveChangesAsync(token); + + _mediatr.Post(new UpdateProducerProductsCommand(request.RequestUser) {ProducerId = entity.Producer.Id}); return Success(); } } diff --git a/Sheaft.Domain/Producer.cs b/Sheaft.Domain/Producer.cs index b8bd791ee..fc9f8a748 100644 --- a/Sheaft.Domain/Producer.cs +++ b/Sheaft.Domain/Producer.cs @@ -23,6 +23,7 @@ public Producer(Guid id, string name, string firstname, string lastname, string public virtual IReadOnlyCollection Tags => _tags?.AsReadOnly(); + public bool HasProducts { get; set; } public bool CanDirectSell { get; set; } public bool NotSubjectToVat { get; private set; } diff --git a/Sheaft.Infrastructure/Persistence/Migrations/20210210215510_Add_ProducerHasProducts.Designer.cs b/Sheaft.Infrastructure/Persistence/Migrations/20210210215510_Add_ProducerHasProducts.Designer.cs new file mode 100644 index 000000000..fd34b6577 --- /dev/null +++ b/Sheaft.Infrastructure/Persistence/Migrations/20210210215510_Add_ProducerHasProducts.Designer.cs @@ -0,0 +1,3422 @@ +// +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.Enum; +using Sheaft.Infrastructure.Persistence; + +namespace Sheaft.Infrastructure.Persistence.Migrations +{ + [DbContext(typeof(AppDbContext))] + [Migration("20210210215510_Add_ProducerHasProducts")] + partial class Add_ProducerHasProducts + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("app") + .HasAnnotation("ProductVersion", "3.1.10") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Sheaft.Domain.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.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.DeliveryMode", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AutoAcceptRelatedPurchaseOrder") + .HasColumnType("bit"); + + b.Property("AutoCompleteRelatedPurchaseOrder") + .HasColumnType("bit"); + + 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("MaxPurchaseOrdersPerTimeSlot") + .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.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.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.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.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.Property("Validation") + .HasColumnType("int"); + + 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.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.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.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.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("FeesVatPercent") + .ValueGeneratedOnAdd() + .HasColumnType("decimal(10,2)") + .HasDefaultValue(0m); + + 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.OrderDelivery", b => + { + b.Property("OrderUid") + .HasColumnType("bigint"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Comment") + .HasColumnType("nvarchar(max)"); + + b.Property("DeliveryModeUid") + .HasColumnType("bigint"); + + b.HasKey("OrderUid", "Id"); + + b.HasIndex("DeliveryModeUid"); + + b.ToTable("OrderDeliveries"); + }); + + modelBuilder.Entity("Sheaft.Domain.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.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.Withholding", 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("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("Uid", "Id", "AuthorUid", "CreditedWalletUid", "DebitedWalletUid", "RemovedOn"); + + b.ToTable("Withholdings"); + }); + + modelBuilder.Entity("Sheaft.Domain.BusinessLegal", b => + { + b.HasBaseType("Sheaft.Domain.Legal"); + + b.Property("Email") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("Siret") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("VatIdentifier") + .HasColumnType("nvarchar(max)"); + + b.HasDiscriminator().HasValue(1); + }); + + modelBuilder.Entity("Sheaft.Domain.ConsumerLegal", b => + { + b.HasBaseType("Sheaft.Domain.Legal"); + + b.HasDiscriminator().HasValue(0); + }); + + modelBuilder.Entity("Sheaft.Domain.CardPayin", b => + { + b.HasBaseType("Sheaft.Domain.Payin"); + + b.Property("CardUid") + .HasColumnType("bigint"); + + b.HasIndex("CardUid"); + + b.HasDiscriminator().HasValue(1); + }); + + modelBuilder.Entity("Sheaft.Domain.WebPayin", b => + { + b.HasBaseType("Sheaft.Domain.Payin"); + + b.Property("RedirectUrl") + .HasColumnType("nvarchar(max)"); + + b.HasDiscriminator().HasValue(0); + }); + + modelBuilder.Entity("Sheaft.Domain.BankAccount", b => + { + b.HasBaseType("Sheaft.Domain.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.Card", b => + { + b.HasBaseType("Sheaft.Domain.PaymentMethod"); + + b.HasDiscriminator().HasValue(1); + }); + + modelBuilder.Entity("Sheaft.Domain.PayinRefund", b => + { + b.HasBaseType("Sheaft.Domain.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.Admin", b => + { + b.HasBaseType("Sheaft.Domain.User"); + + b.HasDiscriminator().HasValue(4); + }); + + modelBuilder.Entity("Sheaft.Domain.Business", b => + { + b.HasBaseType("Sheaft.Domain.User"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("OpenForNewBusiness") + .HasColumnType("bit"); + + b.HasDiscriminator(); + }); + + modelBuilder.Entity("Sheaft.Domain.Consumer", b => + { + b.HasBaseType("Sheaft.Domain.User"); + + b.Property("Anonymous") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.HasDiscriminator().HasValue(2); + }); + + modelBuilder.Entity("Sheaft.Domain.Support", b => + { + b.HasBaseType("Sheaft.Domain.User"); + + b.HasDiscriminator().HasValue(3); + }); + + modelBuilder.Entity("Sheaft.Domain.Producer", b => + { + b.HasBaseType("Sheaft.Domain.Business"); + + b.Property("CanDirectSell") + .HasColumnType("bit"); + + b.Property("HasProducts") + .HasColumnType("bit"); + + b.Property("NotSubjectToVat") + .HasColumnType("bit"); + + b.HasDiscriminator().HasValue(0); + }); + + modelBuilder.Entity("Sheaft.Domain.Store", b => + { + b.HasBaseType("Sheaft.Domain.Business"); + + b.HasDiscriminator().HasValue(1); + }); + + modelBuilder.Entity("Sheaft.Domain.Agreement", b => + { + b.HasOne("Sheaft.Domain.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedByUid"); + + b.HasOne("Sheaft.Domain.DeliveryMode", "Delivery") + .WithMany() + .HasForeignKey("DeliveryModeUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Store", "Store") + .WithMany() + .HasForeignKey("StoreUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Sheaft.Domain.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.DeliveryMode", b => + { + b.HasOne("Sheaft.Domain.Producer", "Producer") + .WithMany() + .HasForeignKey("ProducerUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Sheaft.Domain.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.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.Department", b => + { + b.HasOne("Sheaft.Domain.Level", "Level") + .WithMany() + .HasForeignKey("LevelUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Region", "Region") + .WithMany() + .HasForeignKey("RegionUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Donation", b => + { + b.HasOne("Sheaft.Domain.User", "Author") + .WithMany() + .HasForeignKey("AuthorUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Wallet", "CreditedWallet") + .WithMany() + .HasForeignKey("CreditedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Wallet", "DebitedWallet") + .WithMany() + .HasForeignKey("DebitedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Order", "Order") + .WithMany() + .HasForeignKey("OrderUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Job", b => + { + b.HasOne("Sheaft.Domain.User", "User") + .WithMany() + .HasForeignKey("UserUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Legal", b => + { + b.HasOne("Sheaft.Domain.User", "User") + .WithOne("Legal") + .HasForeignKey("Sheaft.Domain.Legal", "UserUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Sheaft.Domain.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.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.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.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.Notification", b => + { + b.HasOne("Sheaft.Domain.User", "User") + .WithMany() + .HasForeignKey("UserUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Order", b => + { + b.HasOne("Sheaft.Domain.Donation", "Donation") + .WithOne() + .HasForeignKey("Sheaft.Domain.Order", "DonationUid") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Sheaft.Domain.Payin", "Payin") + .WithOne() + .HasForeignKey("Sheaft.Domain.Order", "PayinUid") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Sheaft.Domain.User", "User") + .WithMany() + .HasForeignKey("UserUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.OrderDelivery", b => + { + b.HasOne("Sheaft.Domain.DeliveryMode", "DeliveryMode") + .WithMany() + .HasForeignKey("DeliveryModeUid"); + + b.HasOne("Sheaft.Domain.Order", null) + .WithMany("Deliveries") + .HasForeignKey("OrderUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Sheaft.Domain.ExpectedOrderDelivery", "ExpectedDelivery", b1 => + { + b1.Property("OrderDeliveryOrderUid") + .HasColumnType("bigint"); + + b1.Property("OrderDeliveryId") + .HasColumnType("uniqueidentifier"); + + b1.Property("ExpectedDeliveryDate") + .HasColumnType("datetimeoffset"); + + b1.Property("From") + .HasColumnType("time"); + + b1.Property("To") + .HasColumnType("time"); + + b1.HasKey("OrderDeliveryOrderUid", "OrderDeliveryId"); + + b1.ToTable("OrderDeliveries"); + + b1.WithOwner() + .HasForeignKey("OrderDeliveryOrderUid", "OrderDeliveryId"); + }); + }); + + modelBuilder.Entity("Sheaft.Domain.OrderProduct", b => + { + b.HasOne("Sheaft.Domain.Order", null) + .WithMany("Products") + .HasForeignKey("OrderUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.User", "Producer") + .WithMany() + .HasForeignKey("ProducerUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Payin", b => + { + b.HasOne("Sheaft.Domain.User", "Author") + .WithMany() + .HasForeignKey("AuthorUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Wallet", "CreditedWallet") + .WithMany() + .HasForeignKey("CreditedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Order", "Order") + .WithMany() + .HasForeignKey("OrderUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.PaymentMethod", b => + { + b.HasOne("Sheaft.Domain.User", "User") + .WithMany() + .HasForeignKey("UserUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Payout", b => + { + b.HasOne("Sheaft.Domain.User", "Author") + .WithMany() + .HasForeignKey("AuthorUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.BankAccount", "BankAccount") + .WithMany() + .HasForeignKey("BankAccountUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Wallet", "DebitedWallet") + .WithMany() + .HasForeignKey("DebitedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.ProducerTag", b => + { + b.HasOne("Sheaft.Domain.Producer", null) + .WithMany("Tags") + .HasForeignKey("ProducerUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Tag", "Tag") + .WithMany() + .HasForeignKey("TagUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Product", b => + { + b.HasOne("Sheaft.Domain.Producer", "Producer") + .WithMany() + .HasForeignKey("ProducerUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Returnable", "Returnable") + .WithMany() + .HasForeignKey("ReturnableUid") + .OnDelete(DeleteBehavior.NoAction); + }); + + modelBuilder.Entity("Sheaft.Domain.ProductTag", b => + { + b.HasOne("Sheaft.Domain.Product", null) + .WithMany("Tags") + .HasForeignKey("ProductUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Tag", "Tag") + .WithMany() + .HasForeignKey("TagUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.PurchaseOrder", b => + { + b.HasOne("Sheaft.Domain.Order", null) + .WithMany("PurchaseOrders") + .HasForeignKey("OrderUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.PurchaseOrderSender", "Sender") + .WithOne() + .HasForeignKey("Sheaft.Domain.PurchaseOrder", "PurchaseOrderSenderUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.PurchaseOrderVendor", "Vendor") + .WithOne() + .HasForeignKey("Sheaft.Domain.PurchaseOrder", "PurchaseOrderVendorUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Transfer", "Transfer") + .WithOne() + .HasForeignKey("Sheaft.Domain.PurchaseOrder", "TransferUid") + .OnDelete(DeleteBehavior.NoAction); + + b.OwnsOne("Sheaft.Domain.ExpectedPurchaseOrderDelivery", "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.ExpectedAddress", "Address", b2 => + { + b2.Property("ExpectedPurchaseOrderDeliveryPurchaseOrderUid") + .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("ExpectedPurchaseOrderDeliveryPurchaseOrderUid"); + + b2.ToTable("ExpectedDeliveries"); + + b2.WithOwner() + .HasForeignKey("ExpectedPurchaseOrderDeliveryPurchaseOrderUid"); + }); + }); + }); + + modelBuilder.Entity("Sheaft.Domain.PurchaseOrderProduct", b => + { + b.HasOne("Sheaft.Domain.PurchaseOrder", null) + .WithMany("Products") + .HasForeignKey("PurchaseOrderUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.QuickOrder", b => + { + b.HasOne("Sheaft.Domain.User", "User") + .WithMany() + .HasForeignKey("UserUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.QuickOrderProduct", b => + { + b.HasOne("Sheaft.Domain.Product", "Product") + .WithMany() + .HasForeignKey("ProductUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.QuickOrder", null) + .WithMany("Products") + .HasForeignKey("QuickOrderUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Rating", b => + { + b.HasOne("Sheaft.Domain.Product", null) + .WithMany("Ratings") + .HasForeignKey("ProductUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.User", "User") + .WithMany() + .HasForeignKey("UserUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Refund", b => + { + b.HasOne("Sheaft.Domain.User", "Author") + .WithMany() + .HasForeignKey("AuthorUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Wallet", "DebitedWallet") + .WithMany() + .HasForeignKey("DebitedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Returnable", b => + { + b.HasOne("Sheaft.Domain.Producer", "Producer") + .WithMany() + .HasForeignKey("ProducerUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Reward", b => + { + b.HasOne("Sheaft.Domain.Department", "Department") + .WithMany() + .HasForeignKey("DepartmentUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Level", "Level") + .WithMany("Rewards") + .HasForeignKey("LevelUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Consumer", "Winner") + .WithMany() + .HasForeignKey("WinnerUid"); + }); + + modelBuilder.Entity("Sheaft.Domain.Sponsoring", b => + { + b.HasOne("Sheaft.Domain.User", "Sponsor") + .WithMany() + .HasForeignKey("SponsorUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.User", "Sponsored") + .WithMany() + .HasForeignKey("SponsoredUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.StoreTag", b => + { + b.HasOne("Sheaft.Domain.Store", null) + .WithMany("Tags") + .HasForeignKey("StoreUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Tag", "Tag") + .WithMany() + .HasForeignKey("TagUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Transfer", b => + { + b.HasOne("Sheaft.Domain.User", "Author") + .WithMany() + .HasForeignKey("AuthorUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Wallet", "CreditedWallet") + .WithMany() + .HasForeignKey("CreditedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Wallet", "DebitedWallet") + .WithMany() + .HasForeignKey("DebitedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Payout", "Payout") + .WithMany("Transfers") + .HasForeignKey("PayoutUid") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Sheaft.Domain.PurchaseOrder", "PurchaseOrder") + .WithMany() + .HasForeignKey("PurchaseOrderUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.User", b => + { + b.OwnsMany("Sheaft.Domain.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.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.Department", "Department") + .WithMany() + .HasForeignKey("DepartmentUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b1.WithOwner() + .HasForeignKey("UserUid"); + }); + }); + + modelBuilder.Entity("Sheaft.Domain.Wallet", b => + { + b.HasOne("Sheaft.Domain.User", "User") + .WithMany() + .HasForeignKey("UserUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Withholding", b => + { + b.HasOne("Sheaft.Domain.User", "Author") + .WithMany() + .HasForeignKey("AuthorUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Wallet", "CreditedWallet") + .WithMany() + .HasForeignKey("CreditedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Wallet", "DebitedWallet") + .WithMany() + .HasForeignKey("DebitedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Payout", "Payout") + .WithMany("Withholdings") + .HasForeignKey("PayoutUid") + .OnDelete(DeleteBehavior.NoAction); + }); + + modelBuilder.Entity("Sheaft.Domain.BusinessLegal", b => + { + b.OwnsOne("Sheaft.Domain.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.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.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.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.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.CardPayin", b => + { + b.HasOne("Sheaft.Domain.Card", "Card") + .WithMany() + .HasForeignKey("CardUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.PayinRefund", b => + { + b.HasOne("Sheaft.Domain.Payin", "Payin") + .WithMany("Refunds") + .HasForeignKey("PayinUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.PurchaseOrder", "PurchaseOrder") + .WithMany() + .HasForeignKey("PurchaseOrderUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Store", b => + { + b.OwnsMany("Sheaft.Domain.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/20210210215510_Add_ProducerHasProducts.cs b/Sheaft.Infrastructure/Persistence/Migrations/20210210215510_Add_ProducerHasProducts.cs new file mode 100644 index 000000000..88b70096a --- /dev/null +++ b/Sheaft.Infrastructure/Persistence/Migrations/20210210215510_Add_ProducerHasProducts.cs @@ -0,0 +1,26 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Sheaft.Infrastructure.Persistence.Migrations +{ + public partial class Add_ProducerHasProducts : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "HasProducts", + schema: "app", + table: "Users", + nullable: true); + + migrationBuilder.Sql("WITH t1 AS (SELECT u.Id, case when count(p.Id) > 0 then 1 else 0 end as hasProduct FROM app.Users u JOIN app.Products p on p.ProducerUid = u.Uid GROUP BY u.Id) UPDATE t SET t.HasProducts = t1.hasProduct FROM app.Users AS t LEFT JOIN t1 ON t1.Id = t.Id"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "HasProducts", + schema: "app", + table: "Users"); + } + } +} diff --git a/Sheaft.Infrastructure/Persistence/Migrations/AppDbContextModelSnapshot.cs b/Sheaft.Infrastructure/Persistence/Migrations/AppDbContextModelSnapshot.cs index 01b23514d..a86ce5a8a 100644 --- a/Sheaft.Infrastructure/Persistence/Migrations/AppDbContextModelSnapshot.cs +++ b/Sheaft.Infrastructure/Persistence/Migrations/AppDbContextModelSnapshot.cs @@ -4,6 +4,7 @@ using Microsoft.EntityFrameworkCore.Infrastructure; using Microsoft.EntityFrameworkCore.Metadata; using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Sheaft.Domain.Enum; using Sheaft.Infrastructure.Persistence; namespace Sheaft.Infrastructure.Persistence.Migrations @@ -20,7 +21,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); - modelBuilder.Entity("Sheaft.Domain.Models.Agreement", b => + modelBuilder.Entity("Sheaft.Domain.Agreement", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -71,7 +72,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Agreements"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Country", b => + modelBuilder.Entity("Sheaft.Domain.Country", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -99,7 +100,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Countries"); }); - modelBuilder.Entity("Sheaft.Domain.Models.DeliveryMode", b => + modelBuilder.Entity("Sheaft.Domain.DeliveryMode", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -158,7 +159,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("DeliveryModes"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Department", b => + modelBuilder.Entity("Sheaft.Domain.Department", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -231,7 +232,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Departments"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Donation", b => + modelBuilder.Entity("Sheaft.Domain.Donation", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -313,7 +314,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Donations"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Job", b => + modelBuilder.Entity("Sheaft.Domain.Job", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -382,7 +383,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Jobs"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Legal", b => + modelBuilder.Entity("Sheaft.Domain.Legal", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -429,7 +430,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasDiscriminator("UserKind"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Level", b => + modelBuilder.Entity("Sheaft.Domain.Level", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -466,7 +467,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Levels"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Nationality", b => + modelBuilder.Entity("Sheaft.Domain.Nationality", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -494,7 +495,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Nationalities"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Notification", b => + modelBuilder.Entity("Sheaft.Domain.Notification", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -541,7 +542,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Notifications"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Order", b => + modelBuilder.Entity("Sheaft.Domain.Order", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -664,7 +665,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Orders"); }); - modelBuilder.Entity("Sheaft.Domain.Models.OrderDelivery", b => + modelBuilder.Entity("Sheaft.Domain.OrderDelivery", b => { b.Property("OrderUid") .HasColumnType("bigint"); @@ -685,7 +686,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("OrderDeliveries"); }); - modelBuilder.Entity("Sheaft.Domain.Models.OrderProduct", b => + modelBuilder.Entity("Sheaft.Domain.OrderProduct", b => { b.Property("OrderUid") .HasColumnType("bigint"); @@ -778,7 +779,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("OrderProducts"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Payin", b => + modelBuilder.Entity("Sheaft.Domain.Payin", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -857,7 +858,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasDiscriminator("Kind"); }); - modelBuilder.Entity("Sheaft.Domain.Models.PaymentMethod", b => + modelBuilder.Entity("Sheaft.Domain.PaymentMethod", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -909,7 +910,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasDiscriminator("Kind"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Payout", b => + modelBuilder.Entity("Sheaft.Domain.Payout", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -986,7 +987,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Payouts"); }); - modelBuilder.Entity("Sheaft.Domain.Models.ProducerTag", b => + modelBuilder.Entity("Sheaft.Domain.ProducerTag", b => { b.Property("ProducerUid") .HasColumnType("bigint"); @@ -1001,7 +1002,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("ProducerTags"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Product", b => + modelBuilder.Entity("Sheaft.Domain.Product", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -1108,7 +1109,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Products"); }); - modelBuilder.Entity("Sheaft.Domain.Models.ProductTag", b => + modelBuilder.Entity("Sheaft.Domain.ProductTag", b => { b.Property("ProductUid") .HasColumnType("bigint"); @@ -1123,7 +1124,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("ProductTags"); }); - modelBuilder.Entity("Sheaft.Domain.Models.PurchaseOrder", b => + modelBuilder.Entity("Sheaft.Domain.PurchaseOrder", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -1244,7 +1245,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("PurchaseOrders"); }); - modelBuilder.Entity("Sheaft.Domain.Models.PurchaseOrderProduct", b => + modelBuilder.Entity("Sheaft.Domain.PurchaseOrderProduct", b => { b.Property("PurchaseOrderUid") .HasColumnType("bigint"); @@ -1332,7 +1333,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("PurchaseOrderProducts"); }); - modelBuilder.Entity("Sheaft.Domain.Models.PurchaseOrderSender", b => + modelBuilder.Entity("Sheaft.Domain.PurchaseOrderSender", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -1366,7 +1367,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("PurchaseOrderSenders"); }); - modelBuilder.Entity("Sheaft.Domain.Models.PurchaseOrderVendor", b => + modelBuilder.Entity("Sheaft.Domain.PurchaseOrderVendor", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -1400,7 +1401,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("PurchaseOrderVendors"); }); - modelBuilder.Entity("Sheaft.Domain.Models.QuickOrder", b => + modelBuilder.Entity("Sheaft.Domain.QuickOrder", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -1445,7 +1446,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("QuickOrders"); }); - modelBuilder.Entity("Sheaft.Domain.Models.QuickOrderProduct", b => + modelBuilder.Entity("Sheaft.Domain.QuickOrderProduct", b => { b.Property("QuickOrderUid") .HasColumnType("bigint"); @@ -1464,7 +1465,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("QuickOrderProducts"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Rating", b => + modelBuilder.Entity("Sheaft.Domain.Rating", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -1510,7 +1511,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Ratings"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Refund", b => + modelBuilder.Entity("Sheaft.Domain.Refund", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -1584,7 +1585,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasDiscriminator("Kind"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Region", b => + modelBuilder.Entity("Sheaft.Domain.Region", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -1647,7 +1648,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Regions"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Returnable", b => + modelBuilder.Entity("Sheaft.Domain.Returnable", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -1706,7 +1707,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Returnables"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Reward", b => + modelBuilder.Entity("Sheaft.Domain.Reward", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -1773,7 +1774,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Rewards"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Sponsoring", b => + modelBuilder.Entity("Sheaft.Domain.Sponsoring", b => { b.Property("SponsorUid") .HasColumnType("bigint"); @@ -1794,7 +1795,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Sponsorings"); }); - modelBuilder.Entity("Sheaft.Domain.Models.StoreTag", b => + modelBuilder.Entity("Sheaft.Domain.StoreTag", b => { b.Property("StoreUid") .HasColumnType("bigint"); @@ -1809,7 +1810,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("StoreTags"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Tag", b => + modelBuilder.Entity("Sheaft.Domain.Tag", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -1858,7 +1859,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Tags"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Transfer", b => + modelBuilder.Entity("Sheaft.Domain.Transfer", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -1945,7 +1946,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Transfers"); }); - modelBuilder.Entity("Sheaft.Domain.Models.User", b => + modelBuilder.Entity("Sheaft.Domain.User", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -2018,7 +2019,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasDiscriminator("Kind"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Wallet", b => + modelBuilder.Entity("Sheaft.Domain.Wallet", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -2071,7 +2072,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Wallets"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Withholding", b => + modelBuilder.Entity("Sheaft.Domain.Withholding", b => { b.Property("Uid") .ValueGeneratedOnAdd() @@ -2153,9 +2154,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.ToTable("Withholdings"); }); - modelBuilder.Entity("Sheaft.Domain.Models.BusinessLegal", b => + modelBuilder.Entity("Sheaft.Domain.BusinessLegal", b => { - b.HasBaseType("Sheaft.Domain.Models.Legal"); + b.HasBaseType("Sheaft.Domain.Legal"); b.Property("Email") .HasColumnType("nvarchar(max)"); @@ -2173,16 +2174,16 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasDiscriminator().HasValue(1); }); - modelBuilder.Entity("Sheaft.Domain.Models.ConsumerLegal", b => + modelBuilder.Entity("Sheaft.Domain.ConsumerLegal", b => { - b.HasBaseType("Sheaft.Domain.Models.Legal"); + b.HasBaseType("Sheaft.Domain.Legal"); b.HasDiscriminator().HasValue(0); }); - modelBuilder.Entity("Sheaft.Domain.Models.CardPayin", b => + modelBuilder.Entity("Sheaft.Domain.CardPayin", b => { - b.HasBaseType("Sheaft.Domain.Models.Payin"); + b.HasBaseType("Sheaft.Domain.Payin"); b.Property("CardUid") .HasColumnType("bigint"); @@ -2192,9 +2193,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasDiscriminator().HasValue(1); }); - modelBuilder.Entity("Sheaft.Domain.Models.WebPayin", b => + modelBuilder.Entity("Sheaft.Domain.WebPayin", b => { - b.HasBaseType("Sheaft.Domain.Models.Payin"); + b.HasBaseType("Sheaft.Domain.Payin"); b.Property("RedirectUrl") .HasColumnType("nvarchar(max)"); @@ -2202,9 +2203,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasDiscriminator().HasValue(0); }); - modelBuilder.Entity("Sheaft.Domain.Models.BankAccount", b => + modelBuilder.Entity("Sheaft.Domain.BankAccount", b => { - b.HasBaseType("Sheaft.Domain.Models.PaymentMethod"); + b.HasBaseType("Sheaft.Domain.PaymentMethod"); b.Property("BIC") .IsRequired() @@ -2236,16 +2237,16 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasDiscriminator().HasValue(0); }); - modelBuilder.Entity("Sheaft.Domain.Models.Card", b => + modelBuilder.Entity("Sheaft.Domain.Card", b => { - b.HasBaseType("Sheaft.Domain.Models.PaymentMethod"); + b.HasBaseType("Sheaft.Domain.PaymentMethod"); b.HasDiscriminator().HasValue(1); }); - modelBuilder.Entity("Sheaft.Domain.Models.PayinRefund", b => + modelBuilder.Entity("Sheaft.Domain.PayinRefund", b => { - b.HasBaseType("Sheaft.Domain.Models.Refund"); + b.HasBaseType("Sheaft.Domain.Refund"); b.Property("PayinUid") .HasColumnType("bigint"); @@ -2260,16 +2261,16 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasDiscriminator().HasValue(300); }); - modelBuilder.Entity("Sheaft.Domain.Models.Admin", b => + modelBuilder.Entity("Sheaft.Domain.Admin", b => { - b.HasBaseType("Sheaft.Domain.Models.User"); + b.HasBaseType("Sheaft.Domain.User"); b.HasDiscriminator().HasValue(4); }); - modelBuilder.Entity("Sheaft.Domain.Models.Business", b => + modelBuilder.Entity("Sheaft.Domain.Business", b => { - b.HasBaseType("Sheaft.Domain.Models.User"); + b.HasBaseType("Sheaft.Domain.User"); b.Property("Description") .HasColumnType("nvarchar(max)"); @@ -2280,9 +2281,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasDiscriminator(); }); - modelBuilder.Entity("Sheaft.Domain.Models.Consumer", b => + modelBuilder.Entity("Sheaft.Domain.Consumer", b => { - b.HasBaseType("Sheaft.Domain.Models.User"); + b.HasBaseType("Sheaft.Domain.User"); b.Property("Anonymous") .ValueGeneratedOnAdd() @@ -2292,52 +2293,55 @@ protected override void BuildModel(ModelBuilder modelBuilder) b.HasDiscriminator().HasValue(2); }); - modelBuilder.Entity("Sheaft.Domain.Models.Support", b => + modelBuilder.Entity("Sheaft.Domain.Support", b => { - b.HasBaseType("Sheaft.Domain.Models.User"); + b.HasBaseType("Sheaft.Domain.User"); b.HasDiscriminator().HasValue(3); }); - modelBuilder.Entity("Sheaft.Domain.Models.Producer", b => + modelBuilder.Entity("Sheaft.Domain.Producer", b => { - b.HasBaseType("Sheaft.Domain.Models.Business"); + b.HasBaseType("Sheaft.Domain.Business"); b.Property("CanDirectSell") .HasColumnType("bit"); + b.Property("HasProducts") + .HasColumnType("bit"); + b.Property("NotSubjectToVat") .HasColumnType("bit"); b.HasDiscriminator().HasValue(0); }); - modelBuilder.Entity("Sheaft.Domain.Models.Store", b => + modelBuilder.Entity("Sheaft.Domain.Store", b => { - b.HasBaseType("Sheaft.Domain.Models.Business"); + b.HasBaseType("Sheaft.Domain.Business"); b.HasDiscriminator().HasValue(1); }); - modelBuilder.Entity("Sheaft.Domain.Models.Agreement", b => + modelBuilder.Entity("Sheaft.Domain.Agreement", b => { - b.HasOne("Sheaft.Domain.Models.User", "CreatedBy") + b.HasOne("Sheaft.Domain.User", "CreatedBy") .WithMany() .HasForeignKey("CreatedByUid"); - b.HasOne("Sheaft.Domain.Models.DeliveryMode", "Delivery") + b.HasOne("Sheaft.Domain.DeliveryMode", "Delivery") .WithMany() .HasForeignKey("DeliveryModeUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Store", "Store") + b.HasOne("Sheaft.Domain.Store", "Store") .WithMany() .HasForeignKey("StoreUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.OwnsMany("Sheaft.Domain.Models.TimeSlotHour", "SelectedHours", b1 => + b.OwnsMany("Sheaft.Domain.TimeSlotHour", "SelectedHours", b1 => { b1.Property("AgreementUid") .HasColumnType("bigint"); @@ -2365,15 +2369,15 @@ protected override void BuildModel(ModelBuilder modelBuilder) }); }); - modelBuilder.Entity("Sheaft.Domain.Models.DeliveryMode", b => + modelBuilder.Entity("Sheaft.Domain.DeliveryMode", b => { - b.HasOne("Sheaft.Domain.Models.Producer", "Producer") + b.HasOne("Sheaft.Domain.Producer", "Producer") .WithMany() .HasForeignKey("ProducerUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.OwnsOne("Sheaft.Domain.Models.DeliveryAddress", "Address", b1 => + b.OwnsOne("Sheaft.Domain.DeliveryAddress", "Address", b1 => { b1.Property("DeliveryModeUid") .ValueGeneratedOnAdd() @@ -2409,7 +2413,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("DeliveryModeUid"); }); - b.OwnsMany("Sheaft.Domain.Models.TimeSlotHour", "OpeningHours", b1 => + b.OwnsMany("Sheaft.Domain.TimeSlotHour", "OpeningHours", b1 => { b1.Property("DeliveryModeUid") .HasColumnType("bigint"); @@ -2437,66 +2441,66 @@ protected override void BuildModel(ModelBuilder modelBuilder) }); }); - modelBuilder.Entity("Sheaft.Domain.Models.Department", b => + modelBuilder.Entity("Sheaft.Domain.Department", b => { - b.HasOne("Sheaft.Domain.Models.Level", "Level") + b.HasOne("Sheaft.Domain.Level", "Level") .WithMany() .HasForeignKey("LevelUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Region", "Region") + b.HasOne("Sheaft.Domain.Region", "Region") .WithMany() .HasForeignKey("RegionUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.Donation", b => + modelBuilder.Entity("Sheaft.Domain.Donation", b => { - b.HasOne("Sheaft.Domain.Models.User", "Author") + b.HasOne("Sheaft.Domain.User", "Author") .WithMany() .HasForeignKey("AuthorUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Wallet", "CreditedWallet") + b.HasOne("Sheaft.Domain.Wallet", "CreditedWallet") .WithMany() .HasForeignKey("CreditedWalletUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Wallet", "DebitedWallet") + b.HasOne("Sheaft.Domain.Wallet", "DebitedWallet") .WithMany() .HasForeignKey("DebitedWalletUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Order", "Order") + b.HasOne("Sheaft.Domain.Order", "Order") .WithMany() .HasForeignKey("OrderUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.Job", b => + modelBuilder.Entity("Sheaft.Domain.Job", b => { - b.HasOne("Sheaft.Domain.Models.User", "User") + b.HasOne("Sheaft.Domain.User", "User") .WithMany() .HasForeignKey("UserUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.Legal", b => + modelBuilder.Entity("Sheaft.Domain.Legal", b => { - b.HasOne("Sheaft.Domain.Models.User", "User") + b.HasOne("Sheaft.Domain.User", "User") .WithOne("Legal") - .HasForeignKey("Sheaft.Domain.Models.Legal", "UserUid") + .HasForeignKey("Sheaft.Domain.Legal", "UserUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.OwnsMany("Sheaft.Domain.Models.Document", "Documents", b1 => + b.OwnsMany("Sheaft.Domain.Document", "Documents", b1 => { b1.Property("LegalUid") .HasColumnType("bigint"); @@ -2545,7 +2549,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b1.WithOwner() .HasForeignKey("LegalUid"); - b1.OwnsMany("Sheaft.Domain.Models.Page", "Pages", b2 => + b1.OwnsMany("Sheaft.Domain.Page", "Pages", b2 => { b2.Property("DocumentLegalUid") .HasColumnType("bigint"); @@ -2585,7 +2589,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) }); }); - b.OwnsOne("Sheaft.Domain.Models.Owner", "Owner", b1 => + b.OwnsOne("Sheaft.Domain.Owner", "Owner", b1 => { b1.Property("LegalUid") .ValueGeneratedOnAdd() @@ -2620,7 +2624,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b1.WithOwner() .HasForeignKey("LegalUid"); - b1.OwnsOne("Sheaft.Domain.Models.OwnerAddress", "Address", b2 => + b1.OwnsOne("Sheaft.Domain.OwnerAddress", "Address", b2 => { b2.Property("OwnerLegalUid") .ValueGeneratedOnAdd() @@ -2652,47 +2656,47 @@ protected override void BuildModel(ModelBuilder modelBuilder) }); }); - modelBuilder.Entity("Sheaft.Domain.Models.Notification", b => + modelBuilder.Entity("Sheaft.Domain.Notification", b => { - b.HasOne("Sheaft.Domain.Models.User", "User") + b.HasOne("Sheaft.Domain.User", "User") .WithMany() .HasForeignKey("UserUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.Order", b => + modelBuilder.Entity("Sheaft.Domain.Order", b => { - b.HasOne("Sheaft.Domain.Models.Donation", "Donation") + b.HasOne("Sheaft.Domain.Donation", "Donation") .WithOne() - .HasForeignKey("Sheaft.Domain.Models.Order", "DonationUid") + .HasForeignKey("Sheaft.Domain.Order", "DonationUid") .OnDelete(DeleteBehavior.NoAction); - b.HasOne("Sheaft.Domain.Models.Payin", "Payin") + b.HasOne("Sheaft.Domain.Payin", "Payin") .WithOne() - .HasForeignKey("Sheaft.Domain.Models.Order", "PayinUid") + .HasForeignKey("Sheaft.Domain.Order", "PayinUid") .OnDelete(DeleteBehavior.NoAction); - b.HasOne("Sheaft.Domain.Models.User", "User") + b.HasOne("Sheaft.Domain.User", "User") .WithMany() .HasForeignKey("UserUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.OrderDelivery", b => + modelBuilder.Entity("Sheaft.Domain.OrderDelivery", b => { - b.HasOne("Sheaft.Domain.Models.DeliveryMode", "DeliveryMode") + b.HasOne("Sheaft.Domain.DeliveryMode", "DeliveryMode") .WithMany() .HasForeignKey("DeliveryModeUid"); - b.HasOne("Sheaft.Domain.Models.Order", null) + b.HasOne("Sheaft.Domain.Order", null) .WithMany("Deliveries") .HasForeignKey("OrderUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.OwnsOne("Sheaft.Domain.Models.ExpectedOrderDelivery", "ExpectedDelivery", b1 => + b.OwnsOne("Sheaft.Domain.ExpectedOrderDelivery", "ExpectedDelivery", b1 => { b1.Property("OrderDeliveryOrderUid") .HasColumnType("bigint"); @@ -2718,142 +2722,142 @@ protected override void BuildModel(ModelBuilder modelBuilder) }); }); - modelBuilder.Entity("Sheaft.Domain.Models.OrderProduct", b => + modelBuilder.Entity("Sheaft.Domain.OrderProduct", b => { - b.HasOne("Sheaft.Domain.Models.Order", null) + b.HasOne("Sheaft.Domain.Order", null) .WithMany("Products") .HasForeignKey("OrderUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.User", "Producer") + b.HasOne("Sheaft.Domain.User", "Producer") .WithMany() .HasForeignKey("ProducerUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.Payin", b => + modelBuilder.Entity("Sheaft.Domain.Payin", b => { - b.HasOne("Sheaft.Domain.Models.User", "Author") + b.HasOne("Sheaft.Domain.User", "Author") .WithMany() .HasForeignKey("AuthorUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Wallet", "CreditedWallet") + b.HasOne("Sheaft.Domain.Wallet", "CreditedWallet") .WithMany() .HasForeignKey("CreditedWalletUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Order", "Order") + b.HasOne("Sheaft.Domain.Order", "Order") .WithMany() .HasForeignKey("OrderUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.PaymentMethod", b => + modelBuilder.Entity("Sheaft.Domain.PaymentMethod", b => { - b.HasOne("Sheaft.Domain.Models.User", "User") + b.HasOne("Sheaft.Domain.User", "User") .WithMany() .HasForeignKey("UserUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.Payout", b => + modelBuilder.Entity("Sheaft.Domain.Payout", b => { - b.HasOne("Sheaft.Domain.Models.User", "Author") + b.HasOne("Sheaft.Domain.User", "Author") .WithMany() .HasForeignKey("AuthorUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.BankAccount", "BankAccount") + b.HasOne("Sheaft.Domain.BankAccount", "BankAccount") .WithMany() .HasForeignKey("BankAccountUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Wallet", "DebitedWallet") + b.HasOne("Sheaft.Domain.Wallet", "DebitedWallet") .WithMany() .HasForeignKey("DebitedWalletUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.ProducerTag", b => + modelBuilder.Entity("Sheaft.Domain.ProducerTag", b => { - b.HasOne("Sheaft.Domain.Models.Producer", null) + b.HasOne("Sheaft.Domain.Producer", null) .WithMany("Tags") .HasForeignKey("ProducerUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Tag", "Tag") + b.HasOne("Sheaft.Domain.Tag", "Tag") .WithMany() .HasForeignKey("TagUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.Product", b => + modelBuilder.Entity("Sheaft.Domain.Product", b => { - b.HasOne("Sheaft.Domain.Models.Producer", "Producer") + b.HasOne("Sheaft.Domain.Producer", "Producer") .WithMany() .HasForeignKey("ProducerUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Returnable", "Returnable") + b.HasOne("Sheaft.Domain.Returnable", "Returnable") .WithMany() .HasForeignKey("ReturnableUid") .OnDelete(DeleteBehavior.NoAction); }); - modelBuilder.Entity("Sheaft.Domain.Models.ProductTag", b => + modelBuilder.Entity("Sheaft.Domain.ProductTag", b => { - b.HasOne("Sheaft.Domain.Models.Product", null) + b.HasOne("Sheaft.Domain.Product", null) .WithMany("Tags") .HasForeignKey("ProductUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Tag", "Tag") + b.HasOne("Sheaft.Domain.Tag", "Tag") .WithMany() .HasForeignKey("TagUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.PurchaseOrder", b => + modelBuilder.Entity("Sheaft.Domain.PurchaseOrder", b => { - b.HasOne("Sheaft.Domain.Models.Order", null) + b.HasOne("Sheaft.Domain.Order", null) .WithMany("PurchaseOrders") .HasForeignKey("OrderUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.PurchaseOrderSender", "Sender") + b.HasOne("Sheaft.Domain.PurchaseOrderSender", "Sender") .WithOne() - .HasForeignKey("Sheaft.Domain.Models.PurchaseOrder", "PurchaseOrderSenderUid") + .HasForeignKey("Sheaft.Domain.PurchaseOrder", "PurchaseOrderSenderUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.PurchaseOrderVendor", "Vendor") + b.HasOne("Sheaft.Domain.PurchaseOrderVendor", "Vendor") .WithOne() - .HasForeignKey("Sheaft.Domain.Models.PurchaseOrder", "PurchaseOrderVendorUid") + .HasForeignKey("Sheaft.Domain.PurchaseOrder", "PurchaseOrderVendorUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Transfer", "Transfer") + b.HasOne("Sheaft.Domain.Transfer", "Transfer") .WithOne() - .HasForeignKey("Sheaft.Domain.Models.PurchaseOrder", "TransferUid") + .HasForeignKey("Sheaft.Domain.PurchaseOrder", "TransferUid") .OnDelete(DeleteBehavior.NoAction); - b.OwnsOne("Sheaft.Domain.Models.ExpectedPurchaseOrderDelivery", "ExpectedDelivery", b1 => + b.OwnsOne("Sheaft.Domain.ExpectedPurchaseOrderDelivery", "ExpectedDelivery", b1 => { b1.Property("PurchaseOrderUid") .HasColumnType("bigint"); @@ -2886,7 +2890,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b1.WithOwner() .HasForeignKey("PurchaseOrderUid"); - b1.OwnsOne("Sheaft.Domain.Models.ExpectedAddress", "Address", b2 => + b1.OwnsOne("Sheaft.Domain.ExpectedAddress", "Address", b2 => { b2.Property("ExpectedPurchaseOrderDeliveryPurchaseOrderUid") .HasColumnType("bigint"); @@ -2922,162 +2926,162 @@ protected override void BuildModel(ModelBuilder modelBuilder) }); }); - modelBuilder.Entity("Sheaft.Domain.Models.PurchaseOrderProduct", b => + modelBuilder.Entity("Sheaft.Domain.PurchaseOrderProduct", b => { - b.HasOne("Sheaft.Domain.Models.PurchaseOrder", null) + b.HasOne("Sheaft.Domain.PurchaseOrder", null) .WithMany("Products") .HasForeignKey("PurchaseOrderUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.QuickOrder", b => + modelBuilder.Entity("Sheaft.Domain.QuickOrder", b => { - b.HasOne("Sheaft.Domain.Models.User", "User") + b.HasOne("Sheaft.Domain.User", "User") .WithMany() .HasForeignKey("UserUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.QuickOrderProduct", b => + modelBuilder.Entity("Sheaft.Domain.QuickOrderProduct", b => { - b.HasOne("Sheaft.Domain.Models.Product", "Product") + b.HasOne("Sheaft.Domain.Product", "Product") .WithMany() .HasForeignKey("ProductUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.QuickOrder", null) + b.HasOne("Sheaft.Domain.QuickOrder", null) .WithMany("Products") .HasForeignKey("QuickOrderUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.Rating", b => + modelBuilder.Entity("Sheaft.Domain.Rating", b => { - b.HasOne("Sheaft.Domain.Models.Product", null) + b.HasOne("Sheaft.Domain.Product", null) .WithMany("Ratings") .HasForeignKey("ProductUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.User", "User") + b.HasOne("Sheaft.Domain.User", "User") .WithMany() .HasForeignKey("UserUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.Refund", b => + modelBuilder.Entity("Sheaft.Domain.Refund", b => { - b.HasOne("Sheaft.Domain.Models.User", "Author") + b.HasOne("Sheaft.Domain.User", "Author") .WithMany() .HasForeignKey("AuthorUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Wallet", "DebitedWallet") + b.HasOne("Sheaft.Domain.Wallet", "DebitedWallet") .WithMany() .HasForeignKey("DebitedWalletUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.Returnable", b => + modelBuilder.Entity("Sheaft.Domain.Returnable", b => { - b.HasOne("Sheaft.Domain.Models.Producer", "Producer") + b.HasOne("Sheaft.Domain.Producer", "Producer") .WithMany() .HasForeignKey("ProducerUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.Reward", b => + modelBuilder.Entity("Sheaft.Domain.Reward", b => { - b.HasOne("Sheaft.Domain.Models.Department", "Department") + b.HasOne("Sheaft.Domain.Department", "Department") .WithMany() .HasForeignKey("DepartmentUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Level", "Level") + b.HasOne("Sheaft.Domain.Level", "Level") .WithMany("Rewards") .HasForeignKey("LevelUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Consumer", "Winner") + b.HasOne("Sheaft.Domain.Consumer", "Winner") .WithMany() .HasForeignKey("WinnerUid"); }); - modelBuilder.Entity("Sheaft.Domain.Models.Sponsoring", b => + modelBuilder.Entity("Sheaft.Domain.Sponsoring", b => { - b.HasOne("Sheaft.Domain.Models.User", "Sponsor") + b.HasOne("Sheaft.Domain.User", "Sponsor") .WithMany() .HasForeignKey("SponsorUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.User", "Sponsored") + b.HasOne("Sheaft.Domain.User", "Sponsored") .WithMany() .HasForeignKey("SponsoredUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.StoreTag", b => + modelBuilder.Entity("Sheaft.Domain.StoreTag", b => { - b.HasOne("Sheaft.Domain.Models.Store", null) + b.HasOne("Sheaft.Domain.Store", null) .WithMany("Tags") .HasForeignKey("StoreUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Tag", "Tag") + b.HasOne("Sheaft.Domain.Tag", "Tag") .WithMany() .HasForeignKey("TagUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.Transfer", b => + modelBuilder.Entity("Sheaft.Domain.Transfer", b => { - b.HasOne("Sheaft.Domain.Models.User", "Author") + b.HasOne("Sheaft.Domain.User", "Author") .WithMany() .HasForeignKey("AuthorUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Wallet", "CreditedWallet") + b.HasOne("Sheaft.Domain.Wallet", "CreditedWallet") .WithMany() .HasForeignKey("CreditedWalletUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Wallet", "DebitedWallet") + b.HasOne("Sheaft.Domain.Wallet", "DebitedWallet") .WithMany() .HasForeignKey("DebitedWalletUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Payout", "Payout") + b.HasOne("Sheaft.Domain.Payout", "Payout") .WithMany("Transfers") .HasForeignKey("PayoutUid") .OnDelete(DeleteBehavior.NoAction); - b.HasOne("Sheaft.Domain.Models.PurchaseOrder", "PurchaseOrder") + b.HasOne("Sheaft.Domain.PurchaseOrder", "PurchaseOrder") .WithMany() .HasForeignKey("PurchaseOrderUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.User", b => + modelBuilder.Entity("Sheaft.Domain.User", b => { - b.OwnsMany("Sheaft.Domain.Models.Points", "Points", b1 => + b.OwnsMany("Sheaft.Domain.Points", "Points", b1 => { b1.Property("Uid") .ValueGeneratedOnAdd() @@ -3112,7 +3116,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("UserUid"); }); - b.OwnsOne("Sheaft.Domain.Models.UserAddress", "Address", b1 => + b.OwnsOne("Sheaft.Domain.UserAddress", "Address", b1 => { b1.Property("UserUid") .HasColumnType("bigint"); @@ -3147,7 +3151,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b1.ToTable("UserAddresses"); - b1.HasOne("Sheaft.Domain.Models.Department", "Department") + b1.HasOne("Sheaft.Domain.Department", "Department") .WithMany() .HasForeignKey("DepartmentUid") .OnDelete(DeleteBehavior.Cascade) @@ -3158,44 +3162,44 @@ protected override void BuildModel(ModelBuilder modelBuilder) }); }); - modelBuilder.Entity("Sheaft.Domain.Models.Wallet", b => + modelBuilder.Entity("Sheaft.Domain.Wallet", b => { - b.HasOne("Sheaft.Domain.Models.User", "User") + b.HasOne("Sheaft.Domain.User", "User") .WithMany() .HasForeignKey("UserUid") .OnDelete(DeleteBehavior.Cascade) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.Withholding", b => + modelBuilder.Entity("Sheaft.Domain.Withholding", b => { - b.HasOne("Sheaft.Domain.Models.User", "Author") + b.HasOne("Sheaft.Domain.User", "Author") .WithMany() .HasForeignKey("AuthorUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Wallet", "CreditedWallet") + b.HasOne("Sheaft.Domain.Wallet", "CreditedWallet") .WithMany() .HasForeignKey("CreditedWalletUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Wallet", "DebitedWallet") + b.HasOne("Sheaft.Domain.Wallet", "DebitedWallet") .WithMany() .HasForeignKey("DebitedWalletUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.Payout", "Payout") + b.HasOne("Sheaft.Domain.Payout", "Payout") .WithMany("Withholdings") .HasForeignKey("PayoutUid") .OnDelete(DeleteBehavior.NoAction); }); - modelBuilder.Entity("Sheaft.Domain.Models.BusinessLegal", b => + modelBuilder.Entity("Sheaft.Domain.BusinessLegal", b => { - b.OwnsOne("Sheaft.Domain.Models.Declaration", "Declaration", b1 => + b.OwnsOne("Sheaft.Domain.Declaration", "Declaration", b1 => { b1.Property("BusinessLegalUid") .HasColumnType("bigint"); @@ -3231,7 +3235,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b1.WithOwner() .HasForeignKey("BusinessLegalUid"); - b1.OwnsMany("Sheaft.Domain.Models.Ubo", "Ubos", b2 => + b1.OwnsMany("Sheaft.Domain.Ubo", "Ubos", b2 => { b2.Property("DeclarationBusinessLegalUid") .HasColumnType("bigint"); @@ -3273,7 +3277,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) b2.WithOwner() .HasForeignKey("DeclarationBusinessLegalUid"); - b2.OwnsOne("Sheaft.Domain.Models.BirthAddress", "BirthPlace", b3 => + b2.OwnsOne("Sheaft.Domain.BirthAddress", "BirthPlace", b3 => { b3.Property("UboDeclarationBusinessLegalUid") .HasColumnType("bigint"); @@ -3295,7 +3299,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasForeignKey("UboDeclarationBusinessLegalUid", "UboId"); }); - b2.OwnsOne("Sheaft.Domain.Models.UboAddress", "Address", b3 => + b2.OwnsOne("Sheaft.Domain.UboAddress", "Address", b3 => { b3.Property("UboDeclarationBusinessLegalUid") .HasColumnType("bigint"); @@ -3328,7 +3332,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) }); }); - b.OwnsOne("Sheaft.Domain.Models.LegalAddress", "Address", b1 => + b.OwnsOne("Sheaft.Domain.LegalAddress", "Address", b1 => { b1.Property("BusinessLegalUid") .HasColumnType("bigint"); @@ -3357,33 +3361,33 @@ protected override void BuildModel(ModelBuilder modelBuilder) }); }); - modelBuilder.Entity("Sheaft.Domain.Models.CardPayin", b => + modelBuilder.Entity("Sheaft.Domain.CardPayin", b => { - b.HasOne("Sheaft.Domain.Models.Card", "Card") + b.HasOne("Sheaft.Domain.Card", "Card") .WithMany() .HasForeignKey("CardUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.PayinRefund", b => + modelBuilder.Entity("Sheaft.Domain.PayinRefund", b => { - b.HasOne("Sheaft.Domain.Models.Payin", "Payin") + b.HasOne("Sheaft.Domain.Payin", "Payin") .WithMany("Refunds") .HasForeignKey("PayinUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); - b.HasOne("Sheaft.Domain.Models.PurchaseOrder", "PurchaseOrder") + b.HasOne("Sheaft.Domain.PurchaseOrder", "PurchaseOrder") .WithMany() .HasForeignKey("PurchaseOrderUid") .OnDelete(DeleteBehavior.NoAction) .IsRequired(); }); - modelBuilder.Entity("Sheaft.Domain.Models.Store", b => + modelBuilder.Entity("Sheaft.Domain.Store", b => { - b.OwnsMany("Sheaft.Domain.Models.TimeSlotHour", "OpeningHours", b1 => + b.OwnsMany("Sheaft.Domain.TimeSlotHour", "OpeningHours", b1 => { b1.Property("StoreUid") .HasColumnType("bigint");