summaryrefslogtreecommitdiff
path: root/nodejs/automation/exploration.ts
diff options
context:
space:
mode:
Diffstat (limited to 'nodejs/automation/exploration.ts')
-rw-r--r--nodejs/automation/exploration.ts9
1 files changed, 9 insertions, 0 deletions
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<void> {
+ const response = await api.sendPaginated<System>({endpoint: `/systems`, page: Math.max(1, Math.floor(dbSystems.getSystemsCount()/20)), priority: 100});
+ db.transaction(() => response.forEach(function(system) { try { dbSystems.addSystem(system); } catch {} }))();
+}