feat(server): GET /api/library/sync endpoint
Returns batched upserts + deletes since the supplied cursor. Empty cursor
returns full snapshot; subsequent calls pull deltas. Per-user entities
(likes, playlists) are scoped to the authed user. Composite-key entities
(likes, playlist_tracks) use stable string ids encoded by sync.EncodeLikeID
/ sync.EncodePlaylistTrackID.
Behavior:
204 No Content - no changes since cursor
200 OK - JSON syncResponse {cursor, upserts, deletes}
410 Gone - cursor older than oldest log row; client must reset
401 / 500 - standard envelope errors
Adds sqlc queries GetAlbumsByIDs, GetTracksByIDs, GetPlaylistsByIDs to
mirror the existing GetArtistsByIDs.
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -159,3 +159,8 @@ UPDATE albums
|
||||
updated_at = now()
|
||||
WHERE id = $1;
|
||||
|
||||
|
||||
-- name: GetAlbumsByIDs :many
|
||||
-- Batched lookup used by /api/library/sync to hydrate upsert payloads
|
||||
-- (#357). Mirror of GetArtistsByIDs.
|
||||
SELECT * FROM albums WHERE id = ANY($1::uuid[]);
|
||||
|
||||
Reference in New Issue
Block a user