(tenant_id: &Option<Uuid>)
| 932 | } |
| 933 | |
| 934 | pub async fn get_data_rates(tenant_id: &Option<Uuid>) -> Result<Vec<DevicesDataRate>, Error> { |
| 935 | let mut q = device::table |
| 936 | .inner_join(application::table) |
| 937 | .select(( |
| 938 | device::dr, |
| 939 | diesel::dsl::sql::<diesel::sql_types::BigInt>("count(1)"), |
| 940 | )) |
| 941 | .group_by(device::dr) |
| 942 | .filter(device::dr.is_not_null()) |
| 943 | .into_boxed(); |
| 944 | |
| 945 | if let Some(id) = &tenant_id { |
| 946 | q = q.filter(application::tenant_id.eq(fields::Uuid::from(id))); |
| 947 | } |
| 948 | |
| 949 | q.load(&mut get_async_db_conn().await?) |
| 950 | .await |
| 951 | .map_err(|e| Error::from_diesel(e, "".into())) |
| 952 | } |
| 953 | |
| 954 | pub async fn get_with_class_b_c_queue_items(limit: usize) -> Result<Vec<Device>> { |
| 955 | let mut c = get_async_db_conn().await?; |
no test coverage detected