diff --git a/.gitignore b/.gitignore index d84c44bf4..01eac268c 100644 --- a/.gitignore +++ b/.gitignore @@ -11,3 +11,4 @@ cert.crt server-package.json .idea/httpRequests/ data/ +tmp/ diff --git a/docs/backend_api/AbstractEntity.html b/docs/backend_api/AbstractEntity.html index 2e07d3086..afa51341e 100644 --- a/docs/backend_api/AbstractEntity.html +++ b/docs/backend_api/AbstractEntity.html @@ -183,7 +183,7 @@
Source:
@@ -259,7 +259,7 @@
Source:
@@ -595,7 +595,7 @@
Source:
@@ -833,7 +833,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -869,7 +869,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' -

save() → {AbstractEntity}

+

save() → {this}

@@ -921,7 +921,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -957,7 +957,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
-AbstractEntity +this
diff --git a/docs/backend_api/EtapiToken.html b/docs/backend_api/EtapiToken.html index 5f7b1e1e5..22cf9e2eb 100644 --- a/docs/backend_api/EtapiToken.html +++ b/docs/backend_api/EtapiToken.html @@ -205,7 +205,7 @@ from tokenHash and token.
Source:
@@ -694,7 +694,7 @@ from tokenHash and token.
Source:
@@ -1050,7 +1050,7 @@ from tokenHash and token.
Source:
@@ -1298,7 +1298,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -1334,7 +1334,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' -

save() → {AbstractEntity}

+

save() → {this}

@@ -1391,7 +1391,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -1427,7 +1427,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
-AbstractEntity +this
diff --git a/docs/backend_api/NoteRevision.html b/docs/backend_api/NoteRevision.html index 5bb9a2eb3..890162f52 100644 --- a/docs/backend_api/NoteRevision.html +++ b/docs/backend_api/NoteRevision.html @@ -200,7 +200,7 @@ It's used for seamless note versioning.
Source:
@@ -1097,7 +1097,7 @@ It's used for seamless note versioning.
Source:
@@ -1657,7 +1657,7 @@ It's used for seamless note versioning.
Source:
@@ -2011,7 +2011,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -2047,7 +2047,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' -

save() → {AbstractEntity}

+

save() → {this}

@@ -2104,7 +2104,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -2140,7 +2140,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
-AbstractEntity +this
diff --git a/docs/backend_api/Option.html b/docs/backend_api/Option.html index f31eaf5e9..00e1e5f69 100644 --- a/docs/backend_api/Option.html +++ b/docs/backend_api/Option.html @@ -199,7 +199,7 @@
Source:
@@ -552,7 +552,7 @@
Source:
@@ -908,7 +908,7 @@
Source:
@@ -1156,7 +1156,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -1192,7 +1192,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' -

save() → {AbstractEntity}

+

save() → {this}

@@ -1249,7 +1249,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -1285,7 +1285,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
-AbstractEntity +this
diff --git a/docs/backend_api/RecentNote.html b/docs/backend_api/RecentNote.html index 62c311b5e..227cca7a3 100644 --- a/docs/backend_api/RecentNote.html +++ b/docs/backend_api/RecentNote.html @@ -199,7 +199,7 @@
Source:
@@ -484,7 +484,7 @@
Source:
@@ -840,7 +840,7 @@
Source:
@@ -1088,7 +1088,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -1124,7 +1124,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and ' -

save() → {AbstractEntity}

+

save() → {this}

@@ -1181,7 +1181,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
Source:
@@ -1217,7 +1217,7 @@ This is a low level method, for notes and branches use `note.deleteNote()` and '
-AbstractEntity +this
diff --git a/src/routes/api/attributes.js b/src/routes/api/attributes.js index cb59239a9..8c0299b7a 100644 --- a/src/routes/api/attributes.js +++ b/src/routes/api/attributes.js @@ -68,8 +68,6 @@ function updateNoteAttribute(req) { attribute.markAsDeleted(); } - console.log(attribute); - attribute.save(); return { diff --git a/src/services/backend_script_api.js b/src/services/backend_script_api.js index d83e51b99..6234c3800 100644 --- a/src/services/backend_script_api.js +++ b/src/services/backend_script_api.js @@ -568,8 +568,9 @@ function BackendScriptApi(currentNote, apiParams) { * @param {string} noteId * @param {string} format - either 'html' or 'markdown' * @param {string} zipFilePath + * @returns {Promise} */ - this.exportSubtreeToZipFile = (noteId, format, zipFilePath) => exportService.exportToZipFile(noteId, format, zipFilePath); + this.exportSubtreeToZipFile = async (noteId, format, zipFilePath) => await exportService.exportToZipFile(noteId, format, zipFilePath); /** * This object contains "at your risk" and "no BC guarantees" objects for advanced use cases. diff --git a/src/services/export/zip.js b/src/services/export/zip.js index bc79f3610..c1e48fcab 100644 --- a/src/services/export/zip.js +++ b/src/services/export/zip.js @@ -22,7 +22,7 @@ const ValidationError = require("../../errors/validation_error"); * @param {Branch} branch * @param {string} format - 'html' or 'markdown' */ -function exportToZip(taskContext, branch, format, res, setHeaders = true) { +async function exportToZip(taskContext, branch, format, res, setHeaders = true) { if (!['html', 'markdown'].includes(format)) { throw new ValidationError(`Only 'html' and 'markdown' allowed as export format, '${format}' given`); } @@ -478,12 +478,12 @@ ${markdownContent}`; } archive.pipe(res); - archive.finalize(); + await archive.finalize(); taskContext.taskSucceeded(); } -function exportToZipFile(noteId, format, zipFilePath) { +async function exportToZipFile(noteId, format, zipFilePath) { const fileOutputStream = fs.createWriteStream(zipFilePath); const taskContext = new TaskContext('no-progress-reporting'); @@ -493,7 +493,9 @@ function exportToZipFile(noteId, format, zipFilePath) { throw new ValidationError(`Note ${noteId} not found.`); } - exportToZip(taskContext, note.getParentBranches()[0], format, fileOutputStream, false); + await exportToZip(taskContext, note.getParentBranches()[0], format, fileOutputStream, false); + + log.info(`Exported '${noteId}' with format '${format}' to '${zipFilePath}'`); } module.exports = {