| 321 | } |
| 322 | |
| 323 | pub async fn update(a: Application) -> Result<Application, Error> { |
| 324 | a.validate()?; |
| 325 | |
| 326 | let a: Application = diesel::update(application::dsl::application.find(&a.id)) |
| 327 | .set(( |
| 328 | application::updated_at.eq(Utc::now()), |
| 329 | application::name.eq(&a.name), |
| 330 | application::description.eq(&a.description), |
| 331 | application::tags.eq(&a.tags), |
| 332 | )) |
| 333 | .get_result(&mut get_async_db_conn().await?) |
| 334 | .await |
| 335 | .map_err(|e| Error::from_diesel(e, a.id.to_string()))?; |
| 336 | |
| 337 | info!( |
| 338 | application_id = %a.id, |
| 339 | "Application updated" |
| 340 | ); |
| 341 | |
| 342 | Ok(a) |
| 343 | } |
| 344 | |
| 345 | pub async fn update_mqtt_cls_cert(id: &Uuid, cert: &[u8]) -> Result<Application, Error> { |
| 346 | let app: Application = |