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

[api] fix wrong loved song date

+11 -6
+11 -6
apps/api/src/xrpc/app/rocksky/actor/getActorLovedSongs.ts
··· 18 Effect.catchAll((err) => { 19 console.error(err); 20 return Effect.succeed({ tracks: [] }); 21 - }) 22 ); 23 server.app.rocksky.actor.getActorLovedSongs({ 24 handler: async ({ params }) => { ··· 45 .from(tables.lovedTracks) 46 .leftJoin( 47 tables.tracks, 48 - eq(tables.lovedTracks.trackId, tables.tracks.id) 49 ) 50 .leftJoin(tables.users, eq(tables.lovedTracks.userId, tables.users.id)) 51 .where( 52 or( 53 eq(tables.users.did, params.did), 54 - eq(tables.users.handle, params.did) 55 - ) 56 ) 57 .limit(params.limit ?? 10) 58 .offset(params.offset ?? 0) 59 .orderBy(desc(tables.lovedTracks.createdAt)) 60 .execute() 61 - .then((rows) => rows.map((row) => row.tracks)), 62 catch: (error) => new Error(`Failed to retrieve loved songs: ${error}`), 63 }); 64 }; 65 66 const presentation = ( 67 - data: SelectTrack[] 68 ): Effect.Effect<{ tracks: SongViewBasic[] }, never> => { 69 return Effect.sync(() => ({ 70 tracks: data.map((track) => ({
··· 18 Effect.catchAll((err) => { 19 console.error(err); 20 return Effect.succeed({ tracks: [] }); 21 + }), 22 ); 23 server.app.rocksky.actor.getActorLovedSongs({ 24 handler: async ({ params }) => { ··· 45 .from(tables.lovedTracks) 46 .leftJoin( 47 tables.tracks, 48 + eq(tables.lovedTracks.trackId, tables.tracks.id), 49 ) 50 .leftJoin(tables.users, eq(tables.lovedTracks.userId, tables.users.id)) 51 .where( 52 or( 53 eq(tables.users.did, params.did), 54 + eq(tables.users.handle, params.did), 55 + ), 56 ) 57 .limit(params.limit ?? 10) 58 .offset(params.offset ?? 0) 59 .orderBy(desc(tables.lovedTracks.createdAt)) 60 .execute() 61 + .then((rows) => 62 + rows.map((row) => ({ 63 + ...row.tracks, 64 + createdAt: row.lovedTracks.createdAt, 65 + })) 66 + ), 67 catch: (error) => new Error(`Failed to retrieve loved songs: ${error}`), 68 }); 69 }; 70 71 const presentation = ( 72 + data: SelectTrack[], 73 ): Effect.Effect<{ tracks: SongViewBasic[] }, never> => { 74 return Effect.sync(() => ({ 75 tracks: data.map((track) => ({