| 359 | } |
| 360 | |
| 361 | pub async fn delete(id: &Uuid) -> Result<(), Error> { |
| 362 | let ra = diesel::delete(application::dsl::application.find(fields::Uuid::from(id))) |
| 363 | .execute(&mut get_async_db_conn().await?) |
| 364 | .await?; |
| 365 | if ra == 0 { |
| 366 | return Err(Error::NotFound(id.to_string())); |
| 367 | } |
| 368 | |
| 369 | info!( |
| 370 | application_id = %id, |
| 371 | "Application deleted" |
| 372 | ); |
| 373 | |
| 374 | Ok(()) |
| 375 | } |
| 376 | |
| 377 | pub async fn get_count(filters: &Filters) -> Result<i64, Error> { |
| 378 | let mut q = application::table.select(dsl::count_star()).into_boxed(); |