mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-14 22:35:17 -05:00
added user to shopping list
This commit is contained in:
@@ -14,6 +14,7 @@ from ..recipe.ingredient import IngredientFoodModel, IngredientUnitModel
|
||||
|
||||
if TYPE_CHECKING:
|
||||
from group import Group
|
||||
from users import User
|
||||
|
||||
from ..recipe import RecipeModel
|
||||
|
||||
@@ -122,6 +123,8 @@ class ShoppingList(SqlAlchemyBase, BaseMixins):
|
||||
|
||||
group_id: Mapped[GUID] = mapped_column(GUID, ForeignKey("groups.id"), nullable=False, index=True)
|
||||
group: Mapped["Group"] = orm.relationship("Group", back_populates="shopping_lists")
|
||||
user_id: Mapped[GUID] = mapped_column(GUID, ForeignKey("users.id"), nullable=False, index=True)
|
||||
user: Mapped["User"] = orm.relationship("User", back_populates="shopping_lists")
|
||||
|
||||
name: Mapped[str | None] = mapped_column(String)
|
||||
list_items: Mapped[ShoppingListItem] = orm.relationship(
|
||||
|
||||
@@ -17,6 +17,7 @@ from .user_to_favorite import users_to_favorites
|
||||
if TYPE_CHECKING:
|
||||
from ..group import Group
|
||||
from ..group.mealplan import GroupMealPlan
|
||||
from ..group.shopping_list import ShoppingList
|
||||
from ..recipe import RecipeComment, RecipeModel, RecipeTimelineEvent
|
||||
from .password_reset import PasswordResetModel
|
||||
|
||||
@@ -81,7 +82,7 @@ class User(SqlAlchemyBase, BaseMixins):
|
||||
mealplans: Mapped[Optional["GroupMealPlan"]] = orm.relationship(
|
||||
"GroupMealPlan", order_by="GroupMealPlan.date", **sp_args
|
||||
)
|
||||
|
||||
shopping_lists: Mapped[Optional["ShoppingList"]] = orm.relationship("ShoppingList", **sp_args)
|
||||
favorite_recipes: Mapped[list["RecipeModel"]] = orm.relationship(
|
||||
"RecipeModel", secondary=users_to_favorites, back_populates="favorited_by"
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user