From 7381a7033231e6454a37fd64b1f3de4e8d59355f Mon Sep 17 00:00:00 2001 From: "Adam T. Carpenter" Date: Wed, 11 Nov 2020 20:07:12 -0500 Subject: Kind of flailing with the UI; lots of API bugfixes though. --- dichroism/src/repo/entities/product.rs | 4 ++-- dichroism/src/repo/entities/product_form.rs | 6 ++++-- 2 files changed, 6 insertions(+), 4 deletions(-) (limited to 'dichroism/src/repo/entities') diff --git a/dichroism/src/repo/entities/product.rs b/dichroism/src/repo/entities/product.rs index 81f3d9e..c89495a 100644 --- a/dichroism/src/repo/entities/product.rs +++ b/dichroism/src/repo/entities/product.rs @@ -9,12 +9,12 @@ pub struct Product { pub quantity: i32, pub cents: i32, pub featured: i32, + pub category: String, pub photo_set_id: i32, pub original: String, pub fullsize: String, pub base: String, pub thumbnail: String, - pub category: String, } impl Into for Product { @@ -25,7 +25,7 @@ impl Into for Product { description: self.description, quantity: self.quantity, cents: self.cents, - featured: self.featured != 0, // TODO: is this safe? + featured: self.featured != 0, category: self.category, photo_set: models::PhotoSet { id: Some(self.photo_set_id), diff --git a/dichroism/src/repo/entities/product_form.rs b/dichroism/src/repo/entities/product_form.rs index 0d6e452..b3447eb 100644 --- a/dichroism/src/repo/entities/product_form.rs +++ b/dichroism/src/repo/entities/product_form.rs @@ -1,7 +1,7 @@ use crate::models::*; use crate::schema::products; -#[derive(Insertable, AsChangeset)] +#[derive(Debug, Insertable, AsChangeset)] #[table_name = "products"] pub struct ProductForm { pub id: i32, @@ -11,6 +11,7 @@ pub struct ProductForm { pub cents: i32, pub featured: i32, pub photo_set: i32, + pub category: String, } impl From for ProductForm { @@ -22,7 +23,8 @@ impl From for ProductForm { quantity: p.quantity, cents: p.cents, featured: p.featured as i32, - photo_set: p.photo_set.id.unwrap_or(-1), // TODO: ? + photo_set: p.photo_set.id.unwrap_or(-1), + category: p.category, } } } -- cgit v1.2.3