mirror of
https://github.com/gabehf/Koito.git
synced 2026-03-07 21:48:18 -08:00
feat: Rewind (#116)
* wip * chore: update counts to allow unix timeframe * feat: add db functions for counting new items * wip: endpoint working * wip * wip: initial ui done * add header, adjust ui * add time listened toggle * fix layout, year param * param fixes
This commit is contained in:
parent
c0a8c64243
commit
d4ac96f780
64 changed files with 2252 additions and 1055 deletions
|
|
@ -9,7 +9,7 @@ VALUES ($1, $2, $3)
|
|||
ON CONFLICT DO NOTHING;
|
||||
|
||||
-- name: GetTrack :one
|
||||
SELECT
|
||||
SELECT
|
||||
t.*,
|
||||
get_artists_for_track(t.id) AS artists,
|
||||
r.image
|
||||
|
|
@ -109,6 +109,15 @@ JOIN tracks t ON l.track_id = t.id
|
|||
WHERE l.listened_at BETWEEN $1 AND $2
|
||||
AND t.release_id = $3;
|
||||
|
||||
-- name: CountNewTracks :one
|
||||
SELECT COUNT(*) AS total_count
|
||||
FROM (
|
||||
SELECT track_id
|
||||
FROM listens
|
||||
GROUP BY track_id
|
||||
HAVING MIN(listened_at) BETWEEN $1 AND $2
|
||||
) first_appearances;
|
||||
|
||||
-- name: UpdateTrackMbzID :exec
|
||||
UPDATE tracks SET musicbrainz_id = $2
|
||||
WHERE id = $1;
|
||||
|
|
@ -126,4 +135,4 @@ UPDATE artist_tracks SET is_primary = $3
|
|||
WHERE artist_id = $1 AND track_id = $2;
|
||||
|
||||
-- name: DeleteTrack :exec
|
||||
DELETE FROM tracks WHERE id = $1;
|
||||
DELETE FROM tracks WHERE id = $1;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue