add go bench client
This commit is contained in:
130
TODO_BACKEND.md
Normal file
130
TODO_BACKEND.md
Normal file
@@ -0,0 +1,130 @@
|
||||
# TODO Backend - Actions Requises
|
||||
|
||||
## Actions nécessaires côté backend pour compléter les fonctionnalités frontend
|
||||
|
||||
### 🔴 PRIORITÉ 1 - Fonctionnalité IP URL
|
||||
|
||||
#### 1.1 Ajouter le champ `ip_url` aux schémas Pydantic
|
||||
|
||||
**Fichier** : `backend/app/schemas/device.py`
|
||||
|
||||
```python
|
||||
# Dans DeviceBase
|
||||
class DeviceBase(BaseModel):
|
||||
# ... champs existants ...
|
||||
ip_url: Optional[str] = None # ⬅️ AJOUTER
|
||||
|
||||
# Dans DeviceUpdate
|
||||
class DeviceUpdate(BaseModel):
|
||||
# ... champs existants ...
|
||||
ip_url: Optional[str] = None # ⬅️ AJOUTER
|
||||
```
|
||||
|
||||
#### 1.2 Vérifier que l'API retourne `ip_url`
|
||||
|
||||
**Fichier** : `backend/app/api/devices.py`
|
||||
|
||||
S'assurer que les endpoints GET `/api/devices/{id}` et GET `/api/devices` retournent bien le champ `ip_url` dans les réponses JSON.
|
||||
|
||||
---
|
||||
|
||||
### 🟠 PRIORITÉ 2 - Synchroniser les schémas avec la base de données
|
||||
|
||||
#### 2.1 Ajouter les champs manquants à `HardwareSnapshotResponse`
|
||||
|
||||
**Fichier** : `backend/app/schemas/hardware.py`
|
||||
|
||||
```python
|
||||
class HardwareSnapshotResponse(BaseModel):
|
||||
# ... champs existants ...
|
||||
|
||||
# Migration 016
|
||||
ram_max_capacity_mb: Optional[int] = None # ⬅️ AJOUTER
|
||||
|
||||
# Migration 017
|
||||
is_proxmox_host: Optional[bool] = None # ⬅️ AJOUTER
|
||||
is_proxmox_guest: Optional[bool] = None # ⬅️ AJOUTER
|
||||
proxmox_version: Optional[str] = None # ⬅️ AJOUTER
|
||||
|
||||
# Migration 019
|
||||
audio_hardware_json: Optional[str] = None # ⬅️ AJOUTER
|
||||
audio_software_json: Optional[str] = None # ⬅️ AJOUTER
|
||||
```
|
||||
|
||||
#### 2.2 Vérifier que l'API retourne ces champs
|
||||
|
||||
S'assurer que `/api/devices/{id}` inclut bien `last_hardware_snapshot` avec tous ces champs.
|
||||
|
||||
---
|
||||
|
||||
### 🟡 PRIORITÉ 3 - Amélioration du parsing dmidecode (Optionnel)
|
||||
|
||||
#### 3.1 Enrichir le champ `raw_info_json` avec des champs structurés
|
||||
|
||||
**Contexte** : Le frontend parse actuellement `raw_info_json.dmidecode` pour extraire des infos multi-CPU, signature, socket, etc.
|
||||
|
||||
**Suggestion** : Ajouter des champs dédiés dans `HardwareSnapshot` pour éviter le parsing côté frontend :
|
||||
|
||||
```python
|
||||
class HardwareSnapshot(Base):
|
||||
# ... champs existants ...
|
||||
|
||||
# CPU avancé
|
||||
cpu_signature: Optional[str] = None # Ex: "Family 25, Model 33, Stepping 2"
|
||||
cpu_socket: Optional[str] = None # Ex: "AM4"
|
||||
cpu_voltage_v: Optional[float] = None # Ex: 1.1
|
||||
cpu_current_freq_mhz: Optional[int] = None # Fréquence actuelle
|
||||
|
||||
# Multi-CPU
|
||||
cpu_sockets_count: Optional[int] = None # Nombre de sockets physiques
|
||||
cpu_sockets_json: Optional[str] = None # JSON array des sockets
|
||||
```
|
||||
|
||||
Puis parser côté backend (bench.sh ou benchmark.py) et envoyer structuré.
|
||||
|
||||
---
|
||||
|
||||
### ✅ Actions déjà complétées (DB)
|
||||
|
||||
- ✅ Migration 018 : `devices.ip_url` existe en DB
|
||||
- ✅ Migration 016 : `hardware_snapshots.ram_max_capacity_mb` existe
|
||||
- ✅ Migration 017 : `hardware_snapshots.is_proxmox_host`, `is_proxmox_guest`, `proxmox_version` existent
|
||||
- ✅ Migration 019 : `hardware_snapshots.audio_hardware_json`, `audio_software_json` existent
|
||||
|
||||
**Il ne reste plus qu'à exposer ces champs via l'API** en mettant à jour les schémas Pydantic.
|
||||
|
||||
---
|
||||
|
||||
### 🧪 Tests recommandés après modifications
|
||||
|
||||
1. **Test GET `/api/devices/{id}`** :
|
||||
```bash
|
||||
curl http://localhost:8007/api/devices/1 | jq '.ip_url'
|
||||
curl http://localhost:8007/api/devices/1 | jq '.last_hardware_snapshot.ram_max_capacity_mb'
|
||||
curl http://localhost:8007/api/devices/1 | jq '.last_hardware_snapshot.is_proxmox_host'
|
||||
curl http://localhost:8007/api/devices/1 | jq '.last_hardware_snapshot.audio_hardware_json'
|
||||
```
|
||||
|
||||
2. **Test PUT `/api/devices/{id}`** avec `ip_url` :
|
||||
```bash
|
||||
curl -X PUT http://localhost:8007/api/devices/1 \
|
||||
-H "Content-Type: application/json" \
|
||||
-d '{"ip_url": "http://10.0.0.50:8080"}'
|
||||
```
|
||||
|
||||
3. **Vérifier en DB** :
|
||||
```bash
|
||||
sqlite3 backend/data/data.db "SELECT ip_url FROM devices WHERE id=1;"
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
### 📝 Notes
|
||||
|
||||
- Le frontend est **prêt** pour ces fonctionnalités et appelle déjà les endpoints avec ces champs.
|
||||
- Une fois les schémas backend mis à jour, tout devrait fonctionner sans modification frontend supplémentaire.
|
||||
- Si le backend ne retourne pas ces champs, le frontend affichera simplement "N/A" sans erreur (gestion défensive).
|
||||
|
||||
---
|
||||
|
||||
**Dernière mise à jour** : 2026-01-11
|
||||
Reference in New Issue
Block a user