A decentralized music tracking and discovery platform built on AT Protocol 🎵
listenbrainz spotify atproto lastfm musicbrainz scrobbling

Merge branch 'main' into feat/feed-generator

Changed files
+9 -5
apps
api
src
xrpc
app
rocksky
scrobble
+9 -5
apps/api/src/xrpc/app/rocksky/scrobble/getScrobble.ts
··· 6 6 import type { QueryParams } from "lexicon/types/app/rocksky/scrobble/getScrobble"; 7 7 import * as R from "ramda"; 8 8 import tables from "schema"; 9 + import { SelectAlbum } from "schema/albums"; 9 10 import type { SelectScrobble } from "schema/scrobbles"; 10 11 import type { SelectTrack } from "schema/tracks"; 11 12 import type { SelectUser } from "schema/users"; ··· 21 22 Effect.catchAll((err) => { 22 23 console.error("Error retrieving scrobble:", err); 23 24 return Effect.succeed({}); 24 - }), 25 + }) 25 26 ); 26 27 server.app.rocksky.scrobble.getScrobble({ 27 28 handler: async ({ params }) => { ··· 48 49 .from(tables.scrobbles) 49 50 .leftJoin(tables.tracks, eq(tables.scrobbles.trackId, tables.tracks.id)) 50 51 .leftJoin(tables.users, eq(tables.scrobbles.userId, tables.users.id)) 52 + .leftJoin(tables.albums, eq(tables.scrobbles.albumId, tables.albums.id)) 51 53 .where(eq(tables.scrobbles.uri, params.uri)) 52 54 .execute() 53 55 .then((rows) => rows[0]); ··· 61 63 .from(tables.scrobbles) 62 64 .leftJoin( 63 65 tables.tracks, 64 - eq(tables.tracks.id, tables.scrobbles.trackId), 66 + eq(tables.tracks.id, tables.scrobbles.trackId) 65 67 ) 66 68 .leftJoin(tables.users, eq(tables.scrobbles.userId, tables.users.id)) 67 69 .where(eq(tables.scrobbles.trackId, scrobble?.tracks.id)) ··· 73 75 .from(tables.scrobbles) 74 76 .leftJoin( 75 77 tables.tracks, 76 - eq(tables.scrobbles.trackId, tables.tracks.id), 78 + eq(tables.scrobbles.trackId, tables.tracks.id) 77 79 ) 78 80 .where(eq(tables.scrobbles.trackId, scrobble?.tracks.id)) 79 81 .execute() ··· 85 87 }; 86 88 87 89 const presentation = ([ 88 - { scrobbles, tracks, users }, 90 + { scrobbles, tracks, users, albums }, 89 91 listeners, 90 92 scrobblesCount, 91 93 ]: [Scrobble | undefined, number, number]): Effect.Effect< ··· 93 95 never 94 96 > => { 95 97 return Effect.sync(() => ({ 96 - ...R.omit(["albumArt", "id"], tracks), 98 + ...R.omit(["albumArt", "id", "albumUri"], tracks), 99 + albumUri: albums.uri, 97 100 cover: tracks.albumArt, 98 101 date: scrobbles.timestamp.toISOString(), 99 102 user: users.handle, ··· 109 112 scrobbles: SelectScrobble; 110 113 tracks: SelectTrack; 111 114 users: SelectUser; 115 + albums: SelectAlbum; 112 116 };