Clean up of Cvent and IDAA person and membership related. The person.status only matters if it is Pending.
This commit is contained in:
@@ -9,21 +9,36 @@ from app.db_sql import sql_insert, sql_update, sql_insert_or_update, sql_select,
|
||||
|
||||
from app.routers.api_crud import delete_obj_template, get_obj_template, get_obj_li_template, patch_obj_template, post_obj_template
|
||||
|
||||
from app.methods.c_idaa_methods import refresh_person_group
|
||||
|
||||
from app.models.response_models import Resp_Body_Base, mk_resp
|
||||
|
||||
|
||||
router = APIRouter()
|
||||
|
||||
|
||||
# ### BEGIN ### API Client: IDAA ### refresh_membership_status() ###
|
||||
# Updated 2022-02-01
|
||||
# ### BEGIN ### API Client: IDAA ### r_refresh_membership_status() ###
|
||||
# Updated 2022-03-16
|
||||
@router.get('/refresh_membership_status', response_model=Resp_Body_Base)
|
||||
async def refresh_membership_status(
|
||||
async def r_refresh_membership_status(
|
||||
person_id: str = Query(None, min_length=11, max_length=22),
|
||||
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
):
|
||||
log.setLevel(logging.INFO) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
if person_id := redis_lookup_id_random(record_id_random=person_id, table_name='person'): pass
|
||||
elif person_id is None: pass
|
||||
else: return mk_resp(data=None, status_code=404, response=commons.response) # Not Found
|
||||
|
||||
if refresh_person_group_result := refresh_person_group(person_id=person_id):
|
||||
return mk_resp(data=True, status_message='Updated person records with current membership status group.', response=commons.response)
|
||||
else:
|
||||
return mk_resp(data=True, status_code=400, status_message='Person records were not updated with the current membership status group.', response=commons.response) # Bad Request
|
||||
|
||||
# NOTE: Everything below is old
|
||||
|
||||
# sql = f"""
|
||||
# UPDATE user
|
||||
# INNER JOIN person ON user.id = person.user_id
|
||||
@@ -170,4 +185,4 @@ async def refresh_membership_status(
|
||||
log.warning(f'The SQL UPDATE of person table records failed for not members')
|
||||
|
||||
return mk_resp(data=True, status_message='Updated person and user records with current membership status', response=commons.response)
|
||||
# ### END ### API Client: IDAA ### refresh_membership_status() ###
|
||||
# ### END ### API Client: IDAA ### r_refresh_membership_status() ###
|
||||
|
||||
@@ -200,6 +200,12 @@ async def get_person_w_email(
|
||||
email: str = Query(..., min_length=5, max_length=75),
|
||||
person_id: str = Query(None, min_length=11, max_length=22),
|
||||
|
||||
inc_address: bool = False,
|
||||
inc_contact: bool = False,
|
||||
inc_user: bool = False,
|
||||
inc_user_role_list: bool = False,
|
||||
return_obj: bool = True,
|
||||
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
):
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
@@ -230,6 +236,7 @@ async def get_person_w_email(
|
||||
cvent_contact_obj = cvent_person_contact_obj,
|
||||
account_id = account_id,
|
||||
person_id = person_id,
|
||||
idaa_refresh_person_group = True,
|
||||
):
|
||||
# person_obj = create_update_aether_person_result
|
||||
person_id = create_update_aether_person_result
|
||||
@@ -271,7 +278,7 @@ async def get_person_w_external_id(
|
||||
inc_contact: bool = False,
|
||||
inc_user: bool = False,
|
||||
inc_user_role_list: bool = False,
|
||||
return_obj: Optional[bool] = True,
|
||||
return_obj: bool = True,
|
||||
|
||||
commons: Common_Route_Params = Depends(common_route_params),
|
||||
):
|
||||
@@ -302,6 +309,7 @@ async def get_person_w_external_id(
|
||||
cvent_contact_obj = cvent_person_contact_obj,
|
||||
account_id = account_id,
|
||||
person_id = person_id,
|
||||
idaa_refresh_person_group = True,
|
||||
):
|
||||
# person_obj = create_update_aether_person_result
|
||||
person_id = create_update_aether_person_result
|
||||
|
||||
Reference in New Issue
Block a user