mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-03-01 13:39:41 +00:00
Adding more models
This commit is contained in:
parent
adc4309951
commit
bbf324ea83
27 changed files with 885 additions and 1 deletions
25
server/models/Collection.js
Normal file
25
server/models/Collection.js
Normal file
|
|
@ -0,0 +1,25 @@
|
|||
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
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue