mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 02:16:05 +01:00 
			
		
		
		
	
		
			
				
	
	
		
			28 lines
		
	
	
		
			565 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			28 lines
		
	
	
		
			565 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
| "use strict";
 | |
| 
 | |
| const repository = require('../../services/repository');
 | |
| 
 | |
| async function getLinks(req) {
 | |
|     const note = await repository.getNote(req.params.noteId);
 | |
| 
 | |
|     if (!note) {
 | |
|         return [404, `Note ${req.params.noteId} not found`];
 | |
|     }
 | |
| 
 | |
|     return await note.getLinks();
 | |
| }
 | |
| 
 | |
| async function getIncomingLinks(req) {
 | |
|     const note = await repository.getNote(req.params.noteId);
 | |
| 
 | |
|     if (!note) {
 | |
|         return [404, `Note ${req.params.noteId} not found`];
 | |
|     }
 | |
| 
 | |
|     note.getTargetRelations()
 | |
| }
 | |
| 
 | |
| module.exports = {
 | |
|     getLinks,
 | |
|     getIncomingLinks
 | |
| }; |