Coverage for app/services/status_todo_service.py: 100%
20 statements
« prev ^ index » next coverage.py v7.9.2, created at 2025-07-18 02:28 +0000
« prev ^ index » next coverage.py v7.9.2, created at 2025-07-18 02:28 +0000
1from sqlalchemy.orm import Session
2from app.repository import status_todo_repo
3from app.schemas.status_todo_schema import StatusTodoCreate
5def create_status_todo_service(db: Session, status_todo_in: StatusTodoCreate):
6 return status_todo_repo.create_status_todo(db, status_todo_in.status, status_todo_in.todo_id)
8def get_all_status_todo_service(db: Session):
9 return status_todo_repo.get_all_status_todo(db)
11def get_status_todo_by_id_service(db: Session, status_todo_id: int):
12 return status_todo_repo.get_status_todo_by_id(db, status_todo_id)
14def update_status_todo_service(db: Session, status_todo_id: int, data: StatusTodoCreate):
15 status_todo = status_todo_repo.get_status_todo_by_id(db, status_todo_id)
16 if not status_todo:
17 return None
18 return status_todo_repo.update_status_todo(db, status_todo, data.status, data.todo_id)
20def delete_status_todo_service(db: Session, status_todo_id: int):
21 status_todo = status_todo_repo.get_status_todo_by_id(db, status_todo_id)
22 if not status_todo:
23 return False
24 status_todo_repo.delete_status_todo(db, status_todo)
25 return True