diff options
| -rw-r--r-- | migrations/20220906164354_add-models-table.sql | 6 | ||||
| -rw-r--r-- | src/models/model.rs | 24 |
2 files changed, 15 insertions, 15 deletions
diff --git a/migrations/20220906164354_add-models-table.sql b/migrations/20220906164354_add-models-table.sql index 84425ba..eadd247 100644 --- a/migrations/20220906164354_add-models-table.sql +++ b/migrations/20220906164354_add-models-table.sql @@ -2,9 +2,9 @@ CREATE TABLE models ( id SERIAL PRIMARY KEY, name VARCHAR NOT NULL, description TEXT, - duration INTEGER NOT NULL, - height INTEGER NOT NULL, - weight INTEGER NOT NULL, + duration FLOAT NOT NULL, + height FLOAT NOT NULL, + weight FLOAT NOT NULL, printer VARCHAR, material VARCHAR, author_id INTEGER REFERENCES users(id) NOT NULL, diff --git a/src/models/model.rs b/src/models/model.rs index 071f515..03f872e 100644 --- a/src/models/model.rs +++ b/src/models/model.rs @@ -14,9 +14,9 @@ pub struct Model { #[validate(length(min = 2, message = "Can not be empty"))] name: String, description: Option<String>, - duration: i32, - height: i32, - weight: i32, + duration: f64, + height: f64, + weight: f64, printer: Option<String>, material: Option<String>, author_id: i32, @@ -29,9 +29,9 @@ pub struct Model { pub struct ModelCreate { pub name: String, pub description: Option<String>, - pub duration: i32, - pub height: i32, - pub weight: i32, + pub duration: f64, + pub height: f64, + pub weight: f64, pub printer: Option<String>, pub material: Option<String>, } @@ -41,9 +41,9 @@ pub struct ModelUser { pub id: i32, name: String, description: Option<String>, - duration: i32, - height: i32, - weight: i32, + duration: f64, + height: f64, + weight: f64, printer: Option<String>, material: Option<String>, author_id: i32, @@ -66,9 +66,9 @@ impl Model { pub fn new( name: String, description: Option<String>, - duration: i32, - height: i32, - weight: i32, + duration: f64, + height: f64, + weight: f64, printer: Option<String>, material: Option<String>, author_id: i32, |
