Repository navigation
feat: song listing and detail routes, legacy EVM auth flag, computed artist stream stats - #852
Merged
Akatenvictor merged 2 commits intoOct 18, 2026
Conversation
…artist stream stats
|
@vjuliaife Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits. You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
GET /api/song/:idandGET /api/songare now routed, with visibility rules, explicit response shaping, filters and pagination. The unusedSongService.createSong(and its unrouted controller handler) is removed.ENABLE_LEGACY_EVM_AUTH(defaultfalse) and return410 Gonewhen it is off.totalStreams,totalStreamTimeanduniqueListenersare no longer client-settable or stored onusers; profile responses compute them fromsong_play_events.Changes
Song detail and listing (#810, #811)
SongRoutes.ts:GET /andGET /:id(both withoptionalAuth), registered after/popular,/stream/:idand/embed/:id./:idusesetagCache({ visibility: 'no-cache' }), so clients revalidate and get304when unchanged.SongService.getSongView: validates the id as a UUID (400), returns 404 for flagged / non-ready songs unless the caller owns the song (owner also getserrorReason).toSongView: explicit response shape (title, artist summary, cover, genre, duration, playCount, status, mintStatus, on-chain ids, createdAt).s3OriginalUrl, moderation and review fields are not returned. The same shape is used for list items.ListSongsQueryDTO+SongService.listSongs: query-builder filtersartistId,genreId,tag(slug),mintStatus,status(owner only, 403 otherwise),sort=newest|popular|title,page/limit(limit max 100). Public callers always getstatus = ready AND flagged = false. Response is{ success, data, pagination }using the existingpaginatedResponseutil.SongService.createSongandSongController.createSong(not routed; mass-assigned arbitrary input).docs/openapi.yaml: documented/api/songand/api/song/{id}.src/utils/pagination.ts), so that is what is used. NoCacheService.getSong/cacheSongcaching on the detail route, because that cache holds streaming manifests and the response differs for the owner. No index migration:EXPLAINwas not run (no database here); filter columns (artistId,genreId,status,mintStatus,createdAt) are already indexed,playCountandtitlesorts are not.Legacy EVM auth flag (#809)
ENABLE_LEGACY_EVM_AUTH(defaultfalse),isLegacyEvmAuthEnabled()inauthFlags.ts, andrequireLegacyEvmAuthmiddleware that returns410with a hint to use Privy or email login.GET /api/auth/nonce/:email,POST /api/auth/register,/register-listener,/login,POST /api/wallet/evm/create,/evm/signMessage.ethers(inUserService) and the Dynamic wallet service (inWalletController) are now imported lazily. No other module undersrc/importsethers,@dynamic-labs-wallet/*orviem, so Stellar/Privy flows no longer load them at startup.docs/PRIVY_MIGRATION_GUIDE.md(section 8.1, including the removal follow-up) and.env.example.src/routes/authRoutes.ts(nonce, register, register-listener, login),src/routes/walletRoutes.ts(/evm/create,/evm/signMessage).AuthController(getUserNonce,register,registerListener,login),WalletController(createEvmWallet,signMessage).UserService.createUser(usesethersverifyMessage,validateEthereumAddress),AuthService.getNonce/login,src/services/Dynamic/WalletService.ts.src/config/dynamic.ts,src/utils/dynamicUtils.ts(@dynamic-labs-wallet/node-evm,viem).src/abis/*(Diamond and facet ABIs; no imports fromsrc/, only referenced by subgraph tests).DYNAMIC_ENVIRONMENT_ID,DYNAMIC_AUTH_TOKEN,LISK_SEPOLIA_RPC_URL.Artist stream stats (#807)
totalStreams,totalStreamTime,uniqueListenersfromCreateUserDTO,UpdateUserDTO, theUserentity, JWT payloads,AccountMergeServiceanddocs/database-schema.md; migration1757700000000-DropUserStreamStatColumnsdrops the columns (with adown).SongStatsService.getArtistLifetimeTotals: counts plays, unique listeners and listening time (song duration per play) fromsong_play_events, cached in Redis for the existing 5 minute stats TTL under a key that the existinginvalidateSongpattern already clears.UserServiceown / public / updated profile responses now take these stats from that method.Issues
Resolves #811
Resolves #810
Resolves #809
Resolves #807
Verification
Manual review of the full diff only.
cargo buildandcargo testwere not run (TypeScript repository).Run locally with
npm ci --ignore-scripts:npx jest --silent --forceExiton the new and affected test files:SongListing,SongControllerListing,SongRoutesOrder,ListSongsQueryDTO,legacyEvmGate,UserService.streamStats,SongStatsService,SongService,AuthService,authFlagsall pass. The new tests cover each listing filter and sort, the visibility rules (flagged / processing / failed hidden from the public and shown to the owner), route ordering with/popular, the410gate with the flag unset, false and true, stripping of client-sent stream stats, and stats computed from play-event query results (with the database layer stubbed).npx tsc --noEmitreports no errors in the files touched by this change.SongController.test.ts(13 failures; I only removed thecreateSongcases and pointedgetSongat the new method),WalletController.test.ts,RoyaltyTemplateController.test.ts,uploadStreamingPipeline.test.ts,api.contract.test.ts.Not verified: no database or Redis was available, so the migration, the SQL generated by the query builder and the
EXPLAINplans were not executed.