mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2024-12-20 19:06:06 +01:00
25 lines
489 B
JavaScript
25 lines
489 B
JavaScript
const { DataTypes, Model } = require('sequelize')
|
|
|
|
module.exports = (sequelize) => {
|
|
class Collection extends Model { }
|
|
|
|
Collection.init({
|
|
id: {
|
|
type: DataTypes.UUID,
|
|
defaultValue: DataTypes.UUIDV4,
|
|
primaryKey: true
|
|
},
|
|
name: DataTypes.STRING,
|
|
description: DataTypes.TEXT
|
|
}, {
|
|
sequelize,
|
|
modelName: 'Collection'
|
|
})
|
|
|
|
const { Library } = sequelize.models
|
|
|
|
Library.hasMany(Collection)
|
|
Collection.belongsTo(Library)
|
|
|
|
return Collection
|
|
} |