diff --git a/fpx-workers/src/data.rs b/fpx-workers/src/data.rs index 63597bc06..24d007c95 100644 --- a/fpx-workers/src/data.rs +++ b/fpx-workers/src/data.rs @@ -307,7 +307,7 @@ impl Store for D1Store { async fn routes_get(&self, _tx: &Transaction) -> Result> { SendFuture::new(async { - let routes = self.fetch_all(&self.sql_builder.routes_get()).await?; + let routes = self.fetch_all(&self.sql_builder.routes_get(), &[]).await?; Ok(routes) }) @@ -326,9 +326,9 @@ impl Store for D1Store { route.handler_type.into(), route.currently_registered.into(), route.registration_order.into(), - route.route_origin.into(), + route.route_origin.to_string().into(), route.openapi_spec.into(), - route.request_type.into(), + route.request_type.to_string().into(), ], ) .await diff --git a/fpx/src/data/models.rs b/fpx/src/data/models.rs index 3af3f6373..d2054fa4f 100644 --- a/fpx/src/data/models.rs +++ b/fpx/src/data/models.rs @@ -8,6 +8,7 @@ use serde::{Deserialize, Deserializer, Serialize}; use std::fmt::Formatter; use std::ops::Deref; use std::str::FromStr; +use wasm_bindgen::JsValue; /// A computed value based on the span objects that are present. #[derive(Clone, Debug, Deserialize)] @@ -102,6 +103,12 @@ pub enum RouteOrigin { OpenApi, } +impl ToString for RouteOrigin { + fn to_string(&self) -> String { + serde_json::to_string(&self).expect("serialization to always work") + } +} + impl IntoValue for RouteOrigin { fn into_value(self) -> libsql::Result { let serialized = serde_json::to_string(&self).map_err(|_| libsql::Error::NullValue)?; @@ -116,6 +123,12 @@ pub enum RequestType { Websocket, } +impl ToString for RequestType { + fn to_string(&self) -> String { + serde_json::to_string(&self).expect("serialization to always work") + } +} + impl IntoValue for RequestType { fn into_value(self) -> libsql::Result { let serialized = serde_json::to_string(&self).map_err(|_| libsql::Error::NullValue)?;