Add a RON API to search recipes by title + a bit of refactoring
This commit is contained in:
parent
a3f61e3711
commit
084f7ef445
26 changed files with 499 additions and 333 deletions
|
|
@ -4,7 +4,7 @@ use axum::{
|
|||
extract::{Extension, Query, State},
|
||||
response::{Html, IntoResponse},
|
||||
};
|
||||
use serde::Deserialize;
|
||||
use common::web_api;
|
||||
|
||||
use crate::{
|
||||
app::{Context, Result},
|
||||
|
|
@ -12,15 +12,10 @@ use crate::{
|
|||
html_templates::*,
|
||||
};
|
||||
|
||||
#[derive(Deserialize)]
|
||||
pub struct CurrentRecipeId {
|
||||
current_recipe_id: Option<i64>,
|
||||
}
|
||||
|
||||
#[debug_handler]
|
||||
pub async fn recipes_list_fragments(
|
||||
State(connection): State<db::Connection>,
|
||||
current_recipe: Query<CurrentRecipeId>,
|
||||
params: Query<web_api::RecipesListFragmentsParams>,
|
||||
Extension(context): Extension<Context>,
|
||||
) -> Result<impl IntoResponse> {
|
||||
Ok(Html(
|
||||
|
|
@ -29,7 +24,7 @@ pub async fn recipes_list_fragments(
|
|||
connection,
|
||||
&context.user,
|
||||
context.tr.current_lang_code(),
|
||||
current_recipe.current_recipe_id,
|
||||
params.current_recipe_id,
|
||||
)
|
||||
.await?,
|
||||
context,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue