Merge branch 'refactor/backend-architecture' into development
This commit is contained in:
22
api/app/features/tasks/service.py
Normal file
22
api/app/features/tasks/service.py
Normal file
@@ -0,0 +1,22 @@
|
||||
"""
|
||||
任务状态服务:对外提供任务状态查询与清理,委托给底层 task_tracker。
|
||||
"""
|
||||
from typing import Any
|
||||
|
||||
from app.core.task_tracker import task_tracker
|
||||
|
||||
|
||||
class TasksService:
|
||||
"""任务状态门面,供 router 通过 DI 注入使用。"""
|
||||
|
||||
async def check_tasks_status(self, user_id: str) -> dict[str, Any]:
|
||||
return await task_tracker.check_tasks_status(user_id)
|
||||
|
||||
async def get_user_tasks(self, user_id: str) -> list[dict[str, Any]]:
|
||||
return await task_tracker.get_user_tasks(user_id)
|
||||
|
||||
async def get_pending_tasks(self, user_id: str) -> list[dict[str, Any]]:
|
||||
return await task_tracker.get_pending_tasks(user_id)
|
||||
|
||||
async def clear_user_tasks(self, user_id: str) -> bool:
|
||||
return await task_tracker.clear_user_tasks(user_id)
|
||||
Reference in New Issue
Block a user