mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-03 20:06:08 +01:00 
			
		
		
		
	link router/loading
This commit is contained in:
		
							
								
								
									
										17
									
								
								src/routes/api/links.js
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										17
									
								
								src/routes/api/links.js
									
									
									
									
									
										Normal file
									
								
							@@ -0,0 +1,17 @@
 | 
			
		||||
"use strict";
 | 
			
		||||
 | 
			
		||||
const sql = require('../../services/sql');
 | 
			
		||||
 | 
			
		||||
async function getNoteLinks(req) {
 | 
			
		||||
    const {noteId} = req.params;
 | 
			
		||||
 | 
			
		||||
    return await sql.getRows(`
 | 
			
		||||
        SELECT noteId, targetNoteId, type FROM links WHERE (noteId = ? OR targetNoteId = ?) AND isDeleted = 0
 | 
			
		||||
        UNION
 | 
			
		||||
        SELECT noteId, value, 'relation' FROM attributes WHERE (noteId = ? OR value = ?) AND type = 'relation' AND isDeleted = 0
 | 
			
		||||
        `, [noteId, noteId, noteId, noteId]);
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
module.exports = {
 | 
			
		||||
    getNoteLinks
 | 
			
		||||
};
 | 
			
		||||
		Reference in New Issue
	
	Block a user