mirror of
https://github.com/hedgedoc/hedgedoc.git
synced 2025-05-13 06:34:39 -04:00
Refactor data processing to model definition
This commit is contained in:
parent
d9e19b6029
commit
b1ec3ba748
3 changed files with 27 additions and 0 deletions
|
@ -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));
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue