using GerbilManagerWebAPI.Dtos; using GerbilManagerWebAPI.Genetics; using Microsoft.AspNetCore.Http.HttpResults; namespace GerbilManagerWebAPI.Endpoints { /// /// Inzuchtkoeffizient endpoints (FEAT-1b). Routes/response shapes are IDENTICAL to /// the former InbreedingController — only the hosting style changed to Minimal API. /// public static class InbreedingEndpoints { public static IEndpointRouteBuilder MapInbreedingEndpoints(this IEndpointRouteBuilder app) { // GET /gerbils/{id}/inbreeding-coefficient app.MapGet("/gerbils/{id:guid}/inbreeding-coefficient", Results, NotFound> (Guid id, ApplicationContext db) => { var result = new InbreedingService(db).ForGerbil(id); return result is null ? TypedResults.NotFound() : TypedResults.Ok(result); }) .WithTags("Inbreeding"); // POST /genetics/test-inbreeding app.MapPost("/genetics/test-inbreeding", Ok (TestInbreedingDto dto, ApplicationContext db) => TypedResults.Ok(new InbreedingService(db).ForPairing(dto.FatherId, dto.MotherId))) .WithTags("Inbreeding"); return app; } } }