use axum::{ extract::{Json, State}, response::{self, IntoResponse}, }; use crate::{app::App, boot::Snapshot, error::Internal, token::extract::Identity, user::User}; pub async fn handler(State(app): State, identity: Identity) -> Result { let snapshot = app.boot().snapshot().await?; Ok(Response { user: identity.user, snapshot, }) } #[derive(serde::Serialize)] pub struct Response { pub user: User, #[serde(flatten)] pub snapshot: Snapshot, } impl IntoResponse for Response { fn into_response(self) -> response::Response { Json(self).into_response() } }