Working on general POST, PATCH, SELECT list, SELECT, and DELETE template functions.
This commit is contained in:
@@ -18,7 +18,7 @@ from ..models.response_model import *
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
@router.post('')
|
||||
@router.post('', response_model=Resp_Body_Base)
|
||||
async def post_address_obj(
|
||||
obj: Address_Base,
|
||||
x_account_id: str = Header(...),
|
||||
@@ -41,11 +41,11 @@ async def post_address_obj(
|
||||
return result
|
||||
|
||||
|
||||
@router.patch('/{obj_id}')
|
||||
@router.patch('/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def patch_address_obj(
|
||||
obj_id: str = Query(None, min_length=1, max_length=22),
|
||||
obj: Address_Base,
|
||||
x_account_id: str = Header(...),
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
obj: Address_Base = None,
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
return_obj: Optional[bool] = True,
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
@@ -68,7 +68,7 @@ async def patch_address_obj(
|
||||
return result
|
||||
|
||||
|
||||
@router.get('/list')
|
||||
@router.get('/list', response_model=Resp_Body_Base)
|
||||
async def get_address_obj_li(
|
||||
for_obj_type: Optional[str] = Query(None, min_length=2, max_length=50),
|
||||
for_obj_id: Optional[str] = Query(None, min_length=1, max_length=22),
|
||||
@@ -90,9 +90,9 @@ async def get_address_obj_li(
|
||||
return result
|
||||
|
||||
|
||||
@router.get('/{obj_id}')
|
||||
@router.get('/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def get_address_obj(
|
||||
obj_id: str = Query(None, min_length=1, max_length=22),
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
x_account_id: str = Header(...),
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
@@ -101,7 +101,6 @@ async def get_address_obj(
|
||||
log.debug(locals())
|
||||
|
||||
obj_type = 'address'
|
||||
#obj_id = redis_lookup_id_random(record_id_random=obj_id, table_name=obj_type)
|
||||
result = get_obj_template(
|
||||
obj_type=obj_type,
|
||||
obj_id=obj_id,
|
||||
@@ -111,16 +110,15 @@ async def get_address_obj(
|
||||
return result
|
||||
|
||||
|
||||
@router.delete('/{obj_id}')
|
||||
@router.delete('/{obj_id}', response_model=Resp_Body_Base)
|
||||
async def delete_address_obj(
|
||||
obj_id: str = Query(None, min_length=1, max_length=22),
|
||||
obj_id: str = Query(..., min_length=1, max_length=22),
|
||||
x_account_id: str = Header(...),
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
obj_type = 'address'
|
||||
#obj_id = redis_lookup_id_random(record_id_random=obj_id, table_name=obj_type)
|
||||
result = delete_obj_template(
|
||||
obj_type=obj_type,
|
||||
obj_id=obj_id,
|
||||
|
||||
Reference in New Issue
Block a user