preparing 0.59 without ocr/pdf, userguide, note ancillaries

This commit is contained in:
zadam
2023-02-17 14:49:45 +01:00
parent 42e08284b0
commit 6f7b554cdc
57 changed files with 813 additions and 2246 deletions

View File

@@ -54,10 +54,10 @@ function createNote(req) {
}
function updateNoteData(req) {
const {content, ancillaries} = req.body;
const {content} = req.body;
const {noteId} = req.params;
return noteService.updateNoteData(noteId, content, ancillaries);
return noteService.updateNoteData(noteId, content);
}
function deleteNote(req) {
@@ -127,49 +127,6 @@ function setNoteTypeMime(req) {
note.save();
}
function getNoteAncillaries(req) {
const includeContent = req.query.includeContent === 'true';
const {noteId} = req.params;
const note = becca.getNote(noteId);
if (!note) {
throw new NotFoundError(`Note '${noteId}' doesn't exist.`);
}
const noteAncillaries = note.getNoteAncillaries();
return noteAncillaries.map(ancillary => {
const pojo = ancillary.getPojo();
if (includeContent && utils.isStringNote(null, ancillary.mime)) {
pojo.content = ancillary.getContent()?.toString();
pojo.contentLength = pojo.content.length;
const MAX_ANCILLARY_LENGTH = 1_000_000;
if (pojo.content.length > MAX_ANCILLARY_LENGTH) {
pojo.content = pojo.content.substring(0, MAX_ANCILLARY_LENGTH);
}
}
return pojo;
});
}
function saveNoteAncillary(req) {
const {noteId, name} = req.params;
const {mime, content} = req.body;
const note = becca.getNote(noteId);
if (!note) {
throw new NotFoundError(`Note '${noteId}' doesn't exist.`);
}
note.saveNoteAncillary(name, mime, content);
}
function getRelationMap(req) {
const {relationMapNoteId, noteIds} = req.body;
@@ -383,7 +340,5 @@ module.exports = {
eraseDeletedNotesNow,
getDeleteNotesPreview,
uploadModifiedFile,
forceSaveNoteRevision,
getNoteAncillaries,
saveNoteAncillary
forceSaveNoteRevision
};