diff --git a/alembic/versions/2022-11-22-03.42.45_167eb69066ad_add_recipe_scale_to_shopping_list_item_.py b/alembic/versions/2022-11-22-03.42.45_167eb69066ad_add_recipe_scale_to_shopping_list_item_.py new file mode 100644 index 00000000..42f508cd --- /dev/null +++ b/alembic/versions/2022-11-22-03.42.45_167eb69066ad_add_recipe_scale_to_shopping_list_item_.py @@ -0,0 +1,29 @@ +"""add recipe_scale to shopping list item ref + +Revision ID: 167eb69066ad +Revises: 1923519381ad +Create Date: 2022-11-22 03:42:45.494567 + +""" +import sqlalchemy as sa + +from alembic import op + +# revision identifiers, used by Alembic. +revision = "167eb69066ad" +down_revision = "1923519381ad" +branch_labels = None +depends_on = None + + +def upgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.add_column("shopping_list_item_recipe_reference", sa.Column("recipe_scale", sa.Float(), nullable=True)) + op.execute("UPDATE shopping_list_item_recipe_reference SET recipe_scale = 1") + # ### end Alembic commands ### + + +def downgrade(): + # ### commands auto generated by Alembic - please adjust! ### + op.drop_column("shopping_list_item_recipe_reference", "recipe_scale") + # ### end Alembic commands ### diff --git a/frontend/components/Domain/Recipe/RecipeActionMenu.vue b/frontend/components/Domain/Recipe/RecipeActionMenu.vue index a0745335..b8447d5a 100644 --- a/frontend/components/Domain/Recipe/RecipeActionMenu.vue +++ b/frontend/components/Domain/Recipe/RecipeActionMenu.vue @@ -51,6 +51,7 @@ color="info" :card-menu="false" :recipe-id="recipe.id" + :recipe-scale="recipeScale" :use-items="{ delete: false, edit: false, @@ -105,6 +106,10 @@ export default defineComponent({ required: true, type: String, }, + recipeScale: { + type: Number, + default: 1, + }, open: { required: true, type: Boolean, diff --git a/frontend/components/Domain/Recipe/RecipeContextMenu.vue b/frontend/components/Domain/Recipe/RecipeContextMenu.vue index 475c119f..5ae36e4c 100644 --- a/frontend/components/Domain/Recipe/RecipeContextMenu.vue +++ b/frontend/components/Domain/Recipe/RecipeContextMenu.vue @@ -199,6 +199,10 @@ export default defineComponent({ required: true, type: String, }, + recipeScale: { + type: Number, + default: 1, + }, /** * Optional group ID prop that is only _required_ when the * public URL is requested. If the public URL button is pressed @@ -316,7 +320,7 @@ export default defineComponent({ } async function addRecipeToList(listId: string) { - const { data } = await api.shopping.lists.addRecipe(listId, props.recipeId); + const { data } = await api.shopping.lists.addRecipe(listId, props.recipeId, props.recipeScale); if (data) { alert.success(i18n.t("recipe.recipe-added-to-list") as string); state.shoppingListDialog = false; diff --git a/frontend/components/Domain/Recipe/RecipePage/RecipePage.vue b/frontend/components/Domain/Recipe/RecipePage/RecipePage.vue index 89028b89..f5ffb6dd 100644 --- a/frontend/components/Domain/Recipe/RecipePage/RecipePage.vue +++ b/frontend/components/Domain/Recipe/RecipePage/RecipePage.vue @@ -1,7 +1,7 @@