summaryrefslogtreecommitdiff
path: root/lib/models/note.js
diff options
context:
space:
mode:
authorWu Cheng-Han2016-07-30 11:21:38 +0800
committerWu Cheng-Han2016-07-30 11:21:38 +0800
commit2f117a22cd21fa4fb67a3b2d687485795f86d030 (patch)
tree897902d9d55da45a4f7723f6ea69d6b04f10619b /lib/models/note.js
parent44fd0a617b3135720079f69dd522f6e25154ec36 (diff)
Add support of saving authors and authorship
Diffstat (limited to 'lib/models/note.js')
-rw-r--r--lib/models/note.js8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/models/note.js b/lib/models/note.js
index f9a8ec61..5ee5c7de 100644
--- a/lib/models/note.js
+++ b/lib/models/note.js
@@ -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 {