First Commit 09/10

# Conflicts:
#	PyroFetes/PyroFetes.csproj
This commit is contained in:
2025-10-09 17:12:17 +02:00
parent 0e19ef1ab7
commit 4e64112a31
49 changed files with 908 additions and 0 deletions

View File

@@ -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<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);
}
}