mirror of
				https://github.com/zadam/trilium.git
				synced 2025-10-31 18:36:30 +01:00 
			
		
		
		
	autocomplete for attribute values, closes #31
This commit is contained in:
		| @@ -47,8 +47,6 @@ router.put('/notes/:noteId/attributes', auth.checkApiAuth, wrap(async (req, res, | ||||
| })); | ||||
|  | ||||
| router.get('/attributes/names', auth.checkApiAuth, wrap(async (req, res, next) => { | ||||
|     const noteId = req.params.noteId; | ||||
|  | ||||
|     const names = await sql.getColumn("SELECT DISTINCT name FROM attributes"); | ||||
|  | ||||
|     for (const attr of attributes.BUILTIN_ATTRIBUTES) { | ||||
| @@ -62,4 +60,12 @@ router.get('/attributes/names', auth.checkApiAuth, wrap(async (req, res, next) = | ||||
|     res.send(names); | ||||
| })); | ||||
|  | ||||
| router.get('/attributes/values/:attributeName', auth.checkApiAuth, wrap(async (req, res, next) => { | ||||
|     const attributeName = req.params.attributeName; | ||||
|  | ||||
|     const values = await sql.getColumn("SELECT DISTINCT value FROM attributes WHERE name = ? ORDER BY value", [attributeName]); | ||||
|  | ||||
|     res.send(values); | ||||
| })); | ||||
|  | ||||
| module.exports = router; | ||||
		Reference in New Issue
	
	Block a user