feat: Add revisionCreator command (#2321)

add revisions.create event
This commit is contained in:
Tom Moor
2021-07-15 15:26:43 -04:00
committed by GitHub
parent 30cf244610
commit 8884da8a4b
5 changed files with 95 additions and 15 deletions

View File

@ -49,19 +49,22 @@ Revision.findLatest = function (documentId) {
});
};
Revision.createFromDocument = function (document) {
return Revision.create({
title: document.title,
text: document.text,
userId: document.lastModifiedById,
editorVersion: document.editorVersion,
version: document.version,
documentId: document.id,
Revision.createFromDocument = function (document, options) {
return Revision.create(
{
title: document.title,
text: document.text,
userId: document.lastModifiedById,
editorVersion: document.editorVersion,
version: document.version,
documentId: document.id,
// revision time is set to the last time document was touched as this
// handler can be debounced in the case of an update
createdAt: document.updatedAt,
});
// revision time is set to the last time document was touched as this
// handler can be debounced in the case of an update
createdAt: document.updatedAt,
},
options
);
};
Revision.prototype.migrateVersion = function () {