audiobookshelf/server/models/EBookFile.js
2023-03-18 16:56:57 -05:00

23 lines
524 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
}
}, {
sequelize,
modelName: 'EBookFile'
})
const { FileMetadata } = sequelize.models
FileMetadata.hasOne(EBookFile, { foreignKey: 'FileMetadataId' })
EBookFile.belongsTo(FileMetadata, { as: 'FileMetadata', foreignKey: 'FileMetadataId' })
return EBookFile
}