Updated dependencies and adjusted code to update.

This commit is contained in:
matthias committed 2026-06-06 19:42:56 +02:00
1 parent f136d09f84
commit f2556d0095
9 files changed
+3123 -3023

No files matched your search

+7 -7
View File
@@ -2,7 +2,7 @@ use serde::{Deserialize, Serialize};
use sqlx::{FromRow, PgPool};
use crate::models::origin::Origin;
use crate::models::variant::{load_article_variants, Variant};
use sqlx::{Arguments, Pool, Row, Postgres, Error};
use sqlx::{Arguments, Pool, Row, Postgres, Error, AssertSqlSafe};
use sqlx::postgres::{PgArguments, PgQueryResult, PgRow};
use log::{debug, error, info};
use crate::models::unit::Unit;
@@ -83,7 +83,7 @@ pub async fn load_articles(pool: PgPool) -> Option<Vec<Article>> {
);
let res = sqlx::query(
statement.as_str())
AssertSqlSafe(statement.as_str()))
.fetch_all(&pool).await;
let mut articles: Vec<Article> = Vec::new();
@@ -115,7 +115,7 @@ pub async fn load_article(id: i64, pool: PgPool) -> Option<Article> {
args.add(id);
let res = sqlx::query_with(
statement.as_str(), args)
AssertSqlSafe(statement.as_str()), args)
.fetch_one(&pool).await;
match res {
@@ -152,7 +152,7 @@ pub async fn insert_article(article: &Article, pool: PgPool) -> Option<Article>
);
let res = sqlx::query_with(
statement.as_str(),
AssertSqlSafe(statement.as_str()),
args)
.fetch_one(&pool).await;
@@ -193,7 +193,7 @@ pub async fn update_article(article_id: i64, article: &Article, pool: PgPool) ->
);
let res = sqlx::query_with(
statement.as_str(),
AssertSqlSafe(statement.as_str()),
args)
.fetch_one(&pool).await;
@@ -213,10 +213,10 @@ pub async fn update_article(article_id: i64, article: &Article, pool: PgPool) ->
pub async fn delete_article(article_id: i64, pool: PgPool) -> Option<()> {
let result = sqlx::query(
format!("DELETE FROM {} WHERE id = {}",
AssertSqlSafe(format!("DELETE FROM {} WHERE id = {}",
"article",
article_id
).as_str()
).as_str())
).execute(&pool).await;
match result {