d2578a9093
P2-1: list_by_user[:5] → list_recent_by_user(user_id, limit=5) SQL层LIMIT P2-2: DashboardOverviewResponse 补充 subscription 字段(plan + is_active) - packages/ports/generation_task_repository.py: 新增 list_recent_by_user - packages/adapters/sqlalchemy_impl/generation_task_repository.py: 实现 - apps/api/app/schemas/dashboard.py: 新增 SubscriptionInfo + subscription 字段 - apps/api/app/api/routes/dashboard.py: 使用新接口 + 填充 subscription
22 lines
645 B
Python
22 lines
645 B
Python
from __future__ import annotations
|
|
|
|
from typing import Protocol
|
|
|
|
from packages.domain import GenerationTask
|
|
|
|
|
|
class GenerationTaskRepository(Protocol):
|
|
def create(self, task: GenerationTask) -> GenerationTask: ...
|
|
|
|
def get(self, task_id: str) -> GenerationTask | None: ...
|
|
|
|
def list_by_project(self, project_id: str) -> list[GenerationTask]: ...
|
|
|
|
def list_by_user(self, user_id: str) -> list[GenerationTask]: ...
|
|
|
|
def count_by_user(self, user_id: str) -> int: ...
|
|
|
|
def list_recent_by_user(self, user_id: str, limit: int = 5) -> list[GenerationTask]: ...
|
|
|
|
def update(self, task: GenerationTask) -> GenerationTask: ...
|