Implement US-06 latest blood-pressure observation retrieval
This commit is contained in:
1 parent
05f57dcba3
commit
df47bcbbd7
8 files changed
+97
-2
No files matched your search
@@ -37,6 +37,13 @@ public sealed class ObservationController(ObservationApplicationService service)
|
||||
return observation is null ? NotFound() : Ok(ToDto(observation));
|
||||
}
|
||||
|
||||
[HttpGet("patients/{patientId:guid}/observations/latest")]
|
||||
public async Task<ActionResult<ObservationDto>> GetLatest(Guid patientId, CancellationToken cancellationToken)
|
||||
{
|
||||
var observation = await service.GetLatestAsync(patientId, cancellationToken);
|
||||
return observation is null ? NotFound() : Ok(ToDto(observation));
|
||||
}
|
||||
|
||||
private static ObservationDto ToDto(BloodPressureObservation observation) =>
|
||||
new(observation.ObservationId, observation.PatientId, observation.MeasuredAt, observation.Systolic,
|
||||
observation.Diastolic, observation.Pulse, observation.Context, observation.Note);
|
||||
|
||||
Reference in new issue
Block a user