-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
refactor!: rename recipe ingredient and recipe ingredient draft to re…
…cipe step ingredient and draft respectively This messes up the database migration.
- Loading branch information
Showing
48 changed files
with
721 additions
and
677 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
pub mod ingredient; | ||
pub mod recipe; | ||
pub mod recipe_file; | ||
pub mod recipe_ingredient; | ||
pub mod recipe_ingredient_draft; | ||
pub mod recipe_step; | ||
pub mod recipe_step_ingredient; | ||
pub mod recipe_step_ingredient_draft; | ||
pub mod unit_name; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
use crate::{ | ||
command::error::{CommandError, CommandError::NotFound}, | ||
entity::recipe_step_ingredient::Model, | ||
entity_crud::{ | ||
recipe_step_ingredient::{ | ||
RecipeStepIngredientCondition, RecipeStepIngredientCreate, RecipeStepIngredientCrud, | ||
RecipeStepIngredientFilter, RecipeStepIngredientUpdate, | ||
}, | ||
EntityCrudTrait, | ||
}, | ||
}; | ||
|
||
#[tauri::command] | ||
pub async fn entity_create_recipe_step_ingredient( | ||
create: RecipeStepIngredientCreate, | ||
) -> Result<i64, CommandError> { | ||
let id = RecipeStepIngredientCrud::create(create).await?; | ||
Ok(id) | ||
} | ||
|
||
#[tauri::command] | ||
pub async fn entity_read_recipe_step_ingredient(id: i64) -> Result<Model, CommandError> { | ||
let model_option = RecipeStepIngredientCrud::read(id).await?; | ||
let model = model_option.ok_or(NotFound)?; | ||
Ok(model) | ||
} | ||
|
||
#[tauri::command] | ||
pub async fn entity_update_recipe_step_ingredient( | ||
update: RecipeStepIngredientUpdate, | ||
) -> Result<(), CommandError> { | ||
RecipeStepIngredientCrud::update(update).await?; | ||
Ok(()) | ||
} | ||
|
||
#[tauri::command] | ||
pub async fn entity_delete_recipe_step_ingredient(id: i64) -> Result<(), CommandError> { | ||
RecipeStepIngredientCrud::delete(id).await?; | ||
Ok(()) | ||
} | ||
|
||
#[tauri::command] | ||
pub async fn entity_list_recipe_step_ingredient( | ||
filter: RecipeStepIngredientFilter, | ||
) -> Result<Vec<i64>, CommandError> { | ||
let list = RecipeStepIngredientCrud::list(filter).await?; | ||
Ok(list) | ||
} | ||
|
||
#[tauri::command] | ||
pub async fn entity_count_recipe_step_ingredient( | ||
condition: Option<RecipeStepIngredientCondition>, | ||
) -> Result<i64, CommandError> { | ||
let count = RecipeStepIngredientCrud::count(condition).await?; | ||
Ok(count) | ||
} |
57 changes: 57 additions & 0 deletions
57
src-tauri/src/command/entity/recipe_step_ingredient_draft.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
use crate::{ | ||
command::error::{CommandError, CommandError::NotFound}, | ||
entity::recipe_step_ingredient_draft::Model, | ||
entity_crud::{ | ||
recipe_step_ingredient_draft::{ | ||
RecipeStepIngredientDraftCondition, RecipeStepIngredientDraftCreate, | ||
RecipeStepIngredientDraftCrud, RecipeStepIngredientDraftFilter, | ||
RecipeStepIngredientDraftUpdate, | ||
}, | ||
EntityCrudTrait, | ||
}, | ||
}; | ||
|
||
#[tauri::command] | ||
pub async fn entity_create_recipe_step_ingredient_draft( | ||
create: RecipeStepIngredientDraftCreate, | ||
) -> Result<i64, CommandError> { | ||
let id = RecipeStepIngredientDraftCrud::create(create).await?; | ||
Ok(id) | ||
} | ||
|
||
#[tauri::command] | ||
pub async fn entity_read_recipe_step_ingredient_draft(id: i64) -> Result<Model, CommandError> { | ||
let model_option = RecipeStepIngredientDraftCrud::read(id).await?; | ||
let model = model_option.ok_or(NotFound)?; | ||
Ok(model) | ||
} | ||
|
||
#[tauri::command] | ||
pub async fn entity_update_recipe_step_ingredient_draft( | ||
update: RecipeStepIngredientDraftUpdate, | ||
) -> Result<(), CommandError> { | ||
RecipeStepIngredientDraftCrud::update(update).await?; | ||
Ok(()) | ||
} | ||
|
||
#[tauri::command] | ||
pub async fn entity_delete_recipe_step_ingredient_draft(id: i64) -> Result<(), CommandError> { | ||
RecipeStepIngredientDraftCrud::delete(id).await?; | ||
Ok(()) | ||
} | ||
|
||
#[tauri::command] | ||
pub async fn entity_list_recipe_step_ingredient_draft( | ||
filter: RecipeStepIngredientDraftFilter, | ||
) -> Result<Vec<i64>, CommandError> { | ||
let list = RecipeStepIngredientDraftCrud::list(filter).await?; | ||
Ok(list) | ||
} | ||
|
||
#[tauri::command] | ||
pub async fn entity_count_recipe_step_ingredient_draft( | ||
condition: Option<RecipeStepIngredientDraftCondition>, | ||
) -> Result<i64, CommandError> { | ||
let count = RecipeStepIngredientDraftCrud::count(condition).await?; | ||
Ok(count) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.