Added additional values to settings.
This commit is contained in:
@@ -8,6 +8,8 @@ pub struct Settings {
|
||||
pub id: i64,
|
||||
pub mhd: String,
|
||||
pub bio: String,
|
||||
pub allergens_text: String,
|
||||
pub bio_info: String,
|
||||
}
|
||||
|
||||
fn from_postgres_row_small(row: PgRow) -> Settings {
|
||||
@@ -15,6 +17,8 @@ fn from_postgres_row_small(row: PgRow) -> Settings {
|
||||
id: row.get(0),
|
||||
mhd: row.get(1),
|
||||
bio: row.get(2),
|
||||
allergens_text: row.get(3),
|
||||
bio_info: row.get(4),
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,9 +48,11 @@ pub async fn update_settings(settings: &Settings, pool: PgPool) -> Option<Settin
|
||||
args.add(&settings.id);
|
||||
args.add(&settings.mhd);
|
||||
args.add(&settings.bio);
|
||||
args.add(&settings.allergens_text);
|
||||
args.add(&settings.bio_info);
|
||||
|
||||
let statement = format!(
|
||||
"UPDATE {} SET mhd = $2, bio = $3 WHERE id = $1 RETURNING *",
|
||||
"UPDATE {} SET mhd = $2, bio = $3, allergens_text = $4, bio_info = $5 WHERE id = $1 RETURNING *",
|
||||
"settings",
|
||||
);
|
||||
|
||||
|
||||
Reference in New Issue
Block a user