From 4e64112a317e10cda74a64a3f80ee17da044bdc9 Mon Sep 17 00:00:00 2001 From: carteronm Date: Thu, 9 Oct 2025 17:12:17 +0200 Subject: [PATCH] First Commit 09/10 # Conflicts: # PyroFetes/PyroFetes.csproj --- .../.idea/.idea.PyroFetes/.idea/encodings.xml | 4 ++ .../.idea.PyroFetes/.idea/indexLayout.xml | 8 +++ .../.idea/projectSettingsUpdater.xml | 8 +++ .../.idea/.idea.PyroFetes/.idea/workspace.xml | 66 +++++++++++++++++++ .../Request/CreateAvailabilityDto.cs | 9 +++ .../Request/GetAvailabilityRequest.cs | 6 ++ .../Request/UpdateAvailabilityDto.cs | 10 +++ .../Response/GetAvailabilityDto.cs | 10 +++ .../Request/CreateCommunicationDto.cs | 6 ++ .../Request/GetCommunicationRequest.cs | 6 ++ .../Request/UpdateCommunicationDto.cs | 6 ++ .../Response/GetCommunicationDto.cs | 8 +++ .../DTO/Contact/Request/CreateContactDto.cs | 11 ++++ .../DTO/Contact/Request/GetContactRequest.cs | 6 ++ .../DTO/Contact/Request/UpdateContactDto.cs | 12 ++++ .../DTO/Contact/Response/GetContactDto.cs | 12 ++++ .../Request/CreateExperienceLevelDto.cs | 6 ++ .../Request/GetExperienceLevelRequest.cs | 6 ++ .../Request/UpdateExperienceLevelDto.cs | 7 ++ .../Response/GetExperienceLevelDto.cs | 7 ++ .../Request/CreateHistoryOfApprovalDto.cs | 7 ++ .../Request/GetHistoryOfApprovalRequest.cs | 6 ++ .../Request/UpdateHistoryOfApprovalDto.cs | 8 +++ .../Response/GetHistoryOfApprovalDto.cs | 8 +++ PyroFetes/DTO/Staff/Request/CreateStaffDto.cs | 7 ++ .../DTO/Staff/Request/GetStaffRequest.cs | 6 ++ PyroFetes/DTO/Staff/Request/UpdateStaffDto.cs | 8 +++ PyroFetes/DTO/Staff/Response/GetStaffDto.cs | 6 ++ .../CreateAvailabilityEndpoint.cs | 38 +++++++++++ .../DeleteAvailabilityEndpoint.cs | 30 +++++++++ .../GetAllAvailabilitiesEndpoint.cs | 28 ++++++++ .../Availability/GetAvailabilityEndpoint.cs | 37 +++++++++++ .../UpdateAvailabilityEndpoint.cs | 45 +++++++++++++ .../Contact/CreateContactEndpoint.cs | 42 ++++++++++++ .../Contact/DeleteContactEndpoint.cs | 30 +++++++++ .../Contact/GetAllContactsEndpoint.cs | 30 +++++++++ .../Endpoints/Contact/GetContactEndpoint.cs | 39 +++++++++++ .../Endpoints/Contact/UpdateContactRequest.cs | 49 ++++++++++++++ .../CreateExperienceLevelEndpoint.cs | 34 ++++++++++ .../DeleteExerienceLevelEndpoint.cs | 30 +++++++++ .../GetAllExperienceLevelsEndpoint.cs | 24 +++++++ .../GetExperienceLevelEndpoint.cs | 6 ++ .../UpdateExperienceLevelEndpoint.cs | 6 ++ .../CreateHistoryOfApprovalEndpoint.cs | 36 ++++++++++ .../DeleteHistoryOfApprovalEndpoint.cs | 30 +++++++++ .../GetAllHistoryOfApprovalEndpoint.cs | 26 ++++++++ .../GetHistoryOfApprovalEndpoint.cs | 35 ++++++++++ .../UpdateHistoryOfApprovalEndpoint.cs | 41 ++++++++++++ PyroFetes/PyroFetes.csproj | 2 + 49 files changed, 908 insertions(+) create mode 100644 PyroFetes/.idea/.idea.PyroFetes/.idea/encodings.xml create mode 100644 PyroFetes/.idea/.idea.PyroFetes/.idea/indexLayout.xml create mode 100644 PyroFetes/.idea/.idea.PyroFetes/.idea/projectSettingsUpdater.xml create mode 100644 PyroFetes/.idea/.idea.PyroFetes/.idea/workspace.xml create mode 100644 PyroFetes/DTO/Availability/Request/CreateAvailabilityDto.cs create mode 100644 PyroFetes/DTO/Availability/Request/GetAvailabilityRequest.cs create mode 100644 PyroFetes/DTO/Availability/Request/UpdateAvailabilityDto.cs create mode 100644 PyroFetes/DTO/Availability/Response/GetAvailabilityDto.cs create mode 100644 PyroFetes/DTO/Communication/Request/CreateCommunicationDto.cs create mode 100644 PyroFetes/DTO/Communication/Request/GetCommunicationRequest.cs create mode 100644 PyroFetes/DTO/Communication/Request/UpdateCommunicationDto.cs create mode 100644 PyroFetes/DTO/Communication/Response/GetCommunicationDto.cs create mode 100644 PyroFetes/DTO/Contact/Request/CreateContactDto.cs create mode 100644 PyroFetes/DTO/Contact/Request/GetContactRequest.cs create mode 100644 PyroFetes/DTO/Contact/Request/UpdateContactDto.cs create mode 100644 PyroFetes/DTO/Contact/Response/GetContactDto.cs create mode 100644 PyroFetes/DTO/ExperienceLevel/Request/CreateExperienceLevelDto.cs create mode 100644 PyroFetes/DTO/ExperienceLevel/Request/GetExperienceLevelRequest.cs create mode 100644 PyroFetes/DTO/ExperienceLevel/Request/UpdateExperienceLevelDto.cs create mode 100644 PyroFetes/DTO/ExperienceLevel/Response/GetExperienceLevelDto.cs create mode 100644 PyroFetes/DTO/HistoryOfApproval/Request/CreateHistoryOfApprovalDto.cs create mode 100644 PyroFetes/DTO/HistoryOfApproval/Request/GetHistoryOfApprovalRequest.cs create mode 100644 PyroFetes/DTO/HistoryOfApproval/Request/UpdateHistoryOfApprovalDto.cs create mode 100644 PyroFetes/DTO/HistoryOfApproval/Response/GetHistoryOfApprovalDto.cs create mode 100644 PyroFetes/DTO/Staff/Request/CreateStaffDto.cs create mode 100644 PyroFetes/DTO/Staff/Request/GetStaffRequest.cs create mode 100644 PyroFetes/DTO/Staff/Request/UpdateStaffDto.cs create mode 100644 PyroFetes/DTO/Staff/Response/GetStaffDto.cs create mode 100644 PyroFetes/Endpoints/Availability/CreateAvailabilityEndpoint.cs create mode 100644 PyroFetes/Endpoints/Availability/DeleteAvailabilityEndpoint.cs create mode 100644 PyroFetes/Endpoints/Availability/GetAllAvailabilitiesEndpoint.cs create mode 100644 PyroFetes/Endpoints/Availability/GetAvailabilityEndpoint.cs create mode 100644 PyroFetes/Endpoints/Availability/UpdateAvailabilityEndpoint.cs create mode 100644 PyroFetes/Endpoints/Contact/CreateContactEndpoint.cs create mode 100644 PyroFetes/Endpoints/Contact/DeleteContactEndpoint.cs create mode 100644 PyroFetes/Endpoints/Contact/GetAllContactsEndpoint.cs create mode 100644 PyroFetes/Endpoints/Contact/GetContactEndpoint.cs create mode 100644 PyroFetes/Endpoints/Contact/UpdateContactRequest.cs create mode 100644 PyroFetes/Endpoints/ExperienceLevel/CreateExperienceLevelEndpoint.cs create mode 100644 PyroFetes/Endpoints/ExperienceLevel/DeleteExerienceLevelEndpoint.cs create mode 100644 PyroFetes/Endpoints/ExperienceLevel/GetAllExperienceLevelsEndpoint.cs create mode 100644 PyroFetes/Endpoints/ExperienceLevel/GetExperienceLevelEndpoint.cs create mode 100644 PyroFetes/Endpoints/ExperienceLevel/UpdateExperienceLevelEndpoint.cs create mode 100644 PyroFetes/Endpoints/HistoryOfApproval/CreateHistoryOfApprovalEndpoint.cs create mode 100644 PyroFetes/Endpoints/HistoryOfApproval/DeleteHistoryOfApprovalEndpoint.cs create mode 100644 PyroFetes/Endpoints/HistoryOfApproval/GetAllHistoryOfApprovalEndpoint.cs create mode 100644 PyroFetes/Endpoints/HistoryOfApproval/GetHistoryOfApprovalEndpoint.cs create mode 100644 PyroFetes/Endpoints/HistoryOfApproval/UpdateHistoryOfApprovalEndpoint.cs diff --git a/PyroFetes/.idea/.idea.PyroFetes/.idea/encodings.xml b/PyroFetes/.idea/.idea.PyroFetes/.idea/encodings.xml new file mode 100644 index 0000000..df87cf9 --- /dev/null +++ b/PyroFetes/.idea/.idea.PyroFetes/.idea/encodings.xml @@ -0,0 +1,4 @@ + + + + \ No newline at end of file diff --git a/PyroFetes/.idea/.idea.PyroFetes/.idea/indexLayout.xml b/PyroFetes/.idea/.idea.PyroFetes/.idea/indexLayout.xml new file mode 100644 index 0000000..7b08163 --- /dev/null +++ b/PyroFetes/.idea/.idea.PyroFetes/.idea/indexLayout.xml @@ -0,0 +1,8 @@ + + + + + + + + \ No newline at end of file diff --git a/PyroFetes/.idea/.idea.PyroFetes/.idea/projectSettingsUpdater.xml b/PyroFetes/.idea/.idea.PyroFetes/.idea/projectSettingsUpdater.xml new file mode 100644 index 0000000..ef20cb0 --- /dev/null +++ b/PyroFetes/.idea/.idea.PyroFetes/.idea/projectSettingsUpdater.xml @@ -0,0 +1,8 @@ + + + + + \ No newline at end of file diff --git a/PyroFetes/.idea/.idea.PyroFetes/.idea/workspace.xml b/PyroFetes/.idea/.idea.PyroFetes/.idea/workspace.xml new file mode 100644 index 0000000..1885d46 --- /dev/null +++ b/PyroFetes/.idea/.idea.PyroFetes/.idea/workspace.xml @@ -0,0 +1,66 @@ + + + + + + + + + + + + + + + + 1760014067675 + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PyroFetes/DTO/Availability/Request/CreateAvailabilityDto.cs b/PyroFetes/DTO/Availability/Request/CreateAvailabilityDto.cs new file mode 100644 index 0000000..f5c053c --- /dev/null +++ b/PyroFetes/DTO/Availability/Request/CreateAvailabilityDto.cs @@ -0,0 +1,9 @@ +namespace PyroFetes.DTO.Availability.Request; + +public class CreateAvailabilityDto +{ + public DateOnly AvailabilityDate { get; set; } + public DateOnly DeliveryDate { get; set; } + public DateOnly ExpirationDate { get; set; } + public DateOnly RenewalDate { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Availability/Request/GetAvailabilityRequest.cs b/PyroFetes/DTO/Availability/Request/GetAvailabilityRequest.cs new file mode 100644 index 0000000..9b82857 --- /dev/null +++ b/PyroFetes/DTO/Availability/Request/GetAvailabilityRequest.cs @@ -0,0 +1,6 @@ +namespace PyroFetes.DTO.Availability.Request; + +public class GetAvailabilityRequest +{ + public int Id { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Availability/Request/UpdateAvailabilityDto.cs b/PyroFetes/DTO/Availability/Request/UpdateAvailabilityDto.cs new file mode 100644 index 0000000..3b6ab9e --- /dev/null +++ b/PyroFetes/DTO/Availability/Request/UpdateAvailabilityDto.cs @@ -0,0 +1,10 @@ +namespace PyroFetes.DTO.Availability.Request; + +public class UpdateAvailabilityDto +{ + public int Id { get; set; } + public DateOnly AvailabilityDate { get; set; } + public DateOnly DeliveryDate { get; set; } + public DateOnly ExpirationDate { get; set; } + public DateOnly RenewalDate { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Availability/Response/GetAvailabilityDto.cs b/PyroFetes/DTO/Availability/Response/GetAvailabilityDto.cs new file mode 100644 index 0000000..ed40c91 --- /dev/null +++ b/PyroFetes/DTO/Availability/Response/GetAvailabilityDto.cs @@ -0,0 +1,10 @@ +namespace PyroFetes.DTO.Availability.Response; + +public class GetAvailabilityDto +{ + public int Id { get; set; } + public DateOnly AvailabilityDate { get; set; } + public DateOnly DeliveryDate { get; set; } + public DateOnly ExpirationDate { get; set; } + public DateOnly RenewalDate { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Communication/Request/CreateCommunicationDto.cs b/PyroFetes/DTO/Communication/Request/CreateCommunicationDto.cs new file mode 100644 index 0000000..cb8bbc2 --- /dev/null +++ b/PyroFetes/DTO/Communication/Request/CreateCommunicationDto.cs @@ -0,0 +1,6 @@ +namespace PyroFetes.DTO.Communication.Request; + +public class CreateCommunicationDto +{ + +} \ No newline at end of file diff --git a/PyroFetes/DTO/Communication/Request/GetCommunicationRequest.cs b/PyroFetes/DTO/Communication/Request/GetCommunicationRequest.cs new file mode 100644 index 0000000..185f4d1 --- /dev/null +++ b/PyroFetes/DTO/Communication/Request/GetCommunicationRequest.cs @@ -0,0 +1,6 @@ +namespace PyroFetes.DTO.Communication.Request; + +public class GetCommunicationRequest +{ + +} \ No newline at end of file diff --git a/PyroFetes/DTO/Communication/Request/UpdateCommunicationDto.cs b/PyroFetes/DTO/Communication/Request/UpdateCommunicationDto.cs new file mode 100644 index 0000000..8cb9fcf --- /dev/null +++ b/PyroFetes/DTO/Communication/Request/UpdateCommunicationDto.cs @@ -0,0 +1,6 @@ +namespace PyroFetes.DTO.Communication.Request; + +public class UpdateCommunicationDto +{ + +} \ No newline at end of file diff --git a/PyroFetes/DTO/Communication/Response/GetCommunicationDto.cs b/PyroFetes/DTO/Communication/Response/GetCommunicationDto.cs new file mode 100644 index 0000000..de0f97d --- /dev/null +++ b/PyroFetes/DTO/Communication/Response/GetCommunicationDto.cs @@ -0,0 +1,8 @@ +namespace PyroFetes.DTO.Communication.Response; + +public class GetCommunicationRequest +{ + public string? Calling { get; set; } + public string? Email { get; set; } + public string? Meeting { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Contact/Request/CreateContactDto.cs b/PyroFetes/DTO/Contact/Request/CreateContactDto.cs new file mode 100644 index 0000000..f52343d --- /dev/null +++ b/PyroFetes/DTO/Contact/Request/CreateContactDto.cs @@ -0,0 +1,11 @@ +namespace PyroFetes.DTO.Contact.Request; + +public class CreateContactDto +{ + public string? LastName { get; set; } + public string? FirstName { get; set; } + public string? PhoneNumber { get; set; } + public string? Email { get; set; } + public string? Address { get; set; } + public string? Role { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Contact/Request/GetContactRequest.cs b/PyroFetes/DTO/Contact/Request/GetContactRequest.cs new file mode 100644 index 0000000..d62aa5a --- /dev/null +++ b/PyroFetes/DTO/Contact/Request/GetContactRequest.cs @@ -0,0 +1,6 @@ +namespace PyroFetes.DTO.Contact.Request; + +public class GetContactRequest +{ + public int Id { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Contact/Request/UpdateContactDto.cs b/PyroFetes/DTO/Contact/Request/UpdateContactDto.cs new file mode 100644 index 0000000..42ffd3d --- /dev/null +++ b/PyroFetes/DTO/Contact/Request/UpdateContactDto.cs @@ -0,0 +1,12 @@ +namespace PyroFetes.DTO.Contact.Request; + +public class UpdateContactDto +{ + public int Id { get; set; } + public string? LastName { get; set; } + public string? FirstName { get; set; } + public string? PhoneNumber { get; set; } + public string? Email { get; set; } + public string? Address { get; set; } + public string? Role { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Contact/Response/GetContactDto.cs b/PyroFetes/DTO/Contact/Response/GetContactDto.cs new file mode 100644 index 0000000..38a25d8 --- /dev/null +++ b/PyroFetes/DTO/Contact/Response/GetContactDto.cs @@ -0,0 +1,12 @@ +namespace PyroFetes.DTO.Contact.Response; + +public class GetContactDto +{ + public int Id { get; set; } + public string? LastName { get; set; } + public string? FirstName { get; set; } + public string? PhoneNumber { get; set; } + public string? Email { get; set; } + public string? Address { get; set; } + public string? Role { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/ExperienceLevel/Request/CreateExperienceLevelDto.cs b/PyroFetes/DTO/ExperienceLevel/Request/CreateExperienceLevelDto.cs new file mode 100644 index 0000000..9e40ea6 --- /dev/null +++ b/PyroFetes/DTO/ExperienceLevel/Request/CreateExperienceLevelDto.cs @@ -0,0 +1,6 @@ +namespace PyroFetes.DTO.ExperienceLevel.Request; + +public class CreateExperienceLevelDto +{ + public string? Label { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/ExperienceLevel/Request/GetExperienceLevelRequest.cs b/PyroFetes/DTO/ExperienceLevel/Request/GetExperienceLevelRequest.cs new file mode 100644 index 0000000..a9991e5 --- /dev/null +++ b/PyroFetes/DTO/ExperienceLevel/Request/GetExperienceLevelRequest.cs @@ -0,0 +1,6 @@ +namespace PyroFetes.DTO.ExperienceLevel.Request; + +public class GetExperienceLevelRequest +{ + public int Id { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/ExperienceLevel/Request/UpdateExperienceLevelDto.cs b/PyroFetes/DTO/ExperienceLevel/Request/UpdateExperienceLevelDto.cs new file mode 100644 index 0000000..e0e69bd --- /dev/null +++ b/PyroFetes/DTO/ExperienceLevel/Request/UpdateExperienceLevelDto.cs @@ -0,0 +1,7 @@ +namespace PyroFetes.DTO.ExperienceLevel.Request; + +public class UpdateExperienceLevelDto +{ + public int Id { get; set; } + public string? Label { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/ExperienceLevel/Response/GetExperienceLevelDto.cs b/PyroFetes/DTO/ExperienceLevel/Response/GetExperienceLevelDto.cs new file mode 100644 index 0000000..8a14d3d --- /dev/null +++ b/PyroFetes/DTO/ExperienceLevel/Response/GetExperienceLevelDto.cs @@ -0,0 +1,7 @@ +namespace PyroFetes.DTO.ExperienceLevel.Response; + +public class GetExperienceLevelDto +{ + public int Id { get; set; } + public string? Label { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/HistoryOfApproval/Request/CreateHistoryOfApprovalDto.cs b/PyroFetes/DTO/HistoryOfApproval/Request/CreateHistoryOfApprovalDto.cs new file mode 100644 index 0000000..ba5a33e --- /dev/null +++ b/PyroFetes/DTO/HistoryOfApproval/Request/CreateHistoryOfApprovalDto.cs @@ -0,0 +1,7 @@ +namespace PyroFetes.DTO.HistoryOfApproval.Request; + +public class CreateHistoryOfApprovalDto +{ + public DateOnly DeliveryDate { get; set; } + public DateOnly ExpirationDate { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/HistoryOfApproval/Request/GetHistoryOfApprovalRequest.cs b/PyroFetes/DTO/HistoryOfApproval/Request/GetHistoryOfApprovalRequest.cs new file mode 100644 index 0000000..b2e692f --- /dev/null +++ b/PyroFetes/DTO/HistoryOfApproval/Request/GetHistoryOfApprovalRequest.cs @@ -0,0 +1,6 @@ +namespace PyroFetes.DTO.HistoryOfApproval.Request; + +public class GetHistoryOfApprovalRequest +{ + public int Id { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/HistoryOfApproval/Request/UpdateHistoryOfApprovalDto.cs b/PyroFetes/DTO/HistoryOfApproval/Request/UpdateHistoryOfApprovalDto.cs new file mode 100644 index 0000000..cf8a30e --- /dev/null +++ b/PyroFetes/DTO/HistoryOfApproval/Request/UpdateHistoryOfApprovalDto.cs @@ -0,0 +1,8 @@ +namespace PyroFetes.DTO.HistoryOfApproval.Request; + +public class UpdateHistoryOfApprovalDto +{ + public int Id { get; set; } + public DateOnly DeliveryDate { get; set; } + public DateOnly ExpirationDate { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/HistoryOfApproval/Response/GetHistoryOfApprovalDto.cs b/PyroFetes/DTO/HistoryOfApproval/Response/GetHistoryOfApprovalDto.cs new file mode 100644 index 0000000..b216521 --- /dev/null +++ b/PyroFetes/DTO/HistoryOfApproval/Response/GetHistoryOfApprovalDto.cs @@ -0,0 +1,8 @@ +namespace PyroFetes.DTO.HistoryOfApproval.Response; + +public class GetHistoryOfApprovalDto +{ + public int Id { get; set; } + public DateOnly DeliveryDate { get; set; } + public DateOnly ExpirationDate { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Staff/Request/CreateStaffDto.cs b/PyroFetes/DTO/Staff/Request/CreateStaffDto.cs new file mode 100644 index 0000000..8fdbdf5 --- /dev/null +++ b/PyroFetes/DTO/Staff/Request/CreateStaffDto.cs @@ -0,0 +1,7 @@ +namespace PyroFetes.DTO.Staff.Request; + +public class CreateStaffDto +{ + public string? F4T2NumberApproval { get; set; } + public string? F4T2ExpirationDate { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Staff/Request/GetStaffRequest.cs b/PyroFetes/DTO/Staff/Request/GetStaffRequest.cs new file mode 100644 index 0000000..b8b1799 --- /dev/null +++ b/PyroFetes/DTO/Staff/Request/GetStaffRequest.cs @@ -0,0 +1,6 @@ +namespace PyroFetes.DTO.Staff.Request; + +public class GetStaffRequest +{ + public string? Label { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Staff/Request/UpdateStaffDto.cs b/PyroFetes/DTO/Staff/Request/UpdateStaffDto.cs new file mode 100644 index 0000000..82d0685 --- /dev/null +++ b/PyroFetes/DTO/Staff/Request/UpdateStaffDto.cs @@ -0,0 +1,8 @@ +namespace PyroFetes.DTO.Staff.Request; + +public class UpdateStaffDto +{ + public int Id { get; set; } + public string? F4T2NumberApproval { get; set; } + public string? F4T2ExpirationDate { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/DTO/Staff/Response/GetStaffDto.cs b/PyroFetes/DTO/Staff/Response/GetStaffDto.cs new file mode 100644 index 0000000..0e64206 --- /dev/null +++ b/PyroFetes/DTO/Staff/Response/GetStaffDto.cs @@ -0,0 +1,6 @@ +namespace PyroFetes.DTO.Staff.Response; + +public class GetStaffDto +{ + public int Id { get; set; } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Availability/CreateAvailabilityEndpoint.cs b/PyroFetes/Endpoints/Availability/CreateAvailabilityEndpoint.cs new file mode 100644 index 0000000..73a41b8 --- /dev/null +++ b/PyroFetes/Endpoints/Availability/CreateAvailabilityEndpoint.cs @@ -0,0 +1,38 @@ +using FastEndpoints; +using PyroFetes.DTO.Availability.Request; +using PyroFetes.DTO.Availability.Response; + +namespace PyroFetes.Endpoints.Availability; + +public class CreateAvailabilityEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint +{ + public override void Configure() + { + Post("/api/availabilities"); + AllowAnonymous(); + } + + + public override async Task HandleAsync(CreateAvailabilityDto req, CancellationToken ct) + { + Models.Availability availability = new() + { + AvailabilityDate = req.AvailabilityDate, + DeliveryDate = req.DeliveryDate, + ExpirationDate = req.ExpirationDate, + RenewallDate = req.RenewalDate, + }; + pyroFetesDbContext.Add(availability); + await pyroFetesDbContext.SaveChangesAsync(ct); + + GetAvailabilityDto response = new() + { + AvailabilityDate = availability.AvailabilityDate, + DeliveryDate = availability.DeliveryDate, + ExpirationDate = availability.ExpirationDate, + RenewalDate = availability.RenewallDate + }; + + await Send.OkAsync(response, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Availability/DeleteAvailabilityEndpoint.cs b/PyroFetes/Endpoints/Availability/DeleteAvailabilityEndpoint.cs new file mode 100644 index 0000000..17ce63b --- /dev/null +++ b/PyroFetes/Endpoints/Availability/DeleteAvailabilityEndpoint.cs @@ -0,0 +1,30 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.Availability.Request; +using PyroFetes.DTO.Availability.Response; + +namespace PyroFetes.Endpoints.Availability; + +public class DeleteAvailabilityEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint +{ + public override void Configure() + { + Delete ("/api/availabilities/{@Id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(GetAvailabilityRequest req, CancellationToken ct) + { + Models.Availability? databaseAvailability = await pyroFetesDbContext.Availabilities.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct); + + if (databaseAvailability == null) + { + await Send.NotFoundAsync(ct); + return; + } + pyroFetesDbContext.Availabilities.Remove(databaseAvailability); + await pyroFetesDbContext.SaveChangesAsync(ct); + + await Send.NoContentAsync(ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Availability/GetAllAvailabilitiesEndpoint.cs b/PyroFetes/Endpoints/Availability/GetAllAvailabilitiesEndpoint.cs new file mode 100644 index 0000000..ce2a7eb --- /dev/null +++ b/PyroFetes/Endpoints/Availability/GetAllAvailabilitiesEndpoint.cs @@ -0,0 +1,28 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.Availability.Response; + +namespace PyroFetes.Endpoints.Availability; + +public class GetAllAvailabilityxuest(PyroFetesDbContext pyroFetesDbContext) : EndpointWithoutRequest> +{ + public override void Configure() + { + Get ("/api/availabilities"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CancellationToken ct) + { + List availabilities = await pyroFetesDbContext.Availabilities.Select(x => new GetAvailabilityDto() + { + Id = x.Id, + AvailabilityDate = x.AvailabilityDate, + DeliveryDate = x.DeliveryDate, + ExpirationDate = x.ExpirationDate, + RenewalDate = x.RenewallDate + }).ToListAsync(ct); + + await Send.OkAsync(availabilities, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Availability/GetAvailabilityEndpoint.cs b/PyroFetes/Endpoints/Availability/GetAvailabilityEndpoint.cs new file mode 100644 index 0000000..d0bf0b0 --- /dev/null +++ b/PyroFetes/Endpoints/Availability/GetAvailabilityEndpoint.cs @@ -0,0 +1,37 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.Availability.Request; +using PyroFetes.DTO.Availability.Response; + +namespace PyroFetes.Endpoints.Availability; + +public class GetAvailabilityEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint +{ + public override void Configure() + { + Get ("/api/availabilities/{@Id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(GetAvailabilityRequest database, CancellationToken ct) + { + Models.Availability? databaseAvailability = await pyroFetesDbContext.Availabilities.SingleOrDefaultAsync(x => x.Id == database.Id, cancellationToken: ct); + + if (databaseAvailability == null) + { + await Send.NotFoundAsync(ct); + return; + } + + GetAvailabilityDto dto = new() + { + Id = databaseAvailability.Id, + AvailabilityDate = databaseAvailability.AvailabilityDate, + DeliveryDate = databaseAvailability.DeliveryDate, + ExpirationDate = databaseAvailability.ExpirationDate, + RenewalDate = databaseAvailability.RenewallDate + }; + + await Send.OkAsync(dto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Availability/UpdateAvailabilityEndpoint.cs b/PyroFetes/Endpoints/Availability/UpdateAvailabilityEndpoint.cs new file mode 100644 index 0000000..7386014 --- /dev/null +++ b/PyroFetes/Endpoints/Availability/UpdateAvailabilityEndpoint.cs @@ -0,0 +1,45 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.Availability.Request; +using PyroFetes.DTO.Availability.Response; + +namespace PyroFetes.Endpoints.Availability; + +public class UpdateAvailabilityEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint +{ + public override void Configure() + { + Put ("/api/availabilities/{@Id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(UpdateAvailabilityDto req, CancellationToken ct) + { + Models.Availability? databaseAvailability = await pyroFetesDbContext.Availabilities.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct); + + if (databaseAvailability == null) + { + await Send.NotFoundAsync(ct); + return; + } + else + { + databaseAvailability.AvailabilityDate = req.AvailabilityDate; + databaseAvailability.DeliveryDate = req.DeliveryDate; + databaseAvailability.ExpirationDate = req.ExpirationDate; + databaseAvailability.RenewallDate = req.RenewalDate; + } + await pyroFetesDbContext.SaveChangesAsync(ct); + + GetAvailabilityDto dto = new() + { + Id = databaseAvailability.Id, + AvailabilityDate = req.AvailabilityDate, + DeliveryDate = req.DeliveryDate, + ExpirationDate = req.ExpirationDate, + RenewalDate = req.RenewalDate, + }; + + await Send.OkAsync(dto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Contact/CreateContactEndpoint.cs b/PyroFetes/Endpoints/Contact/CreateContactEndpoint.cs new file mode 100644 index 0000000..e0a65fc --- /dev/null +++ b/PyroFetes/Endpoints/Contact/CreateContactEndpoint.cs @@ -0,0 +1,42 @@ +using FastEndpoints; +using PyroFetes.DTO.Contact.Request; +using PyroFetes.DTO.Contact.Response; + +namespace PyroFetes.Endpoints.Contact; + +public class CreateContactEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint +{ + public override void Configure() + { + Post("/api/contacts"); + AllowAnonymous(); + } + + + public override async Task HandleAsync(CreateContactDto req, CancellationToken ct) + { + Models.Contact contact = new() + { + LastName = req.LastName, + FirstName = req.FirstName, + PhoneNumber = req.PhoneNumber, + Email = req.Email, + Address = req.Address, + Role = req.Role, + }; + pyroFetesDbContext.Add(contact); + await pyroFetesDbContext.SaveChangesAsync(ct); + + GetContactDto response = new() + { + LastName = contact.LastName, + FirstName = contact.FirstName, + PhoneNumber = contact.PhoneNumber, + Email = contact.Email, + Address = contact.Address, + Role = contact.Role, + }; + + await Send.OkAsync(response, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Contact/DeleteContactEndpoint.cs b/PyroFetes/Endpoints/Contact/DeleteContactEndpoint.cs new file mode 100644 index 0000000..51a965c --- /dev/null +++ b/PyroFetes/Endpoints/Contact/DeleteContactEndpoint.cs @@ -0,0 +1,30 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.Contact.Request; +using PyroFetes.DTO.Contact.Response; + +namespace PyroFetes.Endpoints.Contact; + +public class DeleteContactEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint +{ + public override void Configure() + { + Delete ("/api/Contacts/{@Id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(GetContactRequest req, CancellationToken ct) + { + Models.Contact? databaseContact = await pyroFetesDbContext.Contacts.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct); + + if (databaseContact == null) + { + await Send.NotFoundAsync(ct); + return; + } + pyroFetesDbContext.Contacts.Remove(databaseContact); + await pyroFetesDbContext.SaveChangesAsync(ct); + + await Send.NoContentAsync(ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Contact/GetAllContactsEndpoint.cs b/PyroFetes/Endpoints/Contact/GetAllContactsEndpoint.cs new file mode 100644 index 0000000..e7339d9 --- /dev/null +++ b/PyroFetes/Endpoints/Contact/GetAllContactsEndpoint.cs @@ -0,0 +1,30 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.Contact.Response; + +namespace PyroFetes.Endpoints.Contact; + +public class GetAllContactxuest(PyroFetesDbContext pyroFetesDbContext) : EndpointWithoutRequest> +{ + public override void Configure() + { + Get ("/api/contacts"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CancellationToken ct) + { + List contacts = await pyroFetesDbContext.Contacts.Select(x => new GetContactDto() + { + Id = x.Id, + LastName = x.LastName, + FirstName = x.FirstName, + PhoneNumber = x.PhoneNumber, + Email = x.Email, + Address = x.Address, + Role = x.Role, + }).ToListAsync(ct); + + await Send.OkAsync(contacts, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Contact/GetContactEndpoint.cs b/PyroFetes/Endpoints/Contact/GetContactEndpoint.cs new file mode 100644 index 0000000..04a4e5e --- /dev/null +++ b/PyroFetes/Endpoints/Contact/GetContactEndpoint.cs @@ -0,0 +1,39 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.Contact.Request; +using PyroFetes.DTO.Contact.Response; + +namespace PyroFetes.Endpoints.Contact; + +public class GetContactEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint +{ + public override void Configure() + { + Get ("/api/contacts/{@Id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(GetContactRequest database, CancellationToken ct) + { + Models.Contact? databaseContact = await pyroFetesDbContext.Contacts.SingleOrDefaultAsync(x => x.Id == database.Id, cancellationToken: ct); + + if (databaseContact == null) + { + await Send.NotFoundAsync(ct); + return; + } + + GetContactDto dto = new() + { + Id = databaseContact.Id, + LastName = databaseContact.LastName, + FirstName = databaseContact.FirstName, + PhoneNumber = databaseContact.PhoneNumber, + Email = databaseContact.Email, + Address = databaseContact.Address, + Role = databaseContact.Role, + }; + + await Send.OkAsync(dto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/Contact/UpdateContactRequest.cs b/PyroFetes/Endpoints/Contact/UpdateContactRequest.cs new file mode 100644 index 0000000..8fec9d1 --- /dev/null +++ b/PyroFetes/Endpoints/Contact/UpdateContactRequest.cs @@ -0,0 +1,49 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.Contact.Request; +using PyroFetes.DTO.Contact.Response; + +namespace PyroFetes.Endpoints.Contact; + +public class UpdateContactRequest(PyroFetesDbContext pyroFetesDbContext) : Endpoint +{ + public override void Configure() + { + Put ("/api/contacts/{@Id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(UpdateContactDto req, CancellationToken ct) + { + Models.Contact? databaseContact = await pyroFetesDbContext.Contacts.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct); + + if (databaseContact == null) + { + await Send.NotFoundAsync(ct); + return; + } + else + { + databaseContact.LastName = req.LastName; + databaseContact.FirstName = req.FirstName; + databaseContact.PhoneNumber = req.PhoneNumber; + databaseContact.Email = req.Email; + databaseContact.Address = req.Address; + databaseContact.Role = req.Role; + } + await pyroFetesDbContext.SaveChangesAsync(ct); + + GetContactDto dto = new() + { + Id = databaseContact.Id, + LastName = req.LastName, + FirstName = req.FirstName, + PhoneNumber = req.PhoneNumber, + Email = req.Email, + Address = req.Address, + Role = req.Role, + }; + + await Send.OkAsync(dto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/ExperienceLevel/CreateExperienceLevelEndpoint.cs b/PyroFetes/Endpoints/ExperienceLevel/CreateExperienceLevelEndpoint.cs new file mode 100644 index 0000000..ef4ccc6 --- /dev/null +++ b/PyroFetes/Endpoints/ExperienceLevel/CreateExperienceLevelEndpoint.cs @@ -0,0 +1,34 @@ + +using FastEndpoints; +using PyroFetes.DTO.ExperienceLevel.Response; +using PyroFetes.DTO.ExperienceLevel.Request; + +namespace PyroFetes.Endpoints.ExperienceLevel; + +public class CreateExperienceLevelEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint +{ + public override void Configure() + { + Post("/api/ExperienceLevels"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CreateExperienceLevelDto req, CancellationToken ct) + { + Models.ExperienceLevel experienceLevel = new() + { + Label = req.Label + }; + pyroFetesDbContext.Add(experienceLevel); + await pyroFetesDbContext.SaveChangesAsync(ct); + + GetExperienceLevelDto response = new() + { + Id = experienceLevel.Id, + Label = experienceLevel.Label, + }; + + await Send.OkAsync(response, ct); + + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/ExperienceLevel/DeleteExerienceLevelEndpoint.cs b/PyroFetes/Endpoints/ExperienceLevel/DeleteExerienceLevelEndpoint.cs new file mode 100644 index 0000000..5b5792d --- /dev/null +++ b/PyroFetes/Endpoints/ExperienceLevel/DeleteExerienceLevelEndpoint.cs @@ -0,0 +1,30 @@ +using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.ExperienceLevel.Request; +using PyroFetes.DTO.ExperienceLevel.Response; +using FastEndpoints; + +namespace PyroFetes.Endpoints.ExperienceLevel; + +public class DeleteExerienceLevelEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint +{ + public override void Configure() + { + Delete ("/api/ExperienceLevels/{@Id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(GetExperienceLevelRequest req, CancellationToken ct) + { + Models.ExperienceLevel? databaseExperienceLevel = await pyroFetesDbContext.ExperienceLevels.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct); + + if (databaseExperienceLevel == null) + { + await Send.NotFoundAsync(ct); + return; + } + pyroFetesDbContext.ExperienceLevels.Remove(databaseExperienceLevel); + await pyroFetesDbContext.SaveChangesAsync(ct); + + await Send.NoContentAsync(ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/ExperienceLevel/GetAllExperienceLevelsEndpoint.cs b/PyroFetes/Endpoints/ExperienceLevel/GetAllExperienceLevelsEndpoint.cs new file mode 100644 index 0000000..449cfca --- /dev/null +++ b/PyroFetes/Endpoints/ExperienceLevel/GetAllExperienceLevelsEndpoint.cs @@ -0,0 +1,24 @@ +using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.ExperienceLevel.Response; + +namespace PyroFetes.Endpoints.ExperienceLevel; +using FastEndpoints; + +public class GetAllExperienceLevelsEndpoint(PyroFetesDbContext pyroFetesDbContext) : EndpointWithoutRequest> +{ + public override void Configure() + { + Get ("/api/experienceLevels"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CancellationToken ct) + { + List experienceLevels= await pyroFetesDbContext.ExperienceLevels.Select(x => new GetExperienceLevelDto() + { + Id = x.Id, + }).ToListAsync(ct); + + await Send.OkAsync(experienceLevels, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/ExperienceLevel/GetExperienceLevelEndpoint.cs b/PyroFetes/Endpoints/ExperienceLevel/GetExperienceLevelEndpoint.cs new file mode 100644 index 0000000..2123855 --- /dev/null +++ b/PyroFetes/Endpoints/ExperienceLevel/GetExperienceLevelEndpoint.cs @@ -0,0 +1,6 @@ +namespace PyroFetes.Endpoints.ExperienceLevel; + +public class GetExperienceLevelEndpoint +{ + +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/ExperienceLevel/UpdateExperienceLevelEndpoint.cs b/PyroFetes/Endpoints/ExperienceLevel/UpdateExperienceLevelEndpoint.cs new file mode 100644 index 0000000..d2aa8a2 --- /dev/null +++ b/PyroFetes/Endpoints/ExperienceLevel/UpdateExperienceLevelEndpoint.cs @@ -0,0 +1,6 @@ +namespace PyroFetes.Endpoints.ExperienceLevel; + +public class UpdateExperienceLevelEndpoint +{ + +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/HistoryOfApproval/CreateHistoryOfApprovalEndpoint.cs b/PyroFetes/Endpoints/HistoryOfApproval/CreateHistoryOfApprovalEndpoint.cs new file mode 100644 index 0000000..d5251ae --- /dev/null +++ b/PyroFetes/Endpoints/HistoryOfApproval/CreateHistoryOfApprovalEndpoint.cs @@ -0,0 +1,36 @@ +using FastEndpoints; +using PyroFetes.DTO.HistoryOfApproval.Request; +using PyroFetes.DTO.HistoryOfApproval.Response; + +namespace PyroFetes.Endpoints.HistoryOfApproval; + +public class CreateHistoryOfApprovalEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint +{ + public override void Configure() + { + Post("/api/HistoryOfApprovals"); + AllowAnonymous(); + } + + + public override async Task HandleAsync(CreateHistoryOfApprovalDto req, CancellationToken ct) + { + Models.HistoryOfApproval historyOfApproval = new() + { + DeliveryDate = req.DeliveryDate, + ExpirationDate = req.ExpirationDate + }; + pyroFetesDbContext.Add(historyOfApproval); + await pyroFetesDbContext.SaveChangesAsync(ct); + + GetHistoryOfApprovalDto response = new() + { + Id = historyOfApproval.Id, + DeliveryDate = historyOfApproval.DeliveryDate, + ExpirationDate = historyOfApproval.ExpirationDate + }; + + await Send.OkAsync(response, ct); + + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/HistoryOfApproval/DeleteHistoryOfApprovalEndpoint.cs b/PyroFetes/Endpoints/HistoryOfApproval/DeleteHistoryOfApprovalEndpoint.cs new file mode 100644 index 0000000..0095177 --- /dev/null +++ b/PyroFetes/Endpoints/HistoryOfApproval/DeleteHistoryOfApprovalEndpoint.cs @@ -0,0 +1,30 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.HistoryOfApproval.Request; +using PyroFetes.DTO.HistoryOfApproval.Response; + +namespace PyroFetes.Endpoints.HistoryOfApproval; + +public class DeleteHistoryOfApprovalEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint +{ + public override void Configure() + { + Delete ("/api/HistoryOfApprovals/{@Id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(GetHistoryOfApprovalRequest req, CancellationToken ct) + { + Models.HistoryOfApproval? databaseHistoryOfApproval = await pyroFetesDbContext.HistoryOfApprovals.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct); + + if (databaseHistoryOfApproval == null) + { + await Send.NotFoundAsync(ct); + return; + } + pyroFetesDbContext.HistoryOfApprovals.Remove(databaseHistoryOfApproval); + await pyroFetesDbContext.SaveChangesAsync(ct); + + await Send.NoContentAsync(ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/HistoryOfApproval/GetAllHistoryOfApprovalEndpoint.cs b/PyroFetes/Endpoints/HistoryOfApproval/GetAllHistoryOfApprovalEndpoint.cs new file mode 100644 index 0000000..cc0cd48 --- /dev/null +++ b/PyroFetes/Endpoints/HistoryOfApproval/GetAllHistoryOfApprovalEndpoint.cs @@ -0,0 +1,26 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.HistoryOfApproval.Response; + +namespace PyroFetes.Endpoints.HistoryOfApproval; + +public class GetAllHistoryOfApprovalEndpoint(PyroFetesDbContext pyroFetesDbContext) : EndpointWithoutRequest> +{ + public override void Configure() + { + Get ("/api/HistoryOfApprovals"); + AllowAnonymous(); + } + + public override async Task HandleAsync(CancellationToken ct) + { + List historyOfApprovals= await pyroFetesDbContext.HistoryOfApprovals.Select(x => new GetHistoryOfApprovalDto() + { + Id = x.Id, + DeliveryDate = x.DeliveryDate, + ExpirationDate = x.ExpirationDate, + }).ToListAsync(ct); + + await Send.OkAsync(historyOfApprovals, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/HistoryOfApproval/GetHistoryOfApprovalEndpoint.cs b/PyroFetes/Endpoints/HistoryOfApproval/GetHistoryOfApprovalEndpoint.cs new file mode 100644 index 0000000..eb3f70c --- /dev/null +++ b/PyroFetes/Endpoints/HistoryOfApproval/GetHistoryOfApprovalEndpoint.cs @@ -0,0 +1,35 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.HistoryOfApproval.Request; +using PyroFetes.DTO.HistoryOfApproval.Response; + +namespace PyroFetes.Endpoints.HistoryOfApproval; + +public class GetHistoryOfApprovalEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint +{ + public override void Configure() + { + Get ("/api/HistoryOfApprovals/{@Id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(GetHistoryOfApprovalRequest req, CancellationToken ct) + { + Models.HistoryOfApproval? databaseHistoryOfApproval = await pyroFetesDbContext.HistoryOfApprovals.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct); + + if (databaseHistoryOfApproval == null) + { + await Send.NotFoundAsync(ct); + return; + } + + GetHistoryOfApprovalDto dto = new() + { + Id = databaseHistoryOfApproval.Id, + DeliveryDate = databaseHistoryOfApproval.DeliveryDate, + ExpirationDate = databaseHistoryOfApproval.ExpirationDate + }; + + await Send.OkAsync(dto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/Endpoints/HistoryOfApproval/UpdateHistoryOfApprovalEndpoint.cs b/PyroFetes/Endpoints/HistoryOfApproval/UpdateHistoryOfApprovalEndpoint.cs new file mode 100644 index 0000000..e5c98e6 --- /dev/null +++ b/PyroFetes/Endpoints/HistoryOfApproval/UpdateHistoryOfApprovalEndpoint.cs @@ -0,0 +1,41 @@ +using FastEndpoints; +using Microsoft.EntityFrameworkCore; +using PyroFetes.DTO.HistoryOfApproval.Request; +using PyroFetes.DTO.HistoryOfApproval.Response; + +namespace PyroFetes.Endpoints.HistoryOfApproval; + +public class UpdateHistoryOfApprovalEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint +{ + public override void Configure() + { + Put ("/api/HistoryOfApprovals/{@Id}", x => new { x.Id }); + AllowAnonymous(); + } + + public override async Task HandleAsync(UpdateHistoryOfApprovalDto req, CancellationToken ct) + { + Models.HistoryOfApproval? databaseHistoryOfApproval = await pyroFetesDbContext.HistoryOfApprovals.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct); + + if (databaseHistoryOfApproval == null) + { + await Send.NotFoundAsync(ct); + return; + } + else + { + databaseHistoryOfApproval.DeliveryDate = req.DeliveryDate; + databaseHistoryOfApproval.ExpirationDate = req.ExpirationDate; + } + await pyroFetesDbContext.SaveChangesAsync(ct); + + GetHistoryOfApprovalDto dto = new() + { + Id = databaseHistoryOfApproval.Id, + DeliveryDate = req.DeliveryDate, + ExpirationDate = req.ExpirationDate + }; + + await Send.OkAsync(dto, ct); + } +} \ No newline at end of file diff --git a/PyroFetes/PyroFetes.csproj b/PyroFetes/PyroFetes.csproj index 60e4770..b301a92 100644 --- a/PyroFetes/PyroFetes.csproj +++ b/PyroFetes/PyroFetes.csproj @@ -7,6 +7,8 @@ + +