refactored frequency_khz to frequencies

This commit is contained in:
Logan Cusano
2025-05-24 18:39:07 -04:00
parent 58a95fd501
commit 82d7160e5e
3 changed files with 13 additions and 13 deletions

View File

@@ -28,11 +28,11 @@ async def create_system_route():
if name_search_result:
abort(409, f"System with name '{request_data['name']}' already exists")
# Check if frequency_khz exists (optional, depending on requirements)
if 'frequency_khz' in request_data:
freq_search_result = await current_app.sys_db_h.find_system({"frequency_khz": request_data["frequency_khz"]})
# Check if frequencies exists (optional, depending on requirements)
if 'frequencies' in request_data:
freq_search_result = await current_app.sys_db_h.find_system({"frequencies": request_data["frequencies"]})
if freq_search_result:
abort(409, f"System with frequency '{request_data['frequency_khz']}' already exists")
abort(409, f"System with frequency '{request_data['frequencies']}' already exists")
created_system = await current_app.sys_db_h.create_system(request_data)
@@ -262,8 +262,8 @@ async def dismiss_client_from_system_route(system_id: str):
async def search_systems_route():
"""
API endpoint to search for systems based on query parameters.
Allows searching by 'name', 'frequency_khz', or any other field present in the System model.
Example: /systems/search?name=MySystem&frequency_khz=1000
Allows searching by 'name', 'frequencies', or any other field present in the System model.
Example: /systems/search?name=MySystem&frequencies=1000
"""
print("\n--- Handling GET /systems/search ---")
try: