From 856d8e273322ce5da68c42de5875be7d64b9ce22 Mon Sep 17 00:00:00 2001 From: sanchezvem Date: Tue, 7 Oct 2025 23:46:57 +0100 Subject: [PATCH] =?UTF-8?q?Correction=20de=20toutes=20les=20erreurs=20de?= =?UTF-8?q?=20relations=20et=20d'=C3=A9critures=20dans=20tous?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PyroFetes/Models/Movement.cs | 2 +- PyroFetes/Models/Show.cs | 10 ++++------ PyroFetes/Models/ShowStaff.cs | 14 ++++++++++++++ PyroFetes/Models/ShowTruck.cs | 14 ++++++++++++++ PyroFetes/Models/Staff.cs | 5 +++-- PyroFetes/Models/Truck.cs | 6 +++--- PyroFetes/Models/Warehouse.cs | 2 ++ 7 files changed, 41 insertions(+), 12 deletions(-) create mode 100644 PyroFetes/Models/ShowStaff.cs create mode 100644 PyroFetes/Models/ShowTruck.cs diff --git a/PyroFetes/Models/Movement.cs b/PyroFetes/Models/Movement.cs index b7cf0da..ec47c22 100644 --- a/PyroFetes/Models/Movement.cs +++ b/PyroFetes/Models/Movement.cs @@ -11,9 +11,9 @@ public class Movement [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/PyroFetes/Models/Show.cs b/PyroFetes/Models/Show.cs index 29616e5..21514d7 100644 --- a/PyroFetes/Models/Show.cs +++ b/PyroFetes/Models/Show.cs @@ -5,20 +5,18 @@ namespace PyroFetes.Models; public class Show { [Key] public int Id { get; set; } - [Required] public string? Name { get; set; } + [Required, MaxLength(100)] public string? Name { get; set; } [Required, MaxLength(120)] public string? Place { get; set; } [MaxLength(500)] public string? Description { get; set; } + public DateOnly? Date { get; set; } // Link (path/URL/file name) to the pyrotechnic implementation plan [Required, MaxLength(500)] public string? PyrotechnicImplementationPlan { get; set; } - public DateOnly? Date { get; set; } - [Required] public int CityId { get; set; } public City? City { get; set; } - public ICollection? Staff { get; set; } - public ICollection? Trucks { get; set; } - + public List? ShowStaffs { get; set; } + public List? ShowTrucks { get; set; } public List? SoundTimecodes { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/ShowStaff.cs b/PyroFetes/Models/ShowStaff.cs new file mode 100644 index 0000000..60a7215 --- /dev/null +++ b/PyroFetes/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/PyroFetes/Models/ShowTruck.cs b/PyroFetes/Models/ShowTruck.cs new file mode 100644 index 0000000..9f39f8a --- /dev/null +++ b/PyroFetes/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/PyroFetes/Models/Staff.cs b/PyroFetes/Models/Staff.cs index 670adef..e95f08b 100644 --- a/PyroFetes/Models/Staff.cs +++ b/PyroFetes/Models/Staff.cs @@ -9,7 +9,8 @@ public class Staff [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; } - [Required] public string? F4T2NumberApproval { get; set; } + [Required, MaxLength(100)] public string? F4T2NumberApproval { get; set; } [Required] public DateOnly F4T2ExpirationDate { get; set; } - public ICollection? Shows { get; set; } + + public List? ShowStaffs { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Truck.cs b/PyroFetes/Models/Truck.cs index b0a55f8..91794a9 100644 --- a/PyroFetes/Models/Truck.cs +++ b/PyroFetes/Models/Truck.cs @@ -6,9 +6,9 @@ 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] public double? MaxExplosiveCapacity { get; set; } [Required, MaxLength(80)] public string? Sizes { get; set; } [Required, MaxLength(40)] public string? Status { get; set; } - [Required] public int ShowId { get; set; } - public Show? Show { get; set; } + + public List? ShowTrucks { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Warehouse.cs b/PyroFetes/Models/Warehouse.cs index 4a69d2d..c91b24e 100644 --- a/PyroFetes/Models/Warehouse.cs +++ b/PyroFetes/Models/Warehouse.cs @@ -14,6 +14,8 @@ public class Warehouse [Required, MaxLength(100)] public string? City { get; set; } public List? WarehouseProducts { get; set; } + + public List? Materials {get; set;} public List? MovementsSource { get; set; } public List? MovementsDestination { get; set; }