A lot of unplanned clean up and created some new/missing methods and routes. Mainly working on order and order_cart related stuff.

This commit is contained in:
Scott Idem
2021-08-07 18:15:59 -04:00
parent 9915c7d9ed
commit 106a186ea6
12 changed files with 565 additions and 278 deletions

View File

@@ -170,12 +170,12 @@ def load_order_obj(
exclude_unset: bool = True,
model_as_dict: bool = False,
enabled: str = 'enabled', # enabled, disabled, all
inc_order_cfg: bool = False,
inc_order_line_list: bool = False,
inc_order_cfg: bool = False,
inc_person: bool = False,
inc_user: bool = False,
):
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
if order_id := redis_lookup_id_random(record_id_random=order_id, table_name='order'): pass
@@ -193,18 +193,6 @@ def load_order_obj(
except ValidationError as e:
log.error(e.json())
if inc_order_cfg:
if order_cfg_result := load_order_cfg_obj(
order_cfg_id = order_rec.get('order_cfg_id', None),
limit = limit,
by_alias = by_alias,
exclude_unset = exclude_unset,
model_as_dict = model_as_dict,
enabled = enabled,
):
order_obj.order_cfg = order_cfg_result
else: order_obj.order_cfg = None
# Updated 2021-06-18
if inc_order_line_list:
if order_line_rec_list_result := get_order_line_rec_list(
@@ -226,12 +214,19 @@ def load_order_obj(
order_obj.order_line_list = order_line_result_list
else: order_obj.order_line_list = []
# if inc_order_line_list:
# order_line_data = {}
# order_line_data['order_id'] = order_id
# if order_line_rec_li := sql_select(table_name='v_order_line', data=order_line_data, as_list=True):#, field_name='order_id', field_value=order_id):
# log.debug(order_line_rec_li)
# order_rec['order_line_li'] = order_line_rec_li
# Updated 2021-08-07
if inc_order_cfg:
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
if order_cfg_result := load_order_cfg_obj(
account_id = order_rec.get('account_id', None),
by_alias = by_alias,
exclude_unset = exclude_unset,
model_as_dict = True,
):
order_obj.cfg = order_cfg_result
else: order_obj.cfg = None
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(order_cfg_result)
# Updated 2021-06-22
if inc_person: