(
fuota_deployment_id: Uuid,
mc_group_setup_completed: bool,
mc_session_completed: bool,
frag_session_setup_completed: bool,
frag_status_completed: bool,
)
| 577 | } |
| 578 | |
| 579 | pub async fn set_device_completed( |
| 580 | fuota_deployment_id: Uuid, |
| 581 | mc_group_setup_completed: bool, |
| 582 | mc_session_completed: bool, |
| 583 | frag_session_setup_completed: bool, |
| 584 | frag_status_completed: bool, |
| 585 | ) -> Result<()> { |
| 586 | let fuota_deployment_id = fields::Uuid::from(fuota_deployment_id); |
| 587 | |
| 588 | let mut q = diesel::update(fuota_deployment_device::table) |
| 589 | .set(fuota_deployment_device::dsl::completed_at.eq(Some(Utc::now()))) |
| 590 | .filter(fuota_deployment_device::dsl::fuota_deployment_id.eq(&fuota_deployment_id)) |
| 591 | .into_boxed(); |
| 592 | |
| 593 | if mc_group_setup_completed { |
| 594 | q = q.filter(fuota_deployment_device::dsl::mc_group_setup_completed_at.is_not_null()); |
| 595 | } |
| 596 | |
| 597 | if mc_session_completed { |
| 598 | q = q.filter(fuota_deployment_device::dsl::mc_session_completed_at.is_not_null()); |
| 599 | } |
| 600 | |
| 601 | if frag_session_setup_completed { |
| 602 | q = q.filter(fuota_deployment_device::dsl::frag_session_setup_completed_at.is_not_null()); |
| 603 | } |
| 604 | |
| 605 | if frag_status_completed { |
| 606 | q = q.filter(fuota_deployment_device::dsl::frag_status_completed_at.is_not_null()); |
| 607 | } |
| 608 | |
| 609 | q.execute(&mut get_async_db_conn().await?).await?; |
| 610 | |
| 611 | Ok(()) |
| 612 | } |
| 613 | |
| 614 | pub async fn add_gateways(fuota_deployment_id: Uuid, gateway_ids: Vec<EUI64>) -> Result<(), Error> { |
| 615 | let mut errors = Vec::new(); |
no test coverage detected