diff --git a/lib/models/note.js b/lib/models/note.js index 4c501d2..2b51c87 100644 --- a/lib/models/note.js +++ b/lib/models/note.js @@ -208,9 +208,11 @@ module.exports = function (sequelize, DataTypes) { filePath = path.join(config.docspath, note.alias + '.md'); } if (Note.checkFileExist(filePath)) { + var fsCreatedTime = moment(fs.statSync(filePath).ctime); body = fs.readFileSync(filePath, 'utf8'); note.title = LZString.compressToBase64(Note.parseNoteTitle(body)); note.content = LZString.compressToBase64(body); + note.createdAt = fsCreatedTime; } } // if no permission specified and have owner then give editable permission, else default permission is freely