Added topm id and row number and ui changes.

This commit is contained in:
matthias committed 2026-02-07 19:08:13 +01:00
1 parent 05b073812c
commit 088734f237
11 files changed
+176 -74

No files matched your search

+7 -2
View File
@@ -21,6 +21,7 @@ pub struct Article {
pub bio_origin: Option<String>,
pub allergens_text: Option<String>,
pub bio_info: Option<String>,
pub topm_id: Option<String>,
}
fn from_postgres_row_small(row: PgRow) -> Article {
@@ -37,6 +38,7 @@ fn from_postgres_row_small(row: PgRow) -> Article {
bio_origin: row.get(8),
allergens_text: row.get(9),
bio_info: row.get(10),
topm_id: row.get(11),
}
}
@@ -67,6 +69,7 @@ async fn from_postgres_row(row: PgRow, pool: PgPool) -> Article {
bio_origin: row.get(8),
allergens_text: row.get(9),
bio_info: row.get(10),
topm_id: row.get(11),
}
}
@@ -137,9 +140,10 @@ pub async fn insert_article(article: &Article, pool: PgPool) -> Option<Article>
args.add(&article.bio_origin);
args.add(&article.allergens_text);
args.add(&article.bio_info);
args.add(&article.topm_id);
let statement = format!(
"INSERT INTO {} (name, bio, origin, description, ingredients, default_unit_id, mhd, bio_origin, allergens_text, bio_info) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10) RETURNING *",
"INSERT INTO {} (name, bio, origin, description, ingredients, default_unit_id, mhd, bio_origin, allergens_text, bio_info, topm_id) VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9, $10, $11) RETURNING *",
"article",
);
@@ -176,9 +180,10 @@ pub async fn update_article(article_id: i64, article: &Article, pool: PgPool) ->
args.add(&article.bio_origin);
args.add(&article.allergens_text);
args.add(&article.bio_info);
args.add(&article.topm_id);
let statement = format!(
"UPDATE {} SET name = $2, bio = $3, origin = $4, description = $5, ingredients = $6, default_unit_id = $7, mhd = $8, bio_origin = $9, allergens_text = $10, bio_info = $11 WHERE id = $1 RETURNING *",
"UPDATE {} SET name = $2, bio = $3, origin = $4, description = $5, ingredients = $6, default_unit_id = $7, mhd = $8, bio_origin = $9, allergens_text = $10, bio_info = $11, topm_id = $12 WHERE id = $1 RETURNING *",
"article",
);