fix backlink count

This commit is contained in:
zadam
2021-12-24 21:01:36 +01:00
parent 9d38e9342d
commit a232035d47
3 changed files with 36 additions and 13 deletions

View File

@@ -302,6 +302,21 @@ function uploadModifiedFile(req) {
note.setContent(fileContent);
}
function getBacklinkCount(req) {
const {noteId} = req.params;
const note = becca.getNote(noteId);
if (!note) {
return [404, "Not found"];
}
else {
return {
count: note.getTargetRelations().length
};
}
}
module.exports = {
getNote,
updateNote,
@@ -316,5 +331,6 @@ module.exports = {
duplicateSubtree,
eraseDeletedNotesNow,
getDeleteNotesPreview,
uploadModifiedFile
uploadModifiedFile,
getBacklinkCount
};