feat: fetch all artist albums with caching, filter by type in handler
- Provider fetches all release groups via paginated browse, no type filter - Service caches all albums in DB, ensures referenced artists exist first - Server handler filters by album_types (default: album|ep|single), excludes secondary types - Add secondary_types to domain, DB schema, and MB types - Add ErrBadRequest handling for MusicBrainz 400 errors - Replace migrations with single schema.sql - Add GetAllByArtistID and SaveAll to album repository
This commit is contained in:
@@ -1 +0,0 @@
|
||||
DROP EXTENSION IF EXISTS pg_prewarm;
|
||||
@@ -1 +0,0 @@
|
||||
CREATE EXTENSION IF NOT EXISTS pg_prewarm;
|
||||
@@ -1,33 +0,0 @@
|
||||
DROP INDEX IF EXISTS idx_playlist_tracks_position;
|
||||
DROP INDEX IF EXISTS idx_lyrics_track_id;
|
||||
DROP INDEX IF EXISTS idx_genres_name;
|
||||
DROP INDEX IF EXISTS idx_albums_release_date;
|
||||
DROP INDEX IF EXISTS idx_albums_source;
|
||||
DROP INDEX IF EXISTS idx_albums_upc;
|
||||
DROP INDEX IF EXISTS idx_tracks_source;
|
||||
DROP INDEX IF EXISTS idx_tracks_isrc;
|
||||
DROP INDEX IF EXISTS idx_artists_source;
|
||||
DROP INDEX IF EXISTS idx_artists_name;
|
||||
|
||||
DROP TABLE IF EXISTS track_external_ids;
|
||||
DROP TABLE IF EXISTS album_external_ids;
|
||||
DROP TABLE IF EXISTS artist_external_ids;
|
||||
|
||||
DROP TABLE IF EXISTS playlist_tracks;
|
||||
DROP TABLE IF EXISTS playlists;
|
||||
DROP TABLE IF EXISTS lyrics;
|
||||
|
||||
DROP TABLE IF EXISTS similar_artists;
|
||||
DROP TABLE IF EXISTS album_genres;
|
||||
DROP TABLE IF EXISTS artist_genres;
|
||||
DROP TABLE IF EXISTS work_artists;
|
||||
DROP TABLE IF EXISTS album_tracks;
|
||||
DROP TABLE IF EXISTS album_artists;
|
||||
DROP TABLE IF EXISTS track_artists;
|
||||
|
||||
DROP TABLE IF EXISTS genres;
|
||||
DROP TABLE IF EXISTS albums;
|
||||
DROP TABLE IF EXISTS labels;
|
||||
DROP TABLE IF EXISTS tracks;
|
||||
DROP TABLE IF EXISTS works;
|
||||
DROP TABLE IF EXISTS artists;
|
||||
@@ -1,4 +1,4 @@
|
||||
-- Core Entities
|
||||
CREATE EXTENSION IF NOT EXISTS pg_prewarm;
|
||||
|
||||
CREATE TABLE artists (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
@@ -56,6 +56,7 @@ CREATE TABLE albums (
|
||||
label_id UUID REFERENCES labels(id),
|
||||
title TEXT NOT NULL,
|
||||
album_type TEXT,
|
||||
secondary_types TEXT[] DEFAULT '{}',
|
||||
release_date DATE,
|
||||
upc TEXT,
|
||||
total_tracks INT,
|
||||
@@ -73,8 +74,6 @@ CREATE TABLE genres (
|
||||
parent_id UUID REFERENCES genres(id)
|
||||
);
|
||||
|
||||
-- Relationships
|
||||
|
||||
CREATE TABLE track_artists (
|
||||
track_id UUID REFERENCES tracks(id) ON DELETE CASCADE,
|
||||
artist_id UUID REFERENCES artists(id) ON DELETE CASCADE,
|
||||
@@ -125,8 +124,6 @@ CREATE TABLE similar_artists (
|
||||
PRIMARY KEY (artist_id, similar_artist_id)
|
||||
);
|
||||
|
||||
-- Content
|
||||
|
||||
CREATE TABLE lyrics (
|
||||
id UUID PRIMARY KEY DEFAULT gen_random_uuid(),
|
||||
track_id UUID REFERENCES tracks(id) ON DELETE CASCADE,
|
||||
@@ -156,8 +153,6 @@ CREATE TABLE playlist_tracks (
|
||||
PRIMARY KEY (playlist_id, track_id)
|
||||
);
|
||||
|
||||
-- External IDs
|
||||
|
||||
CREATE TABLE artist_external_ids (
|
||||
artist_id UUID REFERENCES artists(id) ON DELETE CASCADE,
|
||||
source TEXT NOT NULL,
|
||||
@@ -185,8 +180,6 @@ CREATE TABLE track_external_ids (
|
||||
PRIMARY KEY (track_id, source, source_id)
|
||||
);
|
||||
|
||||
-- Indexes
|
||||
|
||||
CREATE INDEX idx_artists_name ON artists(name);
|
||||
CREATE INDEX idx_artists_source ON artists(source, source_id);
|
||||
CREATE INDEX idx_tracks_isrc ON tracks(isrc) WHERE isrc IS NOT NULL;
|
||||
Reference in New Issue
Block a user