Added api/classifications endpoint, requiring a new query

This commit is contained in:
bwilliams committed 2026-10-16 14:44:12 +01:00
1 parent 378ac59f41
commit 0e27d2b2f3
9 files changed
+186 -6

No files matched your search

+15
View File
@@ -717,6 +717,21 @@ func (s *Store) ListReleases(
return releases, nil
}
// ListClassifications returns every classification code that at least one
// stored opportunity has, ordered by code. A code no opportunity has any more
// isn't listed. The result is never nil.
func (s *Store) ListClassifications(
ctx context.Context,
) ([]types.ClassificationCode, error) {
classifications := []types.ClassificationCode{}
err := s.db.SelectContext(ctx, &classifications, selectClassificationsInUse)
if err != nil {
return nil, fmt.Errorf("listing classifications: %w", err)
}
return classifications, nil
}
// LatestReleaseDate returns the date of the newest release stored for the
// opportunities from source, or the zero time if none are stored, so a
// fetcher can carry on from where it left off.