A lot of code clean up! Also adding in Response everywhere...
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
import datetime, secrets
|
||||
from fastapi import APIRouter, Body, Depends, Header, HTTPException, Query, status
|
||||
from fastapi import APIRouter, Body, Depends, Header, HTTPException, Query, Response, status
|
||||
from pydantic import BaseModel, EmailStr, Field
|
||||
from typing import Dict, List, Optional, Set, Union
|
||||
|
||||
@@ -42,10 +42,15 @@ async def post_event_person_new(
|
||||
inc_user: bool = False,
|
||||
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(event_person_new_init)
|
||||
log.debug(vars(event_person_new_init))
|
||||
log.debug(dir(event_person_new_init))
|
||||
|
||||
account_id_random = event_person_new_init.account_id_random
|
||||
event_id_random = event_person_new_init.event_id_random
|
||||
|
||||
@@ -57,6 +62,7 @@ async def post_event_person_new(
|
||||
full_name = f'{given_name} {family_name}'
|
||||
elif given_name:
|
||||
full_name = f'{given_name}'
|
||||
display_name = event_person_new_init.person_display_name
|
||||
email = event_person_new_init.email
|
||||
|
||||
if new_password := event_person_new_init.new_password:
|
||||
@@ -72,6 +78,7 @@ async def post_event_person_new(
|
||||
person_new['given_name'] = given_name
|
||||
person_new['family_name'] = family_name
|
||||
person_new['full_name'] = full_name
|
||||
person_new['display_name'] = display_name
|
||||
person_new['organization_name'] = organization_name
|
||||
|
||||
# New person contact
|
||||
@@ -88,6 +95,8 @@ async def post_event_person_new(
|
||||
person_obj_new = Person_Base(**person_new)
|
||||
log.debug(person_obj_new)
|
||||
|
||||
return mk_resp(data=False, status_code=401) # TESTING TESTING TESTING
|
||||
|
||||
create_person_obj_result = create_person_obj(person_obj_new=person_obj_new)
|
||||
if isinstance(create_person_obj_result, int):
|
||||
person_id = create_person_obj_result
|
||||
@@ -109,9 +118,9 @@ async def post_event_person_new(
|
||||
user_new['name'] = full_name
|
||||
user_new['username'] = email
|
||||
user_new['email'] = email
|
||||
user_new['new_password'] = new_password
|
||||
user_new['contact_id_random'] = person_obj.contact.id_random
|
||||
user_new['person_id_random'] = person_obj.id_random
|
||||
user_new['new_password'] = new_password # The string will be turned into a secure hash and stored in user.password.
|
||||
# user_new['contact_id_random'] = person_obj.contact.id_random # REMOVE: No longer used
|
||||
# user_new['person_id_random'] = person_obj.id_random # REMOVE: No longer used
|
||||
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(user_new)
|
||||
@@ -217,6 +226,7 @@ async def patch_event_person_json(
|
||||
exclude: Optional[list] = [],
|
||||
exclude_unset: Optional[bool] = True,
|
||||
exclude_none: Optional[bool] = True,
|
||||
response: Response = Response,
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -268,6 +278,7 @@ async def get_event_person_obj(
|
||||
x_account_id: str = Header(...),
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
response: Response = Response,
|
||||
):
|
||||
log.setLevel(logging.DEBUG) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
@@ -328,6 +339,7 @@ async def get_person_event_person_obj_li(
|
||||
x_account_id: str = Header(...),
|
||||
by_alias: Optional[bool] = True,
|
||||
exclude_unset: Optional[bool] = True,
|
||||
response: Response = Response,
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
Reference in New Issue
Block a user