Add a RON API to search recipes by title + a bit of refactoring

This commit is contained in:
Greg Burri 2025-05-21 19:58:31 +02:00
parent a3f61e3711
commit 084f7ef445
26 changed files with 499 additions and 333 deletions

View file

@ -1,5 +1,5 @@
pub mod consts;
pub mod ron_api;
pub mod toast;
pub mod translation;
pub mod utils;
pub mod translation;
pub mod web_api;

View file

@ -22,6 +22,9 @@ pub enum Sentence {
DatabaseError,
TemplateError,
// Search
SearchPlaceholder,
// Sign in page.
SignInMenu,
SignInTitle,

View file

@ -20,6 +20,28 @@ pub struct DateRange {
/*** Recipe ***/
#[derive(Serialize, Deserialize, Clone)]
pub struct RecipesListFragmentsParams {
pub current_recipe_id: Option<i64>,
}
#[derive(Serialize, Deserialize, Clone)]
pub struct SearchByTitleParams {
pub search_term: String,
}
#[derive(Serialize, Deserialize, Clone)]
pub struct GetTitlesParams {
pub ids: Vec<i64>,
}
#[derive(Serialize, Deserialize, Clone)]
pub struct RecipeSearchResult {
pub recipe_id: i64,
pub title: String,
pub title_highlighted: String,
}
#[repr(u32)]
#[derive(Serialize, Deserialize, FromRepr, Clone, Copy, PartialEq, Debug)]
pub enum Difficulty {