normogen/backend/src/handlers/mod.rs
goose 09589b3bb2 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.
2026-07-04 08:41:48 -03:00

33 lines
1.2 KiB
Rust

pub mod appointments;
pub mod auth;
pub mod health;
pub mod health_stats;
pub mod interactions;
pub mod medications;
pub mod permissions;
pub mod profile;
pub mod sessions;
pub mod shares;
pub mod users;
// Re-export commonly used handler functions
pub use appointments::{
create_appointment, delete_appointment, get_appointment, list_appointments, update_appointment,
};
pub use auth::{login, logout, recover_password, recovery_info, refresh, register};
pub use health::{health_check, ready_check};
pub use health_stats::{
create_health_stat, delete_health_stat, get_health_stat, list_health_stats, update_health_stat,
};
pub use interactions::{check_interactions, check_new_medication};
pub use medications::{
create_medication, delete_medication, get_adherence, get_medication, list_medications,
log_dose, update_medication,
};
pub use permissions::check_permission;
pub use profile::{get_my_profile, update_my_profile};
pub use sessions::{get_sessions, revoke_all_sessions, revoke_session};
pub use shares::{create_share, delete_share, list_shares, update_share};
pub use users::{
change_password, delete_account, get_profile, get_settings, update_profile, update_settings,
};