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,
|
2023-03-19 21:19:22 +01:00
|
|
|
modelName: 'userPermission'
|
2023-03-15 23:42:35 +01:00
|
|
|
})
|
|
|
|
|
2023-03-19 21:19:22 +01:00
|
|
|
const { user } = sequelize.models
|
2023-03-15 23:42:35 +01:00
|
|
|
|
2023-03-19 21:19:22 +01:00
|
|
|
user.hasMany(UserPermission)
|
|
|
|
UserPermission.belongsTo(user)
|
2023-03-15 23:42:35 +01:00
|
|
|
|
|
|
|
return UserPermission
|
|
|
|
}
|