mirror of
https://github.com/linuxserver/heimdalljs.git
synced 2026-02-20 05:12:24 +08:00
29 lines
533 B
JavaScript
29 lines
533 B
JavaScript
'use strict'
|
|
|
|
const { Model } = require('sequelize')
|
|
|
|
class Setting extends Model {
|
|
static init(sequelize, DataTypes) {
|
|
return super.init(
|
|
{
|
|
key: DataTypes.STRING,
|
|
value: {
|
|
type: DataTypes.TEXT,
|
|
get() {
|
|
return JSON.parse(this.getDataValue('value'))
|
|
},
|
|
set(val) {
|
|
this.setDataValue('value', JSON.stringify(val))
|
|
}
|
|
}
|
|
},
|
|
{
|
|
sequelize,
|
|
underscored: true
|
|
}
|
|
)
|
|
}
|
|
}
|
|
|
|
module.exports = Setting
|