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
@@ -7,25 +7,28 @@ namespace PyroFetes.Endpoints.Staff;
public class GetAllStaffsEndpoint(PyroFetesDbContext pyroFetesDbContext) : EndpointWithoutRequest<List<GetStaffDto>>
{
public override void Configure()
{
Get ("/staffs");
{
Get("/staffs");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
List<GetStaffDto> staff = await pyroFetesDbContext.Staffs.Select(x => new GetStaffDto()
{
Id = x.Id,
FirstName = x.FirstName,
LastName = x.LastName,
Profession = x.Profession,
Email = x.Email,
F4T2NumberApproval = x.F4T2NumberApproval,
F4T2ExpirationDate = x.F4T2ExpirationDate,
}).ToListAsync(ct);
List<GetStaffDto> staff = await pyroFetesDbContext.Staffs
.Include(x => x.ExperienceLevel)
.Select(x => new GetStaffDto()
{
Id = x.Id,
FirstName = x.FirstName,
LastName = x.LastName,
Profession = x.Profession,
Email = x.Email,
F4T2NumberApproval = x.F4T2NumberApproval,
F4T2ExpirationDate = x.F4T2ExpirationDate,
ExperienceLevel = x.ExperienceLevel.Label
}).ToListAsync(ct);
await Send.OkAsync(staff, ct);
}
}