feat: delete habits from detail sheet
ci / gitleaks (push) Successful in 6s
ci / docker (push) Successful in 5m40s

This commit is contained in:
2026-09-08 20:16:25 +08:00
parent 89374f2db9
commit 9db323ac2d
5 changed files with 38 additions and 2 deletions
+8
View File
@@ -630,6 +630,14 @@ async def archive_habit(habit_id: UUID, user: User = Depends(current_user), db:
row = await owned_habit(db, user.id, habit_id); row.archived_at = utcnow(); await db.commit(); return Response(status_code=204)
@router.delete("/habits/{habit_id}/permanent", status_code=204)
async def delete_habit_permanently(habit_id: UUID, user: User = Depends(current_user), db: AsyncSession = Depends(get_db)):
row = await owned_habit(db, user.id, habit_id)
await db.delete(row)
await db.commit()
return Response(status_code=204)
@router.post("/habits/{habit_id}/logs")
async def add_habit_log(habit_id: UUID, payload: HabitLogInput, user: User = Depends(current_user), db: AsyncSession = Depends(get_db)):
habit = await owned_habit(db, user.id, habit_id)