feat: add Pomodoro timer functionality with logging and project goals
- Implemented Pomodoro timer in the app, allowing users to start, pause, and stop sessions. - Added context for managing Pomodoro state and actions. - Integrated time logging for completed sessions to track productivity. - Enhanced project settings to include time goals and Pomodoro settings. - Created migration scripts to update the database schema for new project fields and time logs. - Updated UI components to display Pomodoro controls and project time summaries. - Added category filtering for projects in the project list view.
This commit is contained in:
@@ -159,6 +159,32 @@ def delete_task(task_id: int, db: Session = Depends(get_db)):
|
||||
return None
|
||||
|
||||
|
||||
# ========== TIME LOG ENDPOINTS ==========
|
||||
|
||||
@app.post("/api/tasks/{task_id}/time-logs", response_model=schemas.TimeLog, status_code=201)
|
||||
def log_time(task_id: int, time_log: schemas.TimeLogCreate, db: Session = Depends(get_db)):
|
||||
"""Log time spent on a task"""
|
||||
if not crud.get_task(db, task_id):
|
||||
raise HTTPException(status_code=404, detail="Task not found")
|
||||
return crud.create_time_log(db, task_id, time_log)
|
||||
|
||||
|
||||
@app.get("/api/tasks/{task_id}/time-logs", response_model=List[schemas.TimeLog])
|
||||
def get_time_logs(task_id: int, db: Session = Depends(get_db)):
|
||||
"""Get all time logs for a task"""
|
||||
if not crud.get_task(db, task_id):
|
||||
raise HTTPException(status_code=404, detail="Task not found")
|
||||
return crud.get_time_logs_by_task(db, task_id)
|
||||
|
||||
|
||||
@app.get("/api/projects/{project_id}/time-summary", response_model=schemas.ProjectTimeSummary)
|
||||
def get_project_time_summary(project_id: int, db: Session = Depends(get_db)):
|
||||
"""Get aggregated time statistics for a project"""
|
||||
if not crud.get_project(db, project_id):
|
||||
raise HTTPException(status_code=404, detail="Project not found")
|
||||
return crud.get_project_time_summary(db, project_id)
|
||||
|
||||
|
||||
# ========== SEARCH ENDPOINT ==========
|
||||
|
||||
@app.get("/api/search", response_model=List[schemas.Task])
|
||||
|
||||
Reference in New Issue
Block a user