lisa-box
Version:
Home automation system L.I.S.A.
34 lines • 1.06 kB
JavaScript
const Model = require('trails/model');
module.exports = class ChatBotParamList extends Model {
static config() {
}
static schema(app, Sequelize) {
return {
name: {
type: Sequelize.STRING,
allowNull: false,
unique: true
},
values: {
type: Sequelize.STRING,
allowNull: false,
get: function () {
let data = null;
if (this.getDataValue('values')) {
data = JSON.parse(this.getDataValue('values'));
}
return data;
},
set: function (value) {
if (value) {
this.setDataValue('values', JSON.stringify(value));
}
else {
this.setDataValue('values', null);
}
}
}
};
}
};
//# sourceMappingURL=ChatBotParamList.js.map