audiobookshelf/server/models/BookChapter.js

27 lines
538 B
JavaScript
Raw Normal View History

2023-03-12 20:51:45 +01:00
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,
2023-03-15 23:42:35 +01:00
start: DataTypes.FLOAT,
end: DataTypes.FLOAT
2023-03-12 20:51:45 +01:00
}, {
sequelize,
modelName: 'BookChapter'
})
const { Book } = sequelize.models
Book.hasMany(BookChapter)
BookChapter.belongsTo(Book)
return BookChapter
}