Ajout du niveau d'experience

This commit is contained in:
2026-06-11 11:06:31 +02:00
parent 35c99928ad
commit 5d16138ed8
16 changed files with 2270 additions and 26 deletions
@@ -1,4 +1,5 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PyroFetes.DTO.HistoryOfApproval.Request;
using PyroFetes.DTO.HistoryOfApproval.Response;
@@ -15,10 +16,21 @@ public class CreateHistoryOfApprovalEndpoint(PyroFetesDbContext pyroFetesDbConte
public override async Task HandleAsync(CreateHistoryOfApprovalDto req, CancellationToken ct)
{
Models.Staff? databaseStaff = await pyroFetesDbContext.Staffs.SingleOrDefaultAsync(x => x.Id == req.StaffId, cancellationToken: ct);
if (databaseStaff == null)
{
await Send.NotFoundAsync(ct);
Console.WriteLine("Customer Type not found");
return;
}
Models.HistoryOfApproval historyOfApproval = new()
{
DeliveryDate = req.DeliveryDate,
ExpirationDate = req.ExpirationDate
ExpirationDate = req.ExpirationDate,
StaffId = databaseStaff.Id,
};
pyroFetesDbContext.Add(historyOfApproval);
await pyroFetesDbContext.SaveChangesAsync(ct);
@@ -27,7 +39,8 @@ public class CreateHistoryOfApprovalEndpoint(PyroFetesDbContext pyroFetesDbConte
{
Id = historyOfApproval.Id,
DeliveryDate = historyOfApproval.DeliveryDate,
ExpirationDate = historyOfApproval.ExpirationDate
ExpirationDate = historyOfApproval.ExpirationDate,
StaffId = historyOfApproval.StaffId,
};
await Send.OkAsync(response, ct);
@@ -19,6 +19,7 @@ public class GetAllHistoryOfApprovalEndpoint(PyroFetesDbContext pyroFetesDbConte
Id = x.Id,
DeliveryDate = x.DeliveryDate,
ExpirationDate = x.ExpirationDate,
StaffId = x.StaffId,
}).ToListAsync(ct);
await Send.OkAsync(historyOfApprovals, ct);