From a1d6b03ec98abbc073b5b73b631da6ea3eae4eb9 Mon Sep 17 00:00:00 2001 From: Julien Dessaux Date: Wed, 27 Mar 2024 15:20:14 +0100 Subject: [node] finished the great typescript rewrite --- nodejs/automation/exploration.ts | 9 +++++++++ 1 file changed, 9 insertions(+) create mode 100644 nodejs/automation/exploration.ts (limited to 'nodejs/automation/exploration.ts') diff --git a/nodejs/automation/exploration.ts b/nodejs/automation/exploration.ts new file mode 100644 index 0000000..67fbfe4 --- /dev/null +++ b/nodejs/automation/exploration.ts @@ -0,0 +1,9 @@ +import db from '../database/db.ts'; +import * as dbSystems from '../database/systems.ts'; +import { System } from '../model/system.ts'; +import * as api from '../lib/api.ts'; + +export async function init(): Promise { + const response = await api.sendPaginated({endpoint: `/systems`, page: Math.max(1, Math.floor(dbSystems.getSystemsCount()/20)), priority: 100}); + db.transaction(() => response.forEach(function(system) { try { dbSystems.addSystem(system); } catch {} }))(); +} -- cgit v1.2.3