generated from coulomb/repo-seed
ReviewDecision domain model
This commit is contained in:
@@ -21,6 +21,7 @@ from repo_registry.core.models import (
|
||||
Repository,
|
||||
RepositoryAbilityMap,
|
||||
RepositorySnapshot,
|
||||
ReviewDecision,
|
||||
SearchResult,
|
||||
SourceReference,
|
||||
)
|
||||
@@ -929,6 +930,40 @@ class RegistryStore:
|
||||
)
|
||||
return int(cursor.lastrowid)
|
||||
|
||||
def list_review_decisions(
|
||||
self,
|
||||
repository_id: int,
|
||||
analysis_run_id: int | None = None,
|
||||
) -> list[ReviewDecision]:
|
||||
self.get_repository(repository_id)
|
||||
params: tuple[int, ...]
|
||||
where = "WHERE repository_id = ?"
|
||||
params = (repository_id,)
|
||||
if analysis_run_id is not None:
|
||||
where += " AND analysis_run_id = ?"
|
||||
params = (repository_id, analysis_run_id)
|
||||
with self.connect() as connection:
|
||||
rows = connection.execute(
|
||||
f"""
|
||||
SELECT id, repository_id, analysis_run_id, action, notes, created_at
|
||||
FROM review_decisions
|
||||
{where}
|
||||
ORDER BY created_at DESC, id DESC
|
||||
""",
|
||||
params,
|
||||
).fetchall()
|
||||
return [
|
||||
ReviewDecision(
|
||||
id=row["id"],
|
||||
repository_id=row["repository_id"],
|
||||
analysis_run_id=row["analysis_run_id"],
|
||||
action=row["action"],
|
||||
notes=row["notes"],
|
||||
created_at=row["created_at"],
|
||||
)
|
||||
for row in rows
|
||||
]
|
||||
|
||||
def fail_analysis_run(
|
||||
self,
|
||||
repository_id: int,
|
||||
|
||||
Reference in New Issue
Block a user