feat(todos): domains[], photo_path, gps_lat/lng — modèle, schemas, API, tri par date

- Modèle SQLAlchemy : ajout de domains (ARRAY), photo_path, gps_lat, gps_lng ; import Float
- Schemas Pydantic : domain → domains dans TodoCreate, TodoUpdate, TodoResponse ; ajout photo_path, gps_lat, gps_lng
- API GET /api/todos : filtre domain (param URL) redirigé vers domains.contains([domain]) sur le champ ARRAY
- Tests : domain → domains dans les payloads POST ; assertion domains == ["informatique"] dans test_creer_todo
This commit is contained in:
2026-05-24 16:04:21 +02:00
parent a97894437a
commit e9dfb6e293
4 changed files with 22 additions and 8 deletions
+4 -3
View File
@@ -13,7 +13,7 @@ async def cleanup(db_session):
async def test_creer_todo(client):
resp = await client.post("/api/todos/", json={
"title": "TEST_tâche simple",
"domain": "informatique",
"domains": ["informatique"],
"priority": "high",
})
assert resp.status_code == 201
@@ -22,6 +22,7 @@ async def test_creer_todo(client):
assert data["status"] == "pending"
assert data["postponed_count"] == 0
assert data["tags"] == []
assert data["domains"] == ["informatique"]
async def test_lister_todos_filtre_status(client):
@@ -36,8 +37,8 @@ async def test_lister_todos_filtre_status(client):
async def test_lister_todos_filtre_domaine(client):
await client.post("/api/todos/", json={"title": "TEST_info", "domain": "informatique"})
await client.post("/api/todos/", json={"title": "TEST_jardin", "domain": "jardin"})
await client.post("/api/todos/", json={"title": "TEST_info", "domains": ["informatique"]})
await client.post("/api/todos/", json={"title": "TEST_jardin", "domains": ["jardin"]})
resp = await client.get("/api/todos/?domain=informatique&status=")
assert resp.status_code == 200