Cleanup: Remove ae_object_info.py from local root after relocation.
This commit is contained in:
@@ -1,108 +0,0 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import os
|
||||
import json
|
||||
import argparse
|
||||
|
||||
# Setup Path
|
||||
API_ROOT = "/home/scott/OSIT_dev/aether_api_fastapi"
|
||||
sys.path.append(API_ROOT)
|
||||
|
||||
# Object Status Categories
|
||||
CATEGORIES = {
|
||||
"IN_USE": [
|
||||
"account", "site", "site_domain", "person", "user", "event",
|
||||
"event_person", "event_registration", "event_badge", "event_badge_template",
|
||||
"event_presentation", "event_presenter", "event_track", "event_location",
|
||||
"event_file", "event_device", "journal", "journal_entry", "post",
|
||||
"post_comment", "archive", "archive_content", "activity_log",
|
||||
"data_store", "hosted_file", "organization", "address", "contact"
|
||||
],
|
||||
"LEGACY": ["log_client_viewing", "user_role"],
|
||||
"SPECIAL": ["lu_country", "lu_country_subdivision", "lu_time_zone", "hosted_file_link"],
|
||||
"CFG": ["account_cfg", "event_cfg", "membership_cfg", "fundraising_cfg", "order_cfg", "sponsorship_cfg"],
|
||||
"INACTIVE": ["event_exhibit", "event_exhibit_tracking", "event_person_tracking"]
|
||||
}
|
||||
|
||||
def get_category(obj_type):
|
||||
for cat, items in CATEGORIES.items():
|
||||
if obj_type in items:
|
||||
return cat
|
||||
return "UNKNOWN"
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description="AE Object Discovery Tool")
|
||||
parser.add_argument("command", choices=["list", "get", "search"], help="Command to run")
|
||||
parser.add_argument("query", nargs="?", help="Object type or search term")
|
||||
args = parser.parse_args()
|
||||
|
||||
try:
|
||||
from app.ae_obj_types_def import obj_type_kv_li
|
||||
except ImportError as e:
|
||||
print(f"Error: Could not import Aether API definitions. {e}")
|
||||
sys.exit(1)
|
||||
|
||||
if args.command == "list":
|
||||
for cat, items in CATEGORIES.items():
|
||||
print(f"\n### {cat} ###")
|
||||
for item in sorted(items):
|
||||
if item in obj_type_kv_li:
|
||||
print(f" - {item}")
|
||||
|
||||
# Check for ones not in our CATEGORIES mapping
|
||||
unknowns = [obj for obj in obj_type_kv_li if get_category(obj) == "UNKNOWN"]
|
||||
if unknowns:
|
||||
print(f"\n### UNMAPPED ###")
|
||||
for item in sorted(unknowns):
|
||||
print(f" - {item}")
|
||||
|
||||
elif args.command == "get":
|
||||
if not args.query:
|
||||
print("Error: Please specify an object type.")
|
||||
sys.exit(1)
|
||||
|
||||
obj_type = args.query
|
||||
if obj_type in obj_type_kv_li:
|
||||
def_kv = obj_type_kv_li[obj_type]
|
||||
model = def_kv.get('mdl')
|
||||
fields = []
|
||||
if model and hasattr(model, '__fields__'):
|
||||
fields = list(model.__fields__.keys())
|
||||
|
||||
info = {
|
||||
"object_type": obj_type,
|
||||
"category": get_category(obj_type),
|
||||
"table": def_kv.get('tbl'),
|
||||
"view": def_kv.get('tbl_default'),
|
||||
"searchable_fields": def_kv.get('searchable_fields', []),
|
||||
"model_fields": fields
|
||||
}
|
||||
print(json.dumps(info, indent=2))
|
||||
else:
|
||||
print(f"Error: Object type '{obj_type}' not found.")
|
||||
|
||||
elif args.command == "search":
|
||||
if not args.query:
|
||||
print("Error: Please specify a search term.")
|
||||
sys.exit(1)
|
||||
|
||||
term = args.query.lower()
|
||||
results = []
|
||||
for obj_type, def_kv in obj_type_kv_li.items():
|
||||
if term in obj_type:
|
||||
results.append(obj_type)
|
||||
else:
|
||||
# Check searchable fields
|
||||
s_fields = def_kv.get('searchable_fields', [])
|
||||
if any(term in f.lower() for f in s_fields):
|
||||
results.append(obj_type)
|
||||
|
||||
if results:
|
||||
print(f"Found {len(results)} objects matching '{term}':")
|
||||
for r in sorted(set(results)):
|
||||
print(f" - {r} ({get_category(r)})")
|
||||
else:
|
||||
print(f"No objects found matching '{term}'.")
|
||||
|
||||
if __name__ == "__main__":
|
||||
main()
|
||||
Reference in New Issue
Block a user