aboutsummaryrefslogtreecommitdiff
path: root/src/db
diff options
context:
space:
mode:
Diffstat (limited to 'src/db')
-rw-r--r--src/db/categories.rs10
-rw-r--r--src/db/incomes.rs26
-rw-r--r--src/db/jobs.rs4
-rw-r--r--src/db/payments.rs26
-rw-r--r--src/db/users.rs12
5 files changed, 39 insertions, 39 deletions
diff --git a/src/db/categories.rs b/src/db/categories.rs
index 0e2a28c..fafe459 100644
--- a/src/db/categories.rs
+++ b/src/db/categories.rs
@@ -23,7 +23,7 @@ ORDER BY
match res {
Ok(categories) => categories,
Err(err) => {
- error!("Error listing categories: {:?}", err);
+ log::error!("Error listing categories: {:?}", err);
vec![]
}
}
@@ -50,7 +50,7 @@ WHERE
match res {
Ok(p) => Some(p),
Err(err) => {
- error!("Error looking for category {}: {:?}", id, err);
+ log::error!("Error looking for category {}: {:?}", id, err);
None
}
}
@@ -73,7 +73,7 @@ VALUES
match res {
Ok(x) => Some(x.last_insert_rowid()),
Err(err) => {
- error!("Error creating category: {:?}", err);
+ log::error!("Error creating category: {:?}", err);
None
}
}
@@ -101,7 +101,7 @@ WHERE
match res {
Ok(_) => true,
Err(err) => {
- error!("Error updating category {}: {:?}", id, err);
+ log::error!("Error updating category {}: {:?}", id, err);
false
}
}
@@ -125,7 +125,7 @@ WHERE
match res {
Ok(_) => true,
Err(err) => {
- error!("Error deleting category {}: {:?}", id, err);
+ log::error!("Error deleting category {}: {:?}", id, err);
false
}
}
diff --git a/src/db/incomes.rs b/src/db/incomes.rs
index e5c3164..97cb2b7 100644
--- a/src/db/incomes.rs
+++ b/src/db/incomes.rs
@@ -26,7 +26,7 @@ WHERE
match res {
Ok(count) => count,
Err(err) => {
- error!("Error counting incomes: {:?}", err);
+ log::error!("Error counting incomes: {:?}", err);
0
}
}
@@ -62,7 +62,7 @@ OFFSET ?
match res {
Ok(incomes) => incomes,
Err(err) => {
- error!("Error listing incomes: {:?}", err);
+ log::error!("Error listing incomes: {:?}", err);
vec![]
}
}
@@ -73,7 +73,7 @@ pub async fn get_row(pool: &SqlitePool, id: i64) -> i64 {
SELECT
row
FROM (
- SELECT
+ SELECT
ROW_NUMBER () OVER (ORDER BY date DESC) AS row,
id
FROM
@@ -94,7 +94,7 @@ WHERE
match res {
Ok(count) => count,
Err(err) => {
- error!("Error getting income row: {:?}", err);
+ log::error!("Error getting income row: {:?}", err);
1
}
}
@@ -123,7 +123,7 @@ WHERE
match res {
Ok(p) => Some(p),
Err(err) => {
- error!("Error looking for income {}: {:?}", id, err);
+ log::error!("Error looking for income {}: {:?}", id, err);
None
}
}
@@ -147,7 +147,7 @@ VALUES
match res {
Ok(x) => Some(x.last_insert_rowid()),
Err(err) => {
- error!("Error creating income: {:?}", err);
+ log::error!("Error creating income: {:?}", err);
None
}
}
@@ -180,7 +180,7 @@ WHERE
Ok(ids) => ids,
Err(Error::RowNotFound) => vec![],
Err(err) => {
- error!("Error looking if income is defined: {:?}", err);
+ log::error!("Error looking if income is defined: {:?}", err);
vec![]
}
}
@@ -210,7 +210,7 @@ WHERE
match res {
Ok(_) => true,
Err(err) => {
- error!("Error updating income {}: {:?}", id, err);
+ log::error!("Error updating income {}: {:?}", id, err);
false
}
}
@@ -234,7 +234,7 @@ WHERE
match res {
Ok(_) => true,
Err(err) => {
- error!("Error deleting income {}: {:?}", id, err);
+ log::error!("Error deleting income {}: {:?}", id, err);
false
}
}
@@ -272,7 +272,7 @@ ON
match res {
Ok(d) => d,
Err(err) => {
- error!("Error looking for incomes defined for all: {:?}", err);
+ log::error!("Error looking for incomes defined for all: {:?}", err);
None
}
}
@@ -290,7 +290,7 @@ pub async fn cumulative(
match res {
Ok(incomes) => HashMap::from_iter(incomes),
Err(err) => {
- error!("Error computing cumulative income: {:?}", err);
+ log::error!("Error computing cumulative income: {:?}", err);
HashMap::new()
}
}
@@ -435,7 +435,7 @@ FROM
match res {
Ok(xs) => xs,
Err(err) => {
- error!("Error listing incomes for statistics: {:?}", err);
+ log::error!("Error listing incomes for statistics: {:?}", err);
vec![]
}
}
@@ -486,7 +486,7 @@ ORDER BY
match res {
Ok(payments) => payments,
Err(err) => {
- error!("Error listing payments for report: {:?}", err);
+ log::error!("Error listing payments for report: {:?}", err);
vec![]
}
}
diff --git a/src/db/jobs.rs b/src/db/jobs.rs
index 3f84fc8..a80ef68 100644
--- a/src/db/jobs.rs
+++ b/src/db/jobs.rs
@@ -28,7 +28,7 @@ WHERE
Ok(_) => true,
Err(Error::RowNotFound) => false,
Err(err) => {
- error!("Error looking if job should run: {:?}", err);
+ log::error!("Error looking if job should run: {:?}", err);
false
}
}
@@ -48,6 +48,6 @@ WHERE
match res {
Ok(_) => (),
- Err(err) => error!("Error actualizing job last execution: {:?}", err),
+ Err(err) => log::error!("Error actualizing job last execution: {:?}", err),
}
}
diff --git a/src/db/payments.rs b/src/db/payments.rs
index bebc69d..b415a28 100644
--- a/src/db/payments.rs
+++ b/src/db/payments.rs
@@ -82,7 +82,7 @@ WHERE
match res {
Ok(count) => count,
Err(err) => {
- error!("Error counting payments: {:?}", err);
+ log::error!("Error counting payments: {:?}", err);
Count {
count: 0,
total_cost: 0,
@@ -169,7 +169,7 @@ OFFSET ?
match res {
Ok(payments) => payments,
Err(err) => {
- error!("Error listing payments: {:?}", err);
+ log::error!("Error listing payments: {:?}", err);
vec![]
}
}
@@ -308,7 +308,7 @@ GROUP BY
match result {
Ok(payments) => payments,
Err(err) => {
- error!("Error listing payments for statistics: {:?}", err);
+ log::error!("Error listing payments for statistics: {:?}", err);
vec![]
}
}
@@ -342,7 +342,7 @@ WHERE
match res {
Ok(count) => count,
Err(err) => {
- error!("Error getting payment row: {:?}", err);
+ log::error!("Error getting payment row: {:?}", err);
1
}
}
@@ -373,7 +373,7 @@ WHERE
match res {
Ok(p) => Some(p),
Err(err) => {
- error!("Error looking for payment {}: {:?}", id, err);
+ log::error!("Error looking for payment {}: {:?}", id, err);
None
}
}
@@ -400,7 +400,7 @@ VALUES
match res {
Ok(x) => Some(x.last_insert_rowid()),
Err(err) => {
- error!("Error creating payment: {:?}", err);
+ log::error!("Error creating payment: {:?}", err);
None
}
}
@@ -434,7 +434,7 @@ WHERE
match res {
Ok(_) => true,
Err(err) => {
- error!("Error updating payment {}: {:?}", id, err);
+ log::error!("Error updating payment {}: {:?}", id, err);
false
}
}
@@ -458,7 +458,7 @@ WHERE
match res {
Ok(_) => true,
Err(err) => {
- error!("Error deleting payment {}: {:?}", id, err);
+ log::error!("Error deleting payment {}: {:?}", id, err);
false
}
}
@@ -493,7 +493,7 @@ ORDER BY
Ok(category) => Some(category),
Err(Error::RowNotFound) => None,
Err(err) => {
- error!(
+ log::error!(
"Error looking for the category of {}: {:?}",
payment_name, err
);
@@ -521,7 +521,7 @@ LIMIT
Ok(_) => true,
Err(Error::RowNotFound) => false,
Err(err) => {
- error!(
+ log::error!(
"Error looking if category {} is used: {:?}",
category_id, err
);
@@ -560,7 +560,7 @@ ON
match res {
Ok(costs) => HashMap::from_iter(costs),
Err(err) => {
- error!("Error getting payments repartition: {:?}", err);
+ log::error!("Error getting payments repartition: {:?}", err);
HashMap::new()
}
}
@@ -588,7 +588,7 @@ WHERE
match res {
Ok(_) => (),
- Err(err) => error!("Error creating monthly payments: {:?}", err),
+ Err(err) => log::error!("Error creating monthly payments: {:?}", err),
}
}
@@ -640,7 +640,7 @@ ORDER BY
match res {
Ok(payments) => payments,
Err(err) => {
- error!("Error listing payments for report: {:?}", err);
+ log::error!("Error listing payments for report: {:?}", err);
vec![]
}
}
diff --git a/src/db/users.rs b/src/db/users.rs
index 82326a9..f463421 100644
--- a/src/db/users.rs
+++ b/src/db/users.rs
@@ -23,7 +23,7 @@ ORDER BY
match res {
Ok(users) => users,
Err(err) => {
- error!("Error listing users: {:?}", err);
+ log::error!("Error listing users: {:?}", err);
vec![]
}
}
@@ -53,7 +53,7 @@ WHERE
match res {
Ok(_) => true,
Err(err) => {
- error!("Error updating login token: {:?}", err);
+ log::error!("Error updating login token: {:?}", err);
false
}
}
@@ -78,7 +78,7 @@ WHERE
match res {
Ok(_) => true,
Err(err) => {
- error!("Error removing login token: {:?}", err);
+ log::error!("Error removing login token: {:?}", err);
false
}
}
@@ -91,7 +91,7 @@ pub async fn get_by_login_token(
let res = sqlx::query_as::<_, User>(
r#"
SELECT
- id,
+ id,
name,
email
FROM
@@ -108,7 +108,7 @@ WHERE
Ok(user) => Some(user),
Err(Error::RowNotFound) => None,
Err(err) => {
- error!("Error getting user from login token: {:?}", err);
+ log::error!("Error getting user from login token: {:?}", err);
None
}
}
@@ -137,7 +137,7 @@ WHERE
Ok(hash) => Some(hash),
Err(Error::RowNotFound) => None,
Err(err) => {
- error!("Error getting password hash: {:?}", err);
+ log::error!("Error getting password hash: {:?}", err);
None
}
}