Update MeController api endpoints to load library items from DB

This commit is contained in:
advplyr 2023-08-12 15:52:09 -05:00
parent db80cec168
commit f1130eb63a
4 changed files with 56 additions and 32 deletions

View file

@ -678,6 +678,15 @@ module.exports = (sequelize) => {
return libraryItems.map(li => this.getOldLibraryItem(li))
}
/**
* Check if library item exists
* @param {string} libraryItemId
* @returns {Promise<boolean>}
*/
static async checkExistsById(libraryItemId) {
return (await this.count({ where: { id: libraryItemId } })) > 0
}
getMedia(options) {
if (!this.mediaType) return Promise.resolve(null)
const mixinMethodName = `get${sequelize.uppercaseFirst(this.mediaType)}`