diff --git a/mealie/db/models/_model_base.py b/mealie/db/models/_model_base.py index f278a5147..00da8ece6 100644 --- a/mealie/db/models/_model_base.py +++ b/mealie/db/models/_model_base.py @@ -14,11 +14,15 @@ from ._model_utils.datetime import NaiveDateTime, get_utc_now NORMALIZE_PUNCTUATION = string.punctuation.replace("'", "").replace('"', "") _NORMALIZE_PUNCTUATION_TABLE = str.maketrans(NORMALIZE_PUNCTUATION, " " * len(NORMALIZE_PUNCTUATION)) -type PrivateColumn[T] = Mapped[Annotated[T, mapped_column(info={"private": True})]] -""" -A `Mapped` attribute with metadata `private=True`. -Signals to the query filter API not to allow using this field in query operations. -""" + +class PrivateColumn[T]: + """ + Drop-in replacement for `Mapped[]` that marks a column as private. + Private columns cannot be used in query filter expressions. + """ + + def __class_getitem__(cls, item: type) -> type: + return Mapped[Annotated[item, mapped_column(info={"private": True})]] class SqlAlchemyBase(DeclarativeBase):