Skip to content

Commit 03bdee2

Browse files
committed
Update note model on create doc will use the created time of the doc in filesystem
1 parent b906039 commit 03bdee2

1 file changed

Lines changed: 2 additions & 0 deletions

File tree

lib/models/note.js

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -208,9 +208,11 @@ module.exports = function (sequelize, DataTypes) {
208208
filePath = path.join(config.docspath, note.alias + '.md');
209209
}
210210
if (Note.checkFileExist(filePath)) {
211+
var fsCreatedTime = moment(fs.statSync(filePath).ctime);
211212
body = fs.readFileSync(filePath, 'utf8');
212213
note.title = LZString.compressToBase64(Note.parseNoteTitle(body));
213214
note.content = LZString.compressToBase64(body);
215+
note.createdAt = fsCreatedTime;
214216
}
215217
}
216218
// if no permission specified and have owner then give editable permission, else default permission is freely

0 commit comments

Comments
 (0)