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

Function update_device

chirpstack/src/storage/fuota.rs:479–499  ·  view source on GitHub ↗
(d: FuotaDeploymentDevice)

Source from the content-addressed store, hash-verified

477}
478
479pub async fn update_device(d: FuotaDeploymentDevice) -> Result<FuotaDeploymentDevice, Error> {
480 let d: FuotaDeploymentDevice = diesel::update(
481 fuota_deployment_device::dsl::fuota_deployment_device
482 .find((&d.fuota_deployment_id, &d.dev_eui)),
483 )
484 .set((
485 fuota_deployment_device::completed_at.eq(&d.completed_at),
486 fuota_deployment_device::mc_group_setup_completed_at.eq(&d.mc_group_setup_completed_at),
487 fuota_deployment_device::mc_session_completed_at.eq(&d.mc_session_completed_at),
488 fuota_deployment_device::frag_session_setup_completed_at
489 .eq(&d.frag_session_setup_completed_at),
490 fuota_deployment_device::frag_status_completed_at.eq(&d.frag_status_completed_at),
491 fuota_deployment_device::error_msg.eq(&d.error_msg),
492 ))
493 .get_result(&mut get_async_db_conn().await?)
494 .await
495 .map_err(|e| Error::from_diesel(e, d.dev_eui.to_string()))?;
496
497 info!(fuota_deployment_id = %d.fuota_deployment_id, dev_eui = %d.dev_eui, "FUOTA deployment device updated");
498 Ok(d)
499}
500
501pub async fn remove_devices(fuota_deployment_id: Uuid, dev_euis: Vec<EUI64>) -> Result<(), Error> {
502 diesel::delete(

Calls 4

setMethod · 0.80
to_stringMethod · 0.80
updateFunction · 0.70
get_async_db_connFunction · 0.70

Tested by 1

test_fuota_devicesFunction · 0.68