| 660 | } |
| 661 | |
| 662 | pub async fn remove_gateways( |
| 663 | fuota_deployment_id: Uuid, |
| 664 | gateway_ids: Vec<EUI64>, |
| 665 | ) -> Result<(), Error> { |
| 666 | diesel::delete( |
| 667 | fuota_deployment_gateway::table |
| 668 | .filter( |
| 669 | fuota_deployment_gateway::dsl::fuota_deployment_id |
| 670 | .eq(fields::Uuid::from(fuota_deployment_id)), |
| 671 | ) |
| 672 | .filter(fuota_deployment_gateway::dsl::gateway_id.eq_any(gateway_ids)), |
| 673 | ) |
| 674 | .execute(&mut get_async_db_conn().await?) |
| 675 | .await?; |
| 676 | |
| 677 | info!(fuota_deployment_id = %fuota_deployment_id, "Gateway IDs removed from FUOTA Deployment"); |
| 678 | Ok(()) |
| 679 | } |
| 680 | |
| 681 | pub async fn get_gateway_count(fuota_deployment_id: Uuid) -> Result<i64, Error> { |
| 682 | fuota_deployment_gateway::dsl::fuota_deployment_gateway |