From 4cb501fe04180a9d9cf33e0fe65438b3a9b7be37 Mon Sep 17 00:00:00 2001 From: sanchezvem Date: Fri, 3 Oct 2025 14:35:31 +0100 Subject: [PATCH] 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