Add support of saving authors and authorship

This commit is contained in:
Wu Cheng-Han 2016-07-30 11:21:38 +08:00
parent 44fd0a617b
commit 2f117a22cd
6 changed files with 240 additions and 3 deletions

View file

@ -51,6 +51,9 @@ module.exports = function (sequelize, DataTypes) {
content: {
type: DataTypes.TEXT
},
authorship: {
type: DataTypes.TEXT
},
lastchangeAt: {
type: DataTypes.DATE
},
@ -74,6 +77,11 @@ module.exports = function (sequelize, DataTypes) {
foreignKey: "noteId",
constraints: false
});
Note.hasMany(models.Author, {
foreignKey: "noteId",
as: "authors",
constraints: false
});
},
checkFileExist: function (filePath) {
try {