audiobookshelf/server/models/Notification.js

29 lines
748 B
JavaScript
Raw Normal View History

2023-03-15 23:42:35 +01:00
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,
2023-03-18 22:56:57 +01:00
urls: DataTypes.JSON, // JSON array of urls
2023-03-15 23:42:35 +01:00
titleTemplate: DataTypes.STRING(1000),
bodyTemplate: DataTypes.TEXT,
type: DataTypes.STRING,
lastFiredAt: DataTypes.DATE,
lastAttemptFailed: DataTypes.BOOLEAN,
numConsecutiveFailedAttempts: DataTypes.INTEGER,
numTimesFired: DataTypes.INTEGER,
2023-03-18 22:56:57 +01:00
enabled: DataTypes.BOOLEAN,
extraData: DataTypes.JSON
2023-03-15 23:42:35 +01:00
}, {
sequelize,
2023-03-19 21:19:22 +01:00
modelName: 'notification'
2023-03-15 23:42:35 +01:00
})
return Notification
}