diff options
Diffstat (limited to 'src/db')
| -rw-r--r-- | src/db/mod.rs | 6 | ||||
| -rw-r--r-- | src/db/product.rs | 2 | ||||
| -rw-r--r-- | src/db/story.rs | 14 |
3 files changed, 11 insertions, 11 deletions
diff --git a/src/db/mod.rs b/src/db/mod.rs index 51665a3..f1baf44 100644 --- a/src/db/mod.rs +++ b/src/db/mod.rs @@ -19,9 +19,9 @@ pub trait ProductDatabaseHandler { async fn post( &self, pool: &SqlitePool, - name: String, - description: String, - tags: Vec<String>, + name: &str, + description: &str, + tags: Vec<&str>, ) -> Result<Self, AppError> where Self: Sized; diff --git a/src/db/product.rs b/src/db/product.rs index c21734e..1c8be1f 100644 --- a/src/db/product.rs +++ b/src/db/product.rs @@ -18,7 +18,7 @@ pub struct Product { } impl Product { - pub async fn post(tx: &mut Transaction<'static, Sqlite>, name: String, description: String, tags: Vec<String>) -> Result<Product, AppError> { + pub async fn post(tx: &mut Transaction<'static, Sqlite>, name: &str, description: &str, tags: Vec<&str>) -> Result<Product, AppError> { let now = SystemTime::now().duration_since(std::time::UNIX_EPOCH)?.as_millis() as i64; let product = sqlx::query_as!( Product, diff --git a/src/db/story.rs b/src/db/story.rs index 9e5fdb9..5803351 100644 --- a/src/db/story.rs +++ b/src/db/story.rs @@ -76,9 +76,9 @@ impl ProductDatabaseHandler for Story { async fn post( &self, pool: &SqlitePool, - name: String, - description: String, - tags: Vec<String>, + name: &str, + description: &str, + tags: Vec<&str>, ) -> Result<Self, AppError> where Self: Sized, @@ -114,13 +114,13 @@ impl ProductDatabaseHandler for Story { } } -impl PageBuilder for Story { - fn page_title() -> String { - "Stories".to_string() +impl<'a> PageBuilder<'a> for Story { + fn page_title() -> &'a str { + "Stories" } // TODO: Add pdf and epub icons - fn product_specific_card_content<T: PageBuilder + ProductMarker>( + fn product_specific_card_content<T: PageBuilder<'a> + ProductMarker>( &self, specific_product: &super::product::SpecificProduct<T>, ) -> maud::Markup { |
