audiobookshelf/server/models/LibraryFolder.js

25 lines
504 B
JavaScript
Raw Normal View History

2023-07-05 01:14:44 +02:00
const { DataTypes, Model } = require('sequelize')
module.exports = (sequelize) => {
class LibraryFolder extends Model { }
LibraryFolder.init({
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true
},
path: DataTypes.STRING
}, {
sequelize,
modelName: 'libraryFolder'
})
const { library } = sequelize.models
library.hasMany(LibraryFolder, {
onDelete: 'CASCADE'
})
2023-07-05 01:14:44 +02:00
LibraryFolder.belongsTo(library)
return LibraryFolder
}