Add CustomerShopper.corepos_customer_id and refactor importers

removes phone/email support for now..also change how we handle
default/empty values for member start/end date..
This commit is contained in:
Lance Edgar 2023-06-10 14:35:08 -05:00
parent 86a8e2d241
commit 660637522d
7 changed files with 150 additions and 37 deletions

View file

@ -91,7 +91,8 @@ class CoreCustomer(model.Base):
"""))
corepos_account_id = sa.Column(sa.Integer(), nullable=True, doc="""
``Customers.customerAccountID`` value for this customer, within CORE-POS.
``CustomerAccounts.customerAccountID`` value for this customer
account, within CORE-POS.
""")
corepos_card_number = sa.Column(sa.Integer(), nullable=True, doc="""
@ -105,6 +106,42 @@ CoreCustomer.make_proxy(model.Customer, '_corepos', 'corepos_account_id')
CoreCustomer.make_proxy(model.Customer, '_corepos', 'corepos_card_number')
class CoreCustomerShopper(model.Base):
"""
CORE-specific extensions to
:class:`~rattail:rattail.db.model.CustomerShopper`.
"""
__tablename__ = 'corepos_customer_shopper'
__table_args__ = (
sa.ForeignKeyConstraint(['uuid'], ['customer_shopper.uuid'],
name='corepos_customer_shopper_fk_shopper'),
)
__versioned__ = {}
uuid = model.uuid_column(default=None)
shopper = orm.relationship(
model.CustomerShopper, doc="""
Reference to the actual shopper record, which this one extends.
""",
cascade_backrefs=False,
backref=orm.backref(
'_corepos', doc="""
Reference to the CORE-POS extension record for this customer.
""",
uselist=False,
cascade='all, delete-orphan',
cascade_backrefs=False))
corepos_customer_id = sa.Column(sa.Integer(), nullable=True, doc="""
``Customers.customerID`` value for this shopper, within CORE-POS.
""")
def __str__(self):
return str(self.shopper)
CoreCustomerShopper.make_proxy(model.CustomerShopper, '_corepos', 'corepos_customer_id')
class CoreMember(model.Base):
"""
CORE-specific extensions to :class:`rattail:rattail.db.model.Member`.