Show image immediately after submitting review

This commit is contained in:
Reimar 2024-09-13 12:06:45 +02:00
parent eca2b6324b
commit 0ab5fee8b2
Signed by: Reimar
GPG Key ID: 93549FA07F0AE268

View File

@ -217,9 +217,11 @@ async fn create_review(auth: AuthorizedUser, data: web::Data<AppData>, input: we
place_description: input.place_description.clone(), place_description: input.place_description.clone(),
title: input.title.clone(), title: input.title.clone(),
content: input.content.clone(), content: input.content.clone(),
rating: input.rating.clone(), rating: input.rating.clone(),
image_id: input.image_id, image_id: input.image_id,
image: None, image: input.image_id.and_then(|image_id| {
db.query_row("SELECT * FROM images WHERE id = :id LIMIT 1", &[(":id", &image_id.to_string())], |row| Image::from_row(row)).ok()
}),
}), }),
Err(_) => HttpResponse::InternalServerError().finish(), Err(_) => HttpResponse::InternalServerError().finish(),
} }