Work on person related information, order, and order_cart
This commit is contained in:
@@ -253,6 +253,34 @@ def get_order_cart_rec_list(
|
||||
# ### END ### API Order Cart Methods ### get_order_cart_rec_list() ###
|
||||
|
||||
|
||||
# ### BEGIN ### API Order Cart Methods ### get_order_cart_id_for_person_id() ###
|
||||
# Updated 2021-11-16
|
||||
def get_order_cart_id_for_person_id(
|
||||
person_id: int|str,
|
||||
) -> bool|int|None:
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
if person_id := redis_lookup_id_random(record_id_random=person_id, table_name='person'): pass
|
||||
else: return False
|
||||
|
||||
data = {}
|
||||
data['person_id'] = person_id
|
||||
|
||||
sql = f"""
|
||||
SELECT `order_cart`.id AS 'order_cart_id', `order_cart`.id_random AS 'order_cart_id_random', `order_cart`.person_id AS person_id
|
||||
FROM `order_cart` AS `order_cart`
|
||||
WHERE `order_cart`.person_id = :person_id
|
||||
LIMIT 1;
|
||||
"""
|
||||
|
||||
if order_cart_data_result := sql_select(data=data, sql=sql):
|
||||
log.debug(order_cart_data_result)
|
||||
if order_cart_id := order_cart_data_result.get('order_cart_id', None): return order_cart_id
|
||||
else: return False
|
||||
else: return None
|
||||
# ### END ### API Order Cart Methods ### get_order_cart_id_for_person_id() ###
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user