| 100 | } |
| 101 | |
| 102 | pub async fn delete_item(id: &Uuid) -> Result<(), Error> { |
| 103 | let ra = |
| 104 | diesel::delete(device_queue_item::dsl::device_queue_item.find(&fields::Uuid::from(id))) |
| 105 | .execute(&mut get_async_db_conn().await?) |
| 106 | .await?; |
| 107 | if ra == 0 { |
| 108 | return Err(Error::NotFound(id.to_string())); |
| 109 | } |
| 110 | info!(id = %id, "Device queue-item deleted"); |
| 111 | Ok(()) |
| 112 | } |
| 113 | |
| 114 | /// It returns the device queue-item and a bool indicating if there are more items in the queue. |
| 115 | pub async fn get_next_for_dev_eui(dev_eui: &EUI64) -> Result<(DeviceQueueItem, bool), Error> { |