mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-12-28 21:15:26 -05:00
update foods and units for multitenant support
This commit is contained in:
@@ -55,6 +55,10 @@ class Group(SqlAlchemyBase, BaseMixins):
|
||||
group_reports = orm.relationship("ReportModel", **common_args)
|
||||
group_event_notifiers = orm.relationship("GroupEventNotifierModel", **common_args)
|
||||
|
||||
# Owned Models
|
||||
ingredient_units = orm.relationship("IngredientUnitModel", **common_args)
|
||||
ingredient_foods = orm.relationship("IngredientFoodModel", **common_args)
|
||||
|
||||
class Config:
|
||||
exclude = {
|
||||
"users",
|
||||
|
||||
@@ -9,6 +9,11 @@ from .._model_utils.guid import GUID
|
||||
|
||||
class IngredientUnitModel(SqlAlchemyBase, BaseMixins):
|
||||
__tablename__ = "ingredient_units"
|
||||
|
||||
# ID Relationships
|
||||
group_id = Column(GUID, ForeignKey("groups.id"), nullable=False)
|
||||
group = orm.relationship("Group", back_populates="ingredient_units", foreign_keys=[group_id])
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
name = Column(String)
|
||||
description = Column(String)
|
||||
@@ -23,6 +28,11 @@ class IngredientUnitModel(SqlAlchemyBase, BaseMixins):
|
||||
|
||||
class IngredientFoodModel(SqlAlchemyBase, BaseMixins):
|
||||
__tablename__ = "ingredient_foods"
|
||||
|
||||
# ID Relationships
|
||||
group_id = Column(GUID, ForeignKey("groups.id"), nullable=False)
|
||||
group = orm.relationship("Group", back_populates="ingredient_foods", foreign_keys=[group_id])
|
||||
|
||||
id = Column(Integer, primary_key=True)
|
||||
name = Column(String)
|
||||
description = Column(String)
|
||||
|
||||
Reference in New Issue
Block a user