Skip to content

Commit

Permalink
Update:podcastEpisodes table index added for createdAt column #2073 #…
Browse files Browse the repository at this point in the history
  • Loading branch information
advplyr committed Dec 30, 2023
1 parent 456bb87 commit 160c83d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 3 deletions.
1 change: 0 additions & 1 deletion server/controllers/LibraryItemController.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,6 @@ class LibraryItemController {
item.episodesDownloading = [this.podcastManager.currentDownload.toJSONForClient()]
}
}

return res.json(item)
}
res.json(req.libraryItem)
Expand Down
6 changes: 5 additions & 1 deletion server/models/LibraryItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,6 +421,10 @@ class LibraryItem extends Model {
if (!libraryItemId) return null

const libraryItem = await this.findByPk(libraryItemId)
if (!libraryItem) {
Logger.error(`[LibraryItem] Library item not found with id "${libraryItemId}"`)
return null
}

if (libraryItem.mediaType === 'podcast') {
libraryItem.media = await libraryItem.getMedia({
Expand Down Expand Up @@ -453,7 +457,7 @@ class LibraryItem extends Model {
})
}

if (!libraryItem) return null
if (!libraryItem.media) return null
return this.getOldLibraryItem(libraryItem)
}

Expand Down
7 changes: 6 additions & 1 deletion server/models/PodcastEpisode.js
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,12 @@ class PodcastEpisode extends Model {
extraData: DataTypes.JSON
}, {
sequelize,
modelName: 'podcastEpisode'
modelName: 'podcastEpisode',
indexes: [
{
fields: ['createdAt']
}
]
})

const { podcast } = sequelize.models
Expand Down

0 comments on commit 160c83d

Please sign in to comment.