diff options
Diffstat (limited to 'src/models/model.rs')
| -rw-r--r-- | src/models/model.rs | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/models/model.rs b/src/models/model.rs index 03f872e..469356f 100644 --- a/src/models/model.rs +++ b/src/models/model.rs @@ -1,4 +1,4 @@ -use crate::{config::CONFIG, db::get_client, errors::AppError}; +use crate::{config::CONFIG, db::get_client, errors::AppError, json::number_from_string}; use serde_json::json; use sqlx::types::JsonValue; use sqlx::Row; @@ -29,8 +29,11 @@ pub struct Model { pub struct ModelCreate { pub name: String, pub description: Option<String>, + #[serde(deserialize_with = "number_from_string")] pub duration: f64, + #[serde(deserialize_with = "number_from_string")] pub height: f64, + #[serde(deserialize_with = "number_from_string")] pub weight: f64, pub printer: Option<String>, pub material: Option<String>, |
