feat(health): 扩展 device_type 枚举支持 blood_pressure 和 blood_glucose

This commit is contained in:
iven
2026-04-28 19:21:21 +08:00
parent 0aab27295c
commit 40a71e5a1c

View File

@@ -233,6 +233,7 @@ pub fn validate_follow_up_status_transition(current: &str, new: &str) -> HealthR
pub fn validate_device_type(value: &str) -> HealthResult<()> {
validate_enum!(value, "device_type", [
"heart_rate", "blood_oxygen", "steps", "sleep", "temperature", "stress",
"blood_pressure", "blood_glucose",
]);
Ok(())
}
@@ -496,7 +497,11 @@ mod tests {
#[test]
fn device_type_steps() { assert!(validate_device_type("steps").is_ok()); }
#[test]
fn device_type_invalid() { assert!(validate_device_type("blood_pressure").is_err()); }
fn device_type_blood_pressure() { assert!(validate_device_type("blood_pressure").is_ok()); }
#[test]
fn device_type_blood_glucose() { assert!(validate_device_type("blood_glucose").is_ok()); }
#[test]
fn device_type_invalid() { assert!(validate_device_type("invalid_device").is_err()); }
// --- condition_type ---
#[test]