Updates to presenter for new fields with JSON
This commit is contained in:
@@ -31,8 +31,9 @@ def get_token_header(x_token: str = Header(...)):
|
|||||||
class Common_Route_Params_No_Account_ID:
|
class Common_Route_Params_No_Account_ID:
|
||||||
def __init__(
|
def __init__(
|
||||||
self,
|
self,
|
||||||
x_account_id: int = None,
|
x_account_id: int|None = None,
|
||||||
x_account_id_random: str = None,
|
x_account_id_random: str|None = None,
|
||||||
|
x_no_account_id_token: str|None = None,
|
||||||
enabled: str = 'enabled',
|
enabled: str = 'enabled',
|
||||||
limit: int = 10,
|
limit: int = 10,
|
||||||
offset: int = 0,
|
offset: int = 0,
|
||||||
@@ -42,6 +43,7 @@ class Common_Route_Params_No_Account_ID:
|
|||||||
):
|
):
|
||||||
self.x_account_id = x_account_id
|
self.x_account_id = x_account_id
|
||||||
self.x_account_id_random = x_account_id_random
|
self.x_account_id_random = x_account_id_random
|
||||||
|
self.x_no_account_id_token = x_no_account_id_token
|
||||||
self.enabled = enabled
|
self.enabled = enabled
|
||||||
self.limit = limit
|
self.limit = limit
|
||||||
self.offset = offset
|
self.offset = offset
|
||||||
@@ -143,7 +145,7 @@ def common_route_params(
|
|||||||
# include: Optional[list] = [], # Leaving this and exclude commented out
|
# include: Optional[list] = [], # Leaving this and exclude commented out
|
||||||
response: Response = Response,
|
response: Response = Response,
|
||||||
log_lvl: int = logging.INFO, # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
log_lvl: int = logging.INFO, # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||||
) -> Common_Route_Params:
|
) -> Common_Route_Params|Common_Route_Params_No_Account_ID:
|
||||||
log.setLevel(log_lvl)
|
log.setLevel(log_lvl)
|
||||||
log.debug(locals())
|
log.debug(locals())
|
||||||
|
|
||||||
@@ -160,7 +162,7 @@ def common_route_params(
|
|||||||
elif x_no_account_id and len(x_no_account_id) > 10:
|
elif x_no_account_id and len(x_no_account_id) > 10:
|
||||||
log.warning(f'Found the x_no_account_id header param with the value: {x_no_account_id}')
|
log.warning(f'Found the x_no_account_id header param with the value: {x_no_account_id}')
|
||||||
|
|
||||||
x_account_id = 0
|
x_account_id = None
|
||||||
x_account_id_random = '--- NOT SET ---'
|
x_account_id_random = '--- NOT SET ---'
|
||||||
|
|
||||||
elif x_no_account_id_token and len(x_no_account_id_token) > 10: # NOTE: Not a header value!
|
elif x_no_account_id_token and len(x_no_account_id_token) > 10: # NOTE: Not a header value!
|
||||||
@@ -180,7 +182,10 @@ def common_route_params(
|
|||||||
log.warning(f'The x-account-id and x-no-account-id-token headers were not found.')
|
log.warning(f'The x-account-id and x-no-account-id-token headers were not found.')
|
||||||
raise HTTPException(status_code=403, detail='The x-account-id and x-no-account-id-token headers were not found.') # Forbidden
|
raise HTTPException(status_code=403, detail='The x-account-id and x-no-account-id-token headers were not found.') # Forbidden
|
||||||
|
|
||||||
commons = Common_Route_Params( x_account_id=x_account_id, x_account_id_random=x_account_id_random, x_no_account_id_token=x_no_account_id_token, limit=limit, offset=offset, enabled=enabled, by_alias=by_alias, exclude_unset=exclude_unset, response=response )
|
if x_account_id:
|
||||||
|
commons = Common_Route_Params( x_account_id=x_account_id, x_account_id_random=x_account_id_random, x_no_account_id_token=x_no_account_id_token, limit=limit, offset=offset, enabled=enabled, by_alias=by_alias, exclude_unset=exclude_unset, response=response )
|
||||||
|
else:
|
||||||
|
commons = Common_Route_Params_No_Account_ID( x_account_id=None, x_account_id_random=None, x_no_account_id_token=x_no_account_id_token, limit=limit, offset=offset, enabled=enabled, by_alias=by_alias, exclude_unset=exclude_unset, response=response )
|
||||||
|
|
||||||
log.debug(commons)
|
log.debug(commons)
|
||||||
|
|
||||||
|
|||||||
@@ -90,18 +90,27 @@ class Event_Presenter_Base(BaseModel):
|
|||||||
website_url: Optional[str]
|
website_url: Optional[str]
|
||||||
|
|
||||||
phone_li_json: Optional[Union[Json, None]]
|
phone_li_json: Optional[Union[Json, None]]
|
||||||
|
|
||||||
|
# For social media in a JSON object format. The Aether standard field names should be used. Examples: url, url_text, icon, etc.
|
||||||
social_li_json: Optional[Union[Json, None]]
|
social_li_json: Optional[Union[Json, None]]
|
||||||
|
|
||||||
tagline: Optional[str]
|
tagline: Optional[str]
|
||||||
biography: Optional[str]
|
biography: Optional[str]
|
||||||
|
|
||||||
picture_path: Optional[str]
|
picture_path: Optional[str] # Start using image_li_json instead
|
||||||
picture_bg_color: Optional[str]
|
picture_bg_color: Optional[str]
|
||||||
|
|
||||||
|
# For image files only in a JSON object format. The Aether standard field names should be used. Examples: url, url_text, alt_text, width, height, size (in bytes), etc.
|
||||||
|
image_li_json: Optional[Union[Json, None]] # "headshot" is probably the most common
|
||||||
|
# media_li_json: Optional[Union[Json, None]]
|
||||||
|
|
||||||
role: Optional[str]
|
role: Optional[str]
|
||||||
|
|
||||||
file_count: Optional[int]
|
file_count: Optional[int]
|
||||||
|
|
||||||
|
# Comments from the presenter. This is for internal use only.
|
||||||
|
comments: Optional[str]
|
||||||
|
|
||||||
enable: Optional[bool]
|
enable: Optional[bool]
|
||||||
enable_from: Optional[datetime.datetime] = None
|
enable_from: Optional[datetime.datetime] = None
|
||||||
enable_to: Optional[datetime.datetime] = None
|
enable_to: Optional[datetime.datetime] = None
|
||||||
|
|||||||
@@ -42,7 +42,7 @@ class Sponsorship_Base(BaseModel):
|
|||||||
person_json: Optional[Union[Json, None]]
|
person_json: Optional[Union[Json, None]]
|
||||||
poc_json: Optional[Union[Json, None]]
|
poc_json: Optional[Union[Json, None]]
|
||||||
|
|
||||||
# For additional contacts in a JSON object list format. A contact person should contain: given_name, family_name, full_name, email, phone, etc.
|
# For additional contacts in a JSON object list (array) format. A contact person should contain: given_name, family_name, full_name, email, phone, etc.
|
||||||
contact_li_json: Optional[Union[Json, None]]
|
contact_li_json: Optional[Union[Json, None]]
|
||||||
|
|
||||||
# For the logo and image in a JSON object format. The Aether standard field names should be used. Examples: url, url_text, alt_text, width, height, etc.
|
# For the logo and image in a JSON object format. The Aether standard field names should be used. Examples: url, url_text, alt_text, width, height, etc.
|
||||||
@@ -54,7 +54,7 @@ class Sponsorship_Base(BaseModel):
|
|||||||
# For social media in a JSON object format. The Aether standard field names should be used. Examples: url, url_text, icon, etc.
|
# For social media in a JSON object format. The Aether standard field names should be used. Examples: url, url_text, icon, etc.
|
||||||
social_li_json: Optional[Union[Json, None]]
|
social_li_json: Optional[Union[Json, None]]
|
||||||
|
|
||||||
# For a (simple and short) guest list in a JSON object list format. A guest person should contain: given_name, family_name, full_name, title, affiliations, email, phone, assistance, dietry, etc.
|
# For a (simple and short) guest list in a JSON object list (array) format. A guest person should contain: given_name, family_name, full_name, title, affiliations, email, phone, assistance, dietry, etc.
|
||||||
# Example: [{"given_name": "John", "family_name": "Doe", "full_name": "John Doe", "email": "john.doe@example.com"}, {"given_name": "Jane", "family_name": "Doe", "full_name": "Jane Doe", "email": "jane.doe@example.com"}]
|
# Example: [{"given_name": "John", "family_name": "Doe", "full_name": "John Doe", "email": "john.doe@example.com"}, {"given_name": "Jane", "family_name": "Doe", "full_name": "Jane Doe", "email": "jane.doe@example.com"}]
|
||||||
# Example 2: [{"full_name": "Albert Einstein", "email": "albert.einstein@example.com"}, {"full_name": "Marie Curie", "email": "marie.curie@example.com"}]
|
# Example 2: [{"full_name": "Albert Einstein", "email": "albert.einstein@example.com"}, {"full_name": "Marie Curie", "email": "marie.curie@example.com"}]
|
||||||
guest_li_json: Optional[Union[Json, None]]
|
guest_li_json: Optional[Union[Json, None]]
|
||||||
|
|||||||
@@ -470,7 +470,7 @@ async def get_obj(
|
|||||||
|
|
||||||
if use_alt_base:
|
if use_alt_base:
|
||||||
base_name = obj_type_li[obj_name]['base_name_alt']
|
base_name = obj_type_li[obj_name]['base_name_alt']
|
||||||
log.setLevel(logging.DEBUG)
|
# log.setLevel(logging.DEBUG)
|
||||||
log.debug(debug_data)
|
log.debug(debug_data)
|
||||||
else:
|
else:
|
||||||
base_name = obj_type_li[obj_name]['base_name']
|
base_name = obj_type_li[obj_name]['base_name']
|
||||||
|
|||||||
Reference in New Issue
Block a user