feat(backend): dose scheduling + health stats zero-knowledge
Backend changes (frontend + tests follow in next commit): Dose scheduling: - New DoseSchedule struct (times_per_day + days_of_week) as a top-level plaintext field on Medication. Create/update requests accept it. - Revised get_adherence: computes scheduled_doses from the schedule over the period (days_of_week filtering), so missed doses are now reflected. Falls back to taken/total_logged when no schedule. Health stats zero-knowledge: - HealthStatistic model now uses opaque encrypted_data blob (like medications). Only recorded_at stays plaintext (filterable/sortable). - HealthStatResponse wire type. Handlers echo opaque blobs. - Removed the trends endpoint (server can't compute trends on ciphertext; frontend computes them client-side after decrypting). - Deleted the dead HealthData model (kept EncryptedField which it defined). Verified: backend 24 tests, 0 clippy warnings.
This commit is contained in:
parent
69faa43a72
commit
09589b3bb2
8 changed files with 270 additions and 200 deletions
|
|
@ -72,7 +72,6 @@ pub fn build_app(state: AppState) -> Router {
|
|||
// Health statistics management (Phase 2.7)
|
||||
.route("/api/health-stats", post(handlers::create_health_stat))
|
||||
.route("/api/health-stats", get(handlers::list_health_stats))
|
||||
.route("/api/health-stats/trends", get(handlers::get_health_trends))
|
||||
.route("/api/health-stats/:id", get(handlers::get_health_stat))
|
||||
.route("/api/health-stats/:id", put(handlers::update_health_stat))
|
||||
.route("/api/health-stats/:id", delete(handlers::delete_health_stat))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue