initalisation

This commit is contained in:
2025-11-13 14:13:26 +01:00
parent 6a813fc35a
commit 55f92ad761
40 changed files with 755 additions and 0 deletions

View File

@@ -0,0 +1,30 @@
using FastEndpoints;
using Microsoft.EntityFrameworkCore;
using PF3.DTO.Staff.Response;
namespace PF3.Endpoints.Staff;
public class GetAllStaffEndpoint(PF3DbContext pf3DbContext) : EndpointWithoutRequest<List<ReadStaffDto>>
{
public override void Configure()
{
Get("/api/staff");
AllowAnonymous();
}
public override async Task HandleAsync(CancellationToken ct)
{
var staffs = await pf3DbContext.Staffs.ToListAsync(ct);
var result = staffs.Select(s => new ReadStaffDto
{
Id = s.Id,
FirstName = s.FirstName,
LastName = s.LastName,
Profession = s.Profession,
Email = s.Email
}).ToList();
await Send.OkAsync(result, ct);
}
}