1
0
Fork 0
mirror of https://github.com/mealie-recipes/mealie.git synced 2025-07-25 08:09:41 +02:00
mealie/mealie/db/models/theme.py
Hayden 6f38fcf81b
feature/favorite-recipes (#443)
* add favorites options

* bump dependencies

* add badges to all cards

* typo

* remove console.log

* fix site-loader viewport

Co-authored-by: hay-kot <hay-kot@pm.me>
2021-05-29 15:54:18 -08:00

27 lines
995 B
Python

import sqlalchemy.orm as orm
from mealie.db.models.model_base import BaseMixins, SqlAlchemyBase
from sqlalchemy import Column, ForeignKey, Integer, String
class SiteThemeModel(SqlAlchemyBase, BaseMixins):
__tablename__ = "site_theme"
id = Column(Integer, primary_key=True, unique=True)
name = Column(String, nullable=False, unique=True)
colors = orm.relationship("ThemeColorsModel", uselist=False, single_parent=True, cascade="all, delete-orphan")
def __init__(self, name: str, colors: dict, **_) -> None:
self.name = name
self.colors = ThemeColorsModel(**colors)
class ThemeColorsModel(SqlAlchemyBase, BaseMixins):
__tablename__ = "theme_colors"
id = Column(Integer, primary_key=True)
parent_id = Column(Integer, ForeignKey("site_theme.id"))
primary = Column(String)
accent = Column(String)
secondary = Column(String)
success = Column(String)
info = Column(String)
warning = Column(String)
error = Column(String)