# Script to fix the misplaced beach_design route at line 1561

file_path = r'd:\bookbeach\backend\app\routes\admin_routes.py'

# Read the file
with open(file_path, 'r', encoding='utf-8') as f:
    lines = f.readlines()

# Remove lines 1561-1575 (the misplaced beach_design route)
# The misplaced route starts at line 1561 (index 1560) and ends before the edit_market function's finally block
start_remove = 1560  # Line 1561 (0-indexed)
end_remove = 1575    # Line 1576 (0-indexed) - after the misplaced route

# Keep lines before start_remove, skip lines from start_remove to end_remove, keep lines after end_remove
fixed_lines = lines[:start_remove] + lines[end_remove:]

# Write the fixed content back
with open(file_path, 'w', encoding='utf-8') as f:
    f.writelines(fixed_lines)

print("Removed misplaced beach_design route at line 1561 from admin_routes.py")