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

Exclude loved songs with null URIs

Import and and not from drizzle-orm and require lovedTracks.uri to be
non-null so only valid loved tracks are returned

Changed files
+7 -4
apps
api
src
xrpc
app
rocksky
+7 -4
apps/api/src/xrpc/app/rocksky/actor/getActorLovedSongs.ts
··· 1 1 import type { Context } from "context"; 2 - import { desc, eq, or } from "drizzle-orm"; 2 + import { and, desc, eq, not, or } from "drizzle-orm"; 3 3 import { Effect, pipe } from "effect"; 4 4 import type { Server } from "lexicon"; 5 5 import type { QueryParams } from "lexicon/types/app/rocksky/actor/getActorLovedSongs"; ··· 49 49 ) 50 50 .leftJoin(tables.users, eq(tables.lovedTracks.userId, tables.users.id)) 51 51 .where( 52 - or( 53 - eq(tables.users.did, params.did), 54 - eq(tables.users.handle, params.did), 52 + and( 53 + or( 54 + eq(tables.users.did, params.did), 55 + eq(tables.users.handle, params.did), 56 + ), 57 + not(eq(tables.lovedTracks.uri, null)), 55 58 ), 56 59 ) 57 60 .limit(params.limit ?? 10)