summaryrefslogtreecommitdiff
path: root/dichroism/src/product_repo.rs
diff options
context:
space:
mode:
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!()
}