summaryrefslogtreecommitdiff
path: root/dichroism/src/product_repo.rs
diff options
context:
space:
mode:
authorAdam T. Carpenter <atc@53hor.net>2020-10-22 17:44:38 -0400
committerAdam T. Carpenter <atc@53hor.net>2020-10-22 17:44:38 -0400
commit99dabd3f2f81ffcf0b6f2b59e13ebb4502b2ccac (patch)
tree15e19324332173405fc7544af2c17195d7b05ff1 /dichroism/src/product_repo.rs
parent76a782599b4ecc4ecb9b0ce7acc6420ed9e1ec8e (diff)
downloadtheglassyladies-99dabd3f2f81ffcf0b6f2b59e13ebb4502b2ccac.tar.xz
theglassyladies-99dabd3f2f81ffcf0b6f2b59e13ebb4502b2ccac.zip
Added product migration, better organization of DTOs, Entities, and
Domain Models. Also made config loading/photo generation easier.
Diffstat (limited to 'dichroism/src/product_repo.rs')
-rw-r--r--dichroism/src/product_repo.rs19
1 files changed, 5 insertions, 14 deletions
diff --git a/dichroism/src/product_repo.rs b/dichroism/src/product_repo.rs
index 852b930..93176b2 100644
--- a/dichroism/src/product_repo.rs
+++ b/dichroism/src/product_repo.rs
@@ -1,21 +1,12 @@
-use super::models::Product;
+use crate::entities;
+use crate::models;
use diesel::prelude::*;
use diesel::result::Error;
type DBConn = SqliteConnection;
-pub fn create_product(conn: &DBConn) -> Result<Product, Error> {
- todo!()
-}
-
-pub fn read_products(_conn: &DBConn) -> Result<Vec<Product>, Error> {
- todo!()
-}
-
-pub fn update_product(conn: &DBConn) -> Result<Product, Error> {
- todo!()
-}
-
-pub fn delete_product(conn: &DBConn) -> Result<(), Error> {
+pub fn read_products(conn: &DBConn) -> Result<Vec<models::Product>, Error> {
+ use crate::schema::products::dsl::*;
+ let results = products.load::<entities::Product>(conn)?;
todo!()
}