Add some fields to recipe view
This commit is contained in:
parent
54989f3212
commit
afd42ba1d0
6 changed files with 44 additions and 2 deletions
|
|
@ -172,7 +172,7 @@ WHERE [Ingredient].[id] = $1 AND [user_id] = $2
|
|||
.map_err(DBError::from)
|
||||
}
|
||||
|
||||
pub async fn get_recipe(&self, id: i64, with_groups: bool) -> Result<Option<model::Recipe>> {
|
||||
pub async fn get_recipe(&self, id: i64, complete: bool) -> Result<Option<model::Recipe>> {
|
||||
match sqlx::query_as::<_, model::Recipe>(
|
||||
r#"
|
||||
SELECT
|
||||
|
|
@ -186,7 +186,8 @@ FROM [Recipe] WHERE [id] = $1
|
|||
.fetch_optional(&self.pool)
|
||||
.await?
|
||||
{
|
||||
Some(mut recipe) if with_groups => {
|
||||
Some(mut recipe) if complete => {
|
||||
recipe.tags = self.get_recipes_tags(id).await?;
|
||||
recipe.groups = self.get_groups(id).await?;
|
||||
Ok(Some(recipe))
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue