api: Mark all structs as PartialEq + Eq if applicable
This commit is contained in:
parent
8987991139
commit
5b44cc7dde
1 changed files with 25 additions and 25 deletions
|
|
@ -3,80 +3,80 @@ use std::collections::HashMap;
|
||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct LoginRequest {
|
pub struct LoginRequest {
|
||||||
pub username: String,
|
pub username: String,
|
||||||
pub password: String,
|
pub password: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct LoginResponse {
|
pub struct LoginResponse {
|
||||||
pub token: String,
|
pub token: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct EmptyResponse {}
|
pub struct EmptyResponse {}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Household {
|
pub struct Household {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub members: Vec<Uuid>,
|
pub members: Vec<Uuid>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct Households {
|
pub struct Households {
|
||||||
pub households: HashMap<Uuid, Household>,
|
pub households: HashMap<Uuid, Household>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct CreateHouseholdRequest {
|
pub struct CreateHouseholdRequest {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct CreateHouseholdResponse {
|
pub struct CreateHouseholdResponse {
|
||||||
pub id: Uuid,
|
pub id: Uuid,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct RenameHouseholdRequest {
|
pub struct RenameHouseholdRequest {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct AddToHouseholdRequest {
|
pub struct AddToHouseholdRequest {
|
||||||
pub user: Uuid,
|
pub user: Uuid,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct UserInfo {
|
pub struct UserInfo {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub id: Uuid,
|
pub id: Uuid,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct CreateIngredientRequest {
|
pub struct CreateIngredientRequest {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub unit: Option<String>,
|
pub unit: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct CreateIngredientResponse {
|
pub struct CreateIngredientResponse {
|
||||||
pub id: i64,
|
pub id: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct IngredientInfo {
|
pub struct IngredientInfo {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub unit: Option<String>,
|
pub unit: Option<String>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct IngredientList {
|
pub struct IngredientList {
|
||||||
pub ingredients: HashMap<i64, IngredientInfo>,
|
pub ingredients: HashMap<i64, IngredientInfo>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct EditIngredientRequest {
|
pub struct EditIngredientRequest {
|
||||||
pub name: Option<String>,
|
pub name: Option<String>,
|
||||||
pub unit: Option<String>,
|
pub unit: Option<String>,
|
||||||
|
|
@ -84,7 +84,7 @@ pub struct EditIngredientRequest {
|
||||||
pub has_unit: bool,
|
pub has_unit: bool,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
||||||
pub struct CreateRecipeRequest {
|
pub struct CreateRecipeRequest {
|
||||||
pub person_count: u32,
|
pub person_count: u32,
|
||||||
pub name: String,
|
pub name: String,
|
||||||
|
|
@ -93,17 +93,17 @@ pub struct CreateRecipeRequest {
|
||||||
pub steps: String,
|
pub steps: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct CreateRecipeResponse {
|
pub struct CreateRecipeResponse {
|
||||||
pub id: i64,
|
pub id: i64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct ListRecipesResponse {
|
pub struct ListRecipesResponse {
|
||||||
pub recipes: Vec<(i64, String, u8)>,
|
pub recipes: Vec<(i64, String, u8)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
||||||
pub struct RecipeInfo {
|
pub struct RecipeInfo {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
pub rating: u8,
|
pub rating: u8,
|
||||||
|
|
@ -112,32 +112,32 @@ pub struct RecipeInfo {
|
||||||
pub ingredients: Vec<(i64, IngredientInfo, f64)>,
|
pub ingredients: Vec<(i64, IngredientInfo, f64)>,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct RecipeRenameRequest {
|
pub struct RecipeRenameRequest {
|
||||||
pub name: String,
|
pub name: String,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
||||||
pub struct RecipeIngredientEditRequest {
|
pub struct RecipeIngredientEditRequest {
|
||||||
pub amount: f64,
|
pub amount: f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq)]
|
||||||
pub struct AddRecipeIngredientRequest {
|
pub struct AddRecipeIngredientRequest {
|
||||||
pub amount: f64,
|
pub amount: f64,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct RecipeEditStepsRequest {
|
pub struct RecipeEditStepsRequest {
|
||||||
pub steps: String
|
pub steps: String
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct RecipeEditRating {
|
pub struct RecipeEditRating {
|
||||||
pub rating: u8,
|
pub rating: u8,
|
||||||
}
|
}
|
||||||
|
|
||||||
#[derive(Serialize, Deserialize, Clone, Debug)]
|
#[derive(Serialize, Deserialize, Clone, Debug, PartialEq, Eq)]
|
||||||
pub struct RecipeEditPersonCount {
|
pub struct RecipeEditPersonCount {
|
||||||
pub person_count: u32,
|
pub person_count: u32,
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue