Skip to content

feat: add labels table and normalize label data#163

Open
jakebromberg wants to merge 1 commit intomainfrom
feature/labels-table
Open

feat: add labels table and normalize label data#163
jakebromberg wants to merge 1 commit intomainfrom
feature/labels-table

Conversation

@jakebromberg
Copy link
Member

Summary

  • Add labels table with id, label_name (unique), and parent_label_id (self-referencing)
  • Add label_id FK to library and flowsheet tables (nullable, alongside existing varchar columns)
  • Add labels service with CRUD, search, and upsert-by-name operations
  • Add labels controller and routes (/labels) with permission-gated endpoints
  • Update library controller to resolve label strings to label_id via upsert on album creation
  • Update library and flowsheet services to return label_id in queries
  • Propagate label_id through V2 flowsheet track entries

Companion PR: WXYC/wxyc-shared#9 (API contract changes)

Test plan

  • 129 unit tests pass (8 new labels service tests + 1 new flowsheet label_id test)
  • Labels service: CRUD, upsert dedup, search, parent label support
  • Flowsheet: label_id propagates through transformToV2
  • Run drizzle:generate + drizzle:migrate to apply schema migration
  • Integration test with running database
  • CI passes

Add normalized label support to Backend-Service:

Schema:
- Add labels table (id, label_name, parent_label_id)
- Add label_id FK to library and flowsheet tables
- Add label_id to library_artist_view and rotation_library_view

Service layer:
- Add labels service with CRUD + search + upsert by name
- Add labels controller and routes (GET/POST /labels)
- Update library controller to resolve label strings to label_id
- Update library service to return label_id in queries
- Update flowsheet service to propagate label_id through entries
- Add label_id to V2 flowsheet track entries

Tests:
- Add labels service unit tests (8 tests)
- Add flowsheet label_id propagation test
- Update database mock with label support
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant

Comments