mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
27 lines
538 B
JavaScript
27 lines
538 B
JavaScript
const { DataTypes, Model } = require('sequelize')
|
|
|
|
module.exports = (sequelize) => {
|
|
class BookChapter extends Model { }
|
|
|
|
BookChapter.init({
|
|
id: {
|
|
type: DataTypes.UUID,
|
|
defaultValue: DataTypes.UUIDV4,
|
|
primaryKey: true
|
|
},
|
|
index: DataTypes.INTEGER,
|
|
title: DataTypes.STRING,
|
|
start: DataTypes.FLOAT,
|
|
end: DataTypes.FLOAT
|
|
}, {
|
|
sequelize,
|
|
modelName: 'BookChapter'
|
|
})
|
|
|
|
const { Book } = sequelize.models
|
|
|
|
Book.hasMany(BookChapter)
|
|
BookChapter.belongsTo(Book)
|
|
|
|
return BookChapter
|
|
} |