Update User.toJSONForPublic to remove mostRecent key and session key only includes the PlaybackSession

This commit is contained in:
advplyr
2023-08-12 16:11:58 -05:00
parent 09c9c28028
commit f465193b9c
4 changed files with 26 additions and 60 deletions

View File

@ -78,6 +78,11 @@ class PlaybackSession {
}
}
/**
* Session data to send to clients
* @param {[oldLibraryItem]} libraryItem optional
* @returns {object}
*/
toJSONForClient(libraryItem) {
return {
id: this.id,
@ -105,8 +110,8 @@ class PlaybackSession {
startedAt: this.startedAt,
updatedAt: this.updatedAt,
audioTracks: this.audioTracks.map(at => at.toJSON()),
videoTrack: this.videoTrack ? this.videoTrack.toJSON() : null,
libraryItem: libraryItem.toJSONExpanded()
videoTrack: this.videoTrack?.toJSON() || null,
libraryItem: libraryItem?.toJSONExpanded() || null
}
}