Test
Merged
SW
4mo ago+562+562+012345678901234567890123456789-5-5-0123456789
Summary by cubic
Adds POST /api/catalogs to create a catalog or materialize one from a valuation snapshot. Enforces auth-derived ownership, input validation, and idempotent snapshot claims.
-
New Features
POST /api/catalogsaccepts{ name?, snapshot? }(at least one); includes CORS preflight.- Auth via
validateAuthContext; owner comes from credentials, not the body. - Name-only: creates a catalog and links
account_catalogs; returns{ status, catalog, songs_added: 0 }. - Snapshot: verifies ownership, returns existing catalog if already claimed, else creates catalog, links account, adds deduped songs from
song_measurements, updates the snapshot; returns{ songs_added }. - Supabase helpers added:
insertCatalog,selectCatalogById,insertAccountCatalog;selectSongMeasurementsnow supports asnapshotfilter.
-
Bug Fixes
- Materializes songs from
song_measurementsbysnapshotinstead ofsnapshot.isrcsto avoid empty catalogs for album-scoped runs.
- Materializes songs from