Compare commits
No commits in common. "1672f54e02436d2751635f3b4378e33d5c7d6f2e" and "ee350c1852d60281de7466cd426bb97a30adc45c" have entirely different histories.
1672f54e02
...
ee350c1852
1 changed files with 2 additions and 25 deletions
|
|
@ -1,16 +1,5 @@
|
||||||
# api/v1/settings.py
|
from fastapi import APIRouter, HTTPException
|
||||||
import os
|
|
||||||
import json
|
|
||||||
import logging
|
|
||||||
import tempfile
|
|
||||||
from fastapi import APIRouter, HTTPException, Body
|
|
||||||
from starlette.responses import FileResponse
|
|
||||||
from services.settings_service import SettingsService
|
from services.settings_service import SettingsService
|
||||||
import shutil
|
|
||||||
|
|
||||||
# Настройка логирования
|
|
||||||
logging.basicConfig(level=logging.DEBUG) # Уровень DEBUG для детализации
|
|
||||||
logger = logging.getLogger(__name__)
|
|
||||||
|
|
||||||
router = APIRouter()
|
router = APIRouter()
|
||||||
settings_service = SettingsService()
|
settings_service = SettingsService()
|
||||||
|
|
@ -70,16 +59,4 @@ def clear_all_data():
|
||||||
if success:
|
if success:
|
||||||
return {"message": "Все сетевые данные успешно очищены"}
|
return {"message": "Все сетевые данные успешно очищены"}
|
||||||
except Exception as e:
|
except Exception as e:
|
||||||
raise HTTPException(status_code=500, detail=f"Ошибка очистки: {str(e)}")
|
raise HTTPException(status_code=500, detail=f"Ошибка очистки: {str(e)}")
|
||||||
|
|
||||||
DEVICE_PATH = "/home/merelden/main/projects/all/gonets/SRV/storage/devices/devices.json"
|
|
||||||
|
|
||||||
@router.get("/export", response_class=FileResponse)
|
|
||||||
async def export_devices():
|
|
||||||
if not os.path.exists(DEVICE_PATH):
|
|
||||||
return {"error": "Файл не найден"}
|
|
||||||
return FileResponse(
|
|
||||||
path=DEVICE_PATH,
|
|
||||||
filename="device.json",
|
|
||||||
media_type="application/json"
|
|
||||||
)
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue