Api-PWA/DocuMed.Api/Controllers/PatientController.cs

21 lines
727 B
C#

namespace DocuMed.Api.Controllers;
public class PatientController : ICarterModule
{
public void AddRoutes(IEndpointRouteBuilder app)
{
var group = app.NewVersionedApi("Patient")
.MapGroup($"api/patient");
group.MapGet("", GetAllAsync)
.WithDisplayName("Get All Patient")
.HasApiVersion(1.0);
}
private async Task<IResult> GetAllAsync([FromQuery]int page ,
[FromQuery]int? count ,
[FromQuery]string searchName ,
[FromServices]IMediator mediator,
CancellationToken cancellationToken)
=> TypedResults.Ok(await mediator.Send(new GetPatientsQuery(page, Count: count ?? Refers.SizeM, searchName), cancellationToken));
}