feat(feedback): a wishlist and "not interested"
- PUT/DELETE /wishlist/{artist} and GET /wishlist: the artists I want.
- POST/DELETE /discover/{artist}/dismiss and GET /discover/dismissed: the
artists I am not interested in. An artist is wished or dismissed, never both,
and both lists are mine alone.
- Discover never suggests a dismissed artist, does not use one as a seed taken
from my listening, and marks the wished ones it shows (wishlisted).
- New artist_feedback table (migration 0012, SQLite and PostgreSQL), removed
with the account.
- An artist I marked is not cleaned up when the list that named it is replaced,
and goes when its last mark is taken off and nobody names it. Taking a
provider's data back still removes what only it named, marks included.
- Spec, contract test and README updated.
Closes #35
This commit is contained in:
parent
154701191b
commit
a6dbf60ac8
2 changed files with 1283 additions and 32 deletions
17
migrations/postgres/0012_artist_feedback.sql
Normal file
17
migrations/postgres/0012_artist_feedback.sql
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
-- What a user decided about an artist: wanted it ('wishlist') or is not interested
|
||||
-- ('dismissed'). One row per user and artist, so it is one or the other.
|
||||
--
|
||||
-- The artist can be one without files that a provider named. The row keeps such an
|
||||
-- artist from being cleaned up when the list that named it is replaced (see the
|
||||
-- storage code); only taking a provider's data back removes it, and the row with it.
|
||||
|
||||
CREATE TABLE artist_feedback (
|
||||
user_id BIGINT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
artist_id BIGINT NOT NULL REFERENCES artists(id) ON DELETE CASCADE,
|
||||
kind TEXT NOT NULL CHECK (kind IN ('wishlist', 'dismissed')),
|
||||
created_at BIGINT NOT NULL, -- unix seconds
|
||||
PRIMARY KEY (user_id, artist_id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_artist_feedback_artist ON artist_feedback(artist_id);
|
||||
CREATE INDEX idx_artist_feedback_list ON artist_feedback(user_id, kind, created_at);
|
||||
17
migrations/sqlite/0012_artist_feedback.sql
Normal file
17
migrations/sqlite/0012_artist_feedback.sql
Normal file
|
|
@ -0,0 +1,17 @@
|
|||
-- What a user decided about an artist: wanted it ('wishlist') or is not interested
|
||||
-- ('dismissed'). One row per user and artist, so it is one or the other.
|
||||
--
|
||||
-- The artist can be one without files that a provider named. The row keeps such an
|
||||
-- artist from being cleaned up when the list that named it is replaced (see the
|
||||
-- storage code); only taking a provider's data back removes it, and the row with it.
|
||||
|
||||
CREATE TABLE artist_feedback (
|
||||
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
artist_id INTEGER NOT NULL REFERENCES artists(id) ON DELETE CASCADE,
|
||||
kind TEXT NOT NULL CHECK (kind IN ('wishlist', 'dismissed')),
|
||||
created_at INTEGER NOT NULL, -- unix seconds
|
||||
PRIMARY KEY (user_id, artist_id)
|
||||
);
|
||||
|
||||
CREATE INDEX idx_artist_feedback_artist ON artist_feedback(artist_id);
|
||||
CREATE INDEX idx_artist_feedback_list ON artist_feedback(user_id, kind, created_at);
|
||||
Loading…
Reference in a new issue