get endpoint in progress

This commit is contained in:
2026-03-02 23:01:45 +01:00
parent 8ed9d872dc
commit d8416f3c99
3 changed files with 55 additions and 1 deletions

View File

@@ -0,0 +1,32 @@
use axum::{Json, http::StatusCode, response::IntoResponse};
use chrono::{DateTime, Local};
use utoipa::{IntoResponses, ToSchema};
#[derive(ToSchema)]
struct OkResponse {
name: String,
enabled: bool,
time: DateTime<Local>
}
#[derive(IntoResponses)]
enum Responses {
#[response(status = 200)]
Ok(#[to_schema] Vec<OkResponse>),
#[response(status = 500)]
DBError(String)
}
impl IntoResponse for Responses {
fn into_response(self) -> axum::response::Response {
match self {
Responses::Ok(body) => (StatusCode::OK, Json(body)).into_response(),
Responses::DBError(message) => (StatusCode::INTERNAL_SERVER_ERROR, Json(message)).into_response(),
}
}
}
pub fn get_handler() -> Responses {
todo!()
}