audiobookshelf/server/models/UserPermission.js

25 lines
499 B
JavaScript
Raw Normal View History

2023-03-15 23:42:35 +01:00
const { DataTypes, Model } = require('sequelize')
module.exports = (sequelize) => {
class UserPermission extends Model { }
UserPermission.init({
id: {
type: DataTypes.UUID,
defaultValue: DataTypes.UUIDV4,
primaryKey: true
},
key: DataTypes.STRING,
value: DataTypes.STRING
}, {
sequelize,
modelName: 'UserPermission'
})
const { User } = sequelize.models
User.hasMany(UserPermission)
UserPermission.belongsTo(User)
return UserPermission
}