Work on better way to update objects. A lot of work!
This commit is contained in:
@@ -70,6 +70,43 @@ async def patch_event_presentation_obj(
|
||||
return result
|
||||
|
||||
|
||||
# ### BEGIN ### API Event Presentation ### patch_event_presentation_json() ###
|
||||
@router.patch('/{event_presentation_id}/json', response_model=Resp_Body_Base)
|
||||
async def patch_event_presentation_json(
|
||||
event_presentation_obj: Event_Presentation_Base,
|
||||
event_presentation_id: str = Query(..., min_length=1, max_length=22),
|
||||
create_missing_obj: bool = False,
|
||||
x_account_id: Optional[str] = Header(..., ),
|
||||
return_obj: Optional[bool] = True,
|
||||
by_alias: Optional[bool] = True,
|
||||
include: Optional[list] = [],
|
||||
exclude: Optional[list] = [],
|
||||
exclude_unset: Optional[bool] = True,
|
||||
exclude_none: Optional[bool] = True,
|
||||
):
|
||||
log.setLevel(logging.WARNING) # DEBUG, INFO, WARNING, ERROR, EXCEPTION, CRITICAL
|
||||
log.debug(locals())
|
||||
|
||||
if event_presentation_id := redis_lookup_id_random(record_id_random=event_presentation_id, table_name='event_presentation'): pass
|
||||
else:
|
||||
return mk_resp(data=None, status_code=404)
|
||||
|
||||
if event_presentation_obj_up_result := update_event_presentation_obj(
|
||||
event_presentation_id=event_presentation_id,
|
||||
event_presentation_obj_up=event_presentation_obj,
|
||||
create_missing_obj=create_missing_obj,
|
||||
):
|
||||
|
||||
log.debug(event_presentation_obj_up_result)
|
||||
if return_obj:
|
||||
event_presentation_obj = load_event_presentation_obj(event_presentation_id=event_presentation_id)
|
||||
event_presentation_dict = event_presentation_obj.dict(by_alias=by_alias, exclude_unset=exclude_unset)
|
||||
return mk_resp(data=event_presentation_dict)
|
||||
else:
|
||||
return mk_resp(data=event_presentation_obj_up_result)
|
||||
else:
|
||||
return mk_resp(data=False, status_code=400) # Bad Request
|
||||
# ### END ### API Event Presentation ### patch_event_presentation_json() ###
|
||||
|
||||
|
||||
# ### BEGIN ### API Event Presentation ### get_event_presentation_obj() ###
|
||||
|
||||
Reference in New Issue
Block a user