Coverage for app/repository/status_todo_repo.py: 100%

21 statements  

« prev     ^ index     » next       coverage.py v7.9.2, created at 2025-07-18 02:28 +0000

1from sqlalchemy.orm import Session 

2from app.models.status_todo import StatusTodo 

3 

4def create_status_todo(db: Session, status: str, todo_id: int): 

5 status_todo = StatusTodo(status=status, todo_id=todo_id) 

6 db.add(status_todo) 

7 db.commit() 

8 db.refresh(status_todo) 

9 return status_todo 

10 

11def get_all_status_todo(db: Session): 

12 return db.query(StatusTodo).all() 

13 

14def get_status_todo_by_id(db: Session, status_todo_id: int): 

15 return db.query(StatusTodo).filter(StatusTodo.id == status_todo_id).first() 

16 

17def update_status_todo(db: Session, status_todo: StatusTodo, status: str, todo_id: int): 

18 status_todo.status = status 

19 status_todo.todo_id = todo_id 

20 db.commit() 

21 db.refresh(status_todo) 

22 return status_todo 

23 

24def delete_status_todo(db: Session, status_todo: StatusTodo): 

25 db.delete(status_todo) 

26 db.commit()