mirror of
https://github.com/zadam/trilium.git
synced 2025-11-03 03:46:37 +01:00
change in naming of SQL methods
added assert methods to note tree
This commit is contained in:
@@ -25,7 +25,7 @@ router.get('/:noteId/to/:directory', auth.checkApiAuth, async (req, res, next) =
|
||||
|
||||
fs.mkdirSync(completeExportDir);
|
||||
|
||||
const noteTreeId = await sql.getSingleValue('SELECT note_tree_id FROM notes_tree WHERE note_id = ?', [noteId]);
|
||||
const noteTreeId = await sql.getFirstValue('SELECT note_tree_id FROM notes_tree WHERE note_id = ?', [noteId]);
|
||||
|
||||
await exportNote(noteTreeId, completeExportDir);
|
||||
|
||||
@@ -33,14 +33,14 @@ router.get('/:noteId/to/:directory', auth.checkApiAuth, async (req, res, next) =
|
||||
});
|
||||
|
||||
async function exportNote(noteTreeId, dir) {
|
||||
const noteTree = await sql.getSingleResult("SELECT * FROM notes_tree WHERE note_tree_id = ?", [noteTreeId]);
|
||||
const note = await sql.getSingleResult("SELECT * FROM notes WHERE note_id = ?", [noteTree.note_id]);
|
||||
const noteTree = await sql.getFirst("SELECT * FROM notes_tree WHERE note_tree_id = ?", [noteTreeId]);
|
||||
const note = await sql.getFirst("SELECT * FROM notes WHERE note_id = ?", [noteTree.note_id]);
|
||||
|
||||
const pos = (noteTree.note_position + '').padStart(4, '0');
|
||||
|
||||
fs.writeFileSync(dir + '/' + pos + '-' + note.note_title + '.html', html.prettyPrint(note.note_text, {indent_size: 2}));
|
||||
|
||||
const children = await sql.getResults("SELECT * FROM notes_tree WHERE parent_note_id = ? AND is_deleted = 0", [note.note_id]);
|
||||
const children = await sql.getAll("SELECT * FROM notes_tree WHERE parent_note_id = ? AND is_deleted = 0", [note.note_id]);
|
||||
|
||||
if (children.length > 0) {
|
||||
const childrenDir = dir + '/' + pos + '-' + note.note_title;
|
||||
|
||||
Reference in New Issue
Block a user