From 423f4c4a6c99e61db324f578180707aa0e788237 Mon Sep 17 00:00:00 2001 From: reignem Date: Thu, 2 Oct 2025 14:30:54 +0200 Subject: [PATCH 1/6] =?UTF-8?q?Ajout=20du=20Mod=C3=A8le=20du=20sujet=201?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- PyroFetes/Models/.idea/.gitignore | 13 +++++++++++ PyroFetes/Models/.idea/encodings.xml | 4 ++++ PyroFetes/Models/.idea/indexLayout.xml | 8 +++++++ PyroFetes/Models/Brand.cs | 12 ++++++++++ PyroFetes/Models/Classification.cs | 11 +++++++++ PyroFetes/Models/Color.cs | 10 +++++++++ PyroFetes/Models/Effect.cs | 10 +++++++++ PyroFetes/Models/Material.cs | 13 +++++++++++ PyroFetes/Models/Movement.cs | 21 +++++++++++++++++ PyroFetes/Models/Price.cs | 17 ++++++++++++++ PyroFetes/Models/Product.cs | 31 ++++++++++++++++++++++++++ PyroFetes/Models/ProductCategory.cs | 11 +++++++++ PyroFetes/Models/ProductColor.cs | 14 ++++++++++++ PyroFetes/Models/ProductEffect.cs | 15 +++++++++++++ PyroFetes/Models/Supplier.cs | 15 +++++++++++++ PyroFetes/Models/Warehouse.cs | 22 ++++++++++++++++++ PyroFetes/Models/WarehouseProduct.cs | 15 +++++++++++++ 17 files changed, 242 insertions(+) create mode 100644 PyroFetes/Models/.idea/.gitignore create mode 100644 PyroFetes/Models/.idea/encodings.xml create mode 100644 PyroFetes/Models/.idea/indexLayout.xml create mode 100644 PyroFetes/Models/Brand.cs create mode 100644 PyroFetes/Models/Classification.cs create mode 100644 PyroFetes/Models/Color.cs create mode 100644 PyroFetes/Models/Effect.cs create mode 100644 PyroFetes/Models/Material.cs create mode 100644 PyroFetes/Models/Movement.cs create mode 100644 PyroFetes/Models/Price.cs create mode 100644 PyroFetes/Models/Product.cs create mode 100644 PyroFetes/Models/ProductCategory.cs create mode 100644 PyroFetes/Models/ProductColor.cs create mode 100644 PyroFetes/Models/ProductEffect.cs create mode 100644 PyroFetes/Models/Supplier.cs create mode 100644 PyroFetes/Models/Warehouse.cs create mode 100644 PyroFetes/Models/WarehouseProduct.cs diff --git a/PyroFetes/Models/.idea/.gitignore b/PyroFetes/Models/.idea/.gitignore new file mode 100644 index 0000000..516c578 --- /dev/null +++ b/PyroFetes/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/PyroFetes/Models/.idea/encodings.xml b/PyroFetes/Models/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/PyroFetes/Models/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/PyroFetes/Models/.idea/indexLayout.xml b/PyroFetes/Models/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/PyroFetes/Models/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/PyroFetes/Models/Brand.cs b/PyroFetes/Models/Brand.cs new file mode 100644 index 0000000..7278cec --- /dev/null +++ b/PyroFetes/Models/Brand.cs @@ -0,0 +1,12 @@ +using API.Class; + +namespace API.Models; + +public class Brand +{ + public int Id { get; set; } + public string Name { get; set; } + + public int ProductId { get; set; } + public Product Product { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Classification.cs b/PyroFetes/Models/Classification.cs new file mode 100644 index 0000000..bdc57b2 --- /dev/null +++ b/PyroFetes/Models/Classification.cs @@ -0,0 +1,11 @@ +using API.Class; + +namespace API.Models; + +public class Classification +{ + public int Id { get; set; } + public string Label { get; set; } + + public List Products { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Color.cs b/PyroFetes/Models/Color.cs new file mode 100644 index 0000000..2654725 --- /dev/null +++ b/PyroFetes/Models/Color.cs @@ -0,0 +1,10 @@ +using API.Class; + +namespace API.Models; + +public class Color +{ + public int Id { get; set; } + public string Label { get; set; } + +} \ No newline at end of file diff --git a/PyroFetes/Models/Effect.cs b/PyroFetes/Models/Effect.cs new file mode 100644 index 0000000..7643d4b --- /dev/null +++ b/PyroFetes/Models/Effect.cs @@ -0,0 +1,10 @@ +using API.Class; + +namespace API.Models; + +public class Effect +{ + public int Id { get; set; } + public string Label { get; set; } + +} \ No newline at end of file diff --git a/PyroFetes/Models/Material.cs b/PyroFetes/Models/Material.cs new file mode 100644 index 0000000..872c1c9 --- /dev/null +++ b/PyroFetes/Models/Material.cs @@ -0,0 +1,13 @@ +using API.Class; + +namespace API.Models; + +public class Material +{ + public int Id {get; set;} + public string Name {get; set;} + public int Quantity {get; set;} + + public int WarehouseId {get; set;} + public Warehouse Warehouse {get; set;} +} \ No newline at end of file diff --git a/PyroFetes/Models/Movement.cs b/PyroFetes/Models/Movement.cs new file mode 100644 index 0000000..436a1ad --- /dev/null +++ b/PyroFetes/Models/Movement.cs @@ -0,0 +1,21 @@ +using API.Class; + +namespace API.Models; + +public class Movement +{ + public int Id { get; set; } + public DateTime Date { get; set; } + public DateTime Start {get; set;} + public DateTime Arrival {get; set;} + public int Quantity {get; set;} + + public int ProductId {get; set;} + public Product Product {get; set;} + + public int? sourceWarehouse {get; set;} + public Warehouse SourceWarehouse {get; set;} + + public int? destinationWarehouse {get; set;} + public Warehouse DestinationWarehouse {get; set;} +} \ No newline at end of file diff --git a/PyroFetes/Models/Price.cs b/PyroFetes/Models/Price.cs new file mode 100644 index 0000000..6f28e60 --- /dev/null +++ b/PyroFetes/Models/Price.cs @@ -0,0 +1,17 @@ +using System.ComponentModel.DataAnnotations; +using API.Class; +using Microsoft.EntityFrameworkCore; + +namespace API.Models; + +[PrimaryKey(nameof(SupplierId), nameof(ProductId))] +public class Price +{ + public decimal Label { get; set; } + + public int SupplierId { get; set; } + [Required] public Supplier Supplier { get; set; } + + public int ProductId { get; set; } + [Required] public Product Product { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/Product.cs b/PyroFetes/Models/Product.cs new file mode 100644 index 0000000..0399afb --- /dev/null +++ b/PyroFetes/Models/Product.cs @@ -0,0 +1,31 @@ +using API.Class; + +namespace API.Models +{ + public class Product + { + public int Id { get; set; } + public int References { get; set; } + public string Name { get; set; } + public decimal Duration {get; set;} + public decimal Caliber { get; set; } + public int ApprovalNumber { get; set; } + public decimal Weight { get; set; } + public decimal Nec { get; set; } + public decimal SellingPrice { get; set; } + public string Image { get; set; } + public string Link { get; set; } + + // Relations + public int ClassificationId { get; set; } + public Classification Classification { get; set; } + + public int ProductCategoryId { get; set; } + public ProductCategory ProductCategory { get; set; } + + public List Brands { get; set; } + + public List Movements { get; set; } + + } +} \ No newline at end of file diff --git a/PyroFetes/Models/ProductCategory.cs b/PyroFetes/Models/ProductCategory.cs new file mode 100644 index 0000000..ca4bacd --- /dev/null +++ b/PyroFetes/Models/ProductCategory.cs @@ -0,0 +1,11 @@ +using API.Class; + +namespace API.Models; + +public class ProductCategory +{ + public int Id { get; set; } + public string Label { get; set; } + + public List Products { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/ProductColor.cs b/PyroFetes/Models/ProductColor.cs new file mode 100644 index 0000000..58d17bf --- /dev/null +++ b/PyroFetes/Models/ProductColor.cs @@ -0,0 +1,14 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace API.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/PyroFetes/Models/ProductEffect.cs b/PyroFetes/Models/ProductEffect.cs new file mode 100644 index 0000000..bc6b33c --- /dev/null +++ b/PyroFetes/Models/ProductEffect.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; +using Microsoft.EntityFrameworkCore; + +namespace API.Models; + +[PrimaryKey(nameof(ProductId), nameof(EffectId))] +public class ProductEffect +{ + 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/PyroFetes/Models/Supplier.cs b/PyroFetes/Models/Supplier.cs new file mode 100644 index 0000000..b519e1f --- /dev/null +++ b/PyroFetes/Models/Supplier.cs @@ -0,0 +1,15 @@ +using API.Models; + +namespace API.Class; + +public class Supplier +{ + public int Id { get; set; } + public string Name { get; set; } + public string Email { get; set; } + public string PhoneNumber { get; set; } + public string Adress { get; set; } + public int ZipCode { get; set; } + public string City { get; set; } + +} \ No newline at end of file diff --git a/PyroFetes/Models/Warehouse.cs b/PyroFetes/Models/Warehouse.cs new file mode 100644 index 0000000..3145ac4 --- /dev/null +++ b/PyroFetes/Models/Warehouse.cs @@ -0,0 +1,22 @@ +using API.Models; + +namespace API.Class; + +public class Warehouse +{ + public int Id {get; set;} + public string Name {get; set;} + public int MaxWeight {get; set;} + public int Current {get; set;} + public int MinWeight {get; set;} + public string Adress { get; set; } + public int ZipCode { get; set; } + public string City { get; set; } + + + public List Materials {get; set;} + + + public List MovementsSource { get; set; } + public List MovementsDestination { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Models/WarehouseProduct.cs b/PyroFetes/Models/WarehouseProduct.cs new file mode 100644 index 0000000..7aeb873 --- /dev/null +++ b/PyroFetes/Models/WarehouseProduct.cs @@ -0,0 +1,15 @@ +using System.ComponentModel.DataAnnotations; +using API.Class; + +namespace API.Models; + +public class WarehouseProduct +{ + public int Quantity { get; set; } + + public int ProductId { get; set; } + [Required] public Product Product { get; set; } + + public int WarehouseId { get; set; } + [Required] public Warehouse Warehouse { get; set; } +} \ No newline at end of file From 964faa0b6b038934fb4aa169c89de40fe6421863 Mon Sep 17 00:00:00 2001 From: reignem Date: Thu, 2 Oct 2025 14:43:34 +0200 Subject: [PATCH 2/6] Ajout des Key et Required --- PyroFetes/Models/Brand.cs | 11 +++++---- PyroFetes/Models/Classification.cs | 9 ++++--- PyroFetes/Models/Color.cs | 7 +++--- PyroFetes/Models/Effect.cs | 7 +++--- PyroFetes/Models/Material.cs | 13 +++++----- PyroFetes/Models/Movement.cs | 25 ++++++++++--------- PyroFetes/Models/Price.cs | 6 ++--- PyroFetes/Models/Product.cs | 37 ++++++++++++++-------------- PyroFetes/Models/ProductCategory.cs | 9 ++++--- PyroFetes/Models/ProductColor.cs | 4 +-- PyroFetes/Models/ProductEffect.cs | 4 +-- PyroFetes/Models/Supplier.cs | 17 +++++++------ PyroFetes/Models/Warehouse.cs | 25 ++++++++++--------- PyroFetes/Models/WarehouseProduct.cs | 6 ++--- 14 files changed, 95 insertions(+), 85 deletions(-) diff --git a/PyroFetes/Models/Brand.cs b/PyroFetes/Models/Brand.cs index 7278cec..93b596c 100644 --- a/PyroFetes/Models/Brand.cs +++ b/PyroFetes/Models/Brand.cs @@ -1,12 +1,13 @@ -using API.Class; +using System.ComponentModel.DataAnnotations; +using API.Class; namespace API.Models; public class Brand { - public int Id { get; set; } - public string Name { get; set; } + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string Name { get; set; } - public int ProductId { get; set; } - public Product Product { get; set; } + [Required] public int ProductId { get; set; } + [Required] public Product Product { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Classification.cs b/PyroFetes/Models/Classification.cs index bdc57b2..43be442 100644 --- a/PyroFetes/Models/Classification.cs +++ b/PyroFetes/Models/Classification.cs @@ -1,11 +1,12 @@ -using API.Class; +using System.ComponentModel.DataAnnotations; +using API.Class; namespace API.Models; public class Classification { - public int Id { get; set; } - public string Label { get; set; } + [Key] public int Id { get; set; } + [Required] public string Label { get; set; } - public List Products { get; set; } + [Required] public List Products { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Color.cs b/PyroFetes/Models/Color.cs index 2654725..d7a0d7d 100644 --- a/PyroFetes/Models/Color.cs +++ b/PyroFetes/Models/Color.cs @@ -1,10 +1,11 @@ -using API.Class; +using System.ComponentModel.DataAnnotations; +using API.Class; namespace API.Models; public class Color { - public int Id { get; set; } - public string Label { get; set; } + [Key] public int Id { get; set; } + [Required] public string Label { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Effect.cs b/PyroFetes/Models/Effect.cs index 7643d4b..b8f083f 100644 --- a/PyroFetes/Models/Effect.cs +++ b/PyroFetes/Models/Effect.cs @@ -1,10 +1,11 @@ -using API.Class; +using System.ComponentModel.DataAnnotations; +using API.Class; namespace API.Models; public class Effect { - public int Id { get; set; } - public string Label { get; set; } + [Key] public int Id { get; set; } + [Required] public string Label { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Material.cs b/PyroFetes/Models/Material.cs index 872c1c9..f60fc61 100644 --- a/PyroFetes/Models/Material.cs +++ b/PyroFetes/Models/Material.cs @@ -1,13 +1,14 @@ -using API.Class; +using System.ComponentModel.DataAnnotations; +using API.Class; namespace API.Models; public class Material { - public int Id {get; set;} - public string Name {get; set;} - public int Quantity {get; set;} + [Key] public int Id {get; set;} + [Required, MaxLength(100)] public string Name {get; set;} + [Required] public int Quantity {get; set;} - public int WarehouseId {get; set;} - public Warehouse Warehouse {get; set;} + [Required] public int WarehouseId {get; set;} + [Required] public Warehouse Warehouse {get; set;} } \ No newline at end of file diff --git a/PyroFetes/Models/Movement.cs b/PyroFetes/Models/Movement.cs index 436a1ad..ff875d8 100644 --- a/PyroFetes/Models/Movement.cs +++ b/PyroFetes/Models/Movement.cs @@ -1,21 +1,22 @@ -using API.Class; +using System.ComponentModel.DataAnnotations; +using API.Class; namespace API.Models; public class Movement { - public int Id { get; set; } - public DateTime Date { get; set; } - public DateTime Start {get; set;} - public DateTime Arrival {get; set;} - public int Quantity {get; set;} + [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 int ProductId {get; set;} - public Product Product {get; set;} + [Required] public int ProductId {get; set;} + [Required] public Product Product {get; set;} - public int? sourceWarehouse {get; set;} - public Warehouse SourceWarehouse {get; set;} + [Required] public int? sourceWarehouse {get; set;} + [Required] public Warehouse SourceWarehouse {get; set;} - public int? destinationWarehouse {get; set;} - public Warehouse DestinationWarehouse {get; set;} + [Required] public int? destinationWarehouse {get; set;} + [Required] public Warehouse DestinationWarehouse {get; set;} } \ No newline at end of file diff --git a/PyroFetes/Models/Price.cs b/PyroFetes/Models/Price.cs index 6f28e60..9878768 100644 --- a/PyroFetes/Models/Price.cs +++ b/PyroFetes/Models/Price.cs @@ -7,11 +7,11 @@ namespace API.Models; [PrimaryKey(nameof(SupplierId), nameof(ProductId))] public class Price { - public decimal Label { get; set; } + [Required] public decimal Label { get; set; } - public int SupplierId { get; set; } + [Required] public int SupplierId { get; set; } [Required] public Supplier Supplier { get; set; } - public int ProductId { get; set; } + [Required] public int ProductId { get; set; } [Required] public Product Product { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Product.cs b/PyroFetes/Models/Product.cs index 0399afb..e2d5db3 100644 --- a/PyroFetes/Models/Product.cs +++ b/PyroFetes/Models/Product.cs @@ -1,31 +1,32 @@ -using API.Class; +using System.ComponentModel.DataAnnotations; +using API.Class; namespace API.Models { public class Product { - public int Id { get; set; } - public int References { get; set; } - public string Name { get; set; } - public decimal Duration {get; set;} - public decimal Caliber { get; set; } - public int ApprovalNumber { get; set; } - public decimal Weight { get; set; } - public decimal Nec { get; set; } - public decimal SellingPrice { get; set; } - public string Image { get; set; } - public string Link { get; set; } + [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] public string Link { get; set; } // Relations - public int ClassificationId { get; set; } - public Classification Classification { get; set; } + [Required] public int ClassificationId { get; set; } + [Required] public Classification Classification { get; set; } - public int ProductCategoryId { get; set; } - public ProductCategory ProductCategory { get; set; } + [Required] public int ProductCategoryId { get; set; } + [Required] public ProductCategory ProductCategory { get; set; } - public List Brands { get; set; } + [Required] public List Brands { get; set; } - public List Movements { get; set; } + [Required] public List Movements { get; set; } } } \ No newline at end of file diff --git a/PyroFetes/Models/ProductCategory.cs b/PyroFetes/Models/ProductCategory.cs index ca4bacd..419970c 100644 --- a/PyroFetes/Models/ProductCategory.cs +++ b/PyroFetes/Models/ProductCategory.cs @@ -1,11 +1,12 @@ -using API.Class; +using System.ComponentModel.DataAnnotations; +using API.Class; namespace API.Models; public class ProductCategory { - public int Id { get; set; } - public string Label { get; set; } + [Key] public int Id { get; set; } + [Required] public string Label { get; set; } - public List Products { get; set; } + [Required] public List Products { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/ProductColor.cs b/PyroFetes/Models/ProductColor.cs index 58d17bf..8beac4d 100644 --- a/PyroFetes/Models/ProductColor.cs +++ b/PyroFetes/Models/ProductColor.cs @@ -6,9 +6,9 @@ namespace API.Models; [PrimaryKey(nameof(ProductId), nameof(ColorId))] public class ProductColor { - public Product? Product { get; set; } + [Required] public Product? Product { get; set; } [Required] public int ProductId { get; set; } - public Color? Color { get; set; } + [Required] public Color? Color { get; set; } [Required] public int ColorId { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/ProductEffect.cs b/PyroFetes/Models/ProductEffect.cs index bc6b33c..5289662 100644 --- a/PyroFetes/Models/ProductEffect.cs +++ b/PyroFetes/Models/ProductEffect.cs @@ -6,10 +6,10 @@ namespace API.Models; [PrimaryKey(nameof(ProductId), nameof(EffectId))] public class ProductEffect { - public Product? Product { get; set; } + [Required] public Product? Product { get; set; } [Required] public int ProductId { get; set; } - public Effect? Effect { get; set; } + [Required] public Effect? Effect { get; set; } [Required] public int EffectId { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Supplier.cs b/PyroFetes/Models/Supplier.cs index b519e1f..6d44a91 100644 --- a/PyroFetes/Models/Supplier.cs +++ b/PyroFetes/Models/Supplier.cs @@ -1,15 +1,16 @@ -using API.Models; +using System.ComponentModel.DataAnnotations; +using API.Models; namespace API.Class; public class Supplier { - public int Id { get; set; } - public string Name { get; set; } - public string Email { get; set; } - public string PhoneNumber { get; set; } - public string Adress { get; set; } - public int ZipCode { get; set; } - public string City { get; set; } + [Key] public int Id { get; set; } + [Required, MaxLength(100)] public string Name { get; set; } + [Required] public string Email { get; set; } + [Required] public string PhoneNumber { get; set; } + [Required] public string Adress { get; set; } + [Required] public int ZipCode { get; set; } + [Required] public string City { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Warehouse.cs b/PyroFetes/Models/Warehouse.cs index 3145ac4..388e4d2 100644 --- a/PyroFetes/Models/Warehouse.cs +++ b/PyroFetes/Models/Warehouse.cs @@ -1,22 +1,23 @@ -using API.Models; +using System.ComponentModel.DataAnnotations; +using API.Models; namespace API.Class; public class Warehouse { - public int Id {get; set;} - public string Name {get; set;} - public int MaxWeight {get; set;} - public int Current {get; set;} - public int MinWeight {get; set;} - public string Adress { get; set; } - public int ZipCode { get; set; } - public string City { get; set; } + [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] public string Adress { get; set; } + [Required] public int ZipCode { get; set; } + [Required] public string City { get; set; } - public List Materials {get; set;} + [Required] public List Materials {get; set;} - public List MovementsSource { get; set; } - public List MovementsDestination { get; set; } + [Required] public List MovementsSource { get; set; } + [Required] public List MovementsDestination { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/WarehouseProduct.cs b/PyroFetes/Models/WarehouseProduct.cs index 7aeb873..79e5329 100644 --- a/PyroFetes/Models/WarehouseProduct.cs +++ b/PyroFetes/Models/WarehouseProduct.cs @@ -5,11 +5,11 @@ namespace API.Models; public class WarehouseProduct { - public int Quantity { get; set; } + [Key] public int Quantity { get; set; } - public int ProductId { get; set; } + [Required] public int ProductId { get; set; } [Required] public Product Product { get; set; } - public int WarehouseId { get; set; } + [Required] public int WarehouseId { get; set; } [Required] public Warehouse Warehouse { get; set; } } \ No newline at end of file From 9da75d53b90a1e2a2ab2d26f40f8071398664435 Mon Sep 17 00:00:00 2001 From: norguete Date: Thu, 2 Oct 2025 17:37:52 +0200 Subject: [PATCH 3/6] Actualiser PyroFetes/Models/Movement.cs --- PyroFetes/Models/Movement.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/PyroFetes/Models/Movement.cs b/PyroFetes/Models/Movement.cs index ff875d8..084a069 100644 --- a/PyroFetes/Models/Movement.cs +++ b/PyroFetes/Models/Movement.cs @@ -14,9 +14,9 @@ public class Movement [Required] public int ProductId {get; set;} [Required] public Product Product {get; set;} - [Required] public int? sourceWarehouse {get; set;} + [Required] public int? SourceWarehouseId {get; set;} [Required] public Warehouse SourceWarehouse {get; set;} - [Required] public int? destinationWarehouse {get; set;} + [Required] public int? DestinationWarehouseId {get; set;} [Required] public Warehouse DestinationWarehouse {get; set;} } \ No newline at end of file From 4cb501fe04180a9d9cf33e0fe65438b3a9b7be37 Mon Sep 17 00:00:00 2001 From: sanchezvem Date: Fri, 3 Oct 2025 14:35:31 +0100 Subject: [PATCH 4/6] Correcting errors on Entities --- PyroFetes/Models/Brand.cs | 8 ++++---- PyroFetes/Models/Classification.cs | 8 ++++---- PyroFetes/Models/Color.cs | 5 ++--- PyroFetes/Models/Effect.cs | 6 ++---- PyroFetes/Models/Material.cs | 7 +++---- PyroFetes/Models/Movement.cs | 10 +++++----- PyroFetes/Models/Price.cs | 17 ----------------- PyroFetes/Models/Product.cs | 2 +- PyroFetes/Models/ProductCategory.cs | 8 ++++---- PyroFetes/Models/ProductColor.cs | 3 ++- PyroFetes/Models/ProductEffect.cs | 4 ++-- PyroFetes/Models/Supplier.cs | 16 ---------------- PyroFetes/Models/Warehouse.cs | 15 +++++++-------- PyroFetes/Models/WarehouseProduct.cs | 8 ++++---- 14 files changed, 40 insertions(+), 77 deletions(-) delete mode 100644 PyroFetes/Models/Price.cs delete mode 100644 PyroFetes/Models/Supplier.cs diff --git a/PyroFetes/Models/Brand.cs b/PyroFetes/Models/Brand.cs index 93b596c..b42bcfc 100644 --- a/PyroFetes/Models/Brand.cs +++ b/PyroFetes/Models/Brand.cs @@ -1,13 +1,13 @@ using System.ComponentModel.DataAnnotations; -using API.Class; +using API.Models; -namespace API.Models; +namespace PyroFetes.Models; public class Brand { [Key] public int Id { get; set; } - [Required, MaxLength(100)] public string Name { get; set; } + [Required, MaxLength(100)] public string? Name { get; set; } [Required] public int ProductId { get; set; } - [Required] public Product Product { get; set; } + [Required] public Product? Product { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Classification.cs b/PyroFetes/Models/Classification.cs index 43be442..2eff1fc 100644 --- a/PyroFetes/Models/Classification.cs +++ b/PyroFetes/Models/Classification.cs @@ -1,12 +1,12 @@ using System.ComponentModel.DataAnnotations; -using API.Class; +using API.Models; -namespace API.Models; +namespace PyroFetes.Models; public class Classification { [Key] public int Id { get; set; } - [Required] public string Label { get; set; } + [Required] public string? Label { get; set; } - [Required] public List Products { get; set; } + [Required] public List? Products { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Color.cs b/PyroFetes/Models/Color.cs index d7a0d7d..00bb147 100644 --- a/PyroFetes/Models/Color.cs +++ b/PyroFetes/Models/Color.cs @@ -1,11 +1,10 @@ using System.ComponentModel.DataAnnotations; -using API.Class; -namespace API.Models; +namespace PyroFetes.Models; public class Color { [Key] public int Id { get; set; } - [Required] public string Label { get; set; } + [Required] public string? Label { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Effect.cs b/PyroFetes/Models/Effect.cs index b8f083f..2d0ba45 100644 --- a/PyroFetes/Models/Effect.cs +++ b/PyroFetes/Models/Effect.cs @@ -1,11 +1,9 @@ using System.ComponentModel.DataAnnotations; -using API.Class; -namespace API.Models; +namespace PyroFetes.Models; public class Effect { [Key] public int Id { get; set; } - [Required] public string Label { get; set; } - + [Required] public string? Label { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Material.cs b/PyroFetes/Models/Material.cs index f60fc61..d1ad0a9 100644 --- a/PyroFetes/Models/Material.cs +++ b/PyroFetes/Models/Material.cs @@ -1,14 +1,13 @@ using System.ComponentModel.DataAnnotations; -using API.Class; -namespace API.Models; +namespace PyroFetes.Models; public class Material { [Key] public int Id {get; set;} - [Required, MaxLength(100)] public string Name {get; set;} + [Required, MaxLength(100)] public string? Name {get; set;} [Required] public int Quantity {get; set;} [Required] public int WarehouseId {get; set;} - [Required] public Warehouse Warehouse {get; set;} + [Required] public Warehouse? Warehouse {get; set;} } \ No newline at end of file diff --git a/PyroFetes/Models/Movement.cs b/PyroFetes/Models/Movement.cs index 084a069..b0fb0ab 100644 --- a/PyroFetes/Models/Movement.cs +++ b/PyroFetes/Models/Movement.cs @@ -1,7 +1,7 @@ using System.ComponentModel.DataAnnotations; -using API.Class; +using API.Models; -namespace API.Models; +namespace PyroFetes.Models; public class Movement { @@ -12,11 +12,11 @@ public class Movement [Required] public int Quantity {get; set;} [Required] public int ProductId {get; set;} - [Required] public Product Product {get; set;} + [Required] public Product? Product {get; set;} [Required] public int? SourceWarehouseId {get; set;} - [Required] public Warehouse SourceWarehouse {get; set;} + [Required] public Warehouse? SourceWarehouse {get; set;} [Required] public int? DestinationWarehouseId {get; set;} - [Required] public Warehouse DestinationWarehouse {get; set;} + [Required] public Warehouse? DestinationWarehouse {get; set;} } \ No newline at end of file diff --git a/PyroFetes/Models/Price.cs b/PyroFetes/Models/Price.cs deleted file mode 100644 index 9878768..0000000 --- a/PyroFetes/Models/Price.cs +++ /dev/null @@ -1,17 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using API.Class; -using Microsoft.EntityFrameworkCore; - -namespace API.Models; - -[PrimaryKey(nameof(SupplierId), nameof(ProductId))] -public class Price -{ - [Required] public decimal Label { get; set; } - - [Required] public int SupplierId { get; set; } - [Required] public Supplier Supplier { get; set; } - - [Required] public int ProductId { get; set; } - [Required] public Product Product { get; set; } -} \ No newline at end of file diff --git a/PyroFetes/Models/Product.cs b/PyroFetes/Models/Product.cs index e2d5db3..f8c4497 100644 --- a/PyroFetes/Models/Product.cs +++ b/PyroFetes/Models/Product.cs @@ -1,5 +1,5 @@ using System.ComponentModel.DataAnnotations; -using API.Class; +using PyroFetes.Models; namespace API.Models { diff --git a/PyroFetes/Models/ProductCategory.cs b/PyroFetes/Models/ProductCategory.cs index 419970c..14a613c 100644 --- a/PyroFetes/Models/ProductCategory.cs +++ b/PyroFetes/Models/ProductCategory.cs @@ -1,12 +1,12 @@ using System.ComponentModel.DataAnnotations; -using API.Class; +using API.Models; -namespace API.Models; +namespace PyroFetes.Models; public class ProductCategory { [Key] public int Id { get; set; } - [Required] public string Label { get; set; } + [Required] public string? Label { get; set; } - [Required] public List Products { get; set; } + [Required] public List? Products { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/ProductColor.cs b/PyroFetes/Models/ProductColor.cs index 8beac4d..0f27e3c 100644 --- a/PyroFetes/Models/ProductColor.cs +++ b/PyroFetes/Models/ProductColor.cs @@ -1,7 +1,8 @@ using System.ComponentModel.DataAnnotations; +using API.Models; using Microsoft.EntityFrameworkCore; -namespace API.Models; +namespace PyroFetes.Models; [PrimaryKey(nameof(ProductId), nameof(ColorId))] public class ProductColor diff --git a/PyroFetes/Models/ProductEffect.cs b/PyroFetes/Models/ProductEffect.cs index 5289662..39659ec 100644 --- a/PyroFetes/Models/ProductEffect.cs +++ b/PyroFetes/Models/ProductEffect.cs @@ -1,7 +1,7 @@ using System.ComponentModel.DataAnnotations; -using Microsoft.EntityFrameworkCore; +using API.Models; -namespace API.Models; +namespace PyroFetes.Models; [PrimaryKey(nameof(ProductId), nameof(EffectId))] public class ProductEffect diff --git a/PyroFetes/Models/Supplier.cs b/PyroFetes/Models/Supplier.cs deleted file mode 100644 index 6d44a91..0000000 --- a/PyroFetes/Models/Supplier.cs +++ /dev/null @@ -1,16 +0,0 @@ -using System.ComponentModel.DataAnnotations; -using API.Models; - -namespace API.Class; - -public class Supplier -{ - [Key] public int Id { get; set; } - [Required, MaxLength(100)] public string Name { get; set; } - [Required] public string Email { get; set; } - [Required] public string PhoneNumber { get; set; } - [Required] public string Adress { get; set; } - [Required] public int ZipCode { get; set; } - [Required] public string City { get; set; } - -} \ No newline at end of file diff --git a/PyroFetes/Models/Warehouse.cs b/PyroFetes/Models/Warehouse.cs index 388e4d2..3b0f833 100644 --- a/PyroFetes/Models/Warehouse.cs +++ b/PyroFetes/Models/Warehouse.cs @@ -1,23 +1,22 @@ using System.ComponentModel.DataAnnotations; -using API.Models; -namespace API.Class; +namespace PyroFetes.Models; public class Warehouse { [Key] public int Id {get; set;} - [Required, MaxLength(100)] public string Name {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] public string Adress { get; set; } + [Required] public string? Address { get; set; } [Required] public int ZipCode { get; set; } - [Required] public string City { get; set; } + [Required] public string? City { get; set; } - [Required] public List Materials {get; set;} + [Required] public List? Materials {get; set;} - [Required] public List MovementsSource { get; set; } - [Required] public List MovementsDestination { get; set; } + [Required] public List? MovementsSource { get; set; } + [Required] public List? MovementsDestination { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/WarehouseProduct.cs b/PyroFetes/Models/WarehouseProduct.cs index 79e5329..2b9cc41 100644 --- a/PyroFetes/Models/WarehouseProduct.cs +++ b/PyroFetes/Models/WarehouseProduct.cs @@ -1,15 +1,15 @@ using System.ComponentModel.DataAnnotations; -using API.Class; +using API.Models; -namespace API.Models; +namespace PyroFetes.Models; public class WarehouseProduct { [Key] public int Quantity { get; set; } [Required] public int ProductId { get; set; } - [Required] public Product Product { get; set; } + [Required] public Product? Product { get; set; } [Required] public int WarehouseId { get; set; } - [Required] public Warehouse Warehouse { get; set; } + [Required] public Warehouse? Warehouse { get; set; } } \ No newline at end of file From f163aa5feb15b8037ecd7e3f4200433c338f7337 Mon Sep 17 00:00:00 2001 From: sanchezvem Date: Fri, 3 Oct 2025 14:37:27 +0100 Subject: [PATCH 5/6] Correcting type error in all string properties --- PyroFetes/Models/Product.cs | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/PyroFetes/Models/Product.cs b/PyroFetes/Models/Product.cs index f8c4497..cb4613f 100644 --- a/PyroFetes/Models/Product.cs +++ b/PyroFetes/Models/Product.cs @@ -7,26 +7,26 @@ namespace API.Models { [Key] public int Id { get; set; } [Required] public int References { get; set; } - [Required, MaxLength(100)] public string Name { 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] public string Link { get; set; } + [Required] public string? Image { get; set; } + [Required] public string? Link { get; set; } // Relations [Required] public int ClassificationId { get; set; } - [Required] public Classification Classification { get; set; } + [Required] public Classification? Classification { get; set; } [Required] public int ProductCategoryId { get; set; } - [Required] public ProductCategory ProductCategory { get; set; } + [Required] public ProductCategory? ProductCategory { get; set; } - [Required] public List Brands { get; set; } + [Required] public List? Brands { get; set; } - [Required] public List Movements { get; set; } + [Required] public List? Movements { get; set; } } } \ No newline at end of file From 2781f1e80a5603991e89a7af809971d684d114a1 Mon Sep 17 00:00:00 2001 From: sanchezvem Date: Fri, 3 Oct 2025 14:44:12 +0100 Subject: [PATCH 6/6] Change namespace --- PyroFetes/Models/Brand.cs | 1 - PyroFetes/Models/Classification.cs | 1 - PyroFetes/Models/Movement.cs | 1 - PyroFetes/Models/Product.cs | 3 +-- PyroFetes/Models/ProductCategory.cs | 1 - PyroFetes/Models/ProductColor.cs | 1 - PyroFetes/Models/ProductEffect.cs | 1 - PyroFetes/Models/WarehouseProduct.cs | 1 - 8 files changed, 1 insertion(+), 9 deletions(-) diff --git a/PyroFetes/Models/Brand.cs b/PyroFetes/Models/Brand.cs index b42bcfc..49016ca 100644 --- a/PyroFetes/Models/Brand.cs +++ b/PyroFetes/Models/Brand.cs @@ -1,5 +1,4 @@ using System.ComponentModel.DataAnnotations; -using API.Models; namespace PyroFetes.Models; diff --git a/PyroFetes/Models/Classification.cs b/PyroFetes/Models/Classification.cs index 2eff1fc..6ef006b 100644 --- a/PyroFetes/Models/Classification.cs +++ b/PyroFetes/Models/Classification.cs @@ -1,5 +1,4 @@ using System.ComponentModel.DataAnnotations; -using API.Models; namespace PyroFetes.Models; diff --git a/PyroFetes/Models/Movement.cs b/PyroFetes/Models/Movement.cs index b0fb0ab..ad42494 100644 --- a/PyroFetes/Models/Movement.cs +++ b/PyroFetes/Models/Movement.cs @@ -1,5 +1,4 @@ using System.ComponentModel.DataAnnotations; -using API.Models; namespace PyroFetes.Models; diff --git a/PyroFetes/Models/Product.cs b/PyroFetes/Models/Product.cs index cb4613f..8f1cff9 100644 --- a/PyroFetes/Models/Product.cs +++ b/PyroFetes/Models/Product.cs @@ -1,7 +1,6 @@ using System.ComponentModel.DataAnnotations; -using PyroFetes.Models; -namespace API.Models +namespace PyroFetes.Models { public class Product { diff --git a/PyroFetes/Models/ProductCategory.cs b/PyroFetes/Models/ProductCategory.cs index 14a613c..2e339ba 100644 --- a/PyroFetes/Models/ProductCategory.cs +++ b/PyroFetes/Models/ProductCategory.cs @@ -1,5 +1,4 @@ using System.ComponentModel.DataAnnotations; -using API.Models; namespace PyroFetes.Models; diff --git a/PyroFetes/Models/ProductColor.cs b/PyroFetes/Models/ProductColor.cs index 0f27e3c..66acf11 100644 --- a/PyroFetes/Models/ProductColor.cs +++ b/PyroFetes/Models/ProductColor.cs @@ -1,5 +1,4 @@ using System.ComponentModel.DataAnnotations; -using API.Models; using Microsoft.EntityFrameworkCore; namespace PyroFetes.Models; diff --git a/PyroFetes/Models/ProductEffect.cs b/PyroFetes/Models/ProductEffect.cs index 39659ec..4ac084b 100644 --- a/PyroFetes/Models/ProductEffect.cs +++ b/PyroFetes/Models/ProductEffect.cs @@ -1,5 +1,4 @@ using System.ComponentModel.DataAnnotations; -using API.Models; namespace PyroFetes.Models; diff --git a/PyroFetes/Models/WarehouseProduct.cs b/PyroFetes/Models/WarehouseProduct.cs index 2b9cc41..ca3716c 100644 --- a/PyroFetes/Models/WarehouseProduct.cs +++ b/PyroFetes/Models/WarehouseProduct.cs @@ -1,5 +1,4 @@ using System.ComponentModel.DataAnnotations; -using API.Models; namespace PyroFetes.Models;