Work on order endpoint and related methods.
This commit is contained in:
@@ -173,17 +173,18 @@ def save_order_obj(order_obj_new:Order_Base, repl_order_line_li:bool=False):
|
||||
|
||||
|
||||
# ### BEGIN ### API Order Methods ### load_order_obj() ###
|
||||
# Updated 2021-11-19
|
||||
def load_order_obj(
|
||||
order_id: int|str,
|
||||
inc_order_cfg: bool = False,
|
||||
inc_order_line_list: bool = False,
|
||||
inc_person: bool = False,
|
||||
inc_user: bool = False,
|
||||
enabled: str = 'enabled', # enabled, disabled, all
|
||||
limit: int = 1000,
|
||||
by_alias: bool = True,
|
||||
exclude_unset: bool = True,
|
||||
model_as_dict: bool = False,
|
||||
enabled: str = 'enabled', # enabled, disabled, all
|
||||
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.debug(locals())
|
||||
@@ -276,15 +277,16 @@ def load_order_obj(
|
||||
|
||||
|
||||
# ### BEGIN ### API Order Methods ### get_order_rec_list() ###
|
||||
# Updated 2021-11-19
|
||||
def get_order_rec_list(
|
||||
for_obj_type: str,
|
||||
for_obj_id: str,
|
||||
limit: int = 1000,
|
||||
enabled: str = 'enabled', # enabled, disabled, all
|
||||
from_datetime: datetime.datetime = None,
|
||||
to_datetime: datetime.datetime = None,
|
||||
# balance_gt: int = 0, # $0 to $99999
|
||||
status: str = 'closed', # started, in progress, complete, all
|
||||
balance_gt: int = 0, # $0 to $99999
|
||||
enabled: str = 'enabled', # enabled, disabled, all
|
||||
limit: int = 1000,
|
||||
) -> list|bool:
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
@@ -224,9 +224,9 @@ async def get_obj_id_order_list(
|
||||
status: str = 'closed', # open, locked, reopened?, closed (complete), canceled, other
|
||||
enabled: str = 'enabled',
|
||||
limit: int = 50,
|
||||
x_account_id: str = Header(..., min_length=11, max_length=22),
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
x_account_id: str = Header(..., min_length=11, max_length=22),
|
||||
response: Response = Response,
|
||||
):
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
@@ -239,27 +239,27 @@ async def get_obj_id_order_list(
|
||||
log.warning('Likely bad request')
|
||||
return mk_resp(data=False, status_code=400, response=response) # Bad Request
|
||||
|
||||
# Updated 2021-06-28
|
||||
# Updated 2021-11-19
|
||||
if order_rec_list_result := get_order_rec_list(
|
||||
for_obj_type = obj_type,
|
||||
for_obj_id = obj_id,
|
||||
limit = limit,
|
||||
enabled = enabled,
|
||||
from_datetime = from_datetime,
|
||||
to_datetime = to_datetime,
|
||||
status = status,
|
||||
enabled = enabled,
|
||||
limit = limit,
|
||||
):
|
||||
order_result_list = []
|
||||
for order_rec in order_rec_list_result:
|
||||
if load_order_result := load_order_obj(
|
||||
order_id = order_rec.get('order_id', None),
|
||||
limit = limit,
|
||||
inc_order_cfg = inc_order_cfg,
|
||||
inc_order_line_list = inc_order_line_list,
|
||||
enabled = enabled,
|
||||
limit = limit,
|
||||
by_alias = by_alias,
|
||||
exclude_unset = exclude_unset,
|
||||
# model_as_dict = model_as_dict,
|
||||
inc_order_cfg = inc_order_cfg,
|
||||
inc_order_line_list = inc_order_line_list,
|
||||
):
|
||||
order_result_list.append(load_order_result)
|
||||
else:
|
||||
|
||||
Reference in New Issue
Block a user