Centralize snapshot review selection in the store

This commit is contained in:
Ian Gulliver
2026-10-21 12:25:32 -07:00
parent 44d75973a7
commit af4996c585
4 changed files with 14 additions and 20 deletions
+8
View File
@@ -69,6 +69,14 @@ func (s *Store) ListReviews(ctx context.Context, taskID string) ([]api.Review, e
return scanReviews(rows)
}
func (s *Store) SnapshotReviews(ctx context.Context, taskID string, n int) ([]api.Review, error) {
rows, err := s.db.QueryContext(ctx, `SELECT `+reviewColumns+` FROM reviews WHERE task_id = ? AND snapshot_n = ? ORDER BY created_at`, taskID, n)
if err != nil {
return nil, err
}
return scanReviews(rows)
}
func (s *Store) RunningReviews(ctx context.Context) ([]api.Review, error) {
rows, err := s.db.QueryContext(ctx, `SELECT `+reviewColumns+` FROM reviews WHERE state = ? ORDER BY created_at`, string(api.ReviewStateRunning))
if err != nil {