Working on event person, registration, badge, session, presentation, and presenter create and update. _v3 things
This commit is contained in:
@@ -11,7 +11,7 @@ from app.routers.api_crud import delete_obj_template, get_obj_template, get_obj_
|
||||
|
||||
# from app.methods.membership_person_methods import load_membership_person_obj
|
||||
from app.methods.order_methods import get_order_rec_list, load_order_obj
|
||||
from app.methods.person_methods import create_person_obj_v3, create_update_person_obj, get_person_rec_list, get_person_rec_w_external_id, load_person_obj, update_person_obj
|
||||
from app.methods.person_methods import create_person_obj_v3, create_update_person_obj, get_person_rec_list, get_person_rec_w_external_id, load_person_obj, update_person_obj, update_person_obj_v3
|
||||
|
||||
from app.models.person_models import Person_Base
|
||||
from app.models.response_models import Resp_Body_Base, mk_resp
|
||||
@@ -74,23 +74,35 @@ async def patch_person_obj(
|
||||
|
||||
# ### BEGIN ### API Person ### post_person_obj_new_v3() ###
|
||||
# Updated 2021-08-24
|
||||
@router.post('/new_v3', response_model=Resp_Body_Base)
|
||||
@router.post('/person/new_v3', response_model=Resp_Body_Base)
|
||||
async def post_person_obj_new_v3(
|
||||
person_obj: Person_Base,
|
||||
create_sub_obj: bool = False,
|
||||
fail_any: bool = True, # Fail if any thing goes wrong for sub objects
|
||||
enabled: str = 'enabled', # For now this covers any included objects or object lists
|
||||
inc_address: bool = False, # Priority l1
|
||||
inc_contact: bool = False, # Priority l1
|
||||
inc_user: bool = False, # Priority l1
|
||||
x_account_id: str = Header(...),
|
||||
return_obj: bool = True,
|
||||
by_alias: bool = True,
|
||||
exclude_unset: bool = True,
|
||||
response: Response = Response,
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
log.debug(person_obj.account_id)
|
||||
log.debug(person_obj.account_id_random)
|
||||
|
||||
# if person_obj.account_id: pass
|
||||
# else: return mk_resp(data=False, status_code=500, response=response, status_message='Testing')
|
||||
|
||||
# abort(501)
|
||||
|
||||
# There should probably be a check for the account ID before calling the create function?
|
||||
if create_person_obj_result := create_person_obj_v3(
|
||||
account_id = person_obj.account_id,
|
||||
account_id = x_account_id,
|
||||
person_obj_new = person_obj,
|
||||
create_sub_obj = create_sub_obj,
|
||||
fail_any = fail_any
|
||||
@@ -100,7 +112,13 @@ async def post_person_obj_new_v3(
|
||||
if isinstance(create_person_obj_result, int):
|
||||
person_id = create_person_obj_result
|
||||
if return_obj:
|
||||
if load_person_obj_result := load_person_obj(person_id=person_id):
|
||||
if load_person_obj_result := load_person_obj(
|
||||
person_id=person_id,
|
||||
enabled = enabled,
|
||||
inc_address = inc_address,
|
||||
inc_contact = inc_contact,
|
||||
inc_user = inc_user,
|
||||
):
|
||||
data = load_person_obj_result
|
||||
else:
|
||||
data = False
|
||||
@@ -118,7 +136,7 @@ async def post_person_obj_new_v3(
|
||||
|
||||
# ### BEGIN ### API Person ### patch_person_obj_exist_v3() ###
|
||||
# Updated 2021-08-24
|
||||
@router.patch('/{person_id}/exist_v3', response_model=Resp_Body_Base)
|
||||
@router.patch('/person/{person_id}/exist_v3', response_model=Resp_Body_Base)
|
||||
async def patch_person_obj_exist_v3(
|
||||
person_obj: Person_Base,
|
||||
person_id: str = Query(..., min_length=11, max_length=22),
|
||||
|
||||
Reference in New Issue
Block a user