docs(health): OpenAPI 注解 — device_handler + consent_handler
为 device_handler (2 函数) 和 consent_handler (3 函数) 添加 #[utoipa::path] 注解。P1-5 批次 1/N。
This commit is contained in:
@@ -9,12 +9,19 @@ use crate::dto::consent_dto::*;
|
||||
use crate::service::consent_service;
|
||||
use crate::state::HealthState;
|
||||
|
||||
#[derive(Debug, Deserialize)]
|
||||
#[derive(Debug, Deserialize, utoipa::IntoParams)]
|
||||
pub struct ConsentListParams {
|
||||
pub page: Option<u64>,
|
||||
pub page_size: Option<u64>,
|
||||
}
|
||||
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/health/patients/{patient_id}/consents",
|
||||
responses((status = 200, description = "知情同意列表")),
|
||||
tag = "知情同意",
|
||||
security(("bearer_auth" = [])),
|
||||
)]
|
||||
pub async fn list_consents<S>(
|
||||
State(state): State<HealthState>,
|
||||
Extension(ctx): Extension<TenantContext>,
|
||||
@@ -33,6 +40,13 @@ where
|
||||
Ok(Json(ApiResponse::ok(result)))
|
||||
}
|
||||
|
||||
#[utoipa::path(
|
||||
post,
|
||||
path = "/health/consents",
|
||||
responses((status = 200, description = "授权成功")),
|
||||
tag = "知情同意",
|
||||
security(("bearer_auth" = [])),
|
||||
)]
|
||||
pub async fn grant_consent<S>(
|
||||
State(state): State<HealthState>,
|
||||
Extension(ctx): Extension<TenantContext>,
|
||||
@@ -50,6 +64,13 @@ where
|
||||
Ok(Json(ApiResponse::ok(result)))
|
||||
}
|
||||
|
||||
#[utoipa::path(
|
||||
put,
|
||||
path = "/health/consents/{consent_id}/revoke",
|
||||
responses((status = 200, description = "撤销成功")),
|
||||
tag = "知情同意",
|
||||
security(("bearer_auth" = [])),
|
||||
)]
|
||||
pub async fn revoke_consent<S>(
|
||||
State(state): State<HealthState>,
|
||||
Extension(ctx): Extension<TenantContext>,
|
||||
|
||||
@@ -27,6 +27,16 @@ pub struct DeviceListQuery {
|
||||
}
|
||||
|
||||
/// GET /api/v1/health/devices — 设备绑定列表
|
||||
#[utoipa::path(
|
||||
get,
|
||||
path = "/health/devices",
|
||||
params(DeviceListQuery),
|
||||
responses(
|
||||
(status = 200, description = "设备列表"),
|
||||
),
|
||||
tag = "设备管理",
|
||||
security(("bearer_auth" = [])),
|
||||
)]
|
||||
pub async fn list_devices<S>(
|
||||
State(state): State<HealthState>,
|
||||
Extension(ctx): Extension<TenantContext>,
|
||||
@@ -60,6 +70,16 @@ where
|
||||
}
|
||||
|
||||
/// DELETE /api/v1/health/devices/{id} — 解绑设备(软删除)
|
||||
#[utoipa::path(
|
||||
delete,
|
||||
path = "/health/devices/{id}",
|
||||
responses(
|
||||
(status = 200, description = "解绑成功"),
|
||||
(status = 404, description = "设备不存在"),
|
||||
),
|
||||
tag = "设备管理",
|
||||
security(("bearer_auth" = [])),
|
||||
)]
|
||||
pub async fn unbind_device<S>(
|
||||
State(state): State<HealthState>,
|
||||
Extension(ctx): Extension<TenantContext>,
|
||||
|
||||
Reference in New Issue
Block a user