A decentralized music tracking and discovery platform built on AT Protocol 🎵

fix: enhance scrobble and track record serialization with Xata-specific fields

+186 -15
+144 -11
apps/api/src/nowplaying/nowplaying.service.ts
··· 330 330 331 331 const message = JSON.stringify( 332 332 deepSnakeCaseKeys({ 333 - scrobble, 334 - user_album, 335 - user_artist, 336 - user_track, 337 - album_track, 338 - artist_track, 339 - artist_album, 333 + scrobble: { 334 + ...scrobble.scrobble, 335 + album_id: { 336 + ...scrobble.album, 337 + xata_id: scrobble.album.id, 338 + xata_createdat: scrobble.album.createdAt.toISOString(), 339 + xata_updatedat: scrobble.album.updatedAt.toISOString(), 340 + }, 341 + artist_id: { 342 + ...scrobble.artist, 343 + xata_id: scrobble.artist.id, 344 + xata_createdat: scrobble.artist.createdAt.toISOString(), 345 + xata_updatedat: scrobble.artist.updatedAt.toISOString(), 346 + }, 347 + track_id: { 348 + ...scrobble.track, 349 + xata_id: scrobble.track.id, 350 + xata_createdat: scrobble.track.createdAt.toISOString(), 351 + xata_updatedat: scrobble.track.updatedAt.toISOString(), 352 + }, 353 + user_id: { 354 + ...scrobble.user, 355 + xata_id: scrobble.user.id, 356 + xata_createdat: scrobble.user.createdAt.toISOString(), 357 + xata_updatedat: scrobble.user.updatedAt.toISOString(), 358 + }, 359 + xata_id: scrobble.scrobble.id, 360 + xata_createdat: scrobble.scrobble.createdAt.toISOString(), 361 + xata_updatedat: scrobble.scrobble.updatedAt.toISOString(), 362 + }, 363 + user_album: { 364 + ...user_album, 365 + album_id: { 366 + xata_id: scrobble.album.id, 367 + }, 368 + user_id: { 369 + xata_id: scrobble.user.id, 370 + }, 371 + xata_id: user_album.id, 372 + xata_createdat: user_album.createdAt.toISOString(), 373 + xata_updatedat: user_album.updatedAt.toISOString(), 374 + }, 375 + user_artist: { 376 + ...user_artist, 377 + artist_id: { 378 + xata_id: scrobble.artist.id, 379 + }, 380 + user_id: { 381 + xata_id: scrobble.user.id, 382 + }, 383 + xata_id: user_artist.id, 384 + xata_createdat: user_artist.createdAt.toISOString(), 385 + xata_updatedat: user_artist.updatedAt.toISOString(), 386 + }, 387 + user_track: { 388 + ...user_track, 389 + track_id: { 390 + xata_id: scrobble.track.id, 391 + }, 392 + user_id: { 393 + xata_id: scrobble.user.id, 394 + }, 395 + xata_id: user_track.id, 396 + xata_createdat: user_track.createdAt.toISOString(), 397 + xata_updatedat: user_track.updatedAt.toISOString(), 398 + }, 399 + album_track: { 400 + ...album_track, 401 + album_id: { 402 + xata_id: scrobble.album.id, 403 + }, 404 + track_id: { 405 + xata_id: scrobble.track.id, 406 + }, 407 + xata_id: album_track.id, 408 + xata_createdat: album_track.createdAt.toISOString(), 409 + xata_updatedat: album_track.updatedAt.toISOString(), 410 + }, 411 + artist_track: { 412 + ...artist_track, 413 + artist_id: { 414 + xata_id: scrobble.artist.id, 415 + }, 416 + track_id: { 417 + xata_id: scrobble.track.id, 418 + }, 419 + xata_id: artist_track.id, 420 + xata_createdat: artist_track.createdAt.toISOString(), 421 + xata_updatedat: artist_track.updatedAt.toISOString(), 422 + }, 423 + artist_album: { 424 + ...artist_album, 425 + artist_id: { 426 + xata_id: scrobble.artist.id, 427 + }, 428 + album_id: { 429 + xata_id: scrobble.album.id, 430 + }, 431 + xata_id: artist_album.id, 432 + xata_createdat: artist_album.createdAt.toISOString(), 433 + xata_updatedat: artist_album.updatedAt.toISOString(), 434 + }, 340 435 }) 341 436 ); 342 437 ··· 344 439 345 440 const trackMessage = JSON.stringify( 346 441 deepSnakeCaseKeys({ 347 - track: scrobble.track, 348 - album_track, 349 - artist_track, 350 - artist_album, 442 + track: { 443 + ...scrobble.track, 444 + xata_id: scrobble.track.id, 445 + xata_createdat: scrobble.track.createdAt.toISOString(), 446 + xata_updatedat: scrobble.track.updatedAt.toISOString(), 447 + }, 448 + album_track: { 449 + ...album_track, 450 + album_id: { 451 + xata_id: album_track.albumId, 452 + }, 453 + track_id: { 454 + xata_id: album_track.trackId, 455 + }, 456 + xata_id: album_track.id, 457 + xata_createdat: album_track.createdAt.toISOString(), 458 + xata_updatedat: album_track.updatedAt.toISOString(), 459 + }, 460 + artist_track: { 461 + ...artist_track, 462 + artist_id: { 463 + xata_id: artist_track.artistId, 464 + }, 465 + track_id: { 466 + xata_id: artist_track.trackId, 467 + }, 468 + xata_id: artist_track.id, 469 + xata_createdat: artist_track.createdAt.toISOString(), 470 + xata_updatedat: artist_track.updatedAt.toISOString(), 471 + }, 472 + artist_album: { 473 + ...artist_album, 474 + artist_id: { 475 + xata_id: artist_album.artistId, 476 + }, 477 + album_id: { 478 + xata_id: artist_album.albumId, 479 + }, 480 + xata_id: artist_album.id, 481 + xata_createdat: artist_album.createdAt.toISOString(), 482 + xata_updatedat: artist_album.updatedAt.toISOString(), 483 + }, 351 484 }) 352 485 ); 353 486
+42 -4
apps/api/src/tracks/tracks.service.ts
··· 222 222 223 223 const message = JSON.stringify( 224 224 deepSnakeCaseKeys({ 225 - track: track_id, 226 - album_track, 227 - artist_track, 228 - artist_album, 225 + track: { 226 + ...track_id, 227 + xata_id: track_id.id, 228 + xata_createdat: track_id.createdAt.toISOString(), 229 + xata_updatedat: track_id.updatedAt.toISOString(), 230 + }, 231 + album_track: { 232 + ...album_track, 233 + album_id: { 234 + xata_id: album_track.albumId, 235 + }, 236 + track_id: { 237 + xata_id: album_track.trackId, 238 + }, 239 + xata_id: album_track.id, 240 + xata_createdat: album_track.createdAt.toISOString(), 241 + xata_updatedat: album_track.updatedAt.toISOString(), 242 + }, 243 + artist_track: { 244 + ...artist_track, 245 + artist_id: { 246 + xata_id: artist_track.artistId, 247 + }, 248 + track_id: { 249 + xata_id: artist_track.trackId, 250 + }, 251 + xata_id: artist_track.id, 252 + xata_createdat: artist_track.createdAt.toISOString(), 253 + xata_updatedat: artist_track.updatedAt.toISOString(), 254 + }, 255 + artist_album: { 256 + ...artist_album, 257 + artist_id: { 258 + xata_id: artist_album.artistId, 259 + }, 260 + album_id: { 261 + xata_id: artist_album.albumId, 262 + }, 263 + xata_id: artist_album.id, 264 + xata_createdat: artist_album.createdAt.toISOString(), 265 + xata_updatedat: artist_album.updatedAt.toISOString(), 266 + }, 229 267 }) 230 268 ); 231 269