diff options
Diffstat (limited to '')
-rw-r--r-- | lib/models/note.js | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/lib/models/note.js b/lib/models/note.js index 37d26ec0..5c63dc1a 100644 --- a/lib/models/note.js +++ b/lib/models/note.js @@ -53,18 +53,27 @@ module.exports = function (sequelize, DataTypes) { }, title: { type: DataTypes.TEXT, + get: function () { + return sequelize.processData(this.getDataValue('title'), ""); + }, set: function (value) { this.setDataValue('title', sequelize.stripNullByte(value)); } }, content: { type: DataTypes.TEXT, + get: function () { + return sequelize.processData(this.getDataValue('content'), ""); + }, set: function (value) { this.setDataValue('content', sequelize.stripNullByte(value)); } }, authorship: { type: DataTypes.TEXT, + get: function () { + return sequelize.processData(this.getDataValue('authorship'), [], JSON.parse); + }, set: function (value) { this.setDataValue('authorship', JSON.stringify(value)); } |