fix: app id not found

v3
veypi 4 months ago
parent 7211d7cbff
commit a97d289d14

@ -22,7 +22,10 @@ use crate::{
pub async fn get(id: web::Path<String>, stat: web::Data<AppState>) -> Result<impl Responder> { pub async fn get(id: web::Path<String>, stat: web::Data<AppState>) -> Result<impl Responder> {
let n = id.into_inner(); let n = id.into_inner();
if !n.is_empty() { if !n.is_empty() {
let s = app::Entity::find_by_id(n).one(stat.db()).await?; let s = app::Entity::find_by_id(&n).one(stat.db()).await?;
if s.is_none() {
return Err(Error::NotFound(n));
}
Ok(web::Json(s)) Ok(web::Json(s))
} else { } else {
Err(Error::Missing("id".to_string())) Err(Error::Missing("id".to_string()))

Loading…
Cancel
Save