mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
24 lines
554 B
JavaScript
24 lines
554 B
JavaScript
const { DataTypes, Model } = require('sequelize')
|
|
|
|
module.exports = (sequelize) => {
|
|
class EBookFile extends Model { }
|
|
|
|
EBookFile.init({
|
|
id: {
|
|
type: DataTypes.UUID,
|
|
defaultValue: DataTypes.UUIDV4,
|
|
primaryKey: true
|
|
},
|
|
format: DataTypes.STRING
|
|
}, {
|
|
sequelize,
|
|
modelName: 'eBookFile'
|
|
})
|
|
|
|
const { fileMetadata } = sequelize.models
|
|
|
|
fileMetadata.hasOne(EBookFile, { foreignKey: 'fileMetadataId' })
|
|
EBookFile.belongsTo(fileMetadata, { as: 'fileMetadata', foreignKey: 'fileMetadataId' })
|
|
|
|
return EBookFile
|
|
} |