refactoring + uploading attachments WIP

This commit is contained in:
zadam
2023-05-08 00:02:08 +02:00
parent b05ce12e7b
commit 626af84f42
23 changed files with 257 additions and 199 deletions

View File

@@ -7,14 +7,9 @@ const bulkActionService = require("../../services/bulk_actions");
const cls = require("../../services/cls");
const {formatAttrForSearch} = require("../../services/attribute_formatter");
const ValidationError = require("../../errors/validation_error");
const NotFoundError = require("../../errors/not_found_error");
function searchFromNote(req) {
const note = becca.getNote(req.params.noteId);
if (!note) {
throw new NotFoundError(`Note '${req.params.noteId}' has not been found.`);
}
const note = becca.getNoteOrThrow(req.params.noteId);
if (note.isDeleted) {
// this can be triggered from recent changes, and it's harmless to return empty list rather than fail
@@ -29,11 +24,7 @@ function searchFromNote(req) {
}
function searchAndExecute(req) {
const note = becca.getNote(req.params.noteId);
if (!note) {
throw new NotFoundError(`Note '${req.params.noteId}' has not been found.`);
}
const note = becca.getNoteOrThrow(req.params.noteId);
if (note.isDeleted) {
// this can be triggered from recent changes, and it's harmless to return empty list rather than fail