General clean up

This commit is contained in:
Scott Idem
2023-01-30 15:06:02 -05:00
parent 536c4c4732
commit db58d9267c
3 changed files with 103 additions and 25 deletions

View File

@@ -4,7 +4,7 @@ from fastapi import APIRouter, Body, Depends, Header, HTTPException, Query, Resp
from pydantic import BaseModel, EmailStr, Field
from typing import Dict, List, Optional, Set, Union
from app.lib_general import log, logging, common_route_params, Common_Route_Params
from app.lib_general import log, logging, common_route_params, Common_Route_Params, common_route_params_no_account_id, Common_Route_Params_No_Account_ID
from app.config import settings
from app.db_sql import sql_enable_part, sql_insert, sql_update, sql_insert_or_update, sql_limit_offset_part, sql_select, sql_delete, redis_lookup_id_random
@@ -23,8 +23,9 @@ async def get_aether_cfg_obj(
# aether_cfg_id: str = Query(..., min_length=1, max_length=22),
# commons: Common_Route_Params = Depends(common_route_params),
x_account_id: str = Header(None, min_length=11, max_length=22),
response: Response = Response,
commons: Common_Route_Params_No_Account_ID = Depends(common_route_params_no_account_id),
# x_account_id: str = Header(None, min_length=11, max_length=22),
# response: Response = Response,
):
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
@@ -35,9 +36,9 @@ async def get_aether_cfg_obj(
as_list = False,
max_count = 1,
):
return mk_resp(data=sql_select_result)
return mk_resp(data=sql_select_result, response=commons.response)
else:
return mk_resp(data=None, status_code=404)
return mk_resp(data=None, status_code=404, response=commons.response)
@router.get('/aether/flask/cfg/{aether_flask_cfg_id}', response_model=Resp_Body_Base)
@@ -45,11 +46,11 @@ async def get_aether_flask_cfg_obj(
aether_flask_cfg_id: int,
# aether_flask_cfg_id: str = Query(..., min_length=1, max_length=22),
# NOTE: The x_account_id header value is not required.
# commons: Common_Route_Params = Depends(common_route_params),
x_account_id: str = Header(None, min_length=11, max_length=22),
response: Response = Response,
commons: Common_Route_Params_No_Account_ID = Depends(common_route_params_no_account_id),
):
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
if sql_select_result := sql_select(
@@ -58,6 +59,6 @@ async def get_aether_flask_cfg_obj(
as_list = False,
max_count = 1,
):
return mk_resp(data=sql_select_result)
return mk_resp(data=sql_select_result, response=commons.response)
else:
return mk_resp(data=None, status_code=404)
return mk_resp(data=None, status_code=404, response=commons.response)