From acc85ba8de327ded4cca399fdc373ce2fff185ba Mon Sep 17 00:00:00 2001 From: Lance Edgar Date: Mon, 30 Mar 2020 12:24:05 -0500 Subject: [PATCH] Add `ProductUser` model --- corepos/db/office_op/model.py | 45 +++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/corepos/db/office_op/model.py b/corepos/db/office_op/model.py index 7e19da0..d5e4080 100644 --- a/corepos/db/office_op/model.py +++ b/corepos/db/office_op/model.py @@ -410,6 +410,51 @@ class ProductFlag(Base): return self.description or '' +class ProductUser(Base): + """ + Represents extended "user" info for a product (e.g. sale signage). + """ + __tablename__ = 'productUser' + + upc = sa.Column(sa.String(length=13), primary_key=True, nullable=False) + product = orm.relationship( + Product, + primaryjoin=Product.upc == upc, + foreign_keys=[upc], + doc=""" + Reference to the :class:`Product` to which this record applies. + """, + backref=orm.backref( + 'user_info', + uselist=False, + doc=""" + Reference to the :class:`ProductUser` record for this product, if any. + """)) + + description = sa.Column(sa.String(length=255), nullable=True) + + brand = sa.Column(sa.String(length=255), nullable=True) + + sizing = sa.Column(sa.String(length=255), nullable=True) + + photo = sa.Column(sa.String(length=255), nullable=True) + + # TODO: this was not in some older DBs + # nutrition_facts = sa.Column('nutritionFacts', sa.String(length=255), nullable=True) + + long_text = sa.Column(sa.Text(), nullable=True) + + enable_online = sa.Column('enableOnline', sa.Boolean(), nullable=True) + + sold_out = sa.Column('soldOut', sa.Boolean(), nullable=True, default=False) + + # TODO: this was not in some older DBs + # sign_count = sa.Column('signCount', sa.SmallInteger(), nullable=True, default=1) + + # TODO: this was not in some older DBs + # narrow = sa.Column(sa.Boolean(), nullable=True, default=False) + + class VendorItem(Base): """ Represents a "source" for a given item, from a given vendor.