audiobookshelf/server/models/MediaFile.js
2023-03-15 17:42:35 -05:00

29 lines
625 B
JavaScript

const { DataTypes, Model } = require('sequelize')
module.exports = (sequelize) => {
class MediaFile extends Model { }
MediaFile.init({
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true
},
formatName: DataTypes.STRING,
formatNameLong: DataTypes.STRING,
duration: DataTypes.FLOAT,
bitrate: DataTypes.INTEGER,
size: DataTypes.BIGINT,
tags: DataTypes.JSON
}, {
sequelize,
modelName: 'MediaFile'
})
const { FileMetadata } = sequelize.models
FileMetadata.hasOne(MediaFile)
MediaFile.belongsTo(FileMetadata)
return MediaFile
}