MCPcopy Create free account
hub / github.com/chirpstack/chirpstack / update

Function update

chirpstack/src/storage/user.rs:126–144  ·  view source on GitHub ↗
(u: User)

Source from the content-addressed store, hash-verified

124}
125
126pub async fn update(u: User) -> Result<User, Error> {
127 u.validate()?;
128
129 let u: User = diesel::update(user::dsl::user.find(&u.id))
130 .set((
131 user::updated_at.eq(Utc::now()),
132 user::is_admin.eq(&u.is_admin),
133 user::is_active.eq(&u.is_active),
134 user::email.eq(&u.email),
135 user::email_verified.eq(&u.email_verified),
136 user::note.eq(&u.note),
137 user::external_id.eq(&u.external_id),
138 ))
139 .get_result(&mut get_async_db_conn().await?)
140 .await
141 .map_err(|e| Error::from_diesel(e, u.id.to_string()))?;
142 info!(user_id = %u.id, "User updated");
143 Ok(u)
144}
145
146pub async fn set_password_hash(id: &Uuid, hash: &str) -> Result<User, Error> {
147 let u: User = diesel::update(user::dsl::user.find(&fields::Uuid::from(id)))

Callers 15

update_itemFunction · 0.70
update_deploymentFunction · 0.70
update_deviceFunction · 0.70
set_device_timeout_errorFunction · 0.70
set_device_completedFunction · 0.70
create_jobFunction · 0.70
update_jobFunction · 0.70
set_password_hashFunction · 0.70
set_password_by_emailFunction · 0.70
test_userFunction · 0.70
run_scheduler_testFunction · 0.50
test_lorawan_10_rx_delayFunction · 0.50

Calls 4

setMethod · 0.80
to_stringMethod · 0.80
get_async_db_connFunction · 0.70
validateMethod · 0.45

Tested by 3

test_userFunction · 0.56
run_scheduler_testFunction · 0.40
test_lorawan_10_rx_delayFunction · 0.40