add abandoned status to distinguish given-up habits from completed ones
Completed and abandoned habits were both lumped under a single terminal state, making it impossible to tell "finished successfully" apart from "gave up" when reviewing habit history.
This commit is contained in:
@@ -69,6 +69,12 @@ def complete_habit(habit_id: int, db: Session = Depends(get_db), current_user: U
|
||||
return habit_service.complete_habit(db, habit)
|
||||
|
||||
|
||||
@router.post("/{habit_id}/abandon", response_model=HabitOut)
|
||||
def abandon_habit(habit_id: int, db: Session = Depends(get_db), current_user: User = Depends(require_login)):
|
||||
habit = _get_habit_or_404(db, habit_id, current_user.id)
|
||||
return habit_service.abandon_habit(db, habit)
|
||||
|
||||
|
||||
@router.post("/{habit_id}/reactivate", response_model=HabitOut)
|
||||
def reactivate_habit(habit_id: int, db: Session = Depends(get_db), current_user: User = Depends(require_login)):
|
||||
habit = _get_habit_or_404(db, habit_id, current_user.id)
|
||||
|
||||
Reference in New Issue
Block a user