add backend for history

This commit is contained in:
2024-12-30 20:13:03 -05:00
parent c7ca250b66
commit aa1763cbe7
11 changed files with 319 additions and 28 deletions

View File

@@ -9,14 +9,20 @@ pub enum WebsocketResponseError {}
#[derive(Error, Debug)]
pub enum HttpServerResultError {
#[error("Telemetry Not Found: {tlm}")]
TlmNotFound { tlm: String },
#[error("Telemetry Name Not Found: {tlm}")]
TlmNameNotFound { tlm: String },
#[error("Telemetry Uuid Not Found: {uuid}")]
TlmUuidNotFound { uuid: String },
#[error("DateTime Parsing Error: {date_time}")]
InvalidDateTime { date_time: String },
}
impl ResponseError for HttpServerResultError {
fn status_code(&self) -> StatusCode {
match *self {
HttpServerResultError::TlmNotFound { .. } => StatusCode::NOT_FOUND,
HttpServerResultError::TlmNameNotFound { .. } => StatusCode::NOT_FOUND,
HttpServerResultError::TlmUuidNotFound { .. } => StatusCode::NOT_FOUND,
HttpServerResultError::InvalidDateTime { .. } => StatusCode::BAD_REQUEST,
}
}
fn error_response(&self) -> HttpResponse {