mirror of
https://github.com/advplyr/audiobookshelf.git
synced 2026-03-03 06:29:42 +00:00
Starting db migration file
This commit is contained in:
parent
b2e1e24ca5
commit
c738e35a8c
14 changed files with 477 additions and 39 deletions
33
server/models/Notification.js
Normal file
33
server/models/Notification.js
Normal file
|
|
@ -0,0 +1,33 @@
|
|||
const { DataTypes, Model } = require('sequelize')
|
||||
|
||||
module.exports = (sequelize) => {
|
||||
class Notification extends Model { }
|
||||
|
||||
Notification.init({
|
||||
id: {
|
||||
type: DataTypes.UUID,
|
||||
defaultValue: DataTypes.UUIDV4,
|
||||
primaryKey: true
|
||||
},
|
||||
eventName: DataTypes.STRING,
|
||||
urls: DataTypes.TEXT, // JSON array of urls
|
||||
titleTemplate: DataTypes.STRING(1000),
|
||||
bodyTemplate: DataTypes.TEXT,
|
||||
type: DataTypes.STRING,
|
||||
lastFiredAt: DataTypes.DATE,
|
||||
lastAttemptFailed: DataTypes.BOOLEAN,
|
||||
numConsecutiveFailedAttempts: DataTypes.INTEGER,
|
||||
numTimesFired: DataTypes.INTEGER,
|
||||
enabled: DataTypes.BOOLEAN
|
||||
}, {
|
||||
sequelize,
|
||||
modelName: 'Notification'
|
||||
})
|
||||
|
||||
const { Library } = sequelize.models
|
||||
|
||||
Library.hasMany(Notification)
|
||||
Notification.belongsTo(Library)
|
||||
|
||||
return Notification
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue