From a73436c643df27cdc038420681a7fd7a2ff50159 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?No=C3=ABl=20Mugnier?= Date: Thu, 5 Nov 2020 17:38:12 +0100 Subject: [PATCH] =?UTF-8?q?New=20-=20Ajout=20de=20la=20d=C3=A9sactivation?= =?UTF-8?q?=20d'un=20point=20de=20vente=20/=20mode=20de=20livraison?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../DeliveryMode/CreateDeliveryModeCommand.cs | 1 + .../DeliveryMode/UpdateDeliveryModeCommand.cs | 1 + .../Commands/DeliveryModeCommandsHandler.cs | 3 + Sheaft.Application.Models/Dto/DeliveryDto.cs | 1 + .../Dto/DeliveryModeDto.cs | 1 + .../Inputs/CreateDeliveryModeInput.cs | 1 + Sheaft.Application.Queries/DeliveryQueries.cs | 6 +- Sheaft.Domain/DeliveryMode.cs | 11 + .../Inputs/CreateDeliveryModeInputType.cs | 1 + .../Inputs/UpdateDeliveryModeInputType.cs | 1 + .../Outputs/DeliveryModeType.cs | 1 + Sheaft.GraphQL.Types/Outputs/DeliveryType.cs | 2 +- ...201105163042_AvailableDelivery.Designer.cs | 3266 +++++++++++++++++ .../20201105163042_AvailableDelivery.cs | 27 + .../Migrations/AppDbContextModelSnapshot.cs | 11 +- 15 files changed, 3330 insertions(+), 4 deletions(-) create mode 100644 Sheaft.Infrastructure.Persistence/Migrations/20201105163042_AvailableDelivery.Designer.cs create mode 100644 Sheaft.Infrastructure.Persistence/Migrations/20201105163042_AvailableDelivery.cs diff --git a/Sheaft.Application.Commands/DeliveryMode/CreateDeliveryModeCommand.cs b/Sheaft.Application.Commands/DeliveryMode/CreateDeliveryModeCommand.cs index 641ae8da2..0522ad4f8 100644 --- a/Sheaft.Application.Commands/DeliveryMode/CreateDeliveryModeCommand.cs +++ b/Sheaft.Application.Commands/DeliveryMode/CreateDeliveryModeCommand.cs @@ -20,5 +20,6 @@ public CreateDeliveryModeCommand(RequestUser requestUser) : base(requestUser) public int LockOrderHoursBeforeDelivery { get; set; } public LocationAddressInput Address { get; set; } public IEnumerable OpeningHours { get; set; } + public bool Available { get; set; } } } diff --git a/Sheaft.Application.Commands/DeliveryMode/UpdateDeliveryModeCommand.cs b/Sheaft.Application.Commands/DeliveryMode/UpdateDeliveryModeCommand.cs index 810dec64c..5cb0cc085 100644 --- a/Sheaft.Application.Commands/DeliveryMode/UpdateDeliveryModeCommand.cs +++ b/Sheaft.Application.Commands/DeliveryMode/UpdateDeliveryModeCommand.cs @@ -21,5 +21,6 @@ public UpdateDeliveryModeCommand(RequestUser requestUser) : base(requestUser) public int LockOrderHoursBeforeDelivery { get; set; } public LocationAddressInput Address { get; set; } public IEnumerable OpeningHours { get; set; } + public bool Available { get; set; } } } diff --git a/Sheaft.Application.Handlers/Commands/DeliveryModeCommandsHandler.cs b/Sheaft.Application.Handlers/Commands/DeliveryModeCommandsHandler.cs index eda93ec43..560f7b5ae 100644 --- a/Sheaft.Application.Handlers/Commands/DeliveryModeCommandsHandler.cs +++ b/Sheaft.Application.Handlers/Commands/DeliveryModeCommandsHandler.cs @@ -52,6 +52,8 @@ public async Task> Handle(CreateDeliveryModeCommand request, Cancel var entity = new DeliveryMode(Guid.NewGuid(), request.Kind, producer, request.LockOrderHoursBeforeDelivery, deliveryModeAddress, openingHours, request.Name, request.Description); + entity.SetAvailability(request.Available); + if (request.Kind == DeliveryKind.Collective || request.Kind == DeliveryKind.Farm || request.Kind == DeliveryKind.Market) producer.CanDirectSell = true; @@ -70,6 +72,7 @@ public async Task> Handle(UpdateDeliveryModeCommand request, Cancel var entity = await _context.GetByIdAsync(request.Id, token); entity.SetName(request.Name); + entity.SetAvailability(request.Available); entity.SetDescription(request.Description); entity.SetLockOrderHoursBeforeDelivery(request.LockOrderHoursBeforeDelivery); entity.SetKind(request.Kind); diff --git a/Sheaft.Application.Models/Dto/DeliveryDto.cs b/Sheaft.Application.Models/Dto/DeliveryDto.cs index 16bb62ab2..4ad185b1a 100644 --- a/Sheaft.Application.Models/Dto/DeliveryDto.cs +++ b/Sheaft.Application.Models/Dto/DeliveryDto.cs @@ -9,6 +9,7 @@ public class DeliveryDto public Guid Id { get; set; } public DeliveryKind Kind { get; set; } public string Name { get; set; } + public bool Available { get; set; } public AddressDto Address { get; set; } public IEnumerable DeliveryHours { get; set; } } diff --git a/Sheaft.Application.Models/Dto/DeliveryModeDto.cs b/Sheaft.Application.Models/Dto/DeliveryModeDto.cs index 8b13fc454..e8aad7558 100644 --- a/Sheaft.Application.Models/Dto/DeliveryModeDto.cs +++ b/Sheaft.Application.Models/Dto/DeliveryModeDto.cs @@ -14,6 +14,7 @@ public class DeliveryModeDto public int LockOrderHoursBeforeDelivery { get; set; } public string Name { get; set; } public string Description { get; set; } + public bool Available { get; set; } public AddressDto Address { get; set; } public UserDto Producer { get; set; } public IEnumerable OpeningHours { get; set; } diff --git a/Sheaft.Application.Models/Inputs/CreateDeliveryModeInput.cs b/Sheaft.Application.Models/Inputs/CreateDeliveryModeInput.cs index 157b181d9..d84922aea 100644 --- a/Sheaft.Application.Models/Inputs/CreateDeliveryModeInput.cs +++ b/Sheaft.Application.Models/Inputs/CreateDeliveryModeInput.cs @@ -8,6 +8,7 @@ public class CreateDeliveryModeInput public string Name { get; set; } public string Description { get; set; } public DeliveryKind Kind { get; set; } + public bool Available { get; set; } public int? LockOrderHoursBeforeDelivery { get; set; } public LocationAddressInput Address { get; set; } public IEnumerable OpeningHours { get; set; } diff --git a/Sheaft.Application.Queries/DeliveryQueries.cs b/Sheaft.Application.Queries/DeliveryQueries.cs index 128c1e732..7b9bede5f 100644 --- a/Sheaft.Application.Queries/DeliveryQueries.cs +++ b/Sheaft.Application.Queries/DeliveryQueries.cs @@ -41,7 +41,7 @@ public IQueryable GetDeliveries(RequestUser currentUser) public async Task> GetProducersDeliveriesAsync(IEnumerable producerIds, IEnumerable kinds, DateTimeOffset currentDate, RequestUser currentUser, CancellationToken token) { var list = new List(); - var deliveriesMode = await _context.FindAsync(d => producerIds.Contains(d.Producer.Id) && kinds.Contains(d.Kind), token); + var deliveriesMode = await _context.FindAsync(d => d.Available && producerIds.Contains(d.Producer.Id) && kinds.Contains(d.Kind), token); var deliveriesProducerIds = deliveriesMode.Select(c => c.Producer.Id).Distinct(); var producerDistinctIds = producerIds.Distinct(); @@ -68,6 +68,7 @@ public async Task> GetProducersDeliveriesAsyn { Id = deliveryMode.Id, Kind = deliveryMode.Kind, + Available = deliveryMode.Available, Address = deliveryMode.Address != null ? new AddressDto { City = deliveryMode.Address.City, @@ -92,7 +93,7 @@ public async Task> GetProducersDeliveriesAsyn public async Task> GetStoreDeliveriesForProducersAsync(Guid storeId, IEnumerable producerIds, IEnumerable kinds, DateTimeOffset currentDate, RequestUser currentUser, CancellationToken token) { var list = new List(); - var agreements = await _context.FindAsync(d => producerIds.Contains(d.Delivery.Producer.Id) && d.Store.Id == storeId && d.Status == AgreementStatus.Accepted && kinds.Contains(d.Delivery.Kind), token); + var agreements = await _context.FindAsync(d => d.Delivery.Available && producerIds.Contains(d.Delivery.Producer.Id) && d.Store.Id == storeId && d.Status == AgreementStatus.Accepted && kinds.Contains(d.Delivery.Kind), token); var agreementProducerIds = agreements.Select(c => c.Delivery.Producer.Id).Distinct(); var producerDistinctIds = producerIds.Distinct(); @@ -124,6 +125,7 @@ public async Task> GetStoreDeliveriesForProdu { Id = agreement.Delivery.Id, Kind = agreement.Delivery.Kind, + Available = agreement.Delivery.Available, Address = agreement.Delivery.Address != null ? new AddressDto { City = agreement.Delivery.Address.City, diff --git a/Sheaft.Domain/DeliveryMode.cs b/Sheaft.Domain/DeliveryMode.cs index 029d99930..ac9d88858 100644 --- a/Sheaft.Domain/DeliveryMode.cs +++ b/Sheaft.Domain/DeliveryMode.cs @@ -37,6 +37,7 @@ public DeliveryMode(Guid id, DeliveryKind kind, Producer producer, int lockOrder public int LockOrderHoursBeforeDelivery { get; private set; } public string Name { get; private set; } public string Description { get; private set; } + public bool Available { get; private set; } public virtual DeliveryAddress Address { get; private set; } public virtual Producer Producer { get; private set; } public virtual IReadOnlyCollection OpeningHours => _openingHours?.AsReadOnly(); @@ -64,6 +65,11 @@ public void SetDescription(string description) Description = description; } + public void SetAvailability(bool available) + { + Available = available; + } + public void SetName(string name) { Name = name; @@ -73,5 +79,10 @@ public void SetKind(DeliveryKind kind) { Kind = kind; } + + public void SetAvailability(object available) + { + throw new NotImplementedException(); + } } } \ No newline at end of file diff --git a/Sheaft.GraphQL.Types/Inputs/CreateDeliveryModeInputType.cs b/Sheaft.GraphQL.Types/Inputs/CreateDeliveryModeInputType.cs index d0aa8d44e..5705d7f56 100644 --- a/Sheaft.GraphQL.Types/Inputs/CreateDeliveryModeInputType.cs +++ b/Sheaft.GraphQL.Types/Inputs/CreateDeliveryModeInputType.cs @@ -10,6 +10,7 @@ protected override void Configure(IInputObjectTypeDescriptor c.Description); descriptor.Field(c => c.Kind); descriptor.Field(c => c.Name); + descriptor.Field(c => c.Available); descriptor.Field(c => c.LockOrderHoursBeforeDelivery); descriptor.Field(c => c.Address) diff --git a/Sheaft.GraphQL.Types/Inputs/UpdateDeliveryModeInputType.cs b/Sheaft.GraphQL.Types/Inputs/UpdateDeliveryModeInputType.cs index 41b1ba0c0..5d6878077 100644 --- a/Sheaft.GraphQL.Types/Inputs/UpdateDeliveryModeInputType.cs +++ b/Sheaft.GraphQL.Types/Inputs/UpdateDeliveryModeInputType.cs @@ -9,6 +9,7 @@ protected override void Configure(IInputObjectTypeDescriptor c.Description); descriptor.Field(c => c.Kind); + descriptor.Field(c => c.Available); descriptor.Field(c => c.LockOrderHoursBeforeDelivery); descriptor.Field(c => c.Id) diff --git a/Sheaft.GraphQL.Types/Outputs/DeliveryModeType.cs b/Sheaft.GraphQL.Types/Outputs/DeliveryModeType.cs index fccddb2fa..65e6d3566 100644 --- a/Sheaft.GraphQL.Types/Outputs/DeliveryModeType.cs +++ b/Sheaft.GraphQL.Types/Outputs/DeliveryModeType.cs @@ -14,6 +14,7 @@ protected override void Configure(IObjectTypeDescriptor descrip descriptor.Field(c => c.LockOrderHoursBeforeDelivery); descriptor.Field(c => c.Kind); descriptor.Field(c => c.Name); + descriptor.Field(c => c.Available); descriptor.Field(c => c.Description); descriptor.Field(c => c.Address) diff --git a/Sheaft.GraphQL.Types/Outputs/DeliveryType.cs b/Sheaft.GraphQL.Types/Outputs/DeliveryType.cs index 4642246e2..46749697a 100644 --- a/Sheaft.GraphQL.Types/Outputs/DeliveryType.cs +++ b/Sheaft.GraphQL.Types/Outputs/DeliveryType.cs @@ -11,7 +11,7 @@ protected override void Configure(IObjectTypeDescriptor descriptor) { descriptor.Field(c => c.Id).Type>(); descriptor.Field(c => c.Kind); - + descriptor.Field(c => c.Available); descriptor.Field(c => c.Address) .Type(); diff --git a/Sheaft.Infrastructure.Persistence/Migrations/20201105163042_AvailableDelivery.Designer.cs b/Sheaft.Infrastructure.Persistence/Migrations/20201105163042_AvailableDelivery.Designer.cs new file mode 100644 index 000000000..86491933d --- /dev/null +++ b/Sheaft.Infrastructure.Persistence/Migrations/20201105163042_AvailableDelivery.Designer.cs @@ -0,0 +1,3266 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using Sheaft.Domain.Enums; +using Sheaft.Infrastructure.Persistence; + +namespace Sheaft.Infrastructure.Persistence.Migrations +{ + [DbContext(typeof(AppDbContext))] + [Migration("20201105163042_AvailableDelivery")] + partial class AvailableDelivery + { + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasDefaultSchema("app") + .HasAnnotation("ProductVersion", "3.1.9") + .HasAnnotation("Relational:MaxIdentifierLength", 128) + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + modelBuilder.Entity("Sheaft.Domain.Models.Agreement", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CreatedByUid") + .HasColumnType("bigint"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("DeliveryModeUid") + .HasColumnType("bigint"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Reason") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("StoreUid") + .HasColumnType("bigint"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("CreatedByUid"); + + b.HasIndex("DeliveryModeUid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("StoreUid"); + + b.HasIndex("Uid", "Id", "StoreUid", "DeliveryModeUid", "RemovedOn"); + + b.ToTable("Agreements"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Country", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Alpha2") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Uid"); + + b.HasIndex("Alpha2") + .IsUnique(); + + b.HasIndex("Uid", "Id", "Alpha2"); + + b.ToTable("Countries"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.DeliveryMode", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Available") + .HasColumnType("bit"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("LockOrderHoursBeforeDelivery") + .HasColumnType("int"); + + b.Property("Name") + .HasColumnType("nvarchar(max)"); + + b.Property("ProducerUid") + .HasColumnType("bigint"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("ProducerUid"); + + b.HasIndex("Uid", "Id", "ProducerUid", "RemovedOn"); + + b.ToTable("DeliveryModes"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Department", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Code") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ConsumersCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("LevelUid") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Points") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("Position") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("ProducersCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("RegionUid") + .HasColumnType("bigint"); + + b.Property("RequiredProducers") + .HasColumnType("int"); + + b.Property("StoresCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("Code") + .IsUnique(); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("LevelUid"); + + b.HasIndex("RegionUid"); + + b.HasIndex("Uid", "Id", "RegionUid", "LevelUid"); + + b.ToTable("Departments"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Donation", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AuthorUid") + .HasColumnType("bigint"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Credited") + .HasColumnType("decimal(10,2)"); + + b.Property("CreditedWalletUid") + .HasColumnType("bigint"); + + b.Property("Debited") + .HasColumnType("decimal(10,2)"); + + b.Property("DebitedWalletUid") + .HasColumnType("bigint"); + + b.Property("ExecutedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Fees") + .HasColumnType("decimal(10,2)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Identifier") + .HasColumnType("nvarchar(450)"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("OrderUid") + .HasColumnType("bigint"); + + b.Property("Reference") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("ResultCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ResultMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("AuthorUid"); + + b.HasIndex("CreditedWalletUid"); + + b.HasIndex("DebitedWalletUid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Identifier"); + + b.HasIndex("OrderUid"); + + b.HasIndex("Uid", "Id", "AuthorUid", "OrderUid", "CreditedWalletUid", "DebitedWalletUid", "RemovedOn"); + + b.ToTable("Donations"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Job", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Archived") + .HasColumnType("bit"); + + b.Property("Command") + .HasColumnType("nvarchar(max)"); + + b.Property("CompletedOn") + .HasColumnType("datetimeoffset"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("File") + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("Message") + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Queue") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Retried") + .HasColumnType("int"); + + b.Property("StartedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("UserUid") + .HasColumnType("bigint"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("UserUid"); + + b.HasIndex("Uid", "Id", "UserUid", "RemovedOn"); + + b.ToTable("Jobs"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Legal", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("UserKind") + .HasColumnType("int"); + + b.Property("UserUid") + .HasColumnType("bigint"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("UserUid") + .IsUnique(); + + b.HasIndex("Uid", "Id"); + + b.ToTable("Legals"); + + b.HasDiscriminator("UserKind"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Level", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("RequiredPoints") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Uid", "Id", "RemovedOn"); + + b.ToTable("Levels"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Nationality", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Alpha2") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Uid"); + + b.HasIndex("Alpha2") + .IsUnique(); + + b.HasIndex("Uid", "Id", "Alpha2"); + + b.ToTable("Nationalities"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Notification", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Content") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("Method") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Unread") + .HasColumnType("bit"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("UserUid") + .HasColumnType("bigint"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("UserUid"); + + b.HasIndex("Uid", "Id", "UserUid", "RemovedOn"); + + b.ToTable("Notifications"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Order", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Donate") + .HasColumnType("decimal(10,2)"); + + b.Property("DonationKind") + .HasColumnType("int"); + + b.Property("DonationUid") + .HasColumnType("bigint"); + + b.Property("ExpiredOn") + .HasColumnType("datetimeoffset"); + + b.Property("FeesFixedAmount") + .HasColumnType("decimal(10,2)"); + + b.Property("FeesPercent") + .HasColumnType("decimal(10,4)"); + + b.Property("FeesPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("InternalFeesPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("LinesCount") + .HasColumnType("int"); + + b.Property("PayinUid") + .HasColumnType("bigint"); + + b.Property("ProductsCount") + .HasColumnType("int"); + + b.Property("Reference") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("ReturnablesCount") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("TotalOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalWeight") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("UserUid") + .HasColumnType("bigint"); + + b.HasKey("Uid"); + + b.HasIndex("DonationUid") + .IsUnique() + .HasFilter("[DonationUid] IS NOT NULL"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("PayinUid") + .IsUnique() + .HasFilter("[PayinUid] IS NOT NULL"); + + b.HasIndex("UserUid"); + + b.HasIndex("Uid", "Id", "UserUid", "RemovedOn"); + + b.ToTable("Orders"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.OrderDelivery", b => + { + b.Property("OrderUid") + .HasColumnType("bigint"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Comment") + .HasColumnType("nvarchar(max)"); + + b.Property("DeliveryModeUid") + .HasColumnType("bigint"); + + b.Property("ExpectedDeliveryDate") + .HasColumnType("datetimeoffset"); + + b.HasKey("OrderUid", "Id"); + + b.HasIndex("DeliveryModeUid"); + + b.ToTable("OrderDeliveries"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.OrderProduct", b => + { + b.Property("OrderUid") + .HasColumnType("bigint"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ProducerUid") + .HasColumnType("bigint"); + + b.Property("Quantity") + .IsConcurrencyToken() + .HasColumnType("int"); + + b.Property("Reference") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ReturnableName") + .HasColumnType("nvarchar(max)"); + + b.Property("ReturnableOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("ReturnableVat") + .HasColumnType("decimal(10,2)"); + + b.Property("ReturnableVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("ReturnableWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("ReturnablesCount") + .HasColumnType("int"); + + b.Property("TotalOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalWeight") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("UnitOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("UnitVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("UnitWeight") + .HasColumnType("decimal(10,2)"); + + b.Property("UnitWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("Vat") + .HasColumnType("decimal(10,2)"); + + b.HasKey("OrderUid", "Id"); + + b.HasIndex("ProducerUid"); + + b.ToTable("OrderProducts"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Payin", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AuthorUid") + .HasColumnType("bigint"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Credited") + .HasColumnType("decimal(10,2)"); + + b.Property("CreditedWalletUid") + .HasColumnType("bigint"); + + b.Property("Debited") + .HasColumnType("decimal(10,2)"); + + b.Property("ExecutedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Fees") + .HasColumnType("decimal(10,2)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Identifier") + .HasColumnType("nvarchar(450)"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("OrderUid") + .HasColumnType("bigint"); + + b.Property("Reference") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("ResultCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ResultMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("AuthorUid"); + + b.HasIndex("CreditedWalletUid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Identifier"); + + b.HasIndex("OrderUid"); + + b.HasIndex("Uid", "Id", "AuthorUid", "OrderUid", "CreditedWalletUid", "RemovedOn"); + + b.ToTable("Payins"); + + b.HasDiscriminator("Kind"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.PaymentMethod", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Identifier") + .HasColumnType("nvarchar(450)"); + + b.Property("IsActive") + .HasColumnType("bit"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("UserUid") + .HasColumnType("bigint"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Identifier"); + + b.HasIndex("UserUid"); + + b.HasIndex("Uid", "Id", "Identifier", "UserUid", "RemovedOn"); + + b.ToTable("PaymentMethods"); + + b.HasDiscriminator("Kind"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Payout", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AuthorUid") + .HasColumnType("bigint"); + + b.Property("BankAccountUid") + .HasColumnType("bigint"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Credited") + .HasColumnType("decimal(10,2)"); + + b.Property("Debited") + .HasColumnType("decimal(10,2)"); + + b.Property("DebitedWalletUid") + .HasColumnType("bigint"); + + b.Property("ExecutedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Fees") + .HasColumnType("decimal(10,2)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Identifier") + .HasColumnType("nvarchar(450)"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("Reference") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("ResultCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ResultMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("AuthorUid"); + + b.HasIndex("BankAccountUid"); + + b.HasIndex("DebitedWalletUid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Identifier"); + + b.HasIndex("Uid", "Id", "AuthorUid", "BankAccountUid", "DebitedWalletUid", "RemovedOn"); + + b.ToTable("Payouts"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.ProducerTag", b => + { + b.Property("ProducerUid") + .HasColumnType("bigint"); + + b.Property("TagUid") + .HasColumnType("bigint"); + + b.HasKey("ProducerUid", "TagUid"); + + b.HasIndex("TagUid"); + + b.ToTable("ProducerTags"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Product", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Available") + .HasColumnType("bit"); + + b.Property("Conditioning") + .HasColumnType("int"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("OnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("OnSalePricePerUnit") + .HasColumnType("decimal(10,2)"); + + b.Property("Picture") + .HasColumnType("nvarchar(max)"); + + b.Property("ProducerUid") + .HasColumnType("bigint"); + + b.Property("QuantityPerUnit") + .HasColumnType("decimal(10,3)"); + + b.Property("Rating") + .HasColumnType("decimal(10,2)"); + + b.Property("RatingsCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("Reference") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("ReturnableUid") + .HasColumnType("bigint"); + + b.Property("Unit") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("Vat") + .HasColumnType("decimal(10,2)"); + + b.Property("VatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("VatPricePerUnit") + .HasColumnType("decimal(10,2)"); + + b.Property("VisibleToConsumers") + .HasColumnType("bit"); + + b.Property("VisibleToStores") + .HasColumnType("bit"); + + b.Property("Weight") + .HasColumnType("decimal(10,2)"); + + b.Property("WholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("WholeSalePricePerUnit") + .HasColumnType("decimal(10,2)"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("ProducerUid"); + + b.HasIndex("ReturnableUid"); + + b.HasIndex("ProducerUid", "Reference") + .IsUnique(); + + b.HasIndex("Uid", "Id", "ProducerUid", "ReturnableUid", "RemovedOn"); + + b.ToTable("Products"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.ProductTag", b => + { + b.Property("ProductUid") + .HasColumnType("bigint"); + + b.Property("TagUid") + .HasColumnType("bigint"); + + b.HasKey("ProductUid", "TagUid"); + + b.HasIndex("TagUid"); + + b.ToTable("ProductTags"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.PurchaseOrder", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AcceptedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Comment") + .HasColumnType("nvarchar(max)"); + + b.Property("CompletedOn") + .HasColumnType("datetimeoffset"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("DeliveredOn") + .HasColumnType("datetimeoffset"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("LinesCount") + .HasColumnType("int"); + + b.Property("OrderUid") + .HasColumnType("bigint"); + + b.Property("ProductsCount") + .HasColumnType("int"); + + b.Property("PurchaseOrderSenderUid") + .HasColumnType("bigint"); + + b.Property("PurchaseOrderVendorUid") + .HasColumnType("bigint"); + + b.Property("Reason") + .HasColumnType("nvarchar(max)"); + + b.Property("Reference") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("ReturnablesCount") + .HasColumnType("int"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("TotalOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalWeight") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TransferUid") + .HasColumnType("bigint"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("WithdrawnOn") + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("OrderUid"); + + b.HasIndex("PurchaseOrderSenderUid") + .IsUnique(); + + b.HasIndex("PurchaseOrderVendorUid") + .IsUnique(); + + b.HasIndex("TransferUid") + .IsUnique() + .HasFilter("[TransferUid] IS NOT NULL"); + + b.HasIndex("PurchaseOrderVendorUid", "Reference") + .IsUnique(); + + b.HasIndex("OrderUid", "Uid", "Id", "PurchaseOrderVendorUid", "PurchaseOrderSenderUid", "RemovedOn"); + + b.ToTable("PurchaseOrders"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.PurchaseOrderProduct", b => + { + b.Property("PurchaseOrderUid") + .HasColumnType("bigint"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Quantity") + .IsConcurrencyToken() + .HasColumnType("int"); + + b.Property("Reference") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("ReturnableName") + .HasColumnType("nvarchar(max)"); + + b.Property("ReturnableOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("ReturnableVat") + .HasColumnType("decimal(10,2)"); + + b.Property("ReturnableVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("ReturnableWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("ReturnablesCount") + .HasColumnType("int"); + + b.Property("TotalOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalProductWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalReturnableWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalWeight") + .HasColumnType("decimal(10,2)"); + + b.Property("TotalWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("UnitOnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("UnitVatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("UnitWeight") + .HasColumnType("decimal(10,2)"); + + b.Property("UnitWholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("Vat") + .HasColumnType("decimal(10,2)"); + + b.HasKey("PurchaseOrderUid", "Id"); + + b.ToTable("PurchaseOrderProducts"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.PurchaseOrderSender", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Phone") + .HasColumnType("nvarchar(max)"); + + b.Property("Picture") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Uid"); + + b.HasIndex("Id"); + + b.ToTable("PurchaseOrderSenders"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.PurchaseOrderVendor", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Phone") + .HasColumnType("nvarchar(max)"); + + b.Property("Picture") + .HasColumnType("nvarchar(max)"); + + b.HasKey("Uid"); + + b.HasIndex("Id"); + + b.ToTable("PurchaseOrderVendors"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.QuickOrder", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("IsDefault") + .HasColumnType("bit"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("UserUid") + .HasColumnType("bigint"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("UserUid"); + + b.HasIndex("Uid", "Id", "UserUid", "RemovedOn"); + + b.ToTable("QuickOrders"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.QuickOrderProduct", b => + { + b.Property("QuickOrderUid") + .HasColumnType("bigint"); + + b.Property("ProductUid") + .HasColumnType("bigint"); + + b.Property("Quantity") + .IsConcurrencyToken() + .HasColumnType("int"); + + b.HasKey("QuickOrderUid", "ProductUid"); + + b.HasIndex("ProductUid"); + + b.ToTable("QuickOrderProducts"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Rating", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Comment") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("ProductUid") + .HasColumnType("bigint"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("UserUid") + .HasColumnType("bigint"); + + b.Property("Value") + .HasColumnType("decimal(10,2)"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("ProductUid"); + + b.HasIndex("UserUid"); + + b.HasIndex("Uid", "Id", "ProductUid", "UserUid", "RemovedOn"); + + b.ToTable("Ratings"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Refund", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AuthorUid") + .HasColumnType("bigint"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Credited") + .HasColumnType("decimal(10,2)"); + + b.Property("Debited") + .HasColumnType("decimal(10,2)"); + + b.Property("DebitedWalletUid") + .HasColumnType("bigint"); + + b.Property("ExecutedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Fees") + .HasColumnType("decimal(10,2)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Identifier") + .HasColumnType("nvarchar(450)"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("Reference") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("ResultCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ResultMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("AuthorUid"); + + b.HasIndex("DebitedWalletUid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Identifier"); + + b.HasIndex("Uid", "Id", "AuthorUid", "DebitedWalletUid", "RemovedOn"); + + b.ToTable("Refunds"); + + b.HasDiscriminator("Kind"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Region", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Code") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("ConsumersCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Points") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("Position") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("ProducersCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("RequiredProducers") + .HasColumnType("int"); + + b.Property("StoresCount") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("Code") + .IsUnique(); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Uid", "Id"); + + b.ToTable("Regions"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Returnable", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Kind") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("OnSalePrice") + .HasColumnType("decimal(10,2)"); + + b.Property("ProducerUid") + .HasColumnType("bigint"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("Vat") + .HasColumnType("decimal(10,2)"); + + b.Property("VatPrice") + .HasColumnType("decimal(10,2)"); + + b.Property("WholeSalePrice") + .HasColumnType("decimal(10,2)"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("ProducerUid"); + + b.HasIndex("Uid", "Id", "RemovedOn"); + + b.ToTable("Returnables"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Reward", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Contact") + .HasColumnType("nvarchar(max)"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("DepartmentUid") + .HasColumnType("bigint"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Email") + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("LevelUid") + .HasColumnType("bigint"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Phone") + .HasColumnType("nvarchar(max)"); + + b.Property("Picture") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("Url") + .HasColumnType("nvarchar(max)"); + + b.Property("WinnerUid") + .HasColumnType("bigint"); + + b.HasKey("Uid"); + + b.HasIndex("DepartmentUid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("LevelUid"); + + b.HasIndex("WinnerUid"); + + b.HasIndex("Uid", "Id", "DepartmentUid", "LevelUid", "RemovedOn"); + + b.ToTable("Rewards"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Sponsoring", b => + { + b.Property("SponsorUid") + .HasColumnType("bigint"); + + b.Property("SponsoredUid") + .HasColumnType("bigint"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.HasKey("SponsorUid", "SponsoredUid"); + + b.HasIndex("SponsoredUid"); + + b.ToTable("Sponsorings"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.StoreTag", b => + { + b.Property("StoreUid") + .HasColumnType("bigint"); + + b.Property("TagUid") + .HasColumnType("bigint"); + + b.HasKey("StoreUid", "TagUid"); + + b.HasIndex("TagUid"); + + b.ToTable("StoreTags"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Tag", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Available") + .HasColumnType("bit"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("Icon") + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Picture") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Uid", "Id", "RemovedOn"); + + b.ToTable("Tags"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Transfer", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("AuthorUid") + .HasColumnType("bigint"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Credited") + .HasColumnType("decimal(10,2)"); + + b.Property("CreditedWalletUid") + .HasColumnType("bigint"); + + b.Property("Debited") + .HasColumnType("decimal(10,2)"); + + b.Property("DebitedWalletUid") + .HasColumnType("bigint"); + + b.Property("ExecutedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Fees") + .HasColumnType("decimal(10,2)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Identifier") + .HasColumnType("nvarchar(450)"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("PayoutUid") + .HasColumnType("bigint"); + + b.Property("PurchaseOrderUid") + .HasColumnType("bigint"); + + b.Property("Reference") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("ResultCode") + .HasColumnType("nvarchar(max)"); + + b.Property("ResultMessage") + .HasColumnType("nvarchar(max)"); + + b.Property("Status") + .HasColumnType("int"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("AuthorUid"); + + b.HasIndex("CreditedWalletUid"); + + b.HasIndex("DebitedWalletUid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Identifier"); + + b.HasIndex("PayoutUid"); + + b.HasIndex("PurchaseOrderUid"); + + b.HasIndex("Uid", "Id", "AuthorUid", "PurchaseOrderUid", "CreditedWalletUid", "DebitedWalletUid", "RemovedOn"); + + b.ToTable("Transfers"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.User", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Email") + .IsRequired() + .HasColumnType("nvarchar(450)"); + + b.Property("FirstName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Identifier") + .HasColumnType("nvarchar(450)"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("LastName") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Phone") + .HasColumnType("nvarchar(max)"); + + b.Property("Picture") + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("SponsorshipCode") + .HasColumnType("nvarchar(max)"); + + b.Property("TotalPoints") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasDefaultValue(0); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.HasKey("Uid"); + + b.HasIndex("Email") + .IsUnique(); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Identifier"); + + b.HasIndex("Uid", "Id", "RemovedOn"); + + b.ToTable("Users"); + + b.HasDiscriminator("Kind"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Wallet", b => + { + b.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b.Property("Balance") + .HasColumnType("decimal(10,2)"); + + b.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("ExternalUpdatedOn") + .HasColumnType("datetimeoffset"); + + b.Property("Id") + .HasColumnType("uniqueidentifier"); + + b.Property("Identifier") + .HasColumnType("nvarchar(450)"); + + b.Property("Kind") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("RemovedOn") + .HasColumnType("datetimeoffset"); + + b.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b.Property("UserUid") + .HasColumnType("bigint"); + + b.HasKey("Uid"); + + b.HasIndex("Id") + .IsUnique(); + + b.HasIndex("Identifier"); + + b.HasIndex("UserUid"); + + b.HasIndex("Uid", "Id", "UserUid", "RemovedOn"); + + b.ToTable("Wallets"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.BusinessLegal", b => + { + b.HasBaseType("Sheaft.Domain.Models.Legal"); + + b.Property("Email") + .HasColumnType("nvarchar(max)"); + + b.Property("Siret") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("VatIdentifier") + .HasColumnType("nvarchar(max)"); + + b.HasDiscriminator().HasValue(1); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.ConsumerLegal", b => + { + b.HasBaseType("Sheaft.Domain.Models.Legal"); + + b.HasDiscriminator().HasValue(0); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.CardPayin", b => + { + b.HasBaseType("Sheaft.Domain.Models.Payin"); + + b.Property("CardUid") + .HasColumnType("bigint"); + + b.HasIndex("CardUid"); + + b.HasDiscriminator().HasValue(1); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.WebPayin", b => + { + b.HasBaseType("Sheaft.Domain.Models.Payin"); + + b.Property("RedirectUrl") + .HasColumnType("nvarchar(max)"); + + b.HasDiscriminator().HasValue(0); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.BankAccount", b => + { + b.HasBaseType("Sheaft.Domain.Models.PaymentMethod"); + + b.Property("BIC") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("City") + .HasColumnType("nvarchar(max)"); + + b.Property("Country") + .HasColumnType("int"); + + b.Property("IBAN") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Line1") + .HasColumnType("nvarchar(max)"); + + b.Property("Line2") + .HasColumnType("nvarchar(max)"); + + b.Property("Owner") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Zipcode") + .HasColumnType("nvarchar(max)"); + + b.HasDiscriminator().HasValue(0); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Card", b => + { + b.HasBaseType("Sheaft.Domain.Models.PaymentMethod"); + + b.HasDiscriminator().HasValue(1); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.PayinRefund", b => + { + b.HasBaseType("Sheaft.Domain.Models.Refund"); + + b.Property("PayinUid") + .HasColumnType("bigint"); + + b.Property("PurchaseOrderUid") + .HasColumnType("bigint"); + + b.HasIndex("PayinUid"); + + b.HasIndex("PurchaseOrderUid"); + + b.HasDiscriminator().HasValue(300); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Admin", b => + { + b.HasBaseType("Sheaft.Domain.Models.User"); + + b.HasDiscriminator().HasValue(4); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Business", b => + { + b.HasBaseType("Sheaft.Domain.Models.User"); + + b.Property("Description") + .HasColumnType("nvarchar(max)"); + + b.Property("OpenForNewBusiness") + .HasColumnType("bit"); + + b.HasDiscriminator(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Consumer", b => + { + b.HasBaseType("Sheaft.Domain.Models.User"); + + b.Property("Anonymous") + .ValueGeneratedOnAdd() + .HasColumnType("bit") + .HasDefaultValue(false); + + b.HasDiscriminator().HasValue(2); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Support", b => + { + b.HasBaseType("Sheaft.Domain.Models.User"); + + b.HasDiscriminator().HasValue(3); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Producer", b => + { + b.HasBaseType("Sheaft.Domain.Models.Business"); + + b.Property("CanDirectSell") + .HasColumnType("bit"); + + b.HasDiscriminator().HasValue(0); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Store", b => + { + b.HasBaseType("Sheaft.Domain.Models.Business"); + + b.HasDiscriminator().HasValue(1); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Agreement", b => + { + b.HasOne("Sheaft.Domain.Models.User", "CreatedBy") + .WithMany() + .HasForeignKey("CreatedByUid"); + + b.HasOne("Sheaft.Domain.Models.DeliveryMode", "Delivery") + .WithMany() + .HasForeignKey("DeliveryModeUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Store", "Store") + .WithMany() + .HasForeignKey("StoreUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Sheaft.Domain.Models.TimeSlotHour", "SelectedHours", b1 => + { + b1.Property("AgreementUid") + .HasColumnType("bigint"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b1.Property("Day") + .HasColumnType("int"); + + b1.Property("From") + .HasColumnType("time"); + + b1.Property("To") + .HasColumnType("time"); + + b1.HasKey("AgreementUid", "Id"); + + b1.ToTable("AgreementSelectedHours"); + + b1.WithOwner() + .HasForeignKey("AgreementUid"); + }); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.DeliveryMode", b => + { + b.HasOne("Sheaft.Domain.Models.Producer", "Producer") + .WithMany() + .HasForeignKey("ProducerUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsOne("Sheaft.Domain.Models.DeliveryAddress", "Address", b1 => + { + b1.Property("DeliveryModeUid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b1.Property("City") + .HasColumnType("nvarchar(max)"); + + b1.Property("Country") + .HasColumnType("int"); + + b1.Property("Latitude") + .HasColumnType("float"); + + b1.Property("Line1") + .HasColumnType("nvarchar(max)"); + + b1.Property("Line2") + .HasColumnType("nvarchar(max)"); + + b1.Property("Longitude") + .HasColumnType("float"); + + b1.Property("Zipcode") + .HasColumnType("nvarchar(max)"); + + b1.HasKey("DeliveryModeUid"); + + b1.ToTable("DeliveryModes"); + + b1.WithOwner() + .HasForeignKey("DeliveryModeUid"); + }); + + b.OwnsMany("Sheaft.Domain.Models.TimeSlotHour", "OpeningHours", b1 => + { + b1.Property("DeliveryModeUid") + .HasColumnType("bigint"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b1.Property("Day") + .HasColumnType("int"); + + b1.Property("From") + .HasColumnType("time"); + + b1.Property("To") + .HasColumnType("time"); + + b1.HasKey("DeliveryModeUid", "Id"); + + b1.ToTable("DeliveryModeOpeningHours"); + + b1.WithOwner() + .HasForeignKey("DeliveryModeUid"); + }); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Department", b => + { + b.HasOne("Sheaft.Domain.Models.Level", "Level") + .WithMany() + .HasForeignKey("LevelUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Region", "Region") + .WithMany() + .HasForeignKey("RegionUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Donation", b => + { + b.HasOne("Sheaft.Domain.Models.User", "Author") + .WithMany() + .HasForeignKey("AuthorUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Wallet", "CreditedWallet") + .WithMany() + .HasForeignKey("CreditedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Wallet", "DebitedWallet") + .WithMany() + .HasForeignKey("DebitedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Order", "Order") + .WithMany() + .HasForeignKey("OrderUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Job", b => + { + b.HasOne("Sheaft.Domain.Models.User", "User") + .WithMany() + .HasForeignKey("UserUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Legal", b => + { + b.HasOne("Sheaft.Domain.Models.User", "User") + .WithOne() + .HasForeignKey("Sheaft.Domain.Models.Legal", "UserUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.OwnsMany("Sheaft.Domain.Models.Document", "Documents", b1 => + { + b1.Property("LegalUid") + .HasColumnType("bigint"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b1.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b1.Property("Identifier") + .HasColumnType("nvarchar(450)"); + + b1.Property("Kind") + .HasColumnType("int"); + + b1.Property("Name") + .HasColumnType("nvarchar(max)"); + + b1.Property("ProcessedOn") + .HasColumnType("datetimeoffset"); + + b1.Property("ResultCode") + .HasColumnType("nvarchar(max)"); + + b1.Property("ResultMessage") + .HasColumnType("nvarchar(max)"); + + b1.Property("Status") + .HasColumnType("int"); + + b1.Property("UpdatedOn") + .IsConcurrencyToken() + .HasColumnType("datetimeoffset"); + + b1.HasKey("LegalUid", "Id"); + + b1.HasIndex("Id") + .IsUnique(); + + b1.HasIndex("Identifier"); + + b1.ToTable("Documents"); + + b1.WithOwner() + .HasForeignKey("LegalUid"); + + b1.OwnsMany("Sheaft.Domain.Models.Page", "Pages", b2 => + { + b2.Property("DocumentLegalUid") + .HasColumnType("bigint"); + + b2.Property("DocumentId") + .HasColumnType("uniqueidentifier"); + + b2.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b2.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b2.Property("Extension") + .HasColumnType("nvarchar(max)"); + + b2.Property("Filename") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b2.Property("Size") + .HasColumnType("bigint"); + + b2.Property("UploadedOn") + .HasColumnType("datetimeoffset"); + + b2.HasKey("DocumentLegalUid", "DocumentId", "Id"); + + b2.HasIndex("Id") + .IsUnique(); + + b2.ToTable("DocumentPages"); + + b2.WithOwner() + .HasForeignKey("DocumentLegalUid", "DocumentId"); + }); + }); + + b.OwnsOne("Sheaft.Domain.Models.Owner", "Owner", b1 => + { + b1.Property("LegalUid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b1.Property("BirthDate") + .HasColumnType("datetimeoffset"); + + b1.Property("CountryOfResidence") + .HasColumnType("int"); + + b1.Property("Email") + .HasColumnType("nvarchar(max)"); + + b1.Property("FirstName") + .HasColumnType("nvarchar(max)"); + + b1.Property("Id") + .HasColumnType("uniqueidentifier"); + + b1.Property("LastName") + .HasColumnType("nvarchar(max)"); + + b1.Property("Nationality") + .HasColumnType("int"); + + b1.HasKey("LegalUid"); + + b1.ToTable("Legals"); + + b1.WithOwner() + .HasForeignKey("LegalUid"); + + b1.OwnsOne("Sheaft.Domain.Models.OwnerAddress", "Address", b2 => + { + b2.Property("OwnerLegalUid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b2.Property("City") + .HasColumnType("nvarchar(max)"); + + b2.Property("Country") + .HasColumnType("int"); + + b2.Property("Line1") + .HasColumnType("nvarchar(max)"); + + b2.Property("Line2") + .HasColumnType("nvarchar(max)"); + + b2.Property("Zipcode") + .HasColumnType("nvarchar(max)"); + + b2.HasKey("OwnerLegalUid"); + + b2.ToTable("Legals"); + + b2.WithOwner() + .HasForeignKey("OwnerLegalUid"); + }); + }); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Notification", b => + { + b.HasOne("Sheaft.Domain.Models.User", "User") + .WithMany() + .HasForeignKey("UserUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Order", b => + { + b.HasOne("Sheaft.Domain.Models.Donation", "Donation") + .WithOne() + .HasForeignKey("Sheaft.Domain.Models.Order", "DonationUid") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Sheaft.Domain.Models.Payin", "Payin") + .WithOne() + .HasForeignKey("Sheaft.Domain.Models.Order", "PayinUid") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Sheaft.Domain.Models.User", "User") + .WithMany() + .HasForeignKey("UserUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.OrderDelivery", b => + { + b.HasOne("Sheaft.Domain.Models.DeliveryMode", "DeliveryMode") + .WithMany() + .HasForeignKey("DeliveryModeUid"); + + b.HasOne("Sheaft.Domain.Models.Order", null) + .WithMany("Deliveries") + .HasForeignKey("OrderUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.OrderProduct", b => + { + b.HasOne("Sheaft.Domain.Models.Order", null) + .WithMany("Products") + .HasForeignKey("OrderUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.User", "Producer") + .WithMany() + .HasForeignKey("ProducerUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Payin", b => + { + b.HasOne("Sheaft.Domain.Models.User", "Author") + .WithMany() + .HasForeignKey("AuthorUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Wallet", "CreditedWallet") + .WithMany() + .HasForeignKey("CreditedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Order", "Order") + .WithMany() + .HasForeignKey("OrderUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.PaymentMethod", b => + { + b.HasOne("Sheaft.Domain.Models.User", "User") + .WithMany() + .HasForeignKey("UserUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Payout", b => + { + b.HasOne("Sheaft.Domain.Models.User", "Author") + .WithMany() + .HasForeignKey("AuthorUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.BankAccount", "BankAccount") + .WithMany() + .HasForeignKey("BankAccountUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Wallet", "DebitedWallet") + .WithMany() + .HasForeignKey("DebitedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.ProducerTag", b => + { + b.HasOne("Sheaft.Domain.Models.Producer", null) + .WithMany("Tags") + .HasForeignKey("ProducerUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Tag", "Tag") + .WithMany() + .HasForeignKey("TagUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Product", b => + { + b.HasOne("Sheaft.Domain.Models.Producer", "Producer") + .WithMany() + .HasForeignKey("ProducerUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Returnable", "Returnable") + .WithMany() + .HasForeignKey("ReturnableUid") + .OnDelete(DeleteBehavior.NoAction); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.ProductTag", b => + { + b.HasOne("Sheaft.Domain.Models.Product", null) + .WithMany("Tags") + .HasForeignKey("ProductUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Tag", "Tag") + .WithMany() + .HasForeignKey("TagUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.PurchaseOrder", b => + { + b.HasOne("Sheaft.Domain.Models.Order", null) + .WithMany("PurchaseOrders") + .HasForeignKey("OrderUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.PurchaseOrderSender", "Sender") + .WithOne() + .HasForeignKey("Sheaft.Domain.Models.PurchaseOrder", "PurchaseOrderSenderUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.PurchaseOrderVendor", "Vendor") + .WithOne() + .HasForeignKey("Sheaft.Domain.Models.PurchaseOrder", "PurchaseOrderVendorUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Transfer", "Transfer") + .WithOne() + .HasForeignKey("Sheaft.Domain.Models.PurchaseOrder", "TransferUid") + .OnDelete(DeleteBehavior.NoAction); + + b.OwnsOne("Sheaft.Domain.Models.ExpectedDelivery", "ExpectedDelivery", b1 => + { + b1.Property("PurchaseOrderUid") + .HasColumnType("bigint"); + + b1.Property("DeliveredOn") + .HasColumnType("datetimeoffset"); + + b1.Property("DeliveryStartedOn") + .HasColumnType("datetimeoffset"); + + b1.Property("ExpectedDeliveryDate") + .HasColumnType("datetimeoffset"); + + b1.Property("From") + .HasColumnType("time"); + + b1.Property("Kind") + .HasColumnType("int"); + + b1.Property("Name") + .HasColumnType("nvarchar(max)"); + + b1.Property("To") + .HasColumnType("time"); + + b1.HasKey("PurchaseOrderUid"); + + b1.ToTable("ExpectedDeliveries"); + + b1.WithOwner() + .HasForeignKey("PurchaseOrderUid"); + + b1.OwnsOne("Sheaft.Domain.Models.ExpectedAddress", "Address", b2 => + { + b2.Property("ExpectedDeliveryPurchaseOrderUid") + .HasColumnType("bigint"); + + b2.Property("City") + .HasColumnType("nvarchar(max)"); + + b2.Property("Country") + .HasColumnType("int"); + + b2.Property("Latitude") + .HasColumnType("float"); + + b2.Property("Line1") + .HasColumnType("nvarchar(max)"); + + b2.Property("Line2") + .HasColumnType("nvarchar(max)"); + + b2.Property("Longitude") + .HasColumnType("float"); + + b2.Property("Zipcode") + .HasColumnType("nvarchar(max)"); + + b2.HasKey("ExpectedDeliveryPurchaseOrderUid"); + + b2.ToTable("ExpectedDeliveries"); + + b2.WithOwner() + .HasForeignKey("ExpectedDeliveryPurchaseOrderUid"); + }); + }); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.PurchaseOrderProduct", b => + { + b.HasOne("Sheaft.Domain.Models.PurchaseOrder", null) + .WithMany("Products") + .HasForeignKey("PurchaseOrderUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.QuickOrder", b => + { + b.HasOne("Sheaft.Domain.Models.User", "User") + .WithMany() + .HasForeignKey("UserUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.QuickOrderProduct", b => + { + b.HasOne("Sheaft.Domain.Models.Product", "Product") + .WithMany() + .HasForeignKey("ProductUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.QuickOrder", null) + .WithMany("Products") + .HasForeignKey("QuickOrderUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Rating", b => + { + b.HasOne("Sheaft.Domain.Models.Product", null) + .WithMany("Ratings") + .HasForeignKey("ProductUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.User", "User") + .WithMany() + .HasForeignKey("UserUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Refund", b => + { + b.HasOne("Sheaft.Domain.Models.User", "Author") + .WithMany() + .HasForeignKey("AuthorUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Wallet", "DebitedWallet") + .WithMany() + .HasForeignKey("DebitedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Returnable", b => + { + b.HasOne("Sheaft.Domain.Models.Producer", "Producer") + .WithMany() + .HasForeignKey("ProducerUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Reward", b => + { + b.HasOne("Sheaft.Domain.Models.Department", "Department") + .WithMany() + .HasForeignKey("DepartmentUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Level", "Level") + .WithMany("Rewards") + .HasForeignKey("LevelUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Consumer", "Winner") + .WithMany() + .HasForeignKey("WinnerUid"); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Sponsoring", b => + { + b.HasOne("Sheaft.Domain.Models.User", "Sponsor") + .WithMany() + .HasForeignKey("SponsorUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.User", "Sponsored") + .WithMany() + .HasForeignKey("SponsoredUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.StoreTag", b => + { + b.HasOne("Sheaft.Domain.Models.Store", null) + .WithMany("Tags") + .HasForeignKey("StoreUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Tag", "Tag") + .WithMany() + .HasForeignKey("TagUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Transfer", b => + { + b.HasOne("Sheaft.Domain.Models.User", "Author") + .WithMany() + .HasForeignKey("AuthorUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Wallet", "CreditedWallet") + .WithMany() + .HasForeignKey("CreditedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Wallet", "DebitedWallet") + .WithMany() + .HasForeignKey("DebitedWalletUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.Payout", "Payout") + .WithMany("Transfers") + .HasForeignKey("PayoutUid") + .OnDelete(DeleteBehavior.NoAction); + + b.HasOne("Sheaft.Domain.Models.PurchaseOrder", "PurchaseOrder") + .WithMany() + .HasForeignKey("PurchaseOrderUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.User", b => + { + b.OwnsMany("Sheaft.Domain.Models.Points", "Points", b1 => + { + b1.Property("Uid") + .ValueGeneratedOnAdd() + .HasColumnType("bigint") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b1.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b1.Property("Id") + .HasColumnType("uniqueidentifier"); + + b1.Property("Kind") + .HasColumnType("int"); + + b1.Property("Quantity") + .HasColumnType("int"); + + b1.Property("UserUid") + .HasColumnType("bigint"); + + b1.HasKey("Uid"); + + b1.HasIndex("Id") + .IsUnique(); + + b1.HasIndex("UserUid"); + + b1.ToTable("UserPoints"); + + b1.WithOwner() + .HasForeignKey("UserUid"); + }); + + b.OwnsOne("Sheaft.Domain.Models.UserAddress", "Address", b1 => + { + b1.Property("UserUid") + .HasColumnType("bigint"); + + b1.Property("City") + .HasColumnType("nvarchar(max)"); + + b1.Property("Country") + .HasColumnType("int"); + + b1.Property("DepartmentUid") + .HasColumnType("bigint"); + + b1.Property("Latitude") + .HasColumnType("float"); + + b1.Property("Line1") + .HasColumnType("nvarchar(max)"); + + b1.Property("Line2") + .HasColumnType("nvarchar(max)"); + + b1.Property("Longitude") + .HasColumnType("float"); + + b1.Property("Zipcode") + .HasColumnType("nvarchar(max)"); + + b1.HasKey("UserUid"); + + b1.HasIndex("DepartmentUid"); + + b1.ToTable("UserAddresses"); + + b1.HasOne("Sheaft.Domain.Models.Department", "Department") + .WithMany() + .HasForeignKey("DepartmentUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b1.WithOwner() + .HasForeignKey("UserUid"); + }); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Wallet", b => + { + b.HasOne("Sheaft.Domain.Models.User", "User") + .WithMany() + .HasForeignKey("UserUid") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.BusinessLegal", b => + { + b.OwnsOne("Sheaft.Domain.Models.Declaration", "Declaration", b1 => + { + b1.Property("BusinessLegalUid") + .HasColumnType("bigint"); + + b1.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b1.Property("Id") + .HasColumnType("uniqueidentifier"); + + b1.Property("Identifier") + .HasColumnType("nvarchar(max)"); + + b1.Property("ProcessedOn") + .HasColumnType("datetimeoffset"); + + b1.Property("ReasonCode") + .HasColumnType("nvarchar(max)"); + + b1.Property("ReasonMessage") + .HasColumnType("nvarchar(max)"); + + b1.Property("Status") + .HasColumnType("int"); + + b1.Property("UpdatedOn") + .HasColumnType("datetimeoffset"); + + b1.HasKey("BusinessLegalUid"); + + b1.ToTable("Declarations"); + + b1.WithOwner() + .HasForeignKey("BusinessLegalUid"); + + b1.OwnsMany("Sheaft.Domain.Models.Ubo", "Ubos", b2 => + { + b2.Property("DeclarationBusinessLegalUid") + .HasColumnType("bigint"); + + b2.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("uniqueidentifier"); + + b2.Property("BirthDate") + .HasColumnType("datetimeoffset"); + + b2.Property("CreatedOn") + .HasColumnType("datetimeoffset"); + + b2.Property("FirstName") + .HasColumnType("nvarchar(max)"); + + b2.Property("Identifier") + .HasColumnType("nvarchar(450)"); + + b2.Property("LastName") + .HasColumnType("nvarchar(max)"); + + b2.Property("Nationality") + .HasColumnType("int"); + + b2.Property("UpdatedOn") + .HasColumnType("datetimeoffset"); + + b2.HasKey("DeclarationBusinessLegalUid", "Id"); + + b2.HasIndex("Id") + .IsUnique(); + + b2.HasIndex("Identifier"); + + b2.ToTable("DeclarationUbos"); + + b2.WithOwner() + .HasForeignKey("DeclarationBusinessLegalUid"); + + b2.OwnsOne("Sheaft.Domain.Models.BirthAddress", "BirthPlace", b3 => + { + b3.Property("UboDeclarationBusinessLegalUid") + .HasColumnType("bigint"); + + b3.Property("UboId") + .HasColumnType("uniqueidentifier"); + + b3.Property("City") + .HasColumnType("nvarchar(max)"); + + b3.Property("Country") + .HasColumnType("int"); + + b3.HasKey("UboDeclarationBusinessLegalUid", "UboId"); + + b3.ToTable("DeclarationUbos"); + + b3.WithOwner() + .HasForeignKey("UboDeclarationBusinessLegalUid", "UboId"); + }); + + b2.OwnsOne("Sheaft.Domain.Models.UboAddress", "Address", b3 => + { + b3.Property("UboDeclarationBusinessLegalUid") + .HasColumnType("bigint"); + + b3.Property("UboId") + .HasColumnType("uniqueidentifier"); + + b3.Property("City") + .HasColumnType("nvarchar(max)"); + + b3.Property("Country") + .HasColumnType("int"); + + b3.Property("Line1") + .HasColumnType("nvarchar(max)"); + + b3.Property("Line2") + .HasColumnType("nvarchar(max)"); + + b3.Property("Zipcode") + .HasColumnType("nvarchar(max)"); + + b3.HasKey("UboDeclarationBusinessLegalUid", "UboId"); + + b3.ToTable("DeclarationUbos"); + + b3.WithOwner() + .HasForeignKey("UboDeclarationBusinessLegalUid", "UboId"); + }); + }); + }); + + b.OwnsOne("Sheaft.Domain.Models.LegalAddress", "Address", b1 => + { + b1.Property("BusinessLegalUid") + .HasColumnType("bigint"); + + b1.Property("City") + .HasColumnType("nvarchar(max)"); + + b1.Property("Country") + .HasColumnType("int"); + + b1.Property("Line1") + .HasColumnType("nvarchar(max)"); + + b1.Property("Line2") + .HasColumnType("nvarchar(max)"); + + b1.Property("Zipcode") + .HasColumnType("nvarchar(max)"); + + b1.HasKey("BusinessLegalUid"); + + b1.ToTable("BusinessLegalAddresses"); + + b1.WithOwner() + .HasForeignKey("BusinessLegalUid"); + }); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.CardPayin", b => + { + b.HasOne("Sheaft.Domain.Models.Card", "Card") + .WithMany() + .HasForeignKey("CardUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.PayinRefund", b => + { + b.HasOne("Sheaft.Domain.Models.Payin", "Payin") + .WithMany("Refunds") + .HasForeignKey("PayinUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + + b.HasOne("Sheaft.Domain.Models.PurchaseOrder", "PurchaseOrder") + .WithMany() + .HasForeignKey("PurchaseOrderUid") + .OnDelete(DeleteBehavior.NoAction) + .IsRequired(); + }); + + modelBuilder.Entity("Sheaft.Domain.Models.Store", b => + { + b.OwnsMany("Sheaft.Domain.Models.TimeSlotHour", "OpeningHours", b1 => + { + b1.Property("StoreUid") + .HasColumnType("bigint"); + + b1.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int") + .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + + b1.Property("Day") + .HasColumnType("int"); + + b1.Property("From") + .HasColumnType("time"); + + b1.Property("To") + .HasColumnType("time"); + + b1.HasKey("StoreUid", "Id"); + + b1.ToTable("StoreOpeningHours"); + + b1.WithOwner() + .HasForeignKey("StoreUid"); + }); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/Sheaft.Infrastructure.Persistence/Migrations/20201105163042_AvailableDelivery.cs b/Sheaft.Infrastructure.Persistence/Migrations/20201105163042_AvailableDelivery.cs new file mode 100644 index 000000000..8e2e9a45e --- /dev/null +++ b/Sheaft.Infrastructure.Persistence/Migrations/20201105163042_AvailableDelivery.cs @@ -0,0 +1,27 @@ +using Microsoft.EntityFrameworkCore.Migrations; + +namespace Sheaft.Infrastructure.Persistence.Migrations +{ + public partial class AvailableDelivery : Migration + { + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.AddColumn( + name: "Available", + schema: "app", + table: "DeliveryModes", + nullable: false, + defaultValue: false); + + migrationBuilder.Sql("update app.deliveryModes set available = 1"); + } + + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropColumn( + name: "Available", + schema: "app", + table: "DeliveryModes"); + } + } +} diff --git a/Sheaft.Infrastructure.Persistence/Migrations/AppDbContextModelSnapshot.cs b/Sheaft.Infrastructure.Persistence/Migrations/AppDbContextModelSnapshot.cs index 76546eb1b..f2d4d209c 100644 --- a/Sheaft.Infrastructure.Persistence/Migrations/AppDbContextModelSnapshot.cs +++ b/Sheaft.Infrastructure.Persistence/Migrations/AppDbContextModelSnapshot.cs @@ -17,7 +17,7 @@ protected override void BuildModel(ModelBuilder modelBuilder) #pragma warning disable 612, 618 modelBuilder .HasDefaultSchema("app") - .HasAnnotation("ProductVersion", "3.1.8") + .HasAnnotation("ProductVersion", "3.1.9") .HasAnnotation("Relational:MaxIdentifierLength", 128) .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); @@ -107,6 +107,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("bigint") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + b.Property("Available") + .HasColumnType("bit"); + b.Property("CreatedOn") .HasColumnType("datetimeoffset"); @@ -1800,6 +1803,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) .HasColumnType("bigint") .HasAnnotation("SqlServer:ValueGenerationStrategy", SqlServerValueGenerationStrategy.IdentityColumn); + b.Property("Available") + .HasColumnType("bit"); + b.Property("CreatedOn") .HasColumnType("datetimeoffset"); @@ -2199,6 +2205,9 @@ protected override void BuildModel(ModelBuilder modelBuilder) { b.HasBaseType("Sheaft.Domain.Models.Business"); + b.Property("CanDirectSell") + .HasColumnType("bit"); + b.HasDiscriminator().HasValue(0); });