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

fix: improve error handling in artist, album, and song record functions

+3 -4
+3 -4
apps/api/src/nowplaying/nowplaying.service.ts
··· 9 import * as Scrobble from "lexicon/types/app/rocksky/scrobble"; 10 import * as Song from "lexicon/types/app/rocksky/song"; 11 import { deepSnakeCaseKeys } from "lib"; 12 - import _ from "lodash"; 13 import { createHash } from "node:crypto"; 14 import type { Track } from "types/track"; 15 import albumTracks from "../schema/album-tracks"; ··· 40 name: track.albumArtist, 41 createdAt: new Date().toISOString(), 42 pictureUrl: track.artistPicture, 43 - tags: _.get(track, "genres", []), 44 }; 45 46 if (!Artist.validateRecord(record).success) { ··· 134 : undefined, 135 createdAt: new Date().toISOString(), 136 spotifyLink: track.spotifyLink ? track.spotifyLink : undefined, 137 - tags: _.get(track, "genres", []), 138 }; 139 140 if (!Song.validateRecord(record).success) { ··· 190 ? dayjs.unix(track.timestamp).toISOString() 191 : new Date().toISOString(), 192 spotifyLink: track.spotifyLink ? track.spotifyLink : undefined, 193 - tags: _.get(track, "genres", []), 194 }; 195 196 if (!Scrobble.validateRecord(record).success) {
··· 9 import * as Scrobble from "lexicon/types/app/rocksky/scrobble"; 10 import * as Song from "lexicon/types/app/rocksky/song"; 11 import { deepSnakeCaseKeys } from "lib"; 12 import { createHash } from "node:crypto"; 13 import type { Track } from "types/track"; 14 import albumTracks from "../schema/album-tracks"; ··· 39 name: track.albumArtist, 40 createdAt: new Date().toISOString(), 41 pictureUrl: track.artistPicture, 42 + tags: [], 43 }; 44 45 if (!Artist.validateRecord(record).success) { ··· 133 : undefined, 134 createdAt: new Date().toISOString(), 135 spotifyLink: track.spotifyLink ? track.spotifyLink : undefined, 136 + tags: [], 137 }; 138 139 if (!Song.validateRecord(record).success) { ··· 189 ? dayjs.unix(track.timestamp).toISOString() 190 : new Date().toISOString(), 191 spotifyLink: track.spotifyLink ? track.spotifyLink : undefined, 192 + tags: [], 193 }; 194 195 if (!Scrobble.validateRecord(record).success) {