feat: add personal playlists and shareable track links
EOF Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
3a097c15c8
commit
fa79394869
46 files changed
+2307
-292
No files matched your search
+21
-2
@@ -41,7 +41,7 @@ CREATE TABLE refresh_tokens (
|
||||
family_started_at timestamptz NOT NULL, -- время входа: абсолютный срок семьи (180 дней)
|
||||
token_hash bytea NOT NULL UNIQUE, -- SHA-256 от токена
|
||||
device_name text, -- "Chrome / Windows", "Pixel 8"
|
||||
client_type text NOT NULL, -- 'web' | 'android'
|
||||
client_type text NOT NULL, -- 'web' | 'android' | 'desktop'
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
expires_at timestamptz NOT NULL,
|
||||
used_at timestamptz, -- ротирован
|
||||
@@ -303,6 +303,25 @@ CREATE TABLE track_reactions ( -- Коллекция → Лайки
|
||||
);
|
||||
CREATE INDEX ON track_reactions (user_id, reaction, created_at DESC);
|
||||
|
||||
CREATE TABLE playlists (
|
||||
id uuid PRIMARY KEY,
|
||||
user_id uuid NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
name text NOT NULL CHECK (char_length(name) BETWEEN 1 AND 120),
|
||||
description text NOT NULL DEFAULT '' CHECK (char_length(description) <= 2000),
|
||||
revision integer NOT NULL DEFAULT 1, -- оптимистичная блокировка при PUT
|
||||
created_at timestamptz NOT NULL DEFAULT now(),
|
||||
updated_at timestamptz NOT NULL DEFAULT now()
|
||||
);
|
||||
CREATE INDEX playlists_owner ON playlists(user_id, updated_at DESC, id);
|
||||
|
||||
CREATE TABLE playlist_tracks (
|
||||
playlist_id uuid NOT NULL REFERENCES playlists(id) ON DELETE CASCADE,
|
||||
track_id uuid NOT NULL REFERENCES tracks(id) ON DELETE CASCADE,
|
||||
position integer NOT NULL CHECK (position >= 0),
|
||||
PRIMARY KEY (playlist_id, track_id),
|
||||
UNIQUE (playlist_id, position)
|
||||
);
|
||||
|
||||
CREATE TABLE artist_reactions ( -- «не рекомендовать исполнителя» и т.п.
|
||||
user_id uuid REFERENCES users(id) ON DELETE CASCADE,
|
||||
artist_id uuid REFERENCES artists(id) ON DELETE CASCADE,
|
||||
@@ -324,7 +343,7 @@ CREATE TABLE play_events (
|
||||
context_type text, -- wave | album | artist | search | collection | history | queue
|
||||
context_id text, -- id альбома / wave_session и т.п.
|
||||
wave_session_id uuid,
|
||||
client_type text NOT NULL, -- web | android
|
||||
client_type text NOT NULL, -- web | android | desktop
|
||||
offline boolean NOT NULL DEFAULT false,
|
||||
PRIMARY KEY (id, occurred_at)
|
||||
) PARTITION BY RANGE (occurred_at);
|
||||
|
||||
Reference in new issue
Block a user