function user: deactivate set_user_struct_json*
* need rework Signed-off-by: Ralf Zerres <ralf.zerres@networkx.de>
This commit is contained in:
@@ -125,30 +125,31 @@ impl User {
|
||||
.execute(connection)
|
||||
}
|
||||
|
||||
/// update multiple columns of a given user record with a json string
|
||||
pub fn set_user_struct_json(connection: &SqliteConnection) -> Result<(), Box<dyn Error>> {
|
||||
let json = r#"{ "first_name": "Daniela", "last_name": "Knocke", "alias_name": "Sekretariat", "email": "knocke@kanzlei.hiedemann.de", "email_confirmed": 1, "password_hash": "", "initials": "dkn" }"#;
|
||||
let user_struct = serde_json::from_str::<NewUser>(json)?;
|
||||
// /// update multiple columns of a given user record with a json string
|
||||
// pub fn set_user_struct_json(connection: &SqliteConnection) -> Result<(), Box<dyn Error>> {
|
||||
// let json = r#"{ "first_name": "Daniela", "last_name": "Knocke", "alias_name": "Sekretariat", "email": "knocke@kanzlei.hiedemann.de", "email_confirmed": 1, "password_hash": "", "initials": "dkn" }"#;
|
||||
// //let user_struct = serde_json::from_str::<NewUser>(json)?;
|
||||
// let user_struct = serde_json::from_str::<'_>(json)?;
|
||||
|
||||
diesel::insert_into(users)
|
||||
.values(&user_struct)
|
||||
.execute(connection)?;
|
||||
// diesel::insert_into(users)
|
||||
// .values(&user_struct)
|
||||
// .execute(connection)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
// Ok(())
|
||||
// }
|
||||
|
||||
pub fn set_user_struct_json_option(
|
||||
connection: &SqliteConnection,
|
||||
) -> Result<(), Box<dyn Error>> {
|
||||
let json = r#"{ "first_name": null, "last_name": "Knocke", "alias_name": null, "email": "knocke@kanzlei.hiedemann.de", "email_confirmed": 1, "password_hash": "", "initials": "dkn", "id_changed": 1 }"#;
|
||||
let user_form = serde_json::from_str::<NewUser>(json)?;
|
||||
// pub fn set_user_struct_json_option(
|
||||
// connection: &SqliteConnection,
|
||||
// ) -> Result<(), Box<dyn Error>> {
|
||||
// let json = r#"{ "first_name": null, "last_name": "Knocke", "alias_name": null, "email": "knocke@kanzlei.hiedemann.de", "email_confirmed": 1, "password_hash": "", "initials": "dkn", "id_changed": 1 }"#;
|
||||
// let user_form = serde_json::from_str::<'_>(json)?;
|
||||
|
||||
diesel::insert_into(users)
|
||||
.values(&user_form)
|
||||
.execute(connection)?;
|
||||
// diesel::insert_into(users)
|
||||
// .values(&user_form)
|
||||
// .execute(connection)?;
|
||||
|
||||
Ok(())
|
||||
}
|
||||
// Ok(())
|
||||
//}
|
||||
}
|
||||
|
||||
impl<'a> RegisterUser<'a> {
|
||||
|
||||
Reference in New Issue
Block a user