Update V3 CRUD router and object definitions.
- Added 'external_person_id' to Post searchable fields. - Updated api_crud_v3.py to respect 'fields_to_exclude_from_db' model attribute. - Cleaned up old verification scripts (moved to tests/).
This commit is contained in:
@@ -432,6 +432,12 @@ async def post_obj(
|
||||
for k in keys_to_remove:
|
||||
del data_to_insert[k]
|
||||
|
||||
# Filter out model-specific excluded fields (e.g., view-only fields like person_full_name in Journal)
|
||||
if hasattr(input_model, 'fields_to_exclude_from_db'):
|
||||
for k in input_model.fields_to_exclude_from_db:
|
||||
if k in data_to_insert:
|
||||
del data_to_insert[k]
|
||||
|
||||
if sql_insert_result := sql_insert(data=data_to_insert, table_name=table_name_insert):
|
||||
new_obj_id = sql_insert_result
|
||||
new_obj_id_random = get_id_random(record_id=new_obj_id, table_name=obj_name)
|
||||
@@ -489,6 +495,12 @@ async def patch_obj(
|
||||
for k in keys_to_remove:
|
||||
del obj_data[k]
|
||||
|
||||
# Filter out model-specific excluded fields (e.g., view-only fields like person_full_name in Journal)
|
||||
if hasattr(input_model, 'fields_to_exclude_from_db'):
|
||||
for k in input_model.fields_to_exclude_from_db:
|
||||
if k in obj_data:
|
||||
del obj_data[k]
|
||||
|
||||
if sql_update(data=obj_data, table_name=table_name_update, record_id=record_id):
|
||||
if return_obj:
|
||||
if sql_select_result := sql_select(table_name=table_name_select, record_id=record_id):
|
||||
|
||||
Reference in New Issue
Block a user