From af92cdc524846c075bccbe17039ddea6370d71e7 Mon Sep 17 00:00:00 2001 From: sanchezvem Date: Wed, 8 Oct 2025 00:03:52 +0100 Subject: [PATCH] Correcting all type and relations in all entities --- PyroFetes/Models/Availability.cs | 6 ++++-- PyroFetes/Models/Contact.cs | 1 + PyroFetes/Models/CustomerType.cs | 2 +- PyroFetes/Models/ExperienceLevel.cs | 7 +++++-- PyroFetes/Models/HistoryOfApproval.cs | 4 +++- PyroFetes/Models/ProviderType.cs | 4 +++- PyroFetes/Models/ServiceProvider.cs | 2 +- PyroFetes/Models/Staff.cs | 4 ++++ PyroFetes/Models/StaffContact.cs | 5 +++-- 9 files changed, 25 insertions(+), 10 deletions(-) diff --git a/PyroFetes/Models/Availability.cs b/PyroFetes/Models/Availability.cs index 5d85e0d..47b0f1c 100644 --- a/PyroFetes/Models/Availability.cs +++ b/PyroFetes/Models/Availability.cs @@ -4,9 +4,11 @@ namespace PyroFetes.Models; public class Availability { - [Key] public int Id { get; set; } - [Required] public string? AvailabilityDate { get; set; } + [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/PyroFetes/Models/Contact.cs b/PyroFetes/Models/Contact.cs index 3644750..88ef5a4 100644 --- a/PyroFetes/Models/Contact.cs +++ b/PyroFetes/Models/Contact.cs @@ -18,4 +18,5 @@ public class Contact [Required] public int CustomerId { get; set; } public List? Communications { get; set; } + public List? StaffContacts { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/CustomerType.cs b/PyroFetes/Models/CustomerType.cs index 3e24483..197ad09 100644 --- a/PyroFetes/Models/CustomerType.cs +++ b/PyroFetes/Models/CustomerType.cs @@ -5,7 +5,7 @@ namespace PyroFetes.Models; public class CustomerType { [Key] public int Id { get; set; } - [Required] public decimal Price { get; set; } + [Required, MaxLength(100)] public string? Label { get; set; } public List? Customers { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/ExperienceLevel.cs b/PyroFetes/Models/ExperienceLevel.cs index 41a1879..923f757 100644 --- a/PyroFetes/Models/ExperienceLevel.cs +++ b/PyroFetes/Models/ExperienceLevel.cs @@ -4,6 +4,9 @@ namespace PyroFetes.Models; public class ExperienceLevel { - [Key] public int Id { get; set; } - [Required] public string? Label { get; set; } + [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/PyroFetes/Models/HistoryOfApproval.cs b/PyroFetes/Models/HistoryOfApproval.cs index 8c85ef8..c8fd073 100644 --- a/PyroFetes/Models/HistoryOfApproval.cs +++ b/PyroFetes/Models/HistoryOfApproval.cs @@ -5,6 +5,8 @@ namespace PyroFetes.Models; public class HistoryOfApproval { [Key] public int Id { get; set; } - [Required] public DateOnly ExpirationDate { 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/PyroFetes/Models/ProviderType.cs b/PyroFetes/Models/ProviderType.cs index 4c8f70c..0871b8a 100644 --- a/PyroFetes/Models/ProviderType.cs +++ b/PyroFetes/Models/ProviderType.cs @@ -5,5 +5,7 @@ namespace PyroFetes.Models; public class ProviderType { [Key] public int Id { get; set; } - [Required] public string? Label { get; set; } + [Required, MaxLength(100)] public string? Label { get; set; } + + public List? ServiceProviders { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/ServiceProvider.cs b/PyroFetes/Models/ServiceProvider.cs index 2144b69..80b101b 100644 --- a/PyroFetes/Models/ServiceProvider.cs +++ b/PyroFetes/Models/ServiceProvider.cs @@ -8,6 +8,6 @@ public class ServiceProvider [Required] public decimal Price { get; set; } //Relations - public int ProviderTypeId { get; set; } + [Required] public int ProviderTypeId { get; set; } public ProviderType? ProviderType { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/Staff.cs b/PyroFetes/Models/Staff.cs index e95f08b..a95c455 100644 --- a/PyroFetes/Models/Staff.cs +++ b/PyroFetes/Models/Staff.cs @@ -13,4 +13,8 @@ public class Staff [Required] public DateOnly F4T2ExpirationDate { get; set; } public List? ShowStaffs { get; set; } + public List? ExperienceLevels { get; set; } + public List? StaffAvailabilities { get; set; } + public List? StaffHistoryOfApprovals { get; set; } + public List? StaffContacts { get; set; } } \ No newline at end of file diff --git a/PyroFetes/Models/StaffContact.cs b/PyroFetes/Models/StaffContact.cs index 3fb3f87..18ab5a9 100644 --- a/PyroFetes/Models/StaffContact.cs +++ b/PyroFetes/Models/StaffContact.cs @@ -1,3 +1,4 @@ +using System.ComponentModel.DataAnnotations; using Microsoft.EntityFrameworkCore; namespace PyroFetes.Models; @@ -5,8 +6,8 @@ namespace PyroFetes.Models; [PrimaryKey(nameof(ContactId), nameof(StaffId))] public class StaffContact { - public int StaffId { get; set; } + [Required] public int StaffId { get; set; } public Staff? Staff { get; set; } - public int ContactId { get; set; } + [Required] public int ContactId { get; set; } public Contact? Contact { get; set; } } \ No newline at end of file