Skip to content

Commit 160c83d

Browse files
committed
Update:podcastEpisodes table index added for createdAt column #2073 #2075
1 parent 456bb87 commit 160c83d

File tree

3 files changed

+11
-3
lines changed

3 files changed

+11
-3
lines changed

server/controllers/LibraryItemController.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,6 @@ class LibraryItemController {
4949
item.episodesDownloading = [this.podcastManager.currentDownload.toJSONForClient()]
5050
}
5151
}
52-
5352
return res.json(item)
5453
}
5554
res.json(req.libraryItem)

server/models/LibraryItem.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -421,6 +421,10 @@ class LibraryItem extends Model {
421421
if (!libraryItemId) return null
422422

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

425429
if (libraryItem.mediaType === 'podcast') {
426430
libraryItem.media = await libraryItem.getMedia({
@@ -453,7 +457,7 @@ class LibraryItem extends Model {
453457
})
454458
}
455459

456-
if (!libraryItem) return null
460+
if (!libraryItem.media) return null
457461
return this.getOldLibraryItem(libraryItem)
458462
}
459463

server/models/PodcastEpisode.js

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -152,7 +152,12 @@ class PodcastEpisode extends Model {
152152
extraData: DataTypes.JSON
153153
}, {
154154
sequelize,
155-
modelName: 'podcastEpisode'
155+
modelName: 'podcastEpisode',
156+
indexes: [
157+
{
158+
fields: ['createdAt']
159+
}
160+
]
156161
})
157162

158163
const { podcast } = sequelize.models

0 commit comments

Comments
 (0)