generated from coulomb/repo-seed
service logic for facts, chunks, candidates, and current-approved-vs-target comparison
This commit is contained in:
@@ -16,7 +16,9 @@ from repo_registry.web_api.schemas import (
|
||||
AbilityCreate,
|
||||
AbilitySummaryResponse,
|
||||
AbilityUpdate,
|
||||
AnalysisRunChangeApproval,
|
||||
AnalysisRunCreate,
|
||||
AnalysisRunDiffResponse,
|
||||
AnalysisRunResponse,
|
||||
CandidateAbilityMerge,
|
||||
CandidateCapabilityMerge,
|
||||
@@ -239,6 +241,29 @@ def get_analysis_run(
|
||||
raise HTTPException(status_code=404, detail=str(exc)) from exc
|
||||
|
||||
|
||||
@app.get(
|
||||
"/repos/{repository_id}/analysis-runs/{base_analysis_run_id}/diff/{target_analysis_run_id}",
|
||||
tags=["review"],
|
||||
response_model=AnalysisRunDiffResponse,
|
||||
)
|
||||
def diff_analysis_runs(
|
||||
repository_id: int,
|
||||
base_analysis_run_id: int,
|
||||
target_analysis_run_id: int,
|
||||
service: RegistryService = Depends(get_service),
|
||||
) -> dict[str, object]:
|
||||
try:
|
||||
return asdict(
|
||||
service.diff_analysis_runs(
|
||||
repository_id,
|
||||
base_analysis_run_id,
|
||||
target_analysis_run_id,
|
||||
)
|
||||
)
|
||||
except NotFoundError as exc:
|
||||
raise HTTPException(status_code=404, detail=str(exc)) from exc
|
||||
|
||||
|
||||
@app.get(
|
||||
"/repos/{repository_id}/review-decisions",
|
||||
tags=["review"],
|
||||
@@ -375,6 +400,29 @@ def approve_candidate_graph(
|
||||
raise HTTPException(status_code=404, detail=str(exc)) from exc
|
||||
|
||||
|
||||
@app.post(
|
||||
"/repos/{repository_id}/analysis-runs/{analysis_run_id}/changes/approve",
|
||||
tags=["review"],
|
||||
response_model=RepositoryAbilityMapResponse,
|
||||
)
|
||||
def approve_analysis_run_changes(
|
||||
repository_id: int,
|
||||
analysis_run_id: int,
|
||||
payload: AnalysisRunChangeApproval,
|
||||
service: RegistryService = Depends(get_service),
|
||||
) -> dict[str, object]:
|
||||
try:
|
||||
return asdict(
|
||||
service.approve_analysis_run_changes(
|
||||
repository_id,
|
||||
analysis_run_id,
|
||||
notes=payload.notes,
|
||||
)
|
||||
)
|
||||
except NotFoundError as exc:
|
||||
raise HTTPException(status_code=404, detail=str(exc)) from exc
|
||||
|
||||
|
||||
@app.post(
|
||||
"/repos/{repository_id}/analysis-runs/{analysis_run_id}"
|
||||
"/candidate-abilities/{candidate_ability_id}/reject",
|
||||
|
||||
Reference in New Issue
Block a user