fix: cleanup StravaConfig on user delete (FK violation); equalize login timing (user enum); scope upload task-status to owner; SQL-side data-point downsampling; drop unused clsx/react-leaflet deps
Build and push images / validate (push) Successful in 3s
Build and push images / build-backend (push) Successful in 6s
Build and push images / build-worker (push) Successful in 5s
Build and push images / build-frontend (push) Successful in 19s

This commit is contained in:
2026-06-25 12:21:25 +01:00
parent 84eb1c46bd
commit 64caaad4e7
7 changed files with 79 additions and 42 deletions
+7 -1
View File
@@ -19,7 +19,8 @@ from app.core.security import get_current_user
from app.core.config import settings
from app.models.user import (
User, Activity, ActivityDataPoint, ActivityLap, NamedRoute,
Segment, SegmentEffort, PersonalRecord, HealthMetric, WeightLog, GarminConnectConfig,
Segment, SegmentEffort, PersonalRecord, HealthMetric, WeightLog,
GarminConnectConfig, StravaConfig,
)
router = APIRouter()
@@ -134,6 +135,11 @@ async def delete_user(
await db.execute(delete(HealthMetric).where(HealthMetric.user_id == user_id))
await db.execute(delete(WeightLog).where(WeightLog.user_id == user_id))
await db.execute(delete(GarminConnectConfig).where(GarminConnectConfig.user_id == user_id))
# StravaConfig holds Fernet-encrypted OAuth tokens and has a NOT-NULL FK to
# users with no DB-level cascade; the Core deletes above bypass the ORM
# relationship cascade, so it must be removed explicitly or the final
# DELETE on users raises a ForeignKey violation (and leaves tokens orphaned).
await db.execute(delete(StravaConfig).where(StravaConfig.user_id == user_id))
await db.execute(delete(User).where(User.id == user_id))
await db.commit()