diff --git a/app/object_definitions/core.py b/app/object_definitions/core.py index dbf9a1b..bd02bbb 100644 --- a/app/object_definitions/core.py +++ b/app/object_definitions/core.py @@ -25,7 +25,8 @@ core_obj_li = { 'base_name': Activity_Log_Base, # V3 Search Security: 'searchable_fields': [ - 'activity_log_id_random', 'account_id_random', 'person_id_random', + 'id', 'account_id', 'person_id', 'user_id', + 'id_random', 'activity_log_id_random', 'account_id_random', 'person_id_random', 'user_id_random', 'external_client_id', 'name', 'description', 'source', 'url_root', 'url_full_path', 'object_type', 'object_id_random', 'action', 'action_with', 'action_on_type', @@ -66,7 +67,7 @@ core_obj_li = { 'base_name': Account_Cfg_Base, # V3 Search Security: 'searchable_fields': [ - 'id', 'account_id', 'account_cfg_id_random', 'account_id_random', 'account_code', + 'id', 'account_id', 'id_random', 'account_cfg_id_random', 'account_id_random', 'account_code', 'account_name', 'account_short_name', 'default_no_reply_email', 'default_no_reply_name', 'confirm_email', 'help_event_email', 'help_general_email', 'help_tech_email', 'stripe_account_id', @@ -87,7 +88,7 @@ core_obj_li = { 'base_name': Address_Base, # V3 Search Security: 'searchable_fields': [ - 'id', 'account_id', 'contact_id', 'address_id_random', 'account_id_random', + 'id', 'account_id', 'contact_id', 'id_random', 'address_id_random', 'account_id_random', 'for_type', 'for_id_random', 'contact_id_random', 'name', 'attention_to', 'organization_name', 'line_1', 'line_2', 'line_3', 'city', 'country_subdivision_code', 'country_subdivision_name', 'state_province', 'postal_code', @@ -109,7 +110,7 @@ core_obj_li = { 'base_name': Contact_Base, # V3 Search Security: 'searchable_fields': [ - 'id', 'account_id', 'contact_id_random', 'account_id_random', 'for_type', 'for_id_random', + 'id', 'account_id', 'id_random', 'contact_id_random', 'account_id_random', 'for_type', 'for_id_random', 'name', 'title', 'tagline', 'description', 'timezone_name', 'email', 'email_status', 'phone_mobile', 'phone_office', 'website_url', 'website_name', 'enable', 'hide', 'priority', 'sort', 'group', 'notes', 'created_on', 'updated_on' @@ -130,7 +131,7 @@ core_obj_li = { # V3 Search Security: 'searchable_fields': [ 'id', 'account_id', 'person_id', 'user_id', - 'data_store_id_random', 'account_id_random', 'for_type', 'for_id_random', + 'id_random', 'data_store_id_random', 'account_id_random', 'for_type', 'for_id_random', 'person_id_random', 'user_id_random', 'code', 'name', 'description', 'type', 'text', 'meta_text', 'access', 'enable', 'hide', 'priority', 'sort', 'group', 'notes', 'created_on', 'updated_on' @@ -151,7 +152,7 @@ core_obj_li = { # V3 Search Security: 'searchable_fields': [ 'id', 'account_id', 'contact_id', 'person_id', 'user_id', - 'organization_id_random', 'account_id_random', 'contact_id_random', + 'id_random', 'organization_id_random', 'account_id_random', 'contact_id_random', 'person_id_random', 'user_id_random', 'name', 'tagline', 'description', 'company', 'nonprofit', 'enable', 'hide', 'priority', 'sort', 'group', 'notes', 'created_on', 'updated_on' ], @@ -178,7 +179,7 @@ core_obj_li = { # V3 Search Security: 'searchable_fields': [ 'id', 'account_id', 'contact_id', 'organization_id', 'user_id', 'membership_person_id', - 'person_id_random', 'account_id_random', 'contact_id_random', + 'id_random', 'person_id_random', 'account_id_random', 'contact_id_random', 'organization_id_random', 'user_id_random', 'membership_person_id_random', 'title_names', 'given_name', 'middle_name', 'family_name', 'designations', 'professional_title', 'full_name', diff --git a/app/object_definitions/other.py b/app/object_definitions/other.py index 408187f..0909a30 100644 --- a/app/object_definitions/other.py +++ b/app/object_definitions/other.py @@ -33,9 +33,9 @@ other_obj_li = { ], # V3 Search Security: 'searchable_fields': [ - 'sponsorship_id_random', 'account_id_random', 'name', 'description', - 'website_url', 'level_str', 'enable', 'hide', 'priority', 'group', - 'created_on', 'updated_on' + 'id', 'account_id', 'id_random', 'sponsorship_id_random', 'account_id_random', + 'name', 'description', 'website_url', 'level_str', 'enable', 'hide', + 'priority', 'group', 'created_on', 'updated_on' ], }, 'sponsorship_cfg': { @@ -50,8 +50,9 @@ other_obj_li = { 'base_name': Sponsorship_Cfg_Base, # V3 Search Security: 'searchable_fields': [ - 'sponsorship_cfg_id_random', 'account_id_random', 'name', - 'description', 'enable', 'hide', 'priority', 'sort', 'group', 'notes', 'created_on', 'updated_on' + 'id', 'account_id', 'id_random', 'sponsorship_cfg_id_random', 'account_id_random', + 'name', 'description', 'enable', 'hide', 'priority', 'sort', 'group', + 'notes', 'created_on', 'updated_on' ], }, 'archive': { @@ -85,9 +86,10 @@ other_obj_li = { ], # V3 Search Security: 'searchable_fields': [ - 'archive_id_random', 'account_id_random', 'archive_type_id_random', - 'archive_type', 'name', 'description', 'filename', 'original_location', 'enable', - 'hide', 'priority', 'sort', 'group', 'notes', 'created_on', 'updated_on' + 'id', 'account_id', 'id_random', 'archive_id_random', 'account_id_random', + 'archive_type_id_random', 'archive_type', 'name', 'description', + 'filename', 'original_location', 'enable', 'hide', 'priority', + 'sort', 'group', 'notes', 'created_on', 'updated_on' ], }, 'archive_content': { @@ -105,7 +107,8 @@ other_obj_li = { 'public_read': True, # V3 Search Security: 'searchable_fields': [ - 'archive_content_id_random', 'account_id_random', 'archive_id_random', + 'id', 'account_id', 'archive_id', 'hosted_file_id', + 'id_random', 'archive_content_id_random', 'account_id_random', 'archive_id_random', 'archive_content_type', 'lu_media_type', 'name', 'description', 'filename', 'file_extension', 'original_location', 'original_url', 'enable', 'hide', 'priority', 'sort', 'group', 'notes', 'created_on', 'updated_on' @@ -136,7 +139,7 @@ other_obj_li = { ], # V3 Search Security: 'searchable_fields': [ - 'id', 'account_id', 'hosted_file_id_random', 'account_id_random', + 'id', 'account_id', 'id_random', 'hosted_file_id_random', 'account_id_random', 'hash_sha256', 'title', 'description', 'filename', 'extension', 'content_type', 'enable', 'hide', 'priority', 'sort', 'group', 'notes', 'created_on', 'updated_on' @@ -156,7 +159,7 @@ other_obj_li = { 'base_name': Hosted_File_Link_Base, # V3 Search Security: 'searchable_fields': [ - 'id', 'account_id', 'hosted_file_id', 'account_id_random', + 'id', 'account_id', 'hosted_file_id', 'id_random', 'account_id_random', 'hosted_file_id_random', 'link_to_type', 'link_to_id_random', 'created_on', 'updated_on' ], @@ -171,7 +174,8 @@ other_obj_li = { 'base_name': Stripe_Log_Base_In, # V3 Search Security: 'searchable_fields': [ - 'stripe_log_id_random', 'account_id_random', 'person_id_random', + 'id', 'account_id', 'person_id', 'user_id', 'event_id', 'order_id', + 'id_random', 'stripe_log_id_random', 'account_id_random', 'person_id_random', 'user_id_random', 'event_id_random', 'order_id_random', 'type', 'status', 'created_on', 'updated_on' ], @@ -188,7 +192,8 @@ other_obj_li = { 'base_name': Cont_Edu_Cert_Base, # V3 Search Security: 'searchable_fields': [ - 'cont_edu_cert_id_random', 'account_id_random', 'event_id_random', + 'id', 'account_id', 'event_id', + 'id_random', 'cont_edu_cert_id_random', 'account_id_random', 'event_id_random', 'name', 'description', 'code', 'enable', 'hide', 'priority', 'sort', 'group', 'notes', 'created_on', 'updated_on' ], @@ -205,7 +210,8 @@ other_obj_li = { 'base_name': Cont_Edu_Cert_Person_Base, # V3 Search Security: 'searchable_fields': [ - 'cont_edu_cert_person_id_random', 'cont_edu_cert_id_random', + 'id', 'cont_edu_cert_id', 'person_id', + 'id_random', 'cont_edu_cert_person_id_random', 'cont_edu_cert_id_random', 'person_id_random', 'enable', 'hide', 'priority', 'sort', 'group', 'notes', 'created_on', 'updated_on' ], @@ -222,9 +228,9 @@ other_obj_li = { 'base_name': Grant_Base, # V3 Search Security: 'searchable_fields': [ - 'grant_id_random', 'account_id_random', 'code', 'name', - 'description', 'enable', 'hide', 'priority', 'sort', 'group', 'notes', - 'created_on', 'updated_on' + 'id', 'account_id', 'id_random', 'grant_id_random', 'account_id_random', + 'code', 'name', 'description', 'enable', 'hide', 'priority', 'sort', + 'group', 'notes', 'created_on', 'updated_on' ], }, } diff --git a/tests/e2e/test_e2e_v3_registry_verify.py b/tests/e2e/test_e2e_v3_registry_verify.py new file mode 100644 index 0000000..4481502 --- /dev/null +++ b/tests/e2e/test_e2e_v3_registry_verify.py @@ -0,0 +1,72 @@ +import requests +import json +import sys + +# Configuration +BASE_URL = "https://dev-api.oneskyit.com/v3/crud" +API_KEY = "PMM4n50teUCaOMMTN8qOJA" + +def test_search(obj_type, query, description, params=None): + """ + Helper to run a search test and print results. + """ + print(f"--- Testing: {description} ---") + url = f"{BASE_URL}/{obj_type}/search" + + headers = { + "Content-Type": "application/json", + "X-Aether-API-Key": API_KEY, + "x-no-account-id": "bypass" + } + + try: + response = requests.post(url, headers=headers, json=query, params=params) + print(f"URL: {response.url}") + print(f"Status Code: {response.status_code}") + + data = response.json() + result_data = data.get('data') + + if response.status_code == 200: + if isinstance(result_data, list): + print(f"✅ Success: Found {len(result_data)} items.") + else: + print(f"✅ Success: Result type {type(result_data)}") + else: + print(f"❌ Failed: {data.get('status_message')}") + print(f" Details: {json.dumps(data.get('details', {}), indent=2)}") + + except Exception as e: + print(f"💥 Error: {e}") + print("-" * 40 + "\n") + +if __name__ == "__main__": + print(f"Starting Aether V3 Search Registry Verification\n") + + # 1. Standard Search + test_search("journal", {"q": "%"}, "Standard Search (Fulltext)") + + # 2. Test newly added searchable field: created_on + query_date = { + "and_filters": [ + {"field": "created_on", "op": "gt", "value": "2020-01-01"} + ] + } + test_search("journal", query_date, "Search via newly added field: created_on") + + # 3. Test newly added searchable field: id_random + # Get a valid ID first + res = requests.get(f"{BASE_URL}/journal/", headers={"X-Aether-API-Key": API_KEY, "x-no-account-id": "bypass"}, params={"limit": 1}) + if res.status_code == 200 and res.json().get("data"): + valid_id = res.json()["data"][0]["id"] + query_id = { + "and_filters": [ + {"field": "id_random", "op": "eq", "value": valid_id} + ] + } + test_search("journal", query_id, f"Search via newly added field: id_random ({valid_id})") + + # 4. Test Archive Content (Specialized Object) + test_search("archive_content", {"q": "%"}, "Archive Content Search") + + print("Tests Complete.")