Working on user log in and person object

This commit is contained in:
Scott Idem
2021-04-06 17:59:44 -04:00
parent 3aa3fd8ae7
commit a3403109ae
7 changed files with 165 additions and 17 deletions

View File

@@ -12,6 +12,7 @@ from app.db_sql import *
from .api_crud import delete_obj_template, get_obj_template, get_obj_li_template, patch_obj_template, post_obj_template
from ..models.person_model import Person_Base
from ..models.person_methods import load_person_obj
from ..models.response_model import *
@@ -94,20 +95,30 @@ async def get_person_obj_li(
async def get_person_obj(
obj_id: str = Query(..., min_length=1, max_length=22),
x_account_id: str = Header(...),
inc_contact: bool = False,
inc_organization: bool = False,
by_alias: Optional[bool] = True,
exclude_unset: Optional[bool] = True,
):
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
log.debug(locals())
obj_type = 'person'
result = get_obj_template(
obj_type=obj_type,
obj_id=obj_id,
by_alias=True,
exclude_unset=True,
)
return result
user_obj = load_person_obj(
person_id=obj_id,
inc_contact=inc_contact,
inc_organization=inc_organization,
).dict(by_alias=by_alias, exclude_unset=exclude_unset)
data = user_obj
return mk_resp(data=user_obj)
# obj_type = 'person'
# result = get_obj_template(
# obj_type=obj_type,
# obj_id=obj_id,
# by_alias=True,
# exclude_unset=True,
# )
# return result
@router.delete('/{obj_id}', response_model=Resp_Body_Base)