Update:Only load libraries from db when needed

This commit is contained in:
advplyr 2023-07-22 14:25:20 -05:00
parent 1c40af3eef
commit 1d974375a0
13 changed files with 189 additions and 60 deletions

View file

@ -1,7 +1,18 @@
const { DataTypes, Model } = require('sequelize')
module.exports = (sequelize) => {
class LibraryFolder extends Model { }
class LibraryFolder extends Model {
/**
* Gets all library folder path strings
* @returns {Promise<string[]>} array of library folder paths
*/
static async getAllLibraryFolderPaths() {
const libraryFolders = await this.findAll({
attributes: ['path']
})
return libraryFolders.map(l => l.path)
}
}
LibraryFolder.init({
id: {