diff --git a/PF3/DTO/Show/Request/CreateShowDto.cs b/PF3/DTO/Show/Request/CreateShowDto.cs index 5230f53..8e8a759 100644 --- a/PF3/DTO/Show/Request/CreateShowDto.cs +++ b/PF3/DTO/Show/Request/CreateShowDto.cs @@ -1,4 +1,6 @@ -namespace PF3.DTO.Show.Request; +using System; + +namespace PF3.DTO.Show.Request; public class CreateShowDto { diff --git a/PF3/DTO/Show/Request/UpdateShowDto.cs b/PF3/DTO/Show/Request/UpdateShowDto.cs index ac3c132..fd5874d 100644 --- a/PF3/DTO/Show/Request/UpdateShowDto.cs +++ b/PF3/DTO/Show/Request/UpdateShowDto.cs @@ -1,4 +1,6 @@ -namespace PF3.DTO.Show.Request; +using System; + +namespace PF3.DTO.Show.Request; public class UpdateShowDto { diff --git a/PF3/DTO/Show/Response/ReadShowDto.cs b/PF3/DTO/Show/Response/ReadShowDto.cs index 4e91893..397b527 100644 --- a/PF3/DTO/Show/Response/ReadShowDto.cs +++ b/PF3/DTO/Show/Response/ReadShowDto.cs @@ -1,4 +1,6 @@ -namespace PF3.DTO.Show.Response; +using System; + +namespace PF3.DTO.Show.Response; public class ReadShowDto { diff --git a/PF3/DTO/Sound/Request/CreateSoundDto.cs b/PF3/DTO/Sound/Request/CreateSoundDto.cs index e1775ae..9c39955 100644 --- a/PF3/DTO/Sound/Request/CreateSoundDto.cs +++ b/PF3/DTO/Sound/Request/CreateSoundDto.cs @@ -1,4 +1,6 @@ -namespace PF3.DTO.SoundCategory.Request; +using System; + +namespace PF3.DTO.SoundCategory.Request; public class CreateSoundDto { diff --git a/PF3/DTO/Sound/Request/UpdateSoundDto.cs b/PF3/DTO/Sound/Request/UpdateSoundDto.cs index 2382b13..11f252c 100644 --- a/PF3/DTO/Sound/Request/UpdateSoundDto.cs +++ b/PF3/DTO/Sound/Request/UpdateSoundDto.cs @@ -1,4 +1,6 @@ -namespace PF3.DTO.SoundCategory.Request; +using System; + +namespace PF3.DTO.SoundCategory.Request; public class UpdateSoundDto { diff --git a/PF3/DTO/Sound/Response/ReadSoundDto.cs b/PF3/DTO/Sound/Response/ReadSoundDto.cs index 0ee013d..0081ad0 100644 --- a/PF3/DTO/Sound/Response/ReadSoundDto.cs +++ b/PF3/DTO/Sound/Response/ReadSoundDto.cs @@ -1,4 +1,6 @@ -namespace PF3.DTO.SoundCategory.Response; +using System; + +namespace PF3.DTO.SoundCategory.Response; public class ReadSoundDto { diff --git a/PF3/Endpoint/Show/CreateShowEndpoint.cs b/PF3/Endpoint/Show/CreateShowEndpoint.cs new file mode 100644 index 0000000..42ab954 --- /dev/null +++ b/PF3/Endpoint/Show/CreateShowEndpoint.cs @@ -0,0 +1,19 @@ +using FastEndpoints; +using PF3.DTO.Show.Response; +using PyroFetes; + +namespace PF3.Endpoint.Show; + +public class CreateShowEndpoint(PyroFetesDbContext pyroFetesDbContext):Endpoint +{ + public override void Configure() + { + Post("/api/show"); + AllowAnonymous(); + } + + public override Task HandleAsync(CreateShowEndpoint req, CancellationToken ct) + { + + } +} \ No newline at end of file diff --git a/PF3/Migrations/20251008103414_InitialDatabase.Designer.cs b/PF3/Migrations/20251008103414_InitialDatabase.Designer.cs new file mode 100644 index 0000000..8e971b2 --- /dev/null +++ b/PF3/Migrations/20251008103414_InitialDatabase.Designer.cs @@ -0,0 +1,1951 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Migrations; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using PyroFetes; + +#nullable disable + +namespace PyroFetes.Migrations +{ + [DbContext(typeof(PyroFetesDbContext))] + [Migration("20251008103414_InitialDatabase")] + partial class InitialDatabase + { + /// + protected override void BuildTargetModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("PyroFetes.Models.Availability", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AvailabilityDate") + .HasColumnType("date"); + + b.Property("DeliveryDate") + .HasColumnType("date"); + + b.Property("ExpirationDate") + .HasColumnType("date"); + + b.Property("RenewallDate") + .HasColumnType("date"); + + b.HasKey("Id"); + + b.ToTable("Availabilities"); + }); + + modelBuilder.Entity("PyroFetes.Models.Brand", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ProductId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProductId"); + + b.ToTable("Brands"); + }); + + modelBuilder.Entity("PyroFetes.Models.City", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ZipCode") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("City"); + }); + + modelBuilder.Entity("PyroFetes.Models.Classification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Classifications"); + }); + + modelBuilder.Entity("PyroFetes.Models.Color", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Colors"); + }); + + modelBuilder.Entity("PyroFetes.Models.Communication", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Calling") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ContactId") + .HasColumnType("int"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Meeting") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("Communications"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CustomerId") + .HasColumnType("int"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("PhoneNumber") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("Role") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ZipCode") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ContactServiceProvider", b => + { + b.Property("ContactId") + .HasColumnType("int"); + + b.Property("ServiceProviderId") + .HasColumnType("int"); + + b.HasKey("ContactId", "ServiceProviderId"); + + b.HasIndex("ServiceProviderId"); + + b.ToTable("ContactServiceProvider"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contract", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("ServiceProviderId") + .HasColumnType("int"); + + b.Property("TermsAndConditions") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ShowId", "ServiceProviderId"); + + b.HasIndex("ServiceProviderId"); + + b.ToTable("Contract"); + }); + + modelBuilder.Entity("PyroFetes.Models.Customer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CustomerTypeId") + .HasColumnType("int"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerTypeId"); + + b.ToTable("Customers"); + }); + + modelBuilder.Entity("PyroFetes.Models.CustomerType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("CustomerTypes"); + }); + + modelBuilder.Entity("PyroFetes.Models.Deliverer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Transporter") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Deliverers"); + }); + + modelBuilder.Entity("PyroFetes.Models.DeliveryNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("DelivererId") + .HasColumnType("int"); + + b.Property("EstimateDeliveryDate") + .HasColumnType("date"); + + b.Property("ExpeditionDate") + .HasColumnType("date"); + + b.Property("RealDeliveryDate") + .HasColumnType("date"); + + b.Property("TrackingNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.HasIndex("DelivererId"); + + b.ToTable("DeliveryNotes"); + }); + + modelBuilder.Entity("PyroFetes.Models.Effect", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.ToTable("Effects"); + }); + + modelBuilder.Entity("PyroFetes.Models.ExperienceLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("StaffId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("StaffId"); + + b.ToTable("ExperienceLevels"); + }); + + modelBuilder.Entity("PyroFetes.Models.HistoryOfApproval", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("DeliveryDate") + .HasColumnType("date"); + + b.Property("ExpirationDate") + .HasColumnType("date"); + + b.HasKey("Id"); + + b.ToTable("HistoryOfApprovals"); + }); + + modelBuilder.Entity("PyroFetes.Models.Material", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("WarehouseId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("WarehouseId"); + + b.ToTable("Materials"); + }); + + modelBuilder.Entity("PyroFetes.Models.MaterialWarehouse", b => + { + b.Property("MaterialId") + .HasColumnType("int"); + + b.Property("WarehouseId") + .HasColumnType("int"); + + b.HasKey("MaterialId", "WarehouseId"); + + b.HasIndex("WarehouseId"); + + b.ToTable("MaterialWarehouse"); + }); + + modelBuilder.Entity("PyroFetes.Models.Movement", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Arrival") + .HasColumnType("datetime2"); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("DestinationWarehouseId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("SourceWarehouseId") + .HasColumnType("int"); + + b.Property("Start") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("DestinationWarehouseId"); + + b.HasIndex("SourceWarehouseId"); + + b.ToTable("Movements"); + }); + + modelBuilder.Entity("PyroFetes.Models.Price", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("SupplierId") + .HasColumnType("int"); + + b.Property("SellingPrice") + .HasColumnType("decimal(18,2)"); + + b.HasKey("ProductId", "SupplierId"); + + b.HasIndex("SupplierId"); + + b.ToTable("Prices"); + }); + + modelBuilder.Entity("PyroFetes.Models.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ApprovalNumber") + .HasColumnType("int"); + + b.Property("Caliber") + .HasColumnType("decimal(18,2)"); + + b.Property("ClassificationId") + .HasColumnType("int"); + + b.Property("Duration") + .HasColumnType("decimal(18,2)"); + + b.Property("Image") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Link") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("MinimalQuantity") + .HasColumnType("int"); + + b.Property("MovementId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Nec") + .HasColumnType("decimal(18,2)"); + + b.Property("ProductCategoryId") + .HasColumnType("int"); + + b.Property("References") + .HasColumnType("int"); + + b.Property("SellingPrice") + .HasColumnType("decimal(18,2)"); + + b.Property("Weight") + .HasColumnType("decimal(18,2)"); + + b.HasKey("Id"); + + b.HasIndex("ClassificationId"); + + b.HasIndex("MovementId"); + + b.HasIndex("ProductCategoryId"); + + b.ToTable("Products"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("ProductCategories"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductColor", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("ColorId") + .HasColumnType("int"); + + b.HasKey("ProductId", "ColorId"); + + b.HasIndex("ColorId"); + + b.ToTable("ProductColors"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductDelivery", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("DeliveryNoteId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("ProductId", "DeliveryNoteId"); + + b.HasIndex("DeliveryNoteId"); + + b.ToTable("ProductDeliveries"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductEffect", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("EffectId") + .HasColumnType("int"); + + b.HasKey("ProductId", "EffectId"); + + b.HasIndex("EffectId"); + + b.ToTable("ProductEffects"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductTimecode", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("End") + .HasColumnType("decimal(18,2)"); + + b.Property("Start") + .HasColumnType("decimal(18,2)"); + + b.HasKey("ProductId", "ShowId"); + + b.HasIndex("ShowId"); + + b.ToTable("ProductTimecode"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProviderContact", b => + { + b.Property("ContactId") + .HasColumnType("int"); + + b.Property("ProviderId") + .HasColumnType("int"); + + b.HasKey("ContactId", "ProviderId"); + + b.HasIndex("ProviderId"); + + b.ToTable("ProviderContacts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProviderType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("ProviderTypes"); + }); + + modelBuilder.Entity("PyroFetes.Models.PurchaseOrder", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("PurchaseConditions") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.HasKey("Id"); + + b.ToTable("PurchaseOrders"); + }); + + modelBuilder.Entity("PyroFetes.Models.PurchaseProduct", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("PurchaseOrderId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("ProductId", "PurchaseOrderId"); + + b.HasIndex("PurchaseOrderId"); + + b.ToTable("PurchaseProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Quotation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ConditionsSale") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("CustomerId") + .HasColumnType("int"); + + b.Property("Message") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.ToTable("Quotations"); + }); + + modelBuilder.Entity("PyroFetes.Models.QuotationProduct", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("QuotationId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("ProductId", "QuotationId"); + + b.HasIndex("QuotationId"); + + b.ToTable("QuotationProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ServiceProvider", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("ProviderTypeId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProviderTypeId"); + + b.ToTable("Providers"); + }); + + modelBuilder.Entity("PyroFetes.Models.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ElectronicSignature") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Logo") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Settings"); + }); + + modelBuilder.Entity("PyroFetes.Models.Show", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CityId") + .HasColumnType("int"); + + b.Property("Date") + .HasColumnType("date"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Place") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b.Property("PyrotechnicImplementationPlan") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.HasKey("Id"); + + b.HasIndex("CityId"); + + b.ToTable("Shows"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowMaterial", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("MaterialId") + .HasColumnType("int"); + + b.HasKey("ShowId", "MaterialId"); + + b.HasIndex("MaterialId"); + + b.ToTable("ShowMaterial"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowStaff", b => + { + b.Property("StaffId") + .HasColumnType("int"); + + b.Property("ShowId") + .HasColumnType("int"); + + b.HasKey("StaffId", "ShowId"); + + b.HasIndex("ShowId"); + + b.ToTable("ShowStaff"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowTruck", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("TruckId") + .HasColumnType("int"); + + b.HasKey("ShowId", "TruckId"); + + b.HasIndex("TruckId"); + + b.ToTable("ShowTruck"); + }); + + modelBuilder.Entity("PyroFetes.Models.Sound", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Artist") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Duration") + .IsRequired() + .HasColumnType("int"); + + b.Property("Format") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.Property("Kind") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b.Property("SoundCategoryId") + .HasColumnType("int"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.HasKey("Id"); + + b.HasIndex("SoundCategoryId"); + + b.ToTable("Sounds"); + }); + + modelBuilder.Entity("PyroFetes.Models.SoundCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("SoundCategories"); + }); + + modelBuilder.Entity("PyroFetes.Models.SoundTimecode", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("SoundId") + .HasColumnType("int"); + + b.Property("End") + .HasColumnType("decimal(18,2)"); + + b.Property("Start") + .HasColumnType("decimal(18,2)"); + + b.HasKey("ShowId", "SoundId"); + + b.HasIndex("SoundId"); + + b.ToTable("SoundTimecodes"); + }); + + modelBuilder.Entity("PyroFetes.Models.Staff", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b.Property("F4T2ExpirationDate") + .HasColumnType("date"); + + b.Property("F4T2NumberApproval") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.Property("Profession") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Staffs"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffAvailability", b => + { + b.Property("AvailabilityId") + .HasColumnType("int"); + + b.Property("StaffId") + .HasColumnType("int"); + + b.HasKey("AvailabilityId", "StaffId"); + + b.HasIndex("StaffId"); + + b.ToTable("StaffAvailabilities"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffContact", b => + { + b.Property("ContactId") + .HasColumnType("int"); + + b.Property("StaffId") + .HasColumnType("int"); + + b.HasKey("ContactId", "StaffId"); + + b.HasIndex("StaffId"); + + b.ToTable("StaffContacts"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffHistoryOfApproval", b => + { + b.Property("HistoryOfApprovalId") + .HasColumnType("int"); + + b.Property("StaffId") + .HasColumnType("int"); + + b.HasKey("HistoryOfApprovalId", "StaffId"); + + b.HasIndex("StaffId"); + + b.ToTable("StaffHistoryOfApprovals"); + }); + + modelBuilder.Entity("PyroFetes.Models.Supplier", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("DeliveryDelay") + .HasColumnType("int"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("ZipCode") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Suppliers"); + }); + + modelBuilder.Entity("PyroFetes.Models.Truck", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("MaxExplosiveCapacity") + .IsRequired() + .HasColumnType("float"); + + b.Property("Sizes") + .IsRequired() + .HasMaxLength(80) + .HasColumnType("nvarchar(80)"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.HasKey("Id"); + + b.ToTable("Trucks"); + }); + + modelBuilder.Entity("PyroFetes.Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Fonction") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Salt") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("PyroFetes.Models.Warehouse", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Current") + .HasColumnType("int"); + + b.Property("MaxWeight") + .HasColumnType("int"); + + b.Property("MinWeight") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ZipCode") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Warehouses"); + }); + + modelBuilder.Entity("PyroFetes.Models.WarehouseProduct", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("WarehouseId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("ProductId", "WarehouseId"); + + b.HasIndex("WarehouseId"); + + b.ToTable("WarehouseProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Brand", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("Brands") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("PyroFetes.Models.Communication", b => + { + b.HasOne("PyroFetes.Models.Contact", "Contact") + .WithMany("Communications") + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contact", b => + { + b.HasOne("PyroFetes.Models.Customer", "Customer") + .WithMany("Contacts") + .HasForeignKey("CustomerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("PyroFetes.Models.ContactServiceProvider", b => + { + b.HasOne("PyroFetes.Models.Contact", "Contact") + .WithMany("ContactServiceProviders") + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.ServiceProvider", "ServiceProvider") + .WithMany("ContactServiceProviders") + .HasForeignKey("ServiceProviderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("ServiceProvider"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contract", b => + { + b.HasOne("PyroFetes.Models.ServiceProvider", "ServiceProvider") + .WithMany("Contracts") + .HasForeignKey("ServiceProviderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("Contracts") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ServiceProvider"); + + b.Navigation("Show"); + }); + + modelBuilder.Entity("PyroFetes.Models.Customer", b => + { + b.HasOne("PyroFetes.Models.CustomerType", "CustomerType") + .WithMany("Customers") + .HasForeignKey("CustomerTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CustomerType"); + }); + + modelBuilder.Entity("PyroFetes.Models.DeliveryNote", b => + { + b.HasOne("PyroFetes.Models.Deliverer", "Deliverer") + .WithMany("DeliveryNotes") + .HasForeignKey("DelivererId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Deliverer"); + }); + + modelBuilder.Entity("PyroFetes.Models.ExperienceLevel", b => + { + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("ExperienceLevels") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.Material", b => + { + b.HasOne("PyroFetes.Models.Warehouse", "Warehouse") + .WithMany() + .HasForeignKey("WarehouseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Warehouse"); + }); + + modelBuilder.Entity("PyroFetes.Models.MaterialWarehouse", b => + { + b.HasOne("PyroFetes.Models.Material", "Material") + .WithMany("MaterialWarehouses") + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Warehouse", "Warehouse") + .WithMany("MaterialWarehouses") + .HasForeignKey("WarehouseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("Warehouse"); + }); + + modelBuilder.Entity("PyroFetes.Models.Movement", b => + { + b.HasOne("PyroFetes.Models.Warehouse", "DestinationWarehouse") + .WithMany("MovementsDestination") + .HasForeignKey("DestinationWarehouseId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("PyroFetes.Models.Warehouse", "SourceWarehouse") + .WithMany("MovementsSource") + .HasForeignKey("SourceWarehouseId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("DestinationWarehouse"); + + b.Navigation("SourceWarehouse"); + }); + + modelBuilder.Entity("PyroFetes.Models.Price", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("Prices") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Supplier", "Supplier") + .WithMany("Prices") + .HasForeignKey("SupplierId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Supplier"); + }); + + modelBuilder.Entity("PyroFetes.Models.Product", b => + { + b.HasOne("PyroFetes.Models.Classification", "Classification") + .WithMany("Products") + .HasForeignKey("ClassificationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Movement", "Movement") + .WithMany("Products") + .HasForeignKey("MovementId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.ProductCategory", "ProductCategory") + .WithMany("Products") + .HasForeignKey("ProductCategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Classification"); + + b.Navigation("Movement"); + + b.Navigation("ProductCategory"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductColor", b => + { + b.HasOne("PyroFetes.Models.Color", "Color") + .WithMany("ProductColors") + .HasForeignKey("ColorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("ProductColors") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Color"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductDelivery", b => + { + b.HasOne("PyroFetes.Models.DeliveryNote", "DeliveryNote") + .WithMany("ProductDeliveries") + .HasForeignKey("DeliveryNoteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("ProductDeliveries") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DeliveryNote"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductEffect", b => + { + b.HasOne("PyroFetes.Models.Effect", "Effect") + .WithMany("ProductEffects") + .HasForeignKey("EffectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("ProductEffects") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Effect"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductTimecode", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("ProductTimecodes") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ProductTimecodes") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Show"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProviderContact", b => + { + b.HasOne("PyroFetes.Models.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.ServiceProvider", "Provider") + .WithMany() + .HasForeignKey("ProviderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Provider"); + }); + + modelBuilder.Entity("PyroFetes.Models.PurchaseProduct", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("PurchaseProducts") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.PurchaseOrder", "PurchaseOrder") + .WithMany("PurchaseProducts") + .HasForeignKey("PurchaseOrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("PurchaseOrder"); + }); + + modelBuilder.Entity("PyroFetes.Models.Quotation", b => + { + b.HasOne("PyroFetes.Models.Customer", "Customer") + .WithMany("Quotations") + .HasForeignKey("CustomerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("PyroFetes.Models.QuotationProduct", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("QuotationProducts") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Quotation", "Quotation") + .WithMany("QuotationProducts") + .HasForeignKey("QuotationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Quotation"); + }); + + modelBuilder.Entity("PyroFetes.Models.ServiceProvider", b => + { + b.HasOne("PyroFetes.Models.ProviderType", "ProviderType") + .WithMany("ServiceProviders") + .HasForeignKey("ProviderTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProviderType"); + }); + + modelBuilder.Entity("PyroFetes.Models.Show", b => + { + b.HasOne("PyroFetes.Models.City", "City") + .WithMany("Shows") + .HasForeignKey("CityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("City"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowMaterial", b => + { + b.HasOne("PyroFetes.Models.Material", "Material") + .WithMany("ShowMaterials") + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ShowMaterials") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("Show"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowStaff", b => + { + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ShowStaffs") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("ShowStaffs") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Show"); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowTruck", b => + { + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ShowTrucks") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Truck", "Truck") + .WithMany("ShowTrucks") + .HasForeignKey("TruckId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Show"); + + b.Navigation("Truck"); + }); + + modelBuilder.Entity("PyroFetes.Models.Sound", b => + { + b.HasOne("PyroFetes.Models.SoundCategory", "SoundCategory") + .WithMany("Sounds") + .HasForeignKey("SoundCategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("SoundCategory"); + }); + + modelBuilder.Entity("PyroFetes.Models.SoundTimecode", b => + { + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("SoundTimecodes") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Sound", "Sound") + .WithMany("SoundTimecodes") + .HasForeignKey("SoundId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Show"); + + b.Navigation("Sound"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffAvailability", b => + { + b.HasOne("PyroFetes.Models.Availability", "Availability") + .WithMany("StaffAvailabilities") + .HasForeignKey("AvailabilityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("StaffAvailabilities") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Availability"); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffContact", b => + { + b.HasOne("PyroFetes.Models.Contact", "Contact") + .WithMany("StaffContacts") + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("StaffContacts") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffHistoryOfApproval", b => + { + b.HasOne("PyroFetes.Models.HistoryOfApproval", "HistoryOfApproval") + .WithMany("StaffHistoryOfApprovals") + .HasForeignKey("HistoryOfApprovalId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("StaffHistoryOfApprovals") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("HistoryOfApproval"); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.WarehouseProduct", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("WarehouseProducts") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Warehouse", "Warehouse") + .WithMany("WarehouseProducts") + .HasForeignKey("WarehouseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Warehouse"); + }); + + modelBuilder.Entity("PyroFetes.Models.Availability", b => + { + b.Navigation("StaffAvailabilities"); + }); + + modelBuilder.Entity("PyroFetes.Models.City", b => + { + b.Navigation("Shows"); + }); + + modelBuilder.Entity("PyroFetes.Models.Classification", b => + { + b.Navigation("Products"); + }); + + modelBuilder.Entity("PyroFetes.Models.Color", b => + { + b.Navigation("ProductColors"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contact", b => + { + b.Navigation("Communications"); + + b.Navigation("ContactServiceProviders"); + + b.Navigation("StaffContacts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Customer", b => + { + b.Navigation("Contacts"); + + b.Navigation("Quotations"); + }); + + modelBuilder.Entity("PyroFetes.Models.CustomerType", b => + { + b.Navigation("Customers"); + }); + + modelBuilder.Entity("PyroFetes.Models.Deliverer", b => + { + b.Navigation("DeliveryNotes"); + }); + + modelBuilder.Entity("PyroFetes.Models.DeliveryNote", b => + { + b.Navigation("ProductDeliveries"); + }); + + modelBuilder.Entity("PyroFetes.Models.Effect", b => + { + b.Navigation("ProductEffects"); + }); + + modelBuilder.Entity("PyroFetes.Models.HistoryOfApproval", b => + { + b.Navigation("StaffHistoryOfApprovals"); + }); + + modelBuilder.Entity("PyroFetes.Models.Material", b => + { + b.Navigation("MaterialWarehouses"); + + b.Navigation("ShowMaterials"); + }); + + modelBuilder.Entity("PyroFetes.Models.Movement", b => + { + b.Navigation("Products"); + }); + + modelBuilder.Entity("PyroFetes.Models.Product", b => + { + b.Navigation("Brands"); + + b.Navigation("Prices"); + + b.Navigation("ProductColors"); + + b.Navigation("ProductDeliveries"); + + b.Navigation("ProductEffects"); + + b.Navigation("ProductTimecodes"); + + b.Navigation("PurchaseProducts"); + + b.Navigation("QuotationProducts"); + + b.Navigation("WarehouseProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductCategory", b => + { + b.Navigation("Products"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProviderType", b => + { + b.Navigation("ServiceProviders"); + }); + + modelBuilder.Entity("PyroFetes.Models.PurchaseOrder", b => + { + b.Navigation("PurchaseProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Quotation", b => + { + b.Navigation("QuotationProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ServiceProvider", b => + { + b.Navigation("ContactServiceProviders"); + + b.Navigation("Contracts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Show", b => + { + b.Navigation("Contracts"); + + b.Navigation("ProductTimecodes"); + + b.Navigation("ShowMaterials"); + + b.Navigation("ShowStaffs"); + + b.Navigation("ShowTrucks"); + + b.Navigation("SoundTimecodes"); + }); + + modelBuilder.Entity("PyroFetes.Models.Sound", b => + { + b.Navigation("SoundTimecodes"); + }); + + modelBuilder.Entity("PyroFetes.Models.SoundCategory", b => + { + b.Navigation("Sounds"); + }); + + modelBuilder.Entity("PyroFetes.Models.Staff", b => + { + b.Navigation("ExperienceLevels"); + + b.Navigation("ShowStaffs"); + + b.Navigation("StaffAvailabilities"); + + b.Navigation("StaffContacts"); + + b.Navigation("StaffHistoryOfApprovals"); + }); + + modelBuilder.Entity("PyroFetes.Models.Supplier", b => + { + b.Navigation("Prices"); + }); + + modelBuilder.Entity("PyroFetes.Models.Truck", b => + { + b.Navigation("ShowTrucks"); + }); + + modelBuilder.Entity("PyroFetes.Models.Warehouse", b => + { + b.Navigation("MaterialWarehouses"); + + b.Navigation("MovementsDestination"); + + b.Navigation("MovementsSource"); + + b.Navigation("WarehouseProducts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/PF3/Migrations/20251008103414_InitialDatabase.cs b/PF3/Migrations/20251008103414_InitialDatabase.cs new file mode 100644 index 0000000..5c5dbc7 --- /dev/null +++ b/PF3/Migrations/20251008103414_InitialDatabase.cs @@ -0,0 +1,1392 @@ +using System; +using Microsoft.EntityFrameworkCore.Migrations; + +#nullable disable + +namespace PyroFetes.Migrations +{ + /// + public partial class InitialDatabase : Migration + { + /// + protected override void Up(MigrationBuilder migrationBuilder) + { + migrationBuilder.CreateTable( + name: "Availabilities", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + AvailabilityDate = table.Column(type: "date", nullable: false), + DeliveryDate = table.Column(type: "date", nullable: false), + ExpirationDate = table.Column(type: "date", nullable: false), + RenewallDate = table.Column(type: "date", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Availabilities", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "City", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + ZipCode = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_City", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Classifications", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Label = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Classifications", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Colors", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Label = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Colors", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "CustomerTypes", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Label = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_CustomerTypes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Deliverers", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Transporter = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Deliverers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Effects", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Label = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Effects", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "HistoryOfApprovals", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + DeliveryDate = table.Column(type: "date", nullable: false), + ExpirationDate = table.Column(type: "date", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_HistoryOfApprovals", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "ProductCategories", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Label = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProductCategories", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "ProviderTypes", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Label = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProviderTypes", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "PurchaseOrders", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + PurchaseConditions = table.Column(type: "nvarchar(300)", maxLength: 300, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_PurchaseOrders", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Settings", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Logo = table.Column(type: "nvarchar(max)", nullable: false), + ElectronicSignature = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Settings", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "SoundCategories", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SoundCategories", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Staffs", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + FirstName = table.Column(type: "nvarchar(60)", maxLength: 60, nullable: false), + LastName = table.Column(type: "nvarchar(60)", maxLength: 60, nullable: false), + Profession = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Email = table.Column(type: "nvarchar(120)", maxLength: 120, nullable: false), + F4T2NumberApproval = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + F4T2ExpirationDate = table.Column(type: "date", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Staffs", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Suppliers", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Email = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Phone = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), + Address = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + ZipCode = table.Column(type: "int", nullable: false), + City = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + DeliveryDelay = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Suppliers", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Trucks", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Type = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), + MaxExplosiveCapacity = table.Column(type: "float", nullable: false), + Sizes = table.Column(type: "nvarchar(80)", maxLength: 80, nullable: false), + Status = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Trucks", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Users", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Password = table.Column(type: "nvarchar(50)", maxLength: 50, nullable: false), + Salt = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Email = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Fonction = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Users", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Warehouses", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + MaxWeight = table.Column(type: "int", nullable: false), + Current = table.Column(type: "int", nullable: false), + MinWeight = table.Column(type: "int", nullable: false), + Address = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + ZipCode = table.Column(type: "int", nullable: false), + City = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Warehouses", x => x.Id); + }); + + migrationBuilder.CreateTable( + name: "Shows", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Place = table.Column(type: "nvarchar(120)", maxLength: 120, nullable: false), + Description = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: true), + Date = table.Column(type: "date", nullable: true), + PyrotechnicImplementationPlan = table.Column(type: "nvarchar(500)", maxLength: 500, nullable: false), + CityId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Shows", x => x.Id); + table.ForeignKey( + name: "FK_Shows_City_CityId", + column: x => x.CityId, + principalTable: "City", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Customers", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Note = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + CustomerTypeId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Customers", x => x.Id); + table.ForeignKey( + name: "FK_Customers_CustomerTypes_CustomerTypeId", + column: x => x.CustomerTypeId, + principalTable: "CustomerTypes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "DeliveryNotes", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + TrackingNumber = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + DelivererId = table.Column(type: "int", nullable: false), + EstimateDeliveryDate = table.Column(type: "date", nullable: false), + ExpeditionDate = table.Column(type: "date", nullable: false), + RealDeliveryDate = table.Column(type: "date", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_DeliveryNotes", x => x.Id); + table.ForeignKey( + name: "FK_DeliveryNotes_Deliverers_DelivererId", + column: x => x.DelivererId, + principalTable: "Deliverers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Providers", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Price = table.Column(type: "decimal(18,2)", nullable: false), + ProviderTypeId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Providers", x => x.Id); + table.ForeignKey( + name: "FK_Providers_ProviderTypes_ProviderTypeId", + column: x => x.ProviderTypeId, + principalTable: "ProviderTypes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Sounds", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(120)", maxLength: 120, nullable: false), + Type = table.Column(type: "nvarchar(60)", maxLength: 60, nullable: false), + Artist = table.Column(type: "nvarchar(120)", maxLength: 120, nullable: false), + Duration = table.Column(type: "int", nullable: false), + Kind = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), + Format = table.Column(type: "nvarchar(40)", maxLength: 40, nullable: false), + CreationDate = table.Column(type: "datetime2", nullable: true), + SoundCategoryId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Sounds", x => x.Id); + table.ForeignKey( + name: "FK_Sounds_SoundCategories_SoundCategoryId", + column: x => x.SoundCategoryId, + principalTable: "SoundCategories", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ExperienceLevels", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Label = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + StaffId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ExperienceLevels", x => x.Id); + table.ForeignKey( + name: "FK_ExperienceLevels_Staffs_StaffId", + column: x => x.StaffId, + principalTable: "Staffs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "StaffAvailabilities", + columns: table => new + { + StaffId = table.Column(type: "int", nullable: false), + AvailabilityId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_StaffAvailabilities", x => new { x.AvailabilityId, x.StaffId }); + table.ForeignKey( + name: "FK_StaffAvailabilities_Availabilities_AvailabilityId", + column: x => x.AvailabilityId, + principalTable: "Availabilities", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_StaffAvailabilities_Staffs_StaffId", + column: x => x.StaffId, + principalTable: "Staffs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "StaffHistoryOfApprovals", + columns: table => new + { + StaffId = table.Column(type: "int", nullable: false), + HistoryOfApprovalId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_StaffHistoryOfApprovals", x => new { x.HistoryOfApprovalId, x.StaffId }); + table.ForeignKey( + name: "FK_StaffHistoryOfApprovals_HistoryOfApprovals_HistoryOfApprovalId", + column: x => x.HistoryOfApprovalId, + principalTable: "HistoryOfApprovals", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_StaffHistoryOfApprovals_Staffs_StaffId", + column: x => x.StaffId, + principalTable: "Staffs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Materials", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Quantity = table.Column(type: "int", nullable: false), + WarehouseId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Materials", x => x.Id); + table.ForeignKey( + name: "FK_Materials_Warehouses_WarehouseId", + column: x => x.WarehouseId, + principalTable: "Warehouses", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Movements", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Date = table.Column(type: "datetime2", nullable: false), + Start = table.Column(type: "datetime2", nullable: false), + Arrival = table.Column(type: "datetime2", nullable: false), + Quantity = table.Column(type: "int", nullable: false), + SourceWarehouseId = table.Column(type: "int", nullable: true), + DestinationWarehouseId = table.Column(type: "int", nullable: true) + }, + constraints: table => + { + table.PrimaryKey("PK_Movements", x => x.Id); + table.ForeignKey( + name: "FK_Movements_Warehouses_DestinationWarehouseId", + column: x => x.DestinationWarehouseId, + principalTable: "Warehouses", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_Movements_Warehouses_SourceWarehouseId", + column: x => x.SourceWarehouseId, + principalTable: "Warehouses", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "ShowStaff", + columns: table => new + { + StaffId = table.Column(type: "int", nullable: false), + ShowId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ShowStaff", x => new { x.StaffId, x.ShowId }); + table.ForeignKey( + name: "FK_ShowStaff_Shows_ShowId", + column: x => x.ShowId, + principalTable: "Shows", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ShowStaff_Staffs_StaffId", + column: x => x.StaffId, + principalTable: "Staffs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ShowTruck", + columns: table => new + { + ShowId = table.Column(type: "int", nullable: false), + TruckId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ShowTruck", x => new { x.ShowId, x.TruckId }); + table.ForeignKey( + name: "FK_ShowTruck_Shows_ShowId", + column: x => x.ShowId, + principalTable: "Shows", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ShowTruck_Trucks_TruckId", + column: x => x.TruckId, + principalTable: "Trucks", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Contacts", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + LastName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + FirstName = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Email = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + PhoneNumber = table.Column(type: "nvarchar(30)", maxLength: 30, nullable: false), + Address = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + ZipCode = table.Column(type: "int", nullable: false), + City = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Role = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + CustomerId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Contacts", x => x.Id); + table.ForeignKey( + name: "FK_Contacts_Customers_CustomerId", + column: x => x.CustomerId, + principalTable: "Customers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Quotations", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Message = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + ConditionsSale = table.Column(type: "nvarchar(300)", maxLength: 300, nullable: false), + CustomerId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Quotations", x => x.Id); + table.ForeignKey( + name: "FK_Quotations_Customers_CustomerId", + column: x => x.CustomerId, + principalTable: "Customers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Contract", + columns: table => new + { + ShowId = table.Column(type: "int", nullable: false), + ServiceProviderId = table.Column(type: "int", nullable: false), + TermsAndConditions = table.Column(type: "nvarchar(max)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Contract", x => new { x.ShowId, x.ServiceProviderId }); + table.ForeignKey( + name: "FK_Contract_Providers_ServiceProviderId", + column: x => x.ServiceProviderId, + principalTable: "Providers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Contract_Shows_ShowId", + column: x => x.ShowId, + principalTable: "Shows", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "SoundTimecodes", + columns: table => new + { + ShowId = table.Column(type: "int", nullable: false), + SoundId = table.Column(type: "int", nullable: false), + Start = table.Column(type: "decimal(18,2)", nullable: false), + End = table.Column(type: "decimal(18,2)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_SoundTimecodes", x => new { x.ShowId, x.SoundId }); + table.ForeignKey( + name: "FK_SoundTimecodes_Shows_ShowId", + column: x => x.ShowId, + principalTable: "Shows", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_SoundTimecodes_Sounds_SoundId", + column: x => x.SoundId, + principalTable: "Sounds", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "MaterialWarehouse", + columns: table => new + { + MaterialId = table.Column(type: "int", nullable: false), + WarehouseId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_MaterialWarehouse", x => new { x.MaterialId, x.WarehouseId }); + table.ForeignKey( + name: "FK_MaterialWarehouse_Materials_MaterialId", + column: x => x.MaterialId, + principalTable: "Materials", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + table.ForeignKey( + name: "FK_MaterialWarehouse_Warehouses_WarehouseId", + column: x => x.WarehouseId, + principalTable: "Warehouses", + principalColumn: "Id", + onDelete: ReferentialAction.Restrict); + }); + + migrationBuilder.CreateTable( + name: "ShowMaterial", + columns: table => new + { + ShowId = table.Column(type: "int", nullable: false), + MaterialId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ShowMaterial", x => new { x.ShowId, x.MaterialId }); + table.ForeignKey( + name: "FK_ShowMaterial_Materials_MaterialId", + column: x => x.MaterialId, + principalTable: "Materials", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ShowMaterial_Shows_ShowId", + column: x => x.ShowId, + principalTable: "Shows", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Products", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + References = table.Column(type: "int", nullable: false), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Duration = table.Column(type: "decimal(18,2)", nullable: false), + Caliber = table.Column(type: "decimal(18,2)", nullable: false), + ApprovalNumber = table.Column(type: "int", nullable: false), + Weight = table.Column(type: "decimal(18,2)", nullable: false), + Nec = table.Column(type: "decimal(18,2)", nullable: false), + SellingPrice = table.Column(type: "decimal(18,2)", nullable: false), + Image = table.Column(type: "nvarchar(max)", nullable: false), + Link = table.Column(type: "nvarchar(200)", maxLength: 200, nullable: false), + MinimalQuantity = table.Column(type: "int", nullable: false), + ClassificationId = table.Column(type: "int", nullable: false), + ProductCategoryId = table.Column(type: "int", nullable: false), + MovementId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Products", x => x.Id); + table.ForeignKey( + name: "FK_Products_Classifications_ClassificationId", + column: x => x.ClassificationId, + principalTable: "Classifications", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Products_Movements_MovementId", + column: x => x.MovementId, + principalTable: "Movements", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Products_ProductCategories_ProductCategoryId", + column: x => x.ProductCategoryId, + principalTable: "ProductCategories", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Communications", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Calling = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Email = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + Meeting = table.Column(type: "nvarchar(300)", maxLength: 300, nullable: false), + ContactId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Communications", x => x.Id); + table.ForeignKey( + name: "FK_Communications_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ContactServiceProvider", + columns: table => new + { + ContactId = table.Column(type: "int", nullable: false), + ServiceProviderId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ContactServiceProvider", x => new { x.ContactId, x.ServiceProviderId }); + table.ForeignKey( + name: "FK_ContactServiceProvider_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ContactServiceProvider_Providers_ServiceProviderId", + column: x => x.ServiceProviderId, + principalTable: "Providers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ProviderContacts", + columns: table => new + { + ProviderId = table.Column(type: "int", nullable: false), + ContactId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProviderContacts", x => new { x.ContactId, x.ProviderId }); + table.ForeignKey( + name: "FK_ProviderContacts_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ProviderContacts_Providers_ProviderId", + column: x => x.ProviderId, + principalTable: "Providers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "StaffContacts", + columns: table => new + { + StaffId = table.Column(type: "int", nullable: false), + ContactId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_StaffContacts", x => new { x.ContactId, x.StaffId }); + table.ForeignKey( + name: "FK_StaffContacts_Contacts_ContactId", + column: x => x.ContactId, + principalTable: "Contacts", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_StaffContacts_Staffs_StaffId", + column: x => x.StaffId, + principalTable: "Staffs", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Brands", + columns: table => new + { + Id = table.Column(type: "int", nullable: false) + .Annotation("SqlServer:Identity", "1, 1"), + Name = table.Column(type: "nvarchar(100)", maxLength: 100, nullable: false), + ProductId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Brands", x => x.Id); + table.ForeignKey( + name: "FK_Brands_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "Prices", + columns: table => new + { + ProductId = table.Column(type: "int", nullable: false), + SupplierId = table.Column(type: "int", nullable: false), + SellingPrice = table.Column(type: "decimal(18,2)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_Prices", x => new { x.ProductId, x.SupplierId }); + table.ForeignKey( + name: "FK_Prices_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_Prices_Suppliers_SupplierId", + column: x => x.SupplierId, + principalTable: "Suppliers", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ProductColors", + columns: table => new + { + ProductId = table.Column(type: "int", nullable: false), + ColorId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProductColors", x => new { x.ProductId, x.ColorId }); + table.ForeignKey( + name: "FK_ProductColors_Colors_ColorId", + column: x => x.ColorId, + principalTable: "Colors", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ProductColors_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ProductDeliveries", + columns: table => new + { + ProductId = table.Column(type: "int", nullable: false), + DeliveryNoteId = table.Column(type: "int", nullable: false), + Quantity = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProductDeliveries", x => new { x.ProductId, x.DeliveryNoteId }); + table.ForeignKey( + name: "FK_ProductDeliveries_DeliveryNotes_DeliveryNoteId", + column: x => x.DeliveryNoteId, + principalTable: "DeliveryNotes", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ProductDeliveries_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ProductEffects", + columns: table => new + { + ProductId = table.Column(type: "int", nullable: false), + EffectId = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProductEffects", x => new { x.ProductId, x.EffectId }); + table.ForeignKey( + name: "FK_ProductEffects_Effects_EffectId", + column: x => x.EffectId, + principalTable: "Effects", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ProductEffects_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "ProductTimecode", + columns: table => new + { + ProductId = table.Column(type: "int", nullable: false), + ShowId = table.Column(type: "int", nullable: false), + Start = table.Column(type: "decimal(18,2)", nullable: false), + End = table.Column(type: "decimal(18,2)", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_ProductTimecode", x => new { x.ProductId, x.ShowId }); + table.ForeignKey( + name: "FK_ProductTimecode_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_ProductTimecode_Shows_ShowId", + column: x => x.ShowId, + principalTable: "Shows", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "PurchaseProducts", + columns: table => new + { + ProductId = table.Column(type: "int", nullable: false), + PurchaseOrderId = table.Column(type: "int", nullable: false), + Quantity = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_PurchaseProducts", x => new { x.ProductId, x.PurchaseOrderId }); + table.ForeignKey( + name: "FK_PurchaseProducts_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_PurchaseProducts_PurchaseOrders_PurchaseOrderId", + column: x => x.PurchaseOrderId, + principalTable: "PurchaseOrders", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "QuotationProducts", + columns: table => new + { + ProductId = table.Column(type: "int", nullable: false), + QuotationId = table.Column(type: "int", nullable: false), + Quantity = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_QuotationProducts", x => new { x.ProductId, x.QuotationId }); + table.ForeignKey( + name: "FK_QuotationProducts_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_QuotationProducts_Quotations_QuotationId", + column: x => x.QuotationId, + principalTable: "Quotations", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateTable( + name: "WarehouseProducts", + columns: table => new + { + ProductId = table.Column(type: "int", nullable: false), + WarehouseId = table.Column(type: "int", nullable: false), + Quantity = table.Column(type: "int", nullable: false) + }, + constraints: table => + { + table.PrimaryKey("PK_WarehouseProducts", x => new { x.ProductId, x.WarehouseId }); + table.ForeignKey( + name: "FK_WarehouseProducts_Products_ProductId", + column: x => x.ProductId, + principalTable: "Products", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + table.ForeignKey( + name: "FK_WarehouseProducts_Warehouses_WarehouseId", + column: x => x.WarehouseId, + principalTable: "Warehouses", + principalColumn: "Id", + onDelete: ReferentialAction.Cascade); + }); + + migrationBuilder.CreateIndex( + name: "IX_Brands_ProductId", + table: "Brands", + column: "ProductId"); + + migrationBuilder.CreateIndex( + name: "IX_Communications_ContactId", + table: "Communications", + column: "ContactId"); + + migrationBuilder.CreateIndex( + name: "IX_Contacts_CustomerId", + table: "Contacts", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_ContactServiceProvider_ServiceProviderId", + table: "ContactServiceProvider", + column: "ServiceProviderId"); + + migrationBuilder.CreateIndex( + name: "IX_Contract_ServiceProviderId", + table: "Contract", + column: "ServiceProviderId"); + + migrationBuilder.CreateIndex( + name: "IX_Customers_CustomerTypeId", + table: "Customers", + column: "CustomerTypeId"); + + migrationBuilder.CreateIndex( + name: "IX_DeliveryNotes_DelivererId", + table: "DeliveryNotes", + column: "DelivererId"); + + migrationBuilder.CreateIndex( + name: "IX_ExperienceLevels_StaffId", + table: "ExperienceLevels", + column: "StaffId"); + + migrationBuilder.CreateIndex( + name: "IX_Materials_WarehouseId", + table: "Materials", + column: "WarehouseId"); + + migrationBuilder.CreateIndex( + name: "IX_MaterialWarehouse_WarehouseId", + table: "MaterialWarehouse", + column: "WarehouseId"); + + migrationBuilder.CreateIndex( + name: "IX_Movements_DestinationWarehouseId", + table: "Movements", + column: "DestinationWarehouseId"); + + migrationBuilder.CreateIndex( + name: "IX_Movements_SourceWarehouseId", + table: "Movements", + column: "SourceWarehouseId"); + + migrationBuilder.CreateIndex( + name: "IX_Prices_SupplierId", + table: "Prices", + column: "SupplierId"); + + migrationBuilder.CreateIndex( + name: "IX_ProductColors_ColorId", + table: "ProductColors", + column: "ColorId"); + + migrationBuilder.CreateIndex( + name: "IX_ProductDeliveries_DeliveryNoteId", + table: "ProductDeliveries", + column: "DeliveryNoteId"); + + migrationBuilder.CreateIndex( + name: "IX_ProductEffects_EffectId", + table: "ProductEffects", + column: "EffectId"); + + migrationBuilder.CreateIndex( + name: "IX_Products_ClassificationId", + table: "Products", + column: "ClassificationId"); + + migrationBuilder.CreateIndex( + name: "IX_Products_MovementId", + table: "Products", + column: "MovementId"); + + migrationBuilder.CreateIndex( + name: "IX_Products_ProductCategoryId", + table: "Products", + column: "ProductCategoryId"); + + migrationBuilder.CreateIndex( + name: "IX_ProductTimecode_ShowId", + table: "ProductTimecode", + column: "ShowId"); + + migrationBuilder.CreateIndex( + name: "IX_ProviderContacts_ProviderId", + table: "ProviderContacts", + column: "ProviderId"); + + migrationBuilder.CreateIndex( + name: "IX_Providers_ProviderTypeId", + table: "Providers", + column: "ProviderTypeId"); + + migrationBuilder.CreateIndex( + name: "IX_PurchaseProducts_PurchaseOrderId", + table: "PurchaseProducts", + column: "PurchaseOrderId"); + + migrationBuilder.CreateIndex( + name: "IX_QuotationProducts_QuotationId", + table: "QuotationProducts", + column: "QuotationId"); + + migrationBuilder.CreateIndex( + name: "IX_Quotations_CustomerId", + table: "Quotations", + column: "CustomerId"); + + migrationBuilder.CreateIndex( + name: "IX_ShowMaterial_MaterialId", + table: "ShowMaterial", + column: "MaterialId"); + + migrationBuilder.CreateIndex( + name: "IX_Shows_CityId", + table: "Shows", + column: "CityId"); + + migrationBuilder.CreateIndex( + name: "IX_ShowStaff_ShowId", + table: "ShowStaff", + column: "ShowId"); + + migrationBuilder.CreateIndex( + name: "IX_ShowTruck_TruckId", + table: "ShowTruck", + column: "TruckId"); + + migrationBuilder.CreateIndex( + name: "IX_Sounds_SoundCategoryId", + table: "Sounds", + column: "SoundCategoryId"); + + migrationBuilder.CreateIndex( + name: "IX_SoundTimecodes_SoundId", + table: "SoundTimecodes", + column: "SoundId"); + + migrationBuilder.CreateIndex( + name: "IX_StaffAvailabilities_StaffId", + table: "StaffAvailabilities", + column: "StaffId"); + + migrationBuilder.CreateIndex( + name: "IX_StaffContacts_StaffId", + table: "StaffContacts", + column: "StaffId"); + + migrationBuilder.CreateIndex( + name: "IX_StaffHistoryOfApprovals_StaffId", + table: "StaffHistoryOfApprovals", + column: "StaffId"); + + migrationBuilder.CreateIndex( + name: "IX_WarehouseProducts_WarehouseId", + table: "WarehouseProducts", + column: "WarehouseId"); + } + + /// + protected override void Down(MigrationBuilder migrationBuilder) + { + migrationBuilder.DropTable( + name: "Brands"); + + migrationBuilder.DropTable( + name: "Communications"); + + migrationBuilder.DropTable( + name: "ContactServiceProvider"); + + migrationBuilder.DropTable( + name: "Contract"); + + migrationBuilder.DropTable( + name: "ExperienceLevels"); + + migrationBuilder.DropTable( + name: "MaterialWarehouse"); + + migrationBuilder.DropTable( + name: "Prices"); + + migrationBuilder.DropTable( + name: "ProductColors"); + + migrationBuilder.DropTable( + name: "ProductDeliveries"); + + migrationBuilder.DropTable( + name: "ProductEffects"); + + migrationBuilder.DropTable( + name: "ProductTimecode"); + + migrationBuilder.DropTable( + name: "ProviderContacts"); + + migrationBuilder.DropTable( + name: "PurchaseProducts"); + + migrationBuilder.DropTable( + name: "QuotationProducts"); + + migrationBuilder.DropTable( + name: "Settings"); + + migrationBuilder.DropTable( + name: "ShowMaterial"); + + migrationBuilder.DropTable( + name: "ShowStaff"); + + migrationBuilder.DropTable( + name: "ShowTruck"); + + migrationBuilder.DropTable( + name: "SoundTimecodes"); + + migrationBuilder.DropTable( + name: "StaffAvailabilities"); + + migrationBuilder.DropTable( + name: "StaffContacts"); + + migrationBuilder.DropTable( + name: "StaffHistoryOfApprovals"); + + migrationBuilder.DropTable( + name: "Users"); + + migrationBuilder.DropTable( + name: "WarehouseProducts"); + + migrationBuilder.DropTable( + name: "Suppliers"); + + migrationBuilder.DropTable( + name: "Colors"); + + migrationBuilder.DropTable( + name: "DeliveryNotes"); + + migrationBuilder.DropTable( + name: "Effects"); + + migrationBuilder.DropTable( + name: "Providers"); + + migrationBuilder.DropTable( + name: "PurchaseOrders"); + + migrationBuilder.DropTable( + name: "Quotations"); + + migrationBuilder.DropTable( + name: "Materials"); + + migrationBuilder.DropTable( + name: "Trucks"); + + migrationBuilder.DropTable( + name: "Shows"); + + migrationBuilder.DropTable( + name: "Sounds"); + + migrationBuilder.DropTable( + name: "Availabilities"); + + migrationBuilder.DropTable( + name: "Contacts"); + + migrationBuilder.DropTable( + name: "HistoryOfApprovals"); + + migrationBuilder.DropTable( + name: "Staffs"); + + migrationBuilder.DropTable( + name: "Products"); + + migrationBuilder.DropTable( + name: "Deliverers"); + + migrationBuilder.DropTable( + name: "ProviderTypes"); + + migrationBuilder.DropTable( + name: "City"); + + migrationBuilder.DropTable( + name: "SoundCategories"); + + migrationBuilder.DropTable( + name: "Customers"); + + migrationBuilder.DropTable( + name: "Classifications"); + + migrationBuilder.DropTable( + name: "Movements"); + + migrationBuilder.DropTable( + name: "ProductCategories"); + + migrationBuilder.DropTable( + name: "CustomerTypes"); + + migrationBuilder.DropTable( + name: "Warehouses"); + } + } +} diff --git a/PF3/Migrations/PyroFetesDbContext.cs b/PF3/Migrations/PyroFetesDbContext.cs new file mode 100644 index 0000000..b5ce8c7 --- /dev/null +++ b/PF3/Migrations/PyroFetesDbContext.cs @@ -0,0 +1,93 @@ +using Microsoft.EntityFrameworkCore; +using PyroFetes.Models; +using ServiceProvider = PyroFetes.Models.ServiceProvider; + +namespace PyroFetes; + +public class PyroFetesDbContext : DbContext +{ + // Entities + public DbSet Availabilities { get; set; } + public DbSet Brands { get; set; } + public DbSet Classifications { get; set; } + public DbSet Colors { get; set; } + public DbSet Communications { get; set; } + public DbSet Contacts { get; set; } + public DbSet Customers { get; set; } + public DbSet CustomerTypes { get; set; } + public DbSet Deliverers { get; set; } + public DbSet DeliveryNotes { get; set; } + public DbSet Effects { get; set; } + public DbSet ExperienceLevels { get; set; } + public DbSet HistoryOfApprovals { get; set; } + public DbSet Materials { get; set; } + public DbSet Movements { get; set; } + public DbSet Prices { get; set; } + public DbSet Products { get; set; } + public DbSet ProductCategories { get; set; } + public DbSet ProductColors { get; set; } + public DbSet ProductDeliveries { get; set; } + public DbSet ProductEffects { get; set; } + public DbSet Providers { get; set; } + public DbSet ProviderContacts { get; set; } + public DbSet ProviderTypes { get; set; } + public DbSet PurchaseOrders { get; set; } + public DbSet PurchaseProducts { get; set; } + public DbSet Quotations { get; set; } + public DbSet QuotationProducts { get; set; } + public DbSet Settings { get; set; } + public DbSet Shows { get; set; } + public DbSet Sounds { get; set; } + public DbSet SoundCategories { get; set; } + public DbSet SoundTimecodes { get; set; } + public DbSet Staffs { get; set; } + public DbSet StaffAvailabilities { get; set; } + public DbSet StaffContacts { get; set; } + public DbSet StaffHistoryOfApprovals { get; set; } + public DbSet Suppliers { get; set; } + public DbSet Trucks { get; set; } + public DbSet Users { get; set; } + public DbSet Warehouses { get; set; } + public DbSet WarehouseProducts { get; set; } + + // Database configuration + protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) + { + string connectionString = + "Server=romaric-thibault.fr;" + + "Database=PyroFetes;" + + "User Id=pyrofetes;" + + "Password=Crablike8-Fringe-Swimmable;" + + "TrustServerCertificate=true;"; + + optionsBuilder.UseSqlServer(connectionString); + } + + // Models customization + protected override void OnModelCreating(ModelBuilder modelBuilder) + { + modelBuilder.Entity() + .HasOne(m => m.SourceWarehouse) + .WithMany(w => w.MovementsSource) + .HasForeignKey(m => m.SourceWarehouseId) + .OnDelete(DeleteBehavior.Restrict); + + modelBuilder.Entity() + .HasOne(m => m.DestinationWarehouse) + .WithMany(w => w.MovementsDestination) + .HasForeignKey(m => m.DestinationWarehouseId) + .OnDelete(DeleteBehavior.Restrict); + + modelBuilder.Entity() + .HasOne(mw => mw.Material) + .WithMany(m => m.MaterialWarehouses) + .HasForeignKey(mw => mw.MaterialId) + .OnDelete(DeleteBehavior.Restrict); + + modelBuilder.Entity() + .HasOne(mw => mw.Warehouse) + .WithMany(w => w.MaterialWarehouses) + .HasForeignKey(mw => mw.WarehouseId) + .OnDelete(DeleteBehavior.Restrict); + } +} \ No newline at end of file diff --git a/PF3/Migrations/PyroFetesDbContextModelSnapshot.cs b/PF3/Migrations/PyroFetesDbContextModelSnapshot.cs new file mode 100644 index 0000000..1f414fb --- /dev/null +++ b/PF3/Migrations/PyroFetesDbContextModelSnapshot.cs @@ -0,0 +1,1948 @@ +// +using System; +using Microsoft.EntityFrameworkCore; +using Microsoft.EntityFrameworkCore.Infrastructure; +using Microsoft.EntityFrameworkCore.Metadata; +using Microsoft.EntityFrameworkCore.Storage.ValueConversion; +using PyroFetes; + +#nullable disable + +namespace PyroFetes.Migrations +{ + [DbContext(typeof(PyroFetesDbContext))] + partial class PyroFetesDbContextModelSnapshot : ModelSnapshot + { + protected override void BuildModel(ModelBuilder modelBuilder) + { +#pragma warning disable 612, 618 + modelBuilder + .HasAnnotation("ProductVersion", "8.0.20") + .HasAnnotation("Relational:MaxIdentifierLength", 128); + + SqlServerModelBuilderExtensions.UseIdentityColumns(modelBuilder); + + modelBuilder.Entity("PyroFetes.Models.Availability", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("AvailabilityDate") + .HasColumnType("date"); + + b.Property("DeliveryDate") + .HasColumnType("date"); + + b.Property("ExpirationDate") + .HasColumnType("date"); + + b.Property("RenewallDate") + .HasColumnType("date"); + + b.HasKey("Id"); + + b.ToTable("Availabilities"); + }); + + modelBuilder.Entity("PyroFetes.Models.Brand", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ProductId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProductId"); + + b.ToTable("Brands"); + }); + + modelBuilder.Entity("PyroFetes.Models.City", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ZipCode") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("City"); + }); + + modelBuilder.Entity("PyroFetes.Models.Classification", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Classifications"); + }); + + modelBuilder.Entity("PyroFetes.Models.Color", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Colors"); + }); + + modelBuilder.Entity("PyroFetes.Models.Communication", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Calling") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ContactId") + .HasColumnType("int"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Meeting") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.HasKey("Id"); + + b.HasIndex("ContactId"); + + b.ToTable("Communications"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contact", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("CustomerId") + .HasColumnType("int"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("PhoneNumber") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("Role") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ZipCode") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.ToTable("Contacts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ContactServiceProvider", b => + { + b.Property("ContactId") + .HasColumnType("int"); + + b.Property("ServiceProviderId") + .HasColumnType("int"); + + b.HasKey("ContactId", "ServiceProviderId"); + + b.HasIndex("ServiceProviderId"); + + b.ToTable("ContactServiceProvider"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contract", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("ServiceProviderId") + .HasColumnType("int"); + + b.Property("TermsAndConditions") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("ShowId", "ServiceProviderId"); + + b.HasIndex("ServiceProviderId"); + + b.ToTable("Contract"); + }); + + modelBuilder.Entity("PyroFetes.Models.Customer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CustomerTypeId") + .HasColumnType("int"); + + b.Property("Note") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerTypeId"); + + b.ToTable("Customers"); + }); + + modelBuilder.Entity("PyroFetes.Models.CustomerType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("CustomerTypes"); + }); + + modelBuilder.Entity("PyroFetes.Models.Deliverer", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Transporter") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Deliverers"); + }); + + modelBuilder.Entity("PyroFetes.Models.DeliveryNote", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("DelivererId") + .HasColumnType("int"); + + b.Property("EstimateDeliveryDate") + .HasColumnType("date"); + + b.Property("ExpeditionDate") + .HasColumnType("date"); + + b.Property("RealDeliveryDate") + .HasColumnType("date"); + + b.Property("TrackingNumber") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.HasIndex("DelivererId"); + + b.ToTable("DeliveryNotes"); + }); + + modelBuilder.Entity("PyroFetes.Models.Effect", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.ToTable("Effects"); + }); + + modelBuilder.Entity("PyroFetes.Models.ExperienceLevel", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("StaffId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("StaffId"); + + b.ToTable("ExperienceLevels"); + }); + + modelBuilder.Entity("PyroFetes.Models.HistoryOfApproval", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("DeliveryDate") + .HasColumnType("date"); + + b.Property("ExpirationDate") + .HasColumnType("date"); + + b.HasKey("Id"); + + b.ToTable("HistoryOfApprovals"); + }); + + modelBuilder.Entity("PyroFetes.Models.Material", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("WarehouseId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("WarehouseId"); + + b.ToTable("Materials"); + }); + + modelBuilder.Entity("PyroFetes.Models.MaterialWarehouse", b => + { + b.Property("MaterialId") + .HasColumnType("int"); + + b.Property("WarehouseId") + .HasColumnType("int"); + + b.HasKey("MaterialId", "WarehouseId"); + + b.HasIndex("WarehouseId"); + + b.ToTable("MaterialWarehouse"); + }); + + modelBuilder.Entity("PyroFetes.Models.Movement", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Arrival") + .HasColumnType("datetime2"); + + b.Property("Date") + .HasColumnType("datetime2"); + + b.Property("DestinationWarehouseId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.Property("SourceWarehouseId") + .HasColumnType("int"); + + b.Property("Start") + .HasColumnType("datetime2"); + + b.HasKey("Id"); + + b.HasIndex("DestinationWarehouseId"); + + b.HasIndex("SourceWarehouseId"); + + b.ToTable("Movements"); + }); + + modelBuilder.Entity("PyroFetes.Models.Price", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("SupplierId") + .HasColumnType("int"); + + b.Property("SellingPrice") + .HasColumnType("decimal(18,2)"); + + b.HasKey("ProductId", "SupplierId"); + + b.HasIndex("SupplierId"); + + b.ToTable("Prices"); + }); + + modelBuilder.Entity("PyroFetes.Models.Product", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ApprovalNumber") + .HasColumnType("int"); + + b.Property("Caliber") + .HasColumnType("decimal(18,2)"); + + b.Property("ClassificationId") + .HasColumnType("int"); + + b.Property("Duration") + .HasColumnType("decimal(18,2)"); + + b.Property("Image") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Link") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.Property("MinimalQuantity") + .HasColumnType("int"); + + b.Property("MovementId") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Nec") + .HasColumnType("decimal(18,2)"); + + b.Property("ProductCategoryId") + .HasColumnType("int"); + + b.Property("References") + .HasColumnType("int"); + + b.Property("SellingPrice") + .HasColumnType("decimal(18,2)"); + + b.Property("Weight") + .HasColumnType("decimal(18,2)"); + + b.HasKey("Id"); + + b.HasIndex("ClassificationId"); + + b.HasIndex("MovementId"); + + b.HasIndex("ProductCategoryId"); + + b.ToTable("Products"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("ProductCategories"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductColor", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("ColorId") + .HasColumnType("int"); + + b.HasKey("ProductId", "ColorId"); + + b.HasIndex("ColorId"); + + b.ToTable("ProductColors"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductDelivery", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("DeliveryNoteId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("ProductId", "DeliveryNoteId"); + + b.HasIndex("DeliveryNoteId"); + + b.ToTable("ProductDeliveries"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductEffect", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("EffectId") + .HasColumnType("int"); + + b.HasKey("ProductId", "EffectId"); + + b.HasIndex("EffectId"); + + b.ToTable("ProductEffects"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductTimecode", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("End") + .HasColumnType("decimal(18,2)"); + + b.Property("Start") + .HasColumnType("decimal(18,2)"); + + b.HasKey("ProductId", "ShowId"); + + b.HasIndex("ShowId"); + + b.ToTable("ProductTimecode"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProviderContact", b => + { + b.Property("ContactId") + .HasColumnType("int"); + + b.Property("ProviderId") + .HasColumnType("int"); + + b.HasKey("ContactId", "ProviderId"); + + b.HasIndex("ProviderId"); + + b.ToTable("ProviderContacts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProviderType", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Label") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("ProviderTypes"); + }); + + modelBuilder.Entity("PyroFetes.Models.PurchaseOrder", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("PurchaseConditions") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.HasKey("Id"); + + b.ToTable("PurchaseOrders"); + }); + + modelBuilder.Entity("PyroFetes.Models.PurchaseProduct", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("PurchaseOrderId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("ProductId", "PurchaseOrderId"); + + b.HasIndex("PurchaseOrderId"); + + b.ToTable("PurchaseProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Quotation", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ConditionsSale") + .IsRequired() + .HasMaxLength(300) + .HasColumnType("nvarchar(300)"); + + b.Property("CustomerId") + .HasColumnType("int"); + + b.Property("Message") + .IsRequired() + .HasMaxLength(200) + .HasColumnType("nvarchar(200)"); + + b.HasKey("Id"); + + b.HasIndex("CustomerId"); + + b.ToTable("Quotations"); + }); + + modelBuilder.Entity("PyroFetes.Models.QuotationProduct", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("QuotationId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("ProductId", "QuotationId"); + + b.HasIndex("QuotationId"); + + b.ToTable("QuotationProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ServiceProvider", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Price") + .HasColumnType("decimal(18,2)"); + + b.Property("ProviderTypeId") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.HasIndex("ProviderTypeId"); + + b.ToTable("Providers"); + }); + + modelBuilder.Entity("PyroFetes.Models.Setting", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("ElectronicSignature") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.Property("Logo") + .IsRequired() + .HasColumnType("nvarchar(max)"); + + b.HasKey("Id"); + + b.ToTable("Settings"); + }); + + modelBuilder.Entity("PyroFetes.Models.Show", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("CityId") + .HasColumnType("int"); + + b.Property("Date") + .HasColumnType("date"); + + b.Property("Description") + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Place") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b.Property("PyrotechnicImplementationPlan") + .IsRequired() + .HasMaxLength(500) + .HasColumnType("nvarchar(500)"); + + b.HasKey("Id"); + + b.HasIndex("CityId"); + + b.ToTable("Shows"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowMaterial", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("MaterialId") + .HasColumnType("int"); + + b.HasKey("ShowId", "MaterialId"); + + b.HasIndex("MaterialId"); + + b.ToTable("ShowMaterial"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowStaff", b => + { + b.Property("StaffId") + .HasColumnType("int"); + + b.Property("ShowId") + .HasColumnType("int"); + + b.HasKey("StaffId", "ShowId"); + + b.HasIndex("ShowId"); + + b.ToTable("ShowStaff"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowTruck", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("TruckId") + .HasColumnType("int"); + + b.HasKey("ShowId", "TruckId"); + + b.HasIndex("TruckId"); + + b.ToTable("ShowTruck"); + }); + + modelBuilder.Entity("PyroFetes.Models.Sound", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Artist") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b.Property("CreationDate") + .HasColumnType("datetime2"); + + b.Property("Duration") + .IsRequired() + .HasColumnType("int"); + + b.Property("Format") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.Property("Kind") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b.Property("SoundCategoryId") + .HasColumnType("int"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.HasKey("Id"); + + b.HasIndex("SoundCategoryId"); + + b.ToTable("Sounds"); + }); + + modelBuilder.Entity("PyroFetes.Models.SoundCategory", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("SoundCategories"); + }); + + modelBuilder.Entity("PyroFetes.Models.SoundTimecode", b => + { + b.Property("ShowId") + .HasColumnType("int"); + + b.Property("SoundId") + .HasColumnType("int"); + + b.Property("End") + .HasColumnType("decimal(18,2)"); + + b.Property("Start") + .HasColumnType("decimal(18,2)"); + + b.HasKey("ShowId", "SoundId"); + + b.HasIndex("SoundId"); + + b.ToTable("SoundTimecodes"); + }); + + modelBuilder.Entity("PyroFetes.Models.Staff", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasMaxLength(120) + .HasColumnType("nvarchar(120)"); + + b.Property("F4T2ExpirationDate") + .HasColumnType("date"); + + b.Property("F4T2NumberApproval") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("FirstName") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.Property("LastName") + .IsRequired() + .HasMaxLength(60) + .HasColumnType("nvarchar(60)"); + + b.Property("Profession") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Staffs"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffAvailability", b => + { + b.Property("AvailabilityId") + .HasColumnType("int"); + + b.Property("StaffId") + .HasColumnType("int"); + + b.HasKey("AvailabilityId", "StaffId"); + + b.HasIndex("StaffId"); + + b.ToTable("StaffAvailabilities"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffContact", b => + { + b.Property("ContactId") + .HasColumnType("int"); + + b.Property("StaffId") + .HasColumnType("int"); + + b.HasKey("ContactId", "StaffId"); + + b.HasIndex("StaffId"); + + b.ToTable("StaffContacts"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffHistoryOfApproval", b => + { + b.Property("HistoryOfApprovalId") + .HasColumnType("int"); + + b.Property("StaffId") + .HasColumnType("int"); + + b.HasKey("HistoryOfApprovalId", "StaffId"); + + b.HasIndex("StaffId"); + + b.ToTable("StaffHistoryOfApprovals"); + }); + + modelBuilder.Entity("PyroFetes.Models.Supplier", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("DeliveryDelay") + .HasColumnType("int"); + + b.Property("Email") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Phone") + .IsRequired() + .HasMaxLength(30) + .HasColumnType("nvarchar(30)"); + + b.Property("ZipCode") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Suppliers"); + }); + + modelBuilder.Entity("PyroFetes.Models.Truck", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("MaxExplosiveCapacity") + .IsRequired() + .HasColumnType("float"); + + b.Property("Sizes") + .IsRequired() + .HasMaxLength(80) + .HasColumnType("nvarchar(80)"); + + b.Property("Status") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.Property("Type") + .IsRequired() + .HasMaxLength(40) + .HasColumnType("nvarchar(40)"); + + b.HasKey("Id"); + + b.ToTable("Trucks"); + }); + + modelBuilder.Entity("PyroFetes.Models.User", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Email") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Fonction") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Password") + .IsRequired() + .HasMaxLength(50) + .HasColumnType("nvarchar(50)"); + + b.Property("Salt") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.HasKey("Id"); + + b.ToTable("Users"); + }); + + modelBuilder.Entity("PyroFetes.Models.Warehouse", b => + { + b.Property("Id") + .ValueGeneratedOnAdd() + .HasColumnType("int"); + + SqlServerPropertyBuilderExtensions.UseIdentityColumn(b.Property("Id")); + + b.Property("Address") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("City") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("Current") + .HasColumnType("int"); + + b.Property("MaxWeight") + .HasColumnType("int"); + + b.Property("MinWeight") + .HasColumnType("int"); + + b.Property("Name") + .IsRequired() + .HasMaxLength(100) + .HasColumnType("nvarchar(100)"); + + b.Property("ZipCode") + .HasColumnType("int"); + + b.HasKey("Id"); + + b.ToTable("Warehouses"); + }); + + modelBuilder.Entity("PyroFetes.Models.WarehouseProduct", b => + { + b.Property("ProductId") + .HasColumnType("int"); + + b.Property("WarehouseId") + .HasColumnType("int"); + + b.Property("Quantity") + .HasColumnType("int"); + + b.HasKey("ProductId", "WarehouseId"); + + b.HasIndex("WarehouseId"); + + b.ToTable("WarehouseProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Brand", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("Brands") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("PyroFetes.Models.Communication", b => + { + b.HasOne("PyroFetes.Models.Contact", "Contact") + .WithMany("Communications") + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contact", b => + { + b.HasOne("PyroFetes.Models.Customer", "Customer") + .WithMany("Contacts") + .HasForeignKey("CustomerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("PyroFetes.Models.ContactServiceProvider", b => + { + b.HasOne("PyroFetes.Models.Contact", "Contact") + .WithMany("ContactServiceProviders") + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.ServiceProvider", "ServiceProvider") + .WithMany("ContactServiceProviders") + .HasForeignKey("ServiceProviderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("ServiceProvider"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contract", b => + { + b.HasOne("PyroFetes.Models.ServiceProvider", "ServiceProvider") + .WithMany("Contracts") + .HasForeignKey("ServiceProviderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("Contracts") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ServiceProvider"); + + b.Navigation("Show"); + }); + + modelBuilder.Entity("PyroFetes.Models.Customer", b => + { + b.HasOne("PyroFetes.Models.CustomerType", "CustomerType") + .WithMany("Customers") + .HasForeignKey("CustomerTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("CustomerType"); + }); + + modelBuilder.Entity("PyroFetes.Models.DeliveryNote", b => + { + b.HasOne("PyroFetes.Models.Deliverer", "Deliverer") + .WithMany("DeliveryNotes") + .HasForeignKey("DelivererId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Deliverer"); + }); + + modelBuilder.Entity("PyroFetes.Models.ExperienceLevel", b => + { + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("ExperienceLevels") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.Material", b => + { + b.HasOne("PyroFetes.Models.Warehouse", "Warehouse") + .WithMany() + .HasForeignKey("WarehouseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Warehouse"); + }); + + modelBuilder.Entity("PyroFetes.Models.MaterialWarehouse", b => + { + b.HasOne("PyroFetes.Models.Material", "Material") + .WithMany("MaterialWarehouses") + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Warehouse", "Warehouse") + .WithMany("MaterialWarehouses") + .HasForeignKey("WarehouseId") + .OnDelete(DeleteBehavior.Restrict) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("Warehouse"); + }); + + modelBuilder.Entity("PyroFetes.Models.Movement", b => + { + b.HasOne("PyroFetes.Models.Warehouse", "DestinationWarehouse") + .WithMany("MovementsDestination") + .HasForeignKey("DestinationWarehouseId") + .OnDelete(DeleteBehavior.Restrict); + + b.HasOne("PyroFetes.Models.Warehouse", "SourceWarehouse") + .WithMany("MovementsSource") + .HasForeignKey("SourceWarehouseId") + .OnDelete(DeleteBehavior.Restrict); + + b.Navigation("DestinationWarehouse"); + + b.Navigation("SourceWarehouse"); + }); + + modelBuilder.Entity("PyroFetes.Models.Price", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("Prices") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Supplier", "Supplier") + .WithMany("Prices") + .HasForeignKey("SupplierId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Supplier"); + }); + + modelBuilder.Entity("PyroFetes.Models.Product", b => + { + b.HasOne("PyroFetes.Models.Classification", "Classification") + .WithMany("Products") + .HasForeignKey("ClassificationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Movement", "Movement") + .WithMany("Products") + .HasForeignKey("MovementId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.ProductCategory", "ProductCategory") + .WithMany("Products") + .HasForeignKey("ProductCategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Classification"); + + b.Navigation("Movement"); + + b.Navigation("ProductCategory"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductColor", b => + { + b.HasOne("PyroFetes.Models.Color", "Color") + .WithMany("ProductColors") + .HasForeignKey("ColorId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("ProductColors") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Color"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductDelivery", b => + { + b.HasOne("PyroFetes.Models.DeliveryNote", "DeliveryNote") + .WithMany("ProductDeliveries") + .HasForeignKey("DeliveryNoteId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("ProductDeliveries") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("DeliveryNote"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductEffect", b => + { + b.HasOne("PyroFetes.Models.Effect", "Effect") + .WithMany("ProductEffects") + .HasForeignKey("EffectId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("ProductEffects") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Effect"); + + b.Navigation("Product"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductTimecode", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("ProductTimecodes") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ProductTimecodes") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Show"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProviderContact", b => + { + b.HasOne("PyroFetes.Models.Contact", "Contact") + .WithMany() + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.ServiceProvider", "Provider") + .WithMany() + .HasForeignKey("ProviderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Provider"); + }); + + modelBuilder.Entity("PyroFetes.Models.PurchaseProduct", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("PurchaseProducts") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.PurchaseOrder", "PurchaseOrder") + .WithMany("PurchaseProducts") + .HasForeignKey("PurchaseOrderId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("PurchaseOrder"); + }); + + modelBuilder.Entity("PyroFetes.Models.Quotation", b => + { + b.HasOne("PyroFetes.Models.Customer", "Customer") + .WithMany("Quotations") + .HasForeignKey("CustomerId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Customer"); + }); + + modelBuilder.Entity("PyroFetes.Models.QuotationProduct", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("QuotationProducts") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Quotation", "Quotation") + .WithMany("QuotationProducts") + .HasForeignKey("QuotationId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Quotation"); + }); + + modelBuilder.Entity("PyroFetes.Models.ServiceProvider", b => + { + b.HasOne("PyroFetes.Models.ProviderType", "ProviderType") + .WithMany("ServiceProviders") + .HasForeignKey("ProviderTypeId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("ProviderType"); + }); + + modelBuilder.Entity("PyroFetes.Models.Show", b => + { + b.HasOne("PyroFetes.Models.City", "City") + .WithMany("Shows") + .HasForeignKey("CityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("City"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowMaterial", b => + { + b.HasOne("PyroFetes.Models.Material", "Material") + .WithMany("ShowMaterials") + .HasForeignKey("MaterialId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ShowMaterials") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Material"); + + b.Navigation("Show"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowStaff", b => + { + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ShowStaffs") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("ShowStaffs") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Show"); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.ShowTruck", b => + { + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("ShowTrucks") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Truck", "Truck") + .WithMany("ShowTrucks") + .HasForeignKey("TruckId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Show"); + + b.Navigation("Truck"); + }); + + modelBuilder.Entity("PyroFetes.Models.Sound", b => + { + b.HasOne("PyroFetes.Models.SoundCategory", "SoundCategory") + .WithMany("Sounds") + .HasForeignKey("SoundCategoryId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("SoundCategory"); + }); + + modelBuilder.Entity("PyroFetes.Models.SoundTimecode", b => + { + b.HasOne("PyroFetes.Models.Show", "Show") + .WithMany("SoundTimecodes") + .HasForeignKey("ShowId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Sound", "Sound") + .WithMany("SoundTimecodes") + .HasForeignKey("SoundId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Show"); + + b.Navigation("Sound"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffAvailability", b => + { + b.HasOne("PyroFetes.Models.Availability", "Availability") + .WithMany("StaffAvailabilities") + .HasForeignKey("AvailabilityId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("StaffAvailabilities") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Availability"); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffContact", b => + { + b.HasOne("PyroFetes.Models.Contact", "Contact") + .WithMany("StaffContacts") + .HasForeignKey("ContactId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("StaffContacts") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Contact"); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.StaffHistoryOfApproval", b => + { + b.HasOne("PyroFetes.Models.HistoryOfApproval", "HistoryOfApproval") + .WithMany("StaffHistoryOfApprovals") + .HasForeignKey("HistoryOfApprovalId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Staff", "Staff") + .WithMany("StaffHistoryOfApprovals") + .HasForeignKey("StaffId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("HistoryOfApproval"); + + b.Navigation("Staff"); + }); + + modelBuilder.Entity("PyroFetes.Models.WarehouseProduct", b => + { + b.HasOne("PyroFetes.Models.Product", "Product") + .WithMany("WarehouseProducts") + .HasForeignKey("ProductId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.HasOne("PyroFetes.Models.Warehouse", "Warehouse") + .WithMany("WarehouseProducts") + .HasForeignKey("WarehouseId") + .OnDelete(DeleteBehavior.Cascade) + .IsRequired(); + + b.Navigation("Product"); + + b.Navigation("Warehouse"); + }); + + modelBuilder.Entity("PyroFetes.Models.Availability", b => + { + b.Navigation("StaffAvailabilities"); + }); + + modelBuilder.Entity("PyroFetes.Models.City", b => + { + b.Navigation("Shows"); + }); + + modelBuilder.Entity("PyroFetes.Models.Classification", b => + { + b.Navigation("Products"); + }); + + modelBuilder.Entity("PyroFetes.Models.Color", b => + { + b.Navigation("ProductColors"); + }); + + modelBuilder.Entity("PyroFetes.Models.Contact", b => + { + b.Navigation("Communications"); + + b.Navigation("ContactServiceProviders"); + + b.Navigation("StaffContacts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Customer", b => + { + b.Navigation("Contacts"); + + b.Navigation("Quotations"); + }); + + modelBuilder.Entity("PyroFetes.Models.CustomerType", b => + { + b.Navigation("Customers"); + }); + + modelBuilder.Entity("PyroFetes.Models.Deliverer", b => + { + b.Navigation("DeliveryNotes"); + }); + + modelBuilder.Entity("PyroFetes.Models.DeliveryNote", b => + { + b.Navigation("ProductDeliveries"); + }); + + modelBuilder.Entity("PyroFetes.Models.Effect", b => + { + b.Navigation("ProductEffects"); + }); + + modelBuilder.Entity("PyroFetes.Models.HistoryOfApproval", b => + { + b.Navigation("StaffHistoryOfApprovals"); + }); + + modelBuilder.Entity("PyroFetes.Models.Material", b => + { + b.Navigation("MaterialWarehouses"); + + b.Navigation("ShowMaterials"); + }); + + modelBuilder.Entity("PyroFetes.Models.Movement", b => + { + b.Navigation("Products"); + }); + + modelBuilder.Entity("PyroFetes.Models.Product", b => + { + b.Navigation("Brands"); + + b.Navigation("Prices"); + + b.Navigation("ProductColors"); + + b.Navigation("ProductDeliveries"); + + b.Navigation("ProductEffects"); + + b.Navigation("ProductTimecodes"); + + b.Navigation("PurchaseProducts"); + + b.Navigation("QuotationProducts"); + + b.Navigation("WarehouseProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProductCategory", b => + { + b.Navigation("Products"); + }); + + modelBuilder.Entity("PyroFetes.Models.ProviderType", b => + { + b.Navigation("ServiceProviders"); + }); + + modelBuilder.Entity("PyroFetes.Models.PurchaseOrder", b => + { + b.Navigation("PurchaseProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Quotation", b => + { + b.Navigation("QuotationProducts"); + }); + + modelBuilder.Entity("PyroFetes.Models.ServiceProvider", b => + { + b.Navigation("ContactServiceProviders"); + + b.Navigation("Contracts"); + }); + + modelBuilder.Entity("PyroFetes.Models.Show", b => + { + b.Navigation("Contracts"); + + b.Navigation("ProductTimecodes"); + + b.Navigation("ShowMaterials"); + + b.Navigation("ShowStaffs"); + + b.Navigation("ShowTrucks"); + + b.Navigation("SoundTimecodes"); + }); + + modelBuilder.Entity("PyroFetes.Models.Sound", b => + { + b.Navigation("SoundTimecodes"); + }); + + modelBuilder.Entity("PyroFetes.Models.SoundCategory", b => + { + b.Navigation("Sounds"); + }); + + modelBuilder.Entity("PyroFetes.Models.Staff", b => + { + b.Navigation("ExperienceLevels"); + + b.Navigation("ShowStaffs"); + + b.Navigation("StaffAvailabilities"); + + b.Navigation("StaffContacts"); + + b.Navigation("StaffHistoryOfApprovals"); + }); + + modelBuilder.Entity("PyroFetes.Models.Supplier", b => + { + b.Navigation("Prices"); + }); + + modelBuilder.Entity("PyroFetes.Models.Truck", b => + { + b.Navigation("ShowTrucks"); + }); + + modelBuilder.Entity("PyroFetes.Models.Warehouse", b => + { + b.Navigation("MaterialWarehouses"); + + b.Navigation("MovementsDestination"); + + b.Navigation("MovementsSource"); + + b.Navigation("WarehouseProducts"); + }); +#pragma warning restore 612, 618 + } + } +} diff --git a/PF3/Models/.idea/.gitignore b/PF3/Models/.idea/.gitignore new file mode 100644 index 0000000..516c578 --- /dev/null +++ b/PF3/Models/.idea/.gitignore @@ -0,0 +1,13 @@ +# Default ignored files +/shelf/ +/workspace.xml +# Rider ignored files +/.idea.Models.iml +/modules.xml +/contentModel.xml +/projectSettingsUpdater.xml +# Editor-based HTTP Client requests +/httpRequests/ +# Datasource local storage ignored files +/dataSources/ +/dataSources.local.xml diff --git a/PF3/Models/.idea/encodings.xml b/PF3/Models/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/PF3/Models/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/PF3/Models/.idea/indexLayout.xml b/PF3/Models/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/PF3/Models/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/PF3/Models/Availability.cs b/PF3/Models/Availability.cs new file mode 100644 index 0000000..47b0f1c --- /dev/null +++ b/PF3/Models/Availability.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Availability +{ + [Key] public int Id { get; set; } + [Required] public DateOnly AvailabilityDate { get; set; } + [Required] public DateOnly DeliveryDate { get; set; } + [Required] public DateOnly ExpirationDate { get; set; } + [Required] public DateOnly RenewallDate { get; set; } + + public List? StaffAvailabilities { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/Brand.cs b/PF3/Models/Brand.cs new file mode 100644 index 0000000..49016ca --- /dev/null +++ b/PF3/Models/Brand.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Brand +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Name { get; set; } + + [Required] public int ProductId { get; set; } + [Required] public Product? Product { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/City.cs b/PF3/Models/City.cs new file mode 100644 index 0000000..04dc24e --- /dev/null +++ b/PF3/Models/City.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class City +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Name { get; set; } + [Required] public int ZipCode { get; set; } + + public List? Shows { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/Classification.cs b/PF3/Models/Classification.cs new file mode 100644 index 0000000..bd3685b --- /dev/null +++ b/PF3/Models/Classification.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Classification +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Label { get; set; } + + public List? Products { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/Color.cs b/PF3/Models/Color.cs new file mode 100644 index 0000000..acfe830 --- /dev/null +++ b/PF3/Models/Color.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Color +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Label { get; set; } + + public List? ProductColors { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/Communication.cs b/PF3/Models/Communication.cs new file mode 100644 index 0000000..a3dd0d2 --- /dev/null +++ b/PF3/Models/Communication.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Communication +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Calling { get; set; } + [Required, MaxLength(100)] public string? Email { get; set; } + [Required, MaxLength(300)] public string? Meeting { get; set; } + + [Required] public int ContactId { get; set; } + public Contact? Contact { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/Contact.cs b/PF3/Models/Contact.cs new file mode 100644 index 0000000..e1573ad --- /dev/null +++ b/PF3/Models/Contact.cs @@ -0,0 +1,23 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Contact +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? LastName { get; set; } + [Required, MaxLength(100)] public string? FirstName { get; set; } + [Required, MaxLength(100)] public string? Email { get; set; } + [Required, MaxLength(30)] public string? PhoneNumber { get; set; } + [Required, MaxLength(100)] public string? Address { get; set; } + [Required] public int ZipCode { get; set; } + [Required, MaxLength(100)] public string? City { get; set; } + [Required, MaxLength(100)] public string? Role { get; set; } + + public Customer? Customer { get; set; } + [Required] public int CustomerId { get; set; } + + public List? Communications { get; set; } + public List? StaffContacts { get; set; } + public List? ContactServiceProviders { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/ContactServiceProvider.cs b/PF3/Models/ContactServiceProvider.cs new file mode 100644 index 0000000..cc9cd1b --- /dev/null +++ b/PF3/Models/ContactServiceProvider.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ContactId), nameof(ServiceProviderId))] +public class ContactServiceProvider +{ + [Required] public int ContactId { get; set; } + [Required] public int ServiceProviderId { get; set; } + + public Contact? Contact { get; set; } + public ServiceProvider? ServiceProvider { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/Contract.cs b/PF3/Models/Contract.cs new file mode 100644 index 0000000..97cd821 --- /dev/null +++ b/PF3/Models/Contract.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ShowId), nameof(ServiceProviderId))] +public class Contract +{ + [Required] public int ShowId { get; set; } + [Required] public int ServiceProviderId { get; set; } + [Required] public string? TermsAndConditions { get; set; } + + public Show? Show { get; set; } + public ServiceProvider? ServiceProvider { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/Customer.cs b/PF3/Models/Customer.cs new file mode 100644 index 0000000..da6dbba --- /dev/null +++ b/PF3/Models/Customer.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Customer +{ + [Key] public int Id { get; set; } + [Required, MaxLength(200)] public string? Note { get; set; } + + //Relations + [Required] public int CustomerTypeId { get; set; } + public CustomerType? CustomerType { get; set; } + + public List? Contacts { get; set; } + public List? Quotations { get; set; } +} diff --git a/PF3/Models/CustomerType.cs b/PF3/Models/CustomerType.cs new file mode 100644 index 0000000..197ad09 --- /dev/null +++ b/PF3/Models/CustomerType.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class CustomerType +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Label { get; set; } + + public List? Customers { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/Deliverer.cs b/PF3/Models/Deliverer.cs new file mode 100644 index 0000000..34e708c --- /dev/null +++ b/PF3/Models/Deliverer.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Deliverer +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Transporter { get; set; } + + public List? DeliveryNotes { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/DeliveryNote.cs b/PF3/Models/DeliveryNote.cs new file mode 100644 index 0000000..21e873e --- /dev/null +++ b/PF3/Models/DeliveryNote.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class DeliveryNote +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? TrackingNumber { get; set; } + public int DelivererId { get; set; } + [Required] public DateOnly EstimateDeliveryDate { get; set; } + [Required] public DateOnly ExpeditionDate { get; set; } + [Required] public DateOnly RealDeliveryDate { get; set; } + + public Deliverer? Deliverer { get; set; } + public List? ProductDeliveries { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/Effect.cs b/PF3/Models/Effect.cs new file mode 100644 index 0000000..0dcb87c --- /dev/null +++ b/PF3/Models/Effect.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Effect +{ + [Key] public int Id { get; set; } + [Required, MaxLength(200)] public string? Label { get; set; } + + public List? ProductEffects { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/ExperienceLevel.cs b/PF3/Models/ExperienceLevel.cs new file mode 100644 index 0000000..923f757 --- /dev/null +++ b/PF3/Models/ExperienceLevel.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class ExperienceLevel +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Label { get; set; } + + public Staff? Staff { get; set; } + [Required] public int StaffId { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/HistoryOfApproval.cs b/PF3/Models/HistoryOfApproval.cs new file mode 100644 index 0000000..c8fd073 --- /dev/null +++ b/PF3/Models/HistoryOfApproval.cs @@ -0,0 +1,12 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class HistoryOfApproval +{ + [Key] public int Id { get; set; } + [Required] public DateOnly DeliveryDate { get; set; } + [Required] public DateOnly ExpirationDate { get; set; } + + public List? StaffHistoryOfApprovals { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/Material.cs b/PF3/Models/Material.cs new file mode 100644 index 0000000..224e5d5 --- /dev/null +++ b/PF3/Models/Material.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Material +{ + [Key] public int Id {get; set;} + [Required, MaxLength(100)] public string? Name {get; set;} + [Required] public int Quantity {get; set;} + + [Required] public int WarehouseId {get; set;} + public Warehouse? Warehouse {get; set;} + + public List? ShowMaterials {get; set;} + public List? MaterialWarehouses {get; set;} +} \ No newline at end of file diff --git a/PF3/Models/MaterialWarehouse.cs b/PF3/Models/MaterialWarehouse.cs new file mode 100644 index 0000000..4f49ba9 --- /dev/null +++ b/PF3/Models/MaterialWarehouse.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(MaterialId), nameof(WarehouseId))] +public class MaterialWarehouse +{ + [Required] public int MaterialId { get; set; } + [Required] public int WarehouseId { get; set; } + + public Material? Material { get; set; } + public Warehouse? Warehouse { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/Movement.cs b/PF3/Models/Movement.cs new file mode 100644 index 0000000..fe26f18 --- /dev/null +++ b/PF3/Models/Movement.cs @@ -0,0 +1,19 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Movement +{ + [Key] public int Id { get; set; } + [Required] public DateTime Date { get; set; } + [Required] public DateTime Start {get; set;} + [Required] public DateTime Arrival {get; set;} + [Required] public int Quantity {get; set;} + + public List? Products { get; set; } + + public int? SourceWarehouseId {get; set;} + public Warehouse? SourceWarehouse {get; set;} + public int? DestinationWarehouseId {get; set;} + public Warehouse? DestinationWarehouse {get; set;} +} \ No newline at end of file diff --git a/PF3/Models/Price.cs b/PF3/Models/Price.cs new file mode 100644 index 0000000..2ee597e --- /dev/null +++ b/PF3/Models/Price.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; +using System.Runtime.CompilerServices; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ProductId), nameof(SupplierId))] +public class Price +{ + [Required] public int ProductId { get; set; } + [Required] public int SupplierId { get; set; } + [Required] public decimal SellingPrice { get; set; } + + public Product? Product { get; set; } + public Supplier? Supplier { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/Product.cs b/PF3/Models/Product.cs new file mode 100644 index 0000000..b0f0d7f --- /dev/null +++ b/PF3/Models/Product.cs @@ -0,0 +1,42 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models +{ + public class Product + { + [Key] public int Id { get; set; } + [Required] public int References { get; set; } + [Required, MaxLength(100)] public string? Name { get; set; } + [Required] public decimal Duration {get; set;} + [Required] public decimal Caliber { get; set; } + [Required] public int ApprovalNumber { get; set; } + [Required] public decimal Weight { get; set; } + [Required] public decimal Nec { get; set; } + [Required] public decimal SellingPrice { get; set; } + [Required] public string? Image { get; set; } + [Required, MaxLength(200)] public string? Link { get; set; } + [Required] public int MinimalQuantity { get; set; } + + // Relations + [Required] public int ClassificationId { get; set; } + public Classification? Classification { get; set; } + + [Required] public int ProductCategoryId { get; set; } + public ProductCategory? ProductCategory { get; set; } + + [Required] public int MovementId {get; set;} + public Movement? Movement {get; set;} + + public List? ProductDeliveries { get; set; } + public List? Brands { get; set; } + public List? ProductEffects { get; set; } + public List? ProductColors { get; set; } + public List? PurchaseProducts { get; set; } + public List? Prices { get; set; } + public List? QuotationProducts { get; set; } + public List? WarehouseProducts { get; set; } + public List? ProductTimecodes { get; set; } + + + } +} \ No newline at end of file diff --git a/PF3/Models/ProductCategory.cs b/PF3/Models/ProductCategory.cs new file mode 100644 index 0000000..79bd67f --- /dev/null +++ b/PF3/Models/ProductCategory.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class ProductCategory +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Label { get; set; } + + public List? Products { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/ProductColor.cs b/PF3/Models/ProductColor.cs new file mode 100644 index 0000000..f93d964 --- /dev/null +++ b/PF3/Models/ProductColor.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ProductId), nameof(ColorId))] +public class ProductColor +{ + public Product? Product { get; set; } + [Required] public int ProductId { get; set; } + + public Color? Color { get; set; } + [Required] public int ColorId { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/ProductDelivery.cs b/PF3/Models/ProductDelivery.cs new file mode 100644 index 0000000..bfbae68 --- /dev/null +++ b/PF3/Models/ProductDelivery.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ProductId), nameof(DeliveryNoteId))] +public class ProductDelivery +{ + [Required] public int ProductId { get; set; } + [Required] public int DeliveryNoteId { get; set; } + [Required] public int Quantity { get; set; } + + public Product? Product { get; set; } + public DeliveryNote? DeliveryNote { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/ProductEffect.cs b/PF3/Models/ProductEffect.cs new file mode 100644 index 0000000..3f269d6 --- /dev/null +++ b/PF3/Models/ProductEffect.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ProductId), nameof(EffectId))] +public class ProductEffect +{ + [Required] public Product? Product { get; set; } + [Required] public int ProductId { get; set; } + + public Effect? Effect { get; set; } + [Required] public int EffectId { get; set; } + +} \ No newline at end of file diff --git a/PF3/Models/ProductTimecode.cs b/PF3/Models/ProductTimecode.cs new file mode 100644 index 0000000..a4ad826 --- /dev/null +++ b/PF3/Models/ProductTimecode.cs @@ -0,0 +1,17 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ProductId), nameof(ShowId))] +public class ProductTimecode +{ + public Product? Product { get; set; } + [Required] public int ProductId { get; set; } + + public Show? Show { get; set; } + [Required] public int ShowId { get; set; } + + [Required] public decimal Start { get; set; } + [Required] public decimal End { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/ProviderContact.cs b/PF3/Models/ProviderContact.cs new file mode 100644 index 0000000..8d21d35 --- /dev/null +++ b/PF3/Models/ProviderContact.cs @@ -0,0 +1,12 @@ +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ContactId), nameof(ProviderId))] +public class ProviderContact +{ + public int ProviderId { get; set; } + public ServiceProvider? Provider { get; set; } + public int ContactId { get; set; } + public Contact? Contact { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/ProviderType.cs b/PF3/Models/ProviderType.cs new file mode 100644 index 0000000..0871b8a --- /dev/null +++ b/PF3/Models/ProviderType.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class ProviderType +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Label { get; set; } + + public List? ServiceProviders { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/PurchaseOrder.cs b/PF3/Models/PurchaseOrder.cs new file mode 100644 index 0000000..815f5a0 --- /dev/null +++ b/PF3/Models/PurchaseOrder.cs @@ -0,0 +1,11 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class PurchaseOrder +{ + [Key] public int Id { get; set; } + [Required, MaxLength(300)] public string? PurchaseConditions { get; set; } + + public List? PurchaseProducts { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/PurchaseProduct.cs b/PF3/Models/PurchaseProduct.cs new file mode 100644 index 0000000..c335ede --- /dev/null +++ b/PF3/Models/PurchaseProduct.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ProductId), nameof(PurchaseOrderId))] +public class PurchaseProduct +{ + public Product? Product { get; set; } + [Required] public int ProductId { get; set; } + + public PurchaseOrder? PurchaseOrder { get; set; } + [Required] public int PurchaseOrderId { get; set; } + + [Required] public int Quantity { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/Quotation.cs b/PF3/Models/Quotation.cs new file mode 100644 index 0000000..569c271 --- /dev/null +++ b/PF3/Models/Quotation.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Quotation +{ + [Key] public int Id { get; set; } + [Required, MaxLength(200)] public string? Message { get; set; } + [Required, MaxLength(300)] public string? ConditionsSale { get; set; } + + [Required] public int CustomerId { get; set; } + public Customer? Customer { get; set; } + + public List? QuotationProducts { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/QuotationProduct.cs b/PF3/Models/QuotationProduct.cs new file mode 100644 index 0000000..8e2f3bb --- /dev/null +++ b/PF3/Models/QuotationProduct.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ProductId), nameof(QuotationId))] +public class QuotationProduct +{ + [Required] public int ProductId { get; set; } + [Required] public int QuotationId { get; set; } + [Required] public int Quantity { get; set; } + + public Product? Product { get; set; } + public Quotation? Quotation { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/ServiceProvider.cs b/PF3/Models/ServiceProvider.cs new file mode 100644 index 0000000..b91e0d7 --- /dev/null +++ b/PF3/Models/ServiceProvider.cs @@ -0,0 +1,16 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class ServiceProvider +{ + [Key] public int Id { get; set; } + [Required] public decimal Price { get; set; } + + //Relations + [Required] public int ProviderTypeId { get; set; } + public ProviderType? ProviderType { get; set; } + + public List? Contracts { get; set; } + public List? ContactServiceProviders { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/Setting.cs b/PF3/Models/Setting.cs new file mode 100644 index 0000000..0759032 --- /dev/null +++ b/PF3/Models/Setting.cs @@ -0,0 +1,10 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Setting +{ + [Key] public int Id { get; set; } + [Required] public string? Logo { get; set; } + [Required] public string? ElectronicSignature { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/Show.cs b/PF3/Models/Show.cs deleted file mode 100644 index b076106..0000000 --- a/PF3/Models/Show.cs +++ /dev/null @@ -1,27 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace PF3.Models; - -public class Show -{ - [Key] public int Id { get; set; } - - [Required] - public string? Name { get; set; } - - [Required, MaxLength(120)] - public string? Place { get; set; } - - [MaxLength(500)] - public string? Description { get; set; } - - // Lien (chemin/URL/nom de fichier) vers le plan d’implémentation pyrotechnique - [Required, MaxLength(500)] - public string? PyrotechnicImplementationPlan { get; set; } - - public DateTime? Date { get; set; } - - public ICollection Staff { get; set; } = new List(); - public ICollection Trucks { get; set; } = new List(); - public ICollection SoundCues { get; set; } = new List(); -} \ No newline at end of file diff --git a/PF3/Models/ShowMaterial.cs b/PF3/Models/ShowMaterial.cs new file mode 100644 index 0000000..81cc82a --- /dev/null +++ b/PF3/Models/ShowMaterial.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ShowId), nameof(MaterialId))] +public class ShowMaterial +{ + [Required] public Show? Show { get; set; } + [Required] public int ShowId { get; set; } + + public Material? Material { get; set; } + [Required] public int MaterialId { get; set; } + +} \ No newline at end of file diff --git a/PF3/Models/ShowServiceProvider.cs b/PF3/Models/ShowServiceProvider.cs new file mode 100644 index 0000000..351c9fc --- /dev/null +++ b/PF3/Models/ShowServiceProvider.cs @@ -0,0 +1,9 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class ShowServiceProvider +{ + [Key] public int Id { get; set; } + +} \ No newline at end of file diff --git a/PF3/Models/ShowStaff.cs b/PF3/Models/ShowStaff.cs new file mode 100644 index 0000000..60a7215 --- /dev/null +++ b/PF3/Models/ShowStaff.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(StaffId), nameof(ShowId))] +public class ShowStaff +{ + public Staff? Staff { get; set; } + [Required] public int StaffId { get; set; } + + public Show? Show { get; set; } + [Required] public int ShowId { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/ShowTruck.cs b/PF3/Models/ShowTruck.cs new file mode 100644 index 0000000..9f39f8a --- /dev/null +++ b/PF3/Models/ShowTruck.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ShowId), nameof(TruckId))] +public class ShowTruck +{ + public Show? Show { get; set; } + [Required] public int ShowId { get; set; } + + public Truck? Truck { get; set; } + [Required] public int TruckId { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/Sound.cs b/PF3/Models/Sound.cs deleted file mode 100644 index f1fbf0c..0000000 --- a/PF3/Models/Sound.cs +++ /dev/null @@ -1,35 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using PF3.Models; - -namespace PF3.Models; - -public class Sound -{ - [Key] public int Id { get; set; } - - [Required, MaxLength(120)] - public string Name { get; set; } = null!; - - [Required, MaxLength(60)] - public string? Type { get; set; } - - [Required, MaxLength(120)] - public string? Artist { get; set; } - - [Required, Range(0, int.MaxValue)] - public int? Duration { get; set; } - - [Required, MaxLength(40)] - public string? Kind { get; set; } - - [Required, MaxLength(40)] - public string? Format { get; set; } - - public DateTime? CreationDate { get; set; } - - [Required] - public int SoundCategoryId { get; set; } - public SoundCategory? Category { get; set; } - - public ICollection ShowPlacements { get; set; } = new List(); -} \ No newline at end of file diff --git a/PF3/Models/SoundCategory.cs b/PF3/Models/SoundCategory.cs deleted file mode 100644 index 89d67bc..0000000 --- a/PF3/Models/SoundCategory.cs +++ /dev/null @@ -1,13 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace PF3.Models; - -public class SoundCategory -{ - [Key] public int Id { get; set; } - - [Required, MaxLength(60)] - public string Name { get; set; } = null!; - - public ICollection Sounds { get; set; } = new List(); -} \ No newline at end of file diff --git a/PF3/Models/SoundTimecode.cs b/PF3/Models/SoundTimecode.cs deleted file mode 100644 index 0f349ce..0000000 --- a/PF3/Models/SoundTimecode.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace PF3.Models; - -public class SoundTimecode -{ - [Key] public int Id { get; set; } - - [Required] - public int ShowId { get; set; } - public Show? Show { get; set; } - - [Required] - public int SoundId { get; set; } - public Sound? Sound { get; set; } - - [Required, Range(0, int.MaxValue)] - public int Start { get; set; } - - [Required, Range(0, int.MaxValue)] - public int End { get; set; } -} \ No newline at end of file diff --git a/PF3/Models/Staff.cs b/PF3/Models/Staff.cs deleted file mode 100644 index caa3c1e..0000000 --- a/PF3/Models/Staff.cs +++ /dev/null @@ -1,22 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace PF3.Models; - -public class Staff -{ - [Key] public int Id { get; set; } - - [Required, MaxLength(60)] - public string FirstName { get; set; } = null!; - - [Required, MaxLength(60)] - public string LastName { get; set; } = null!; - - [Required, MaxLength(100)] - public string? Profession { get; set; } - - [Required, MaxLength(120)] - public string? Email { get; set; } - - public ICollection Shows { get; set; } = new List(); -} \ No newline at end of file diff --git a/PF3/Models/StaffAvailability.cs b/PF3/Models/StaffAvailability.cs new file mode 100644 index 0000000..3ba0732 --- /dev/null +++ b/PF3/Models/StaffAvailability.cs @@ -0,0 +1,12 @@ +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(AvailabilityId), nameof(StaffId))] +public class StaffAvailability +{ + public int StaffId { get; set; } + public Staff? Staff { get; set; } + public int AvailabilityId { get; set; } + public Availability? Availability { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/StaffContact.cs b/PF3/Models/StaffContact.cs new file mode 100644 index 0000000..18ab5a9 --- /dev/null +++ b/PF3/Models/StaffContact.cs @@ -0,0 +1,13 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ContactId), nameof(StaffId))] +public class StaffContact +{ + [Required] public int StaffId { get; set; } + public Staff? Staff { get; set; } + [Required] public int ContactId { get; set; } + public Contact? Contact { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/StaffHistoryOfApproval.cs b/PF3/Models/StaffHistoryOfApproval.cs new file mode 100644 index 0000000..3937064 --- /dev/null +++ b/PF3/Models/StaffHistoryOfApproval.cs @@ -0,0 +1,12 @@ +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(HistoryOfApprovalId), nameof(StaffId))] +public class StaffHistoryOfApproval +{ + public int StaffId { get; set; } + public Staff? Staff { get; set; } + public int HistoryOfApprovalId { get; set; } + public HistoryOfApproval? HistoryOfApproval { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/Supplier.cs b/PF3/Models/Supplier.cs new file mode 100644 index 0000000..f131804 --- /dev/null +++ b/PF3/Models/Supplier.cs @@ -0,0 +1,17 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Supplier +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Name { get; set; } + [Required, MaxLength(100)] public string? Email { get; set; } + [Required, MaxLength(30)] public string? Phone { get; set; } + [Required, MaxLength(100)] public string? Address { get; set; } + [Required] public int ZipCode { get; set; } + [Required, MaxLength(100)] public string? City { get; set; } + [Required] public int DeliveryDelay { get; set; } + + public List? Prices { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/Truck.cs b/PF3/Models/Truck.cs deleted file mode 100644 index aae485f..0000000 --- a/PF3/Models/Truck.cs +++ /dev/null @@ -1,24 +0,0 @@ -using System.ComponentModel.DataAnnotations; - -namespace PF3.Models; - -public class Truck -{ - [Key] public int Id { get; set; } - - [Required, MaxLength(40)] - public string Type { get; set; } = null!; - - [Range(0, double.MaxValue)] - public double? MaxExplosiveCapacity { get; set; } - - [Required, MaxLength(80)] - public string? Sizes { get; set; } - - [Required, MaxLength(40)] - public string? Statut { get; set; } - - [Required] - public int ShowId { get; set; } - public Show? Show { get; set; } -} \ No newline at end of file diff --git a/PF3/Models/User.cs b/PF3/Models/User.cs new file mode 100644 index 0000000..8baaa1c --- /dev/null +++ b/PF3/Models/User.cs @@ -0,0 +1,13 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class User +{ + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string? Name { get; set; } + [Required, MinLength(12), MaxLength(50)] public string? Password { get; set; } + [Required, MaxLength(100)] public string? Salt { get; set; } + [Required, MaxLength(100)] public string? Email { get; set; } + [Required, MaxLength(100)] public string? Fonction { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/Warehouse.cs b/PF3/Models/Warehouse.cs new file mode 100644 index 0000000..8d014e7 --- /dev/null +++ b/PF3/Models/Warehouse.cs @@ -0,0 +1,22 @@ +using System.ComponentModel.DataAnnotations; + +namespace PyroFetes.Models; + +public class Warehouse +{ + [Key] public int Id {get; set;} + [Required, MaxLength(100)] public string? Name {get; set;} + [Required] public int MaxWeight {get; set;} + [Required] public int Current {get; set;} + [Required] public int MinWeight {get; set;} + [Required, MaxLength(100)] public string? Address { get; set; } + [Required] public int ZipCode { get; set; } + [Required, MaxLength(100)] public string? City { get; set; } + + public List? WarehouseProducts { get; set; } + + public List? MaterialWarehouses {get; set;} + + public List? MovementsSource { get; set; } + public List? MovementsDestination { get; set; } +} \ No newline at end of file diff --git a/PF3/Models/WarehouseProduct.cs b/PF3/Models/WarehouseProduct.cs new file mode 100644 index 0000000..fe89d36 --- /dev/null +++ b/PF3/Models/WarehouseProduct.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace PyroFetes.Models; + +[PrimaryKey(nameof(ProductId), nameof(WarehouseId))] +public class WarehouseProduct +{ + [Required] public int ProductId { get; set; } + public Product? Product { get; set; } + [Required] public int WarehouseId { get; set; } + public Warehouse? Warehouse { get; set; } + + [Required] public int Quantity { get; set; } +} \ No newline at end of file diff --git a/PF3/PF3.csproj b/PF3/PF3.csproj index 72289cb..01b3d74 100644 --- a/PF3/PF3.csproj +++ b/PF3/PF3.csproj @@ -7,7 +7,15 @@ + + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + @@ -15,7 +23,12 @@ - + + + + + + diff --git a/PF3/Program.cs b/PF3/Program.cs index 161f695..ec8fcbb 100644 --- a/PF3/Program.cs +++ b/PF3/Program.cs @@ -1,3 +1,9 @@ +using System; +using System.Linq; +using Microsoft.AspNetCore.Builder; +using Microsoft.Extensions.DependencyInjection; +using Microsoft.Extensions.Hosting; + var builder = WebApplication.CreateBuilder(args); // Add services to the container.