fix: resolve frontend/backend integration bugs
- Rename skincare route prefix /skin-snapshots → /skincare to match API client - Add redirect_slashes=False to FastAPI app; change collection routes from "/" to "" to eliminate 307 redirects on POST/GET without trailing slash - Fix redirect() inside try/catch in products/new and routines/new server actions (SvelteKit redirect() throws and was being caught as a 500 error) - Eagerly load inventory and steps relationships via explicit SELECT + model_dump(mode="json"), working around SQLModel 0.0.37 not serializing Relationship fields in response_model - Add field_validator for product_effect_profile to coerce DB-returned dict → ProductEffectProfile, eliminating Pydantic serializer warning - Update all tests to use routes without trailing slash Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
parent
8d4f9d1fc6
commit
9bf94a979c
11 changed files with 85 additions and 68 deletions
|
|
@ -8,7 +8,7 @@ import uuid
|
|||
|
||||
def test_create_routine_minimal(client):
|
||||
r = client.post(
|
||||
"/routines/", json={"routine_date": "2026-02-26", "part_of_day": "am"}
|
||||
"/routines", json={"routine_date": "2026-02-26", "part_of_day": "am"}
|
||||
)
|
||||
assert r.status_code == 201
|
||||
data = r.json()
|
||||
|
|
@ -19,21 +19,21 @@ def test_create_routine_minimal(client):
|
|||
|
||||
def test_create_routine_invalid_part_of_day(client):
|
||||
r = client.post(
|
||||
"/routines/", json={"routine_date": "2026-02-26", "part_of_day": "noon"}
|
||||
"/routines", json={"routine_date": "2026-02-26", "part_of_day": "noon"}
|
||||
)
|
||||
assert r.status_code == 422
|
||||
|
||||
|
||||
def test_list_routines_empty(client):
|
||||
r = client.get("/routines/")
|
||||
r = client.get("/routines")
|
||||
assert r.status_code == 200
|
||||
assert r.json() == []
|
||||
|
||||
|
||||
def test_list_filter_date_range(client):
|
||||
client.post("/routines/", json={"routine_date": "2026-01-01", "part_of_day": "am"})
|
||||
client.post("/routines/", json={"routine_date": "2026-06-01", "part_of_day": "am"})
|
||||
r = client.get("/routines/?from_date=2026-05-01&to_date=2026-12-31")
|
||||
client.post("/routines", json={"routine_date": "2026-01-01", "part_of_day": "am"})
|
||||
client.post("/routines", json={"routine_date": "2026-06-01", "part_of_day": "am"})
|
||||
r = client.get("/routines?from_date=2026-05-01&to_date=2026-12-31")
|
||||
assert r.status_code == 200
|
||||
data = r.json()
|
||||
assert len(data) == 1
|
||||
|
|
@ -41,9 +41,9 @@ def test_list_filter_date_range(client):
|
|||
|
||||
|
||||
def test_list_filter_part_of_day(client):
|
||||
client.post("/routines/", json={"routine_date": "2026-02-01", "part_of_day": "am"})
|
||||
client.post("/routines/", json={"routine_date": "2026-02-02", "part_of_day": "pm"})
|
||||
r = client.get("/routines/?part_of_day=pm")
|
||||
client.post("/routines", json={"routine_date": "2026-02-01", "part_of_day": "am"})
|
||||
client.post("/routines", json={"routine_date": "2026-02-02", "part_of_day": "pm"})
|
||||
r = client.get("/routines?part_of_day=pm")
|
||||
assert r.status_code == 200
|
||||
data = r.json()
|
||||
assert len(data) == 1
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue