mirror of
				https://github.com/zadam/trilium.git
				synced 2025-11-04 05:28:59 +01:00 
			
		
		
		
	server-ts: Convert services/scheduler
This commit is contained in:
		
							parent
							
								
									92ca32bd70
								
							
						
					
					
						commit
						ea36b37f66
					
				@ -51,7 +51,7 @@ require('./services/backup');
 | 
				
			|||||||
// trigger consistency checks timer
 | 
					// trigger consistency checks timer
 | 
				
			||||||
require('./services/consistency_checks');
 | 
					require('./services/consistency_checks');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
require('./services/scheduler.js');
 | 
					require('./services/scheduler');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
if (utils.isElectron()) {
 | 
					if (utils.isElectron()) {
 | 
				
			||||||
    require('@electron/remote/main').initialize();
 | 
					    require('@electron/remote/main').initialize();
 | 
				
			||||||
 | 
				
			|||||||
@ -1,28 +1,24 @@
 | 
				
			|||||||
const scriptService = require('./script');
 | 
					import scriptService = require('./script');
 | 
				
			||||||
const cls = require('./cls');
 | 
					import cls = require('./cls');
 | 
				
			||||||
const sqlInit = require('./sql_init');
 | 
					import sqlInit = require('./sql_init');
 | 
				
			||||||
const config = require('./config');
 | 
					import config = require('./config');
 | 
				
			||||||
const log = require('./log');
 | 
					import log = require('./log');
 | 
				
			||||||
const attributeService = require('../services/attributes');
 | 
					import attributeService = require('../services/attributes');
 | 
				
			||||||
const protectedSessionService = require('../services/protected_session');
 | 
					import protectedSessionService = require('../services/protected_session');
 | 
				
			||||||
const hiddenSubtreeService = require('./hidden_subtree');
 | 
					import hiddenSubtreeService = require('./hidden_subtree');
 | 
				
			||||||
 | 
					import BNote = require('../becca/entities/bnote');
 | 
				
			||||||
 | 
					
 | 
				
			||||||
/**
 | 
					function getRunAtHours(note: BNote): number[] {
 | 
				
			||||||
 * @param {BNote} note
 | 
					 | 
				
			||||||
 * @return {int[]}
 | 
					 | 
				
			||||||
 */
 | 
					 | 
				
			||||||
function getRunAtHours(note) {
 | 
					 | 
				
			||||||
    try {
 | 
					    try {
 | 
				
			||||||
        return note.getLabelValues('runAtHour').map(hour => parseInt(hour));
 | 
					        return note.getLabelValues('runAtHour').map(hour => parseInt(hour));
 | 
				
			||||||
    }
 | 
					    } catch (e: any) {
 | 
				
			||||||
    catch (e) {
 | 
					 | 
				
			||||||
        log.error(`Could not parse runAtHour for note ${note.noteId}: ${e.message}`);
 | 
					        log.error(`Could not parse runAtHour for note ${note.noteId}: ${e.message}`);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        return [];
 | 
					        return [];
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
function runNotesWithLabel(runAttrValue) {
 | 
					function runNotesWithLabel(runAttrValue: string) {
 | 
				
			||||||
    const instanceName = config.General ? config.General.instanceName : null;
 | 
					    const instanceName = config.General ? config.General.instanceName : null;
 | 
				
			||||||
    const currentHours = new Date().getHours();
 | 
					    const currentHours = new Date().getHours();
 | 
				
			||||||
    const notes = attributeService.getNotesWithLabel('run', runAttrValue);
 | 
					    const notes = attributeService.getNotesWithLabel('run', runAttrValue);
 | 
				
			||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user