chore: 迁移服务器前同步本地修改
This commit is contained in:
@@ -17,7 +17,7 @@ from typing import Optional
|
||||
from fastapi import APIRouter, Depends, HTTPException
|
||||
|
||||
from kilostar.utils.access import Accessor, TokenData
|
||||
from kilostar.utils.ray_hook import ray_actor_hook
|
||||
from kilostar.utils.actor import get_actor
|
||||
|
||||
task_router = APIRouter(prefix="/api/v1/task", tags=["task"])
|
||||
|
||||
@@ -30,8 +30,8 @@ async def list_tasks(
|
||||
token_data: TokenData = Depends(Accessor.get_current_user),
|
||||
):
|
||||
"""列出当前用户的所有短任务,按时间倒序。"""
|
||||
postgres_database = ray_actor_hook("postgres_database").postgres_database
|
||||
tasks = await postgres_database.list_tasks_by_user.remote(
|
||||
postgres_database = get_actor("postgres_database")
|
||||
tasks = await postgres_database.list_tasks_by_user(
|
||||
user_id=token_data.user_id,
|
||||
status=status,
|
||||
limit=limit,
|
||||
@@ -46,8 +46,8 @@ async def get_task(
|
||||
token_data: TokenData = Depends(Accessor.get_current_user),
|
||||
):
|
||||
"""按 task_id 读取一条 task 详情。仅 owner 可访问。"""
|
||||
postgres_database = ray_actor_hook("postgres_database").postgres_database
|
||||
task = await postgres_database.get_task.remote(task_id)
|
||||
postgres_database = get_actor("postgres_database")
|
||||
task = await postgres_database.get_task(task_id)
|
||||
if not task:
|
||||
raise HTTPException(status_code=404, detail="task not found")
|
||||
if task.get("user_id") != token_data.user_id:
|
||||
|
||||
Reference in New Issue
Block a user