feat(import): an Import page, with the numbers of every import kept
The report of an import used to be shown once in Settings and lost. Each import is now stored (migration 0030, spotify_imports) as the report in JSON, and GET /me/import/spotify lists the past ones, newest first. POST /me/import/spotify answers with the same shape plus id and created_at. The web app gets an Import page (menu, More tab) with the form and one card for each past import: plays read, added, already there, not in the library, the playlists it made and the artists that are missing. Settings only links to it. An import that finds nothing is not kept, and a report that cannot be stored is still returned to the person who asked.
This commit is contained in:
parent
83b578ea4c
commit
aa4883b955
2 changed files with 868 additions and 154 deletions
10
migrations/postgres/0030_spotify_imports.sql
Normal file
10
migrations/postgres/0030_spotify_imports.sql
Normal file
|
|
@ -0,0 +1,10 @@
|
|||
-- PostgreSQL flavour of sqlite/0030_spotify_imports.sql.
|
||||
|
||||
CREATE TABLE spotify_imports (
|
||||
id BIGINT GENERATED BY DEFAULT AS IDENTITY PRIMARY KEY,
|
||||
user_id BIGINT NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
created_at BIGINT NOT NULL,
|
||||
report TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX idx_spotify_imports_user ON spotify_imports(user_id, created_at DESC);
|
||||
11
migrations/sqlite/0030_spotify_imports.sql
Normal file
11
migrations/sqlite/0030_spotify_imports.sql
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
-- What each import of a Spotify export did, kept so the numbers can be read again later: the report as JSON (see
|
||||
-- internal/spotifyimport). The files themselves are never kept.
|
||||
|
||||
CREATE TABLE spotify_imports (
|
||||
id INTEGER PRIMARY KEY,
|
||||
user_id INTEGER NOT NULL REFERENCES users(id) ON DELETE CASCADE,
|
||||
created_at INTEGER NOT NULL, -- unix seconds
|
||||
report TEXT NOT NULL
|
||||
);
|
||||
|
||||
CREATE INDEX idx_spotify_imports_user ON spotify_imports(user_id, created_at DESC);
|
||||
Loading…
Reference in a new issue