aboutsummaryrefslogtreecommitdiff
path: root/src/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/db')
-rw-r--r--src/db/incomes.rs9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/db/incomes.rs b/src/db/incomes.rs
index f2eaf1c..2952d62 100644
--- a/src/db/incomes.rs
+++ b/src/db/incomes.rs
@@ -139,7 +139,7 @@ VALUES
"#,
)
.bind(i.user_id)
- .bind(NaiveDate::from_ymd_opt(i.year, i.month, 1)?)
+ .bind(i.date)
.bind(i.amount)
.execute(pool)
.await;
@@ -156,8 +156,7 @@ VALUES
pub async fn defined_at(
pool: &SqlitePool,
user_id: i64,
- month: u32,
- year: i32,
+ date: NaiveDate,
) -> Vec<i64> {
let query = r#"
SELECT
@@ -172,7 +171,7 @@ WHERE
let res = sqlx::query(&query)
.bind(user_id)
- .bind(NaiveDate::from_ymd(year, month, 1))
+ .bind(date)
.map(|row: SqliteRow| row.get("id"))
.fetch_all(pool)
.await;
@@ -202,7 +201,7 @@ WHERE
"#,
)
.bind(i.user_id)
- .bind(NaiveDate::from_ymd(i.year, i.month, 1))
+ .bind(i.date)
.bind(i.amount)
.bind(id)
.execute(pool)