FEAT-4: pedigree data module - depth-limited ancestor traversal, lazy expand, cycle guard, rd3t conversion (15 tests)
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
7
gerbil-manager-web/src/api/litters.ts
Normal file
7
gerbil-manager-web/src/api/litters.ts
Normal file
@@ -0,0 +1,7 @@
|
||||
/** Typed API functions for the Würfe (litters) resource. */
|
||||
import { api, resources } from './client'
|
||||
import type { Litter } from './types'
|
||||
|
||||
export function getLitter(id: string): Promise<Litter> {
|
||||
return api.get<Litter>(`${resources.litters}/${id}`)
|
||||
}
|
||||
22
gerbil-manager-web/src/api/pedigree.ts
Normal file
22
gerbil-manager-web/src/api/pedigree.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
/**
|
||||
* FEAT-4: Stammbaum-bezogene API-Aufrufe.
|
||||
*
|
||||
* Der Inzuchtkoeffizient wird serverseitig über die VOLLE Ahnentiefe berechnet
|
||||
* (Board-Entscheidung; UI zeigt 4 Generationen, Koeffizient zählt alle).
|
||||
* Endpunkt entsteht in DATA-2-Folgearbeit — bis dahin antwortet er mit 404 und
|
||||
* die UI zeigt einen „wird berechnet …“-Zustand.
|
||||
*/
|
||||
import { api, resources } from './client'
|
||||
|
||||
export interface InbreedingCoefficient {
|
||||
/** Koeffizient nach Wright, 0..1. */
|
||||
coefficient: number
|
||||
}
|
||||
|
||||
export async function getInbreedingCoefficient(gerbilId: string): Promise<number> {
|
||||
const raw = await api.get<InbreedingCoefficient | number>(
|
||||
`${resources.gerbils}/${gerbilId}/inbreeding-coefficient`,
|
||||
)
|
||||
// Defensiv: Endpunkt-Form ist noch nicht final (nacktes number vs. Objekt).
|
||||
return typeof raw === 'number' ? raw : raw.coefficient
|
||||
}
|
||||
Reference in New Issue
Block a user