feat: make repository reads alias-aware
Assistant: codex Assistant-Model: gpt-5.6-sol Assistant-Session: 01a049a4-ee9f-78e1-9d66-2cb0f9bea3e3
This commit is contained in:
parent
639b9aed08
commit
2e2ae1e5d0
19 changed files with 982 additions and 94 deletions
|
|
@ -8,16 +8,14 @@ from api.database import get_session
|
|||
from api.models.managed_repo import ManagedRepo
|
||||
from api.models.repo_goal import RepoGoal, RepoGoalStatus
|
||||
from api.schemas.repo_goal import RepoGoalCreate, RepoGoalRead, RepoGoalUpdate
|
||||
from api.services.repository_aliases import resolve_repository_slug
|
||||
|
||||
router = APIRouter(prefix="/repo-goals", tags=["repo-goals"])
|
||||
|
||||
|
||||
async def _resolve_repo(repo_slug: str, session: AsyncSession) -> ManagedRepo:
|
||||
result = await session.execute(select(ManagedRepo).where(ManagedRepo.slug == repo_slug))
|
||||
repo = result.scalar_one_or_none()
|
||||
if repo is None:
|
||||
raise HTTPException(status_code=404, detail=f"Repo '{repo_slug}' not found")
|
||||
return repo
|
||||
resolution = await resolve_repository_slug(session, repo_slug)
|
||||
return resolution.repo
|
||||
|
||||
|
||||
@router.get("/", response_model=list[RepoGoalRead])
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue