Migrate tools and collapse series. fix continue shelves. remove old objects

This commit is contained in:
advplyr 2025-01-05 14:09:03 -06:00
parent ac159bea72
commit 108eaba022
21 changed files with 132 additions and 1341 deletions

View file

@ -415,7 +415,7 @@ module.exports = {
* @param {import('../../models/User')} user
* @param {number} limit
* @param {number} offset
* @returns {Promise<{ libraryItems:import('../../objects/LibraryItem')[], count:number }>}
* @returns {Promise<{ libraryItems:import('../../models/LibraryItem')[], count:number }>}
*/
async getLibraryItemsForAuthor(author, user, limit, offset) {
const { libraryItems, count } = await libraryItemsBookFilters.getFilteredLibraryItems(author.libraryId, user, 'authors', author.id, 'addedAt', true, false, [], limit, offset)

View file

@ -297,7 +297,7 @@ module.exports = {
delete podcast.libraryItem
libraryItem.media = podcast
libraryItem.recentEpisode = ep.getOldPodcastEpisode(libraryItem.id).toJSON()
libraryItem.recentEpisode = ep.toOldJSON(libraryItem.id)
return libraryItem
})
@ -460,13 +460,14 @@ module.exports = {
})
const episodeResults = episodes.map((ep) => {
const libraryItem = ep.podcast.libraryItem
libraryItem.media = ep.podcast
const oldPodcast = Database.podcastModel.getOldPodcast(libraryItem)
const oldPodcastEpisode = ep.getOldPodcastEpisode(libraryItem.id).toJSONExpanded()
oldPodcastEpisode.podcast = oldPodcast
oldPodcastEpisode.libraryId = libraryItem.libraryId
return oldPodcastEpisode
ep.podcast.podcastEpisodes = [] // Not needed
const oldPodcastJson = ep.podcast.toOldJSON(ep.podcast.libraryItem.id)
const oldPodcastEpisodeJson = ep.toOldJSONExpanded(ep.podcast.libraryItem.id)
oldPodcastEpisodeJson.podcast = oldPodcastJson
oldPodcastEpisodeJson.libraryId = ep.podcast.libraryItem.libraryId
return oldPodcastEpisodeJson
})
return episodeResults