mirror of
https://github.com/mealie-recipes/mealie.git
synced 2025-10-27 08:14:30 -04:00
* add default assets for user profile * add recipe avatar * change user_id to UUID * add profile image upload * setup image cache keys * cleanup tests and add image tests * purge user data on delete * new user repository tests * add user_id validator for int -> UUID conversion * delete depreciated route * force set content type * refactor tests to use temp directory * validate parent exists before createing * set user_id to correct type * update instruction id * reset primary key on migration
32 lines
973 B
Python
32 lines
973 B
Python
from sqlalchemy import Column, ForeignKey, Integer, String, orm
|
|
|
|
from .._model_base import BaseMixins, SqlAlchemyBase
|
|
from .._model_utils import auto_init
|
|
from .._model_utils.guid import GUID
|
|
|
|
|
|
class RecipeIngredientRefLink(SqlAlchemyBase, BaseMixins):
|
|
__tablename__ = "recipe_ingredient_ref_link"
|
|
instruction_id = Column(GUID, ForeignKey("recipe_instructions.id"))
|
|
reference_id = Column(GUID)
|
|
|
|
@auto_init()
|
|
def __init__(self, **_) -> None:
|
|
pass
|
|
|
|
|
|
class RecipeInstruction(SqlAlchemyBase):
|
|
__tablename__ = "recipe_instructions"
|
|
id = Column(GUID, primary_key=True, default=GUID.generate)
|
|
parent_id = Column(Integer, ForeignKey("recipes.id"))
|
|
position = Column(Integer)
|
|
type = Column(String, default="")
|
|
title = Column(String)
|
|
text = Column(String)
|
|
|
|
ingredient_references = orm.relationship("RecipeIngredientRefLink", cascade="all, delete-orphan")
|
|
|
|
@auto_init()
|
|
def __init__(self, **_) -> None:
|
|
pass
|