Compare commits
4 Commits
Author | SHA1 | Date | |
---|---|---|---|
70d47eb82b | |||
6f3c9a5fac | |||
44a48f8ccd | |||
a93d399942 |
@@ -1,4 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="Encoding" addBOMForNewFiles="with BOM under Windows, with no BOM otherwise" />
|
|
||||||
</project>
|
|
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="UserContentModel">
|
|
||||||
<attachedFolders />
|
|
||||||
<explicitIncludes />
|
|
||||||
<explicitExcludes />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@@ -1,8 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="RiderProjectSettingsUpdater">
|
|
||||||
<option name="singleClickDiffPreview" value="1" />
|
|
||||||
<option name="unhandledExceptionsIgnoreList" value="1" />
|
|
||||||
<option name="vcsConfiguration" value="3" />
|
|
||||||
</component>
|
|
||||||
</project>
|
|
66
PyroFetes/.idea/.idea.PyroFetes/.idea/workspace.xml
generated
66
PyroFetes/.idea/.idea.PyroFetes/.idea/workspace.xml
generated
@@ -1,66 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<project version="4">
|
|
||||||
<component name="ChangeListManager">
|
|
||||||
<list default="true" id="d96e474d-65b4-4ba3-b29a-8b061521ff58" name="Changes" comment="" />
|
|
||||||
<option name="SHOW_DIALOG" value="false" />
|
|
||||||
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
||||||
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
||||||
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
||||||
</component>
|
|
||||||
<component name="ProblemsViewState">
|
|
||||||
<option name="selectedTabId" value="Toolset" />
|
|
||||||
</component>
|
|
||||||
<component name="ProjectColorInfo"><![CDATA[{
|
|
||||||
"associatedIndex": 5
|
|
||||||
}]]></component>
|
|
||||||
<component name="ProjectId" id="33pVanUBtZaJBGFUWpQVCbSMGAe" />
|
|
||||||
<component name="ProjectViewState">
|
|
||||||
<option name="hideEmptyMiddlePackages" value="true" />
|
|
||||||
<option name="showLibraryContents" value="true" />
|
|
||||||
</component>
|
|
||||||
<component name="PropertiesComponent"><![CDATA[{
|
|
||||||
"keyToString": {
|
|
||||||
"ModuleVcsDetector.initialDetectionPerformed": "true",
|
|
||||||
"RunOnceActivity.ShowReadmeOnStart": "true",
|
|
||||||
"last_opened_file_path": "/home/carteronm@stsio.lan/Documents/Projet4/PyroFetes.sln",
|
|
||||||
"nodejs_package_manager_path": "npm",
|
|
||||||
"vue.rearranger.settings.migration": "true"
|
|
||||||
}
|
|
||||||
}]]></component>
|
|
||||||
<component name="TaskManager">
|
|
||||||
<task active="true" id="Default" summary="Default task">
|
|
||||||
<changelist id="d96e474d-65b4-4ba3-b29a-8b061521ff58" name="Changes" comment="" />
|
|
||||||
<created>1760014067675</created>
|
|
||||||
<option name="number" value="Default" />
|
|
||||||
<option name="presentableId" value="Default" />
|
|
||||||
<updated>1760014067675</updated>
|
|
||||||
<workItem from="1760014069254" duration="39000" />
|
|
||||||
</task>
|
|
||||||
<servers />
|
|
||||||
</component>
|
|
||||||
<component name="TypeScriptGeneratedFilesManager">
|
|
||||||
<option name="version" value="3" />
|
|
||||||
</component>
|
|
||||||
<component name="UnityProjectConfiguration" hasMinimizedUI="false" />
|
|
||||||
<component name="VcsManagerConfiguration">
|
|
||||||
<option name="CLEAR_INITIAL_COMMIT_MESSAGE" value="true" />
|
|
||||||
</component>
|
|
||||||
<component name="XDebuggerManager">
|
|
||||||
<breakpoint-manager>
|
|
||||||
<breakpoints>
|
|
||||||
<breakpoint enabled="true" type="DotNet_Exception_Breakpoints">
|
|
||||||
<properties exception="System.OperationCanceledException" breakIfHandledByOtherCode="false" displayValue="System.OperationCanceledException" />
|
|
||||||
<option name="timeStamp" value="1" />
|
|
||||||
</breakpoint>
|
|
||||||
<breakpoint enabled="true" type="DotNet_Exception_Breakpoints">
|
|
||||||
<properties exception="System.Threading.Tasks.TaskCanceledException" breakIfHandledByOtherCode="false" displayValue="System.Threading.Tasks.TaskCanceledException" />
|
|
||||||
<option name="timeStamp" value="2" />
|
|
||||||
</breakpoint>
|
|
||||||
<breakpoint enabled="true" type="DotNet_Exception_Breakpoints">
|
|
||||||
<properties exception="System.Threading.ThreadAbortException" breakIfHandledByOtherCode="false" displayValue="System.Threading.ThreadAbortException" />
|
|
||||||
<option name="timeStamp" value="3" />
|
|
||||||
</breakpoint>
|
|
||||||
</breakpoints>
|
|
||||||
</breakpoint-manager>
|
|
||||||
</component>
|
|
||||||
</project>
|
|
@@ -1,9 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
@@ -1,6 +0,0 @@
|
|||||||
namespace PyroFetes.DTO.Availability.Request;
|
|
||||||
|
|
||||||
public class GetAvailabilityRequest
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
@@ -1,10 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
@@ -1,10 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
@@ -1,8 +0,0 @@
|
|||||||
namespace PyroFetes.DTO.Communication.Request;
|
|
||||||
|
|
||||||
public class CreateCommunicationDto
|
|
||||||
{
|
|
||||||
public string? Calling { get; set; }
|
|
||||||
public string? Email { get; set; }
|
|
||||||
public string? Meeting { get; set; }
|
|
||||||
}
|
|
@@ -1,6 +0,0 @@
|
|||||||
namespace PyroFetes.DTO.Communication.Request;
|
|
||||||
|
|
||||||
public class GetCommunicationRequest
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
@@ -1,9 +0,0 @@
|
|||||||
namespace PyroFetes.DTO.Communication.Request;
|
|
||||||
|
|
||||||
public class UpdateCommunicationDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string? Calling { get; set; }
|
|
||||||
public string? Email { get; set; }
|
|
||||||
public string? Meeting { get; set; }
|
|
||||||
}
|
|
@@ -1,9 +0,0 @@
|
|||||||
namespace PyroFetes.DTO.Communication.Response;
|
|
||||||
|
|
||||||
public class GetCommunicationDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string? Calling { get; set; }
|
|
||||||
public string? Email { get; set; }
|
|
||||||
public string? Meeting { get; set; }
|
|
||||||
}
|
|
@@ -1,11 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
@@ -1,6 +0,0 @@
|
|||||||
namespace PyroFetes.DTO.Contact.Request;
|
|
||||||
|
|
||||||
public class GetContactRequest
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
@@ -1,12 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
@@ -1,12 +0,0 @@
|
|||||||
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; }
|
|
||||||
}
|
|
@@ -1,6 +0,0 @@
|
|||||||
namespace PyroFetes.DTO.ExperienceLevel.Request;
|
|
||||||
|
|
||||||
public class CreateExperienceLevelDto
|
|
||||||
{
|
|
||||||
public string? Label { get; set; }
|
|
||||||
}
|
|
@@ -1,6 +0,0 @@
|
|||||||
namespace PyroFetes.DTO.ExperienceLevel.Request;
|
|
||||||
|
|
||||||
public class GetExperienceLevelDTO
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
namespace PyroFetes.DTO.ExperienceLevel.Request;
|
|
||||||
|
|
||||||
public class UpdateExperienceLevelDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string? Label { get; set; }
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
namespace PyroFetes.DTO.ExperienceLevel.Response;
|
|
||||||
|
|
||||||
public class GetExperienceLevelDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string? Label { get; set; }
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
namespace PyroFetes.DTO.HistoryOfApproval.Request;
|
|
||||||
|
|
||||||
public class CreateHistoryOfApprovalDto
|
|
||||||
{
|
|
||||||
public DateOnly DeliveryDate { get; set; }
|
|
||||||
public DateOnly ExpirationDate { get; set; }
|
|
||||||
}
|
|
@@ -1,6 +0,0 @@
|
|||||||
namespace PyroFetes.DTO.HistoryOfApproval.Request;
|
|
||||||
|
|
||||||
public class GetHistoryOfApprovalRequest
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
@@ -1,8 +0,0 @@
|
|||||||
namespace PyroFetes.DTO.HistoryOfApproval.Request;
|
|
||||||
|
|
||||||
public class UpdateHistoryOfApprovalDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public DateOnly DeliveryDate { get; set; }
|
|
||||||
public DateOnly ExpirationDate { get; set; }
|
|
||||||
}
|
|
@@ -1,8 +0,0 @@
|
|||||||
namespace PyroFetes.DTO.HistoryOfApproval.Response;
|
|
||||||
|
|
||||||
public class GetHistoryOfApprovalDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public DateOnly DeliveryDate { get; set; }
|
|
||||||
public DateOnly ExpirationDate { get; set; }
|
|
||||||
}
|
|
@@ -1,7 +0,0 @@
|
|||||||
namespace PyroFetes.DTO.Staff.Request;
|
|
||||||
|
|
||||||
public class CreateStaffDto
|
|
||||||
{
|
|
||||||
public string? F4T2NumberApproval { get; set; }
|
|
||||||
public DateOnly F4T2ExpirationDate { get; set; }
|
|
||||||
}
|
|
@@ -1,6 +0,0 @@
|
|||||||
namespace PyroFetes.DTO.Staff.Request;
|
|
||||||
|
|
||||||
public class GetStaffRequest
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
}
|
|
@@ -1,8 +0,0 @@
|
|||||||
namespace PyroFetes.DTO.Staff.Request;
|
|
||||||
|
|
||||||
public class UpdateStaffDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string? F4T2NumberApproval { get; set; }
|
|
||||||
public DateOnly F4T2ExpirationDate { get; set; }
|
|
||||||
}
|
|
@@ -1,8 +0,0 @@
|
|||||||
namespace PyroFetes.DTO.Staff.Response;
|
|
||||||
|
|
||||||
public class GetStaffDto
|
|
||||||
{
|
|
||||||
public int Id { get; set; }
|
|
||||||
public string? F4T2NumberApproval { get; set; }
|
|
||||||
public DateOnly F4T2ExpirationDate { get; set; }
|
|
||||||
}
|
|
@@ -1,38 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using PyroFetes.DTO.Availability.Request;
|
|
||||||
using PyroFetes.DTO.Availability.Response;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Availability;
|
|
||||||
|
|
||||||
public class CreateAvailabilityEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint<CreateAvailabilityDto, GetAvailabilityDto>
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,30 +0,0 @@
|
|||||||
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 <GetAvailabilityRequest, GetAvailabilityDto>
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,28 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using PyroFetes.DTO.Availability.Response;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Availability;
|
|
||||||
|
|
||||||
public class GetAllAvailabilityxuest(PyroFetesDbContext pyroFetesDbContext) : EndpointWithoutRequest<List<GetAvailabilityDto>>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get ("/api/availabilities");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CancellationToken ct)
|
|
||||||
{
|
|
||||||
List<GetAvailabilityDto> 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);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,37 +0,0 @@
|
|||||||
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 <GetAvailabilityRequest, GetAvailabilityDto>
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,45 +0,0 @@
|
|||||||
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 <UpdateAvailabilityDto, GetAvailabilityDto>
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,36 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using PyroFetes.DTO.Communication.Request;
|
|
||||||
using PyroFetes.DTO.Communication.Response;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Communication;
|
|
||||||
|
|
||||||
public class CreateCommunicationEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint<CreateCommunicationDto, GetCommunicationDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Post("/api/communications");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CreateCommunicationDto req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
Models.Communication communication = new()
|
|
||||||
{
|
|
||||||
Calling = req.Calling,
|
|
||||||
Email = req.Email,
|
|
||||||
Meeting = req.Meeting
|
|
||||||
};
|
|
||||||
pyroFetesDbContext.Add(communication);
|
|
||||||
await pyroFetesDbContext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
GetCommunicationDto response = new()
|
|
||||||
{
|
|
||||||
Calling = req.Calling,
|
|
||||||
Email = req.Email,
|
|
||||||
Meeting = req.Meeting
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(response, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,30 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using PyroFetes.DTO.Availability.Request;
|
|
||||||
using PyroFetes.DTO.Communication.Response;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Communication;
|
|
||||||
|
|
||||||
public class DeleteCommunicationEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint <GetCommunicationDto, GetCommunicationEndpoint>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Delete ("/api/availabilities/{@Id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public 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);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,28 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using PyroFetes.DTO.Availability.Response;
|
|
||||||
using PyroFetes.DTO.Communication.Response;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Communication;
|
|
||||||
|
|
||||||
public class GetCommunicationEndpoint(PyroFetesDbContext pyroFetesDbContext) : EndpointWithoutRequest<List<GetCommunicationDto>>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get ("/api/availabilities");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CancellationToken ct)
|
|
||||||
{
|
|
||||||
List<GetCommunicationDto> communications = await pyroFetesDbContext.Communications.Select(x => new GetCommunicationDto()
|
|
||||||
{
|
|
||||||
Id = x.Id,
|
|
||||||
Calling = x.Calling,
|
|
||||||
Email = x.Email,
|
|
||||||
Meeting = x.Meeting,
|
|
||||||
}).ToListAsync(ct);
|
|
||||||
|
|
||||||
await Send.OkAsync(communications, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,42 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using PyroFetes.DTO.Contact.Request;
|
|
||||||
using PyroFetes.DTO.Contact.Response;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Contact;
|
|
||||||
|
|
||||||
public class CreateContactEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint<CreateContactDto, GetContactDto>
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,30 +0,0 @@
|
|||||||
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 <GetContactRequest, GetContactDto>
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,30 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using PyroFetes.DTO.Contact.Response;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Contact;
|
|
||||||
|
|
||||||
public class GetAllContactxuest(PyroFetesDbContext pyroFetesDbContext) : EndpointWithoutRequest<List<GetContactDto>>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get ("/api/contacts");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CancellationToken ct)
|
|
||||||
{
|
|
||||||
List<GetContactDto> 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);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,39 +0,0 @@
|
|||||||
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 <GetContactRequest, GetContactDto>
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,49 +0,0 @@
|
|||||||
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 <UpdateContactDto, GetContactDto>
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,34 +0,0 @@
|
|||||||
|
|
||||||
using FastEndpoints;
|
|
||||||
using PyroFetes.DTO.ExperienceLevel.Response;
|
|
||||||
using PyroFetes.DTO.ExperienceLevel.Request;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.ExperienceLevel;
|
|
||||||
|
|
||||||
public class CreateExperienceLevelEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint<CreateExperienceLevelDto, GetExperienceLevelDto>
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,30 +0,0 @@
|
|||||||
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 <GetExperienceLevelDTO, GetExperienceLevelDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Delete ("/api/ExperienceLevels/{@Id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(GetExperienceLevelDTO 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);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,26 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using PyroFetes.DTO.ExperienceLevel.Response;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.ExperienceLevel;
|
|
||||||
using FastEndpoints;
|
|
||||||
|
|
||||||
public class GetAllExperienceLevelsEndpoint(PyroFetesDbContext pyroFetesDbContext) : EndpointWithoutRequest<List<GetExperienceLevelDto>>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get ("/api/experienceLevels");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CancellationToken ct)
|
|
||||||
{
|
|
||||||
List<GetExperienceLevelDto> experienceLevels= await pyroFetesDbContext.ExperienceLevels.Select(x => new GetExperienceLevelDto()
|
|
||||||
{
|
|
||||||
Id = x.Id,
|
|
||||||
Label = x.Label,
|
|
||||||
|
|
||||||
}).ToListAsync(ct);
|
|
||||||
|
|
||||||
await Send.OkAsync(experienceLevels, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,34 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using PyroFetes.DTO.ExperienceLevel.Request;
|
|
||||||
using PyroFetes.DTO.ExperienceLevel.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.ExperienceLevel;
|
|
||||||
|
|
||||||
public class GetExperienceLevelEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint <GetExperienceLevelDTO, GetExperienceLevelDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get ("/api/experienceLevels/{@Id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(GetExperienceLevelDTO 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;
|
|
||||||
}
|
|
||||||
|
|
||||||
GetExperienceLevelDto dto = new()
|
|
||||||
{
|
|
||||||
Id = databaseExperienceLevel.Id,
|
|
||||||
Label = databaseExperienceLevel.Label,
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(dto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,39 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using PyroFetes.DTO.ExperienceLevel.Request;
|
|
||||||
using PyroFetes.DTO.ExperienceLevel.Response;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.ExperienceLevel;
|
|
||||||
|
|
||||||
public class UpdateExperienceLevelEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint <UpdateExperienceLevelDto, GetExperienceLevelDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Put ("/api/ExperienceLevels/{@Id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(UpdateExperienceLevelDto 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;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
databaseExperienceLevel.Label = req.Label;
|
|
||||||
}
|
|
||||||
await pyroFetesDbContext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
GetExperienceLevelDto dto = new()
|
|
||||||
{
|
|
||||||
Id = databaseExperienceLevel.Id,
|
|
||||||
Label = req.Label,
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(dto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,36 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using PyroFetes.DTO.HistoryOfApproval.Request;
|
|
||||||
using PyroFetes.DTO.HistoryOfApproval.Response;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.HistoryOfApproval;
|
|
||||||
|
|
||||||
public class CreateHistoryOfApprovalEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint<CreateHistoryOfApprovalDto, GetHistoryOfApprovalDto>
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,30 +0,0 @@
|
|||||||
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 <GetHistoryOfApprovalRequest, GetHistoryOfApprovalDto>
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,26 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using PyroFetes.DTO.HistoryOfApproval.Response;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.HistoryOfApproval;
|
|
||||||
|
|
||||||
public class GetAllHistoryOfApprovalEndpoint(PyroFetesDbContext pyroFetesDbContext) : EndpointWithoutRequest<List<GetHistoryOfApprovalDto>>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get ("/api/HistoryOfApprovals");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CancellationToken ct)
|
|
||||||
{
|
|
||||||
List<GetHistoryOfApprovalDto> historyOfApprovals= await pyroFetesDbContext.HistoryOfApprovals.Select(x => new GetHistoryOfApprovalDto()
|
|
||||||
{
|
|
||||||
Id = x.Id,
|
|
||||||
DeliveryDate = x.DeliveryDate,
|
|
||||||
ExpirationDate = x.ExpirationDate,
|
|
||||||
}).ToListAsync(ct);
|
|
||||||
|
|
||||||
await Send.OkAsync(historyOfApprovals, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,35 +0,0 @@
|
|||||||
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 <GetHistoryOfApprovalRequest, GetHistoryOfApprovalDto>
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,41 +0,0 @@
|
|||||||
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 <UpdateHistoryOfApprovalDto, GetHistoryOfApprovalDto>
|
|
||||||
{
|
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,34 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using PyroFetes.DTO.Staff.Request;
|
|
||||||
using PyroFetes.DTO.Staff.Response;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Staff;
|
|
||||||
|
|
||||||
public class CreateStaffEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint<CreateStaffDto, GetStaffDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Post("/api/availabilities");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CreateStaffDto req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
Models.Staff staff = new()
|
|
||||||
{
|
|
||||||
F4T2NumberApproval = req.F4T2NumberApproval,
|
|
||||||
F4T2ExpirationDate = req.F4T2ExpirationDate,
|
|
||||||
};
|
|
||||||
pyroFetesDbContext.Add(staff);
|
|
||||||
await pyroFetesDbContext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
GetStaffDto response = new()
|
|
||||||
{
|
|
||||||
F4T2NumberApproval = staff.F4T2NumberApproval,
|
|
||||||
F4T2ExpirationDate = staff.F4T2ExpirationDate,
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(response, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,30 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using PyroFetes.DTO.Staff.Request;
|
|
||||||
using PyroFetes.DTO.Staff.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Staff;
|
|
||||||
|
|
||||||
public class DeleteStaffEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint <GetStaffRequest, GetStaffDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Delete ("/api/staff/{@Id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(GetStaffRequest req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
Models.Staff? databaseStaff = await pyroFetesDbContext.Staffs.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
|
|
||||||
|
|
||||||
if (databaseStaff == null)
|
|
||||||
{
|
|
||||||
await Send.NotFoundAsync(ct);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
pyroFetesDbContext.Staffs.Remove(databaseStaff);
|
|
||||||
await pyroFetesDbContext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
await Send.NoContentAsync(ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,27 +0,0 @@
|
|||||||
using FastEndpoints;
|
|
||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using PyroFetes.DTO.Staff.Response;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Staff;
|
|
||||||
|
|
||||||
public class GetAllStaffsEndpoint(PyroFetesDbContext pyroFetesDbContext) : EndpointWithoutRequest<List<GetStaffDto>>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get ("/api/availabilities");
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(CancellationToken ct)
|
|
||||||
{
|
|
||||||
List<GetStaffDto> staff = await pyroFetesDbContext.Staffs.Select(x => new GetStaffDto()
|
|
||||||
{
|
|
||||||
Id = x.Id,
|
|
||||||
F4T2NumberApproval = x.F4T2NumberApproval,
|
|
||||||
F4T2ExpirationDate = x.F4T2ExpirationDate,
|
|
||||||
|
|
||||||
}).ToListAsync(ct);
|
|
||||||
|
|
||||||
await Send.OkAsync(staff, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,35 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using PyroFetes.DTO.Staff.Request;
|
|
||||||
using PyroFetes.DTO.Staff.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Staff;
|
|
||||||
|
|
||||||
public class GetStaffEndpoint(PyroFetesDbContext pyroFetesDbContext) : Endpoint <GetStaffRequest, GetStaffDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Get ("/api/Staffs/{@Id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(GetStaffRequest database, CancellationToken ct)
|
|
||||||
{
|
|
||||||
Models.Staff? databaseStaff = await pyroFetesDbContext.Staffs.SingleOrDefaultAsync(x => x.Id == database.Id, cancellationToken: ct);
|
|
||||||
|
|
||||||
if (databaseStaff == null)
|
|
||||||
{
|
|
||||||
await Send.NotFoundAsync(ct);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
GetStaffDto dto = new()
|
|
||||||
{
|
|
||||||
Id = databaseStaff.Id,
|
|
||||||
F4T2NumberApproval = databaseStaff.F4T2NumberApproval,
|
|
||||||
F4T2ExpirationDate = databaseStaff.F4T2ExpirationDate,
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(dto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
@@ -1,41 +0,0 @@
|
|||||||
using Microsoft.EntityFrameworkCore;
|
|
||||||
using PyroFetes.DTO.Staff.Request;
|
|
||||||
using PyroFetes.DTO.Staff.Response;
|
|
||||||
using FastEndpoints;
|
|
||||||
|
|
||||||
namespace PyroFetes.Endpoints.Staff;
|
|
||||||
|
|
||||||
public class UpdateStaffRequest(PyroFetesDbContext pyroFetesDbContext) : Endpoint <UpdateStaffDto, GetStaffDto>
|
|
||||||
{
|
|
||||||
public override void Configure()
|
|
||||||
{
|
|
||||||
Put ("/api/Staffs/{@Id}", x => new { x.Id });
|
|
||||||
AllowAnonymous();
|
|
||||||
}
|
|
||||||
|
|
||||||
public override async Task HandleAsync(UpdateStaffDto req, CancellationToken ct)
|
|
||||||
{
|
|
||||||
Models.Staff? databaseStaff = await pyroFetesDbContext.Staffs.SingleOrDefaultAsync(x => x.Id == req.Id, cancellationToken: ct);
|
|
||||||
|
|
||||||
if (databaseStaff == null)
|
|
||||||
{
|
|
||||||
await Send.NotFoundAsync(ct);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
databaseStaff.F4T2NumberApproval = req.F4T2NumberApproval;
|
|
||||||
databaseStaff.F4T2ExpirationDate = req.F4T2ExpirationDate;
|
|
||||||
}
|
|
||||||
await pyroFetesDbContext.SaveChangesAsync(ct);
|
|
||||||
|
|
||||||
GetStaffDto dto = new()
|
|
||||||
{
|
|
||||||
Id = databaseStaff.Id,
|
|
||||||
F4T2NumberApproval = req.F4T2NumberApproval,
|
|
||||||
F4T2ExpirationDate = req.F4T2ExpirationDate,
|
|
||||||
};
|
|
||||||
|
|
||||||
await Send.OkAsync(dto, ct);
|
|
||||||
}
|
|
||||||
}
|
|
1950
PyroFetes/Migrations/20251010083620_FixingDatabase.Designer.cs
generated
Normal file
1950
PyroFetes/Migrations/20251010083620_FixingDatabase.Designer.cs
generated
Normal file
File diff suppressed because it is too large
Load Diff
52
PyroFetes/Migrations/20251010083620_FixingDatabase.cs
Normal file
52
PyroFetes/Migrations/20251010083620_FixingDatabase.cs
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
using Microsoft.EntityFrameworkCore.Migrations;
|
||||||
|
|
||||||
|
#nullable disable
|
||||||
|
|
||||||
|
namespace PyroFetes.Migrations
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
public partial class FixingDatabase : Migration
|
||||||
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Up(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "References",
|
||||||
|
table: "Products");
|
||||||
|
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "SellingPrice",
|
||||||
|
table: "Products");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<string>(
|
||||||
|
name: "Reference",
|
||||||
|
table: "Products",
|
||||||
|
type: "nvarchar(20)",
|
||||||
|
maxLength: 20,
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: "");
|
||||||
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void Down(MigrationBuilder migrationBuilder)
|
||||||
|
{
|
||||||
|
migrationBuilder.DropColumn(
|
||||||
|
name: "Reference",
|
||||||
|
table: "Products");
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<int>(
|
||||||
|
name: "References",
|
||||||
|
table: "Products",
|
||||||
|
type: "int",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0);
|
||||||
|
|
||||||
|
migrationBuilder.AddColumn<decimal>(
|
||||||
|
name: "SellingPrice",
|
||||||
|
table: "Products",
|
||||||
|
type: "decimal(18,2)",
|
||||||
|
nullable: false,
|
||||||
|
defaultValue: 0m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@@ -541,11 +541,10 @@ namespace PyroFetes.Migrations
|
|||||||
b.Property<int>("ProductCategoryId")
|
b.Property<int>("ProductCategoryId")
|
||||||
.HasColumnType("int");
|
.HasColumnType("int");
|
||||||
|
|
||||||
b.Property<int>("References")
|
b.Property<string>("Reference")
|
||||||
.HasColumnType("int");
|
.IsRequired()
|
||||||
|
.HasMaxLength(20)
|
||||||
b.Property<decimal>("SellingPrice")
|
.HasColumnType("nvarchar(20)");
|
||||||
.HasColumnType("decimal(18,2)");
|
|
||||||
|
|
||||||
b.Property<decimal>("Weight")
|
b.Property<decimal>("Weight")
|
||||||
.HasColumnType("decimal(18,2)");
|
.HasColumnType("decimal(18,2)");
|
||||||
|
@@ -5,14 +5,13 @@ namespace PyroFetes.Models
|
|||||||
public class Product
|
public class Product
|
||||||
{
|
{
|
||||||
[Key] public int Id { get; set; }
|
[Key] public int Id { get; set; }
|
||||||
[Required] public int References { get; set; }
|
[Required, MaxLength(20)] public string? Reference { 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 Duration {get; set;}
|
||||||
[Required] public decimal Caliber { get; set; }
|
[Required] public decimal Caliber { get; set; }
|
||||||
[Required] public int ApprovalNumber { get; set; }
|
[Required] public int ApprovalNumber { get; set; }
|
||||||
[Required] public decimal Weight { get; set; }
|
[Required] public decimal Weight { get; set; }
|
||||||
[Required] public decimal Nec { get; set; }
|
[Required] public decimal Nec { get; set; }
|
||||||
[Required] public decimal SellingPrice { get; set; }
|
|
||||||
[Required] public string? Image { get; set; }
|
[Required] public string? Image { get; set; }
|
||||||
[Required, MaxLength(200)] public string? Link { get; set; }
|
[Required, MaxLength(200)] public string? Link { get; set; }
|
||||||
[Required] public int MinimalQuantity { get; set; }
|
[Required] public int MinimalQuantity { get; set; }
|
||||||
|
@@ -7,8 +7,6 @@
|
|||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<PackageReference Include="FastEndpoints" Version="7.0.1" />
|
|
||||||
<PackageReference Include="FastEndpoints.Swagger" Version="7.0.1" />
|
|
||||||
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.19"/>
|
<PackageReference Include="Microsoft.AspNetCore.OpenApi" Version="8.0.19"/>
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.20" />
|
<PackageReference Include="Microsoft.EntityFrameworkCore" Version="8.0.20" />
|
||||||
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.20">
|
<PackageReference Include="Microsoft.EntityFrameworkCore.Design" Version="8.0.20">
|
||||||
|
Reference in New Issue
Block a user