From 2f117a22cd21fa4fb67a3b2d687485795f86d030 Mon Sep 17 00:00:00 2001 From: Wu Cheng-Han Date: Sat, 30 Jul 2016 11:21:38 +0800 Subject: Add support of saving authors and authorship --- lib/models/note.js | 8 ++++++++ 1 file changed, 8 insertions(+) (limited to 'lib/models/note.js') 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 { -- cgit v1.2.3