| 499 | } |
| 500 | |
| 501 | pub async fn remove_devices(fuota_deployment_id: Uuid, dev_euis: Vec<EUI64>) -> Result<(), Error> { |
| 502 | diesel::delete( |
| 503 | fuota_deployment_device::table |
| 504 | .filter( |
| 505 | fuota_deployment_device::dsl::fuota_deployment_id |
| 506 | .eq(fields::Uuid::from(fuota_deployment_id)), |
| 507 | ) |
| 508 | .filter(fuota_deployment_device::dsl::dev_eui.eq_any(&dev_euis)), |
| 509 | ) |
| 510 | .execute(&mut get_async_db_conn().await?) |
| 511 | .await?; |
| 512 | |
| 513 | info!(fuota_deployment_id = %fuota_deployment_id, "DevEUIs removed from FUOTA Deployment"); |
| 514 | Ok(()) |
| 515 | } |
| 516 | |
| 517 | pub async fn get_device_count(fuota_deployment_id: Uuid) -> Result<i64, Error> { |
| 518 | fuota_deployment_device::dsl::fuota_deployment_device |