diff --git a/Cargo.lock b/Cargo.lock
index fc9db08..e0fee13 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -292,6 +292,7 @@ dependencies = [
"chrono",
"r2d2",
"r2d2_sqlite",
+ "rand",
"rusqlite",
"serde",
"tera",
diff --git a/Cargo.toml b/Cargo.toml
index a4d6dce..5a92953 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -14,6 +14,7 @@ axum-extra = { version = "0.10.0", features = ["cookie"] }
chrono = { version = "0.4.39", features = ["serde"] }
r2d2 = "0.8.10"
r2d2_sqlite = "0.25.0"
+rand = "0.8.5"
# this dependency is needed soly because the r2d2_sqlite crate doesn't export
# the 'chrono' feature flag
rusqlite = { version = "0.32.1", features = ["chrono", "bundled"] }
diff --git a/src/db/comment.rs b/src/db/comment.rs
index f865584..1530922 100644
--- a/src/db/comment.rs
+++ b/src/db/comment.rs
@@ -5,14 +5,14 @@ use super::{DbError, DbPool};
#[derive(Serialize, Deserialize)]
pub struct Comment {
- id: i32,
- plant_id: i32,
+ id: i64,
+ plant_id: i64,
comment: String,
}
#[derive(Deserialize)]
pub struct NewComment {
- plant_id: i32,
+ plant_id: i64,
comment: String,
}
diff --git a/src/db/event.rs b/src/db/event.rs
index 59148ec..2c9128a 100644
--- a/src/db/event.rs
+++ b/src/db/event.rs
@@ -64,8 +64,8 @@ impl FromSql for EventType {
#[derive(Serialize)]
pub struct Event {
- id: i32,
- plant_id: i32,
+ id: i64,
+ plant_id: i64,
event_type: EventType,
date: NaiveDate,
description: String,
@@ -85,7 +85,7 @@ impl Event {
#[derive(Deserialize)]
pub struct NewEvent {
- plant_id: i32,
+ plant_id: i64,
event_type: EventType,
date: NaiveDate,
description: String,
diff --git a/src/db/plant.rs b/src/db/plant.rs
index faeae78..3b55c1d 100644
--- a/src/db/plant.rs
+++ b/src/db/plant.rs
@@ -5,7 +5,7 @@ use super::{Comment, DbError, DbPool, Event};
#[derive(Serialize)]
pub struct Plant {
- id: i32,
+ id: i64,
name: String,
species: String,
description: String,
@@ -37,7 +37,7 @@ impl Plant {
Ok(plants?)
}
- pub fn by_id(pool: &DbPool, id: i32) -> Result