Update ORM Mappings

This commit is contained in:
2022-07-12 07:39:15 -07:00
parent 4102eecd22
commit edd129e532

View File

@@ -27,20 +27,30 @@ __all__ = ('init_orm', )
def init_orm(): def init_orm():
"""Initialize the Sigl ORM.""" """Initialize the Sigl ORM."""
# # Access Keys # Access Keys
# db.mapper(AccessKey, access_keys, properties={ db.mapper(AccessKey, access_keys, properties={
# 'tokens': db.relationship( 'tokens': db.relationship(
# AccessToken, AccessToken,
# backref='accessKey', back_populates='accessKey',
# cascade='all, delete-orphan', cascade='all, delete-orphan',
# ) )
# }) })
# # Access Tokens # Access Tokens
# db.mapper(AccessToken, access_tokens) db.mapper(AccessToken, access_tokens, properties={
'accessKey': db.relationship(
AccessKey,
back_populates='tokens',
)
})
# # List Entries # # List Entries
# db.mapper(ListEntry, list_entries) db.mapper(ListEntry, list_entries, properties={
'shoppingList': db.relationship(
ShoppingList,
back_populates='entries',
)
})
# Products # Products
db.mapper(Product, products, properties={ db.mapper(Product, products, properties={
@@ -49,11 +59,6 @@ def init_orm():
back_populates='product', back_populates='product',
cascade='all, delete-orphan', cascade='all, delete-orphan',
), ),
# 'shoppingLists': db.relationship(
# ShoppingList,
# backref='product',
# cascade='all, delete-orphan',
# ),
}) })
# Product Locations # Product Locations
@@ -64,11 +69,11 @@ def init_orm():
) )
}) })
# # Shopping Lists # Shopping Lists
# db.mapper(ShoppingList, lists, properties={ db.mapper(ShoppingList, lists, properties={
# 'entries': db.relationship( 'entries': db.relationship(
# ListEntry, ListEntry,
# backref='shoppingList', back_populates='shoppingList',
# cascade='all, delete-orphan', cascade='all, delete-orphan',
# ) )
# }) })