Simplify web API (put ids in url)
This commit is contained in:
parent
0c43935bef
commit
6e017e41a3
14 changed files with 403 additions and 588 deletions
|
|
@ -2,29 +2,8 @@ use chrono::NaiveDate;
|
|||
use ron::ser::{PrettyConfig, to_string_pretty};
|
||||
use serde::{Deserialize, Serialize};
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct SetLang {
|
||||
pub lang: String,
|
||||
}
|
||||
|
||||
/*** Generic types ***/
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct Ids {
|
||||
pub ids: Vec<i64>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct Id {
|
||||
pub id: i64,
|
||||
}
|
||||
|
||||
// A simple value.
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct Value<T> {
|
||||
pub value: T,
|
||||
}
|
||||
|
||||
// A value associated with an id.
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct KeyValue<T> {
|
||||
|
|
@ -32,11 +11,6 @@ pub struct KeyValue<T> {
|
|||
pub value: T,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct Strings {
|
||||
pub strs: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct DateRange {
|
||||
pub start_date: NaiveDate,
|
||||
|
|
@ -45,30 +19,6 @@ pub struct DateRange {
|
|||
|
||||
/*** Recipe ***/
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct SetRecipeTitle {
|
||||
pub recipe_id: i64,
|
||||
pub title: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct SetRecipeDescription {
|
||||
pub recipe_id: i64,
|
||||
pub description: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct SetRecipeServings {
|
||||
pub recipe_id: i64,
|
||||
pub servings: Option<u32>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct SetRecipeEstimatedTime {
|
||||
pub recipe_id: i64,
|
||||
pub estimated_time: Option<u32>,
|
||||
}
|
||||
|
||||
#[repr(u32)]
|
||||
#[derive(Serialize, Deserialize, Clone, Copy, PartialEq, Debug)]
|
||||
pub enum Difficulty {
|
||||
|
|
@ -96,72 +46,6 @@ impl From<Difficulty> for u32 {
|
|||
}
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct SetRecipeDifficulty {
|
||||
pub recipe_id: i64,
|
||||
pub difficulty: Difficulty,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct SetRecipeLanguage {
|
||||
pub recipe_id: i64,
|
||||
pub lang: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct SetRecipeIsPublic {
|
||||
pub recipe_id: i64,
|
||||
pub is_public: bool,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct SetGroupName {
|
||||
pub group_id: i64,
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct SetGroupComment {
|
||||
pub group_id: i64,
|
||||
pub comment: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct SetStepAction {
|
||||
pub step_id: i64,
|
||||
pub action: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct SetIngredientName {
|
||||
pub ingredient_id: i64,
|
||||
pub name: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct SetIngredientComment {
|
||||
pub ingredient_id: i64,
|
||||
pub comment: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct SetIngredientQuantity {
|
||||
pub ingredient_id: i64,
|
||||
pub quantity: Option<f64>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct SetIngredientUnit {
|
||||
pub ingredient_id: i64,
|
||||
pub unit: String,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone)]
|
||||
pub struct Tags {
|
||||
pub recipe_id: i64,
|
||||
pub tags: Vec<String>,
|
||||
}
|
||||
|
||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
||||
pub struct Group {
|
||||
pub id: i64,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue