Centralize snapshot review selection in the store
This commit is contained in:
@@ -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 {
|
||||
|
||||
Reference in New Issue
Block a user