(id: &Uuid)
| 191 | } |
| 192 | |
| 193 | pub async fn delete(id: &Uuid) -> Result<(), Error> { |
| 194 | let ra = diesel::delete(user::dsl::user.find(&fields::Uuid::from(id))) |
| 195 | .execute(&mut get_async_db_conn().await?) |
| 196 | .await |
| 197 | .map_err(|e| Error::from_diesel(e, id.to_string()))?; |
| 198 | |
| 199 | if ra == 0 { |
| 200 | return Err(Error::NotFound(id.to_string())); |
| 201 | } |
| 202 | info!(user_id = %id, "User deleted"); |
| 203 | Ok(()) |
| 204 | } |
| 205 | |
| 206 | pub async fn get_count() -> Result<i64, Error> { |
| 207 | let count = user::dsl::user |