From c48827906e8b0355327bbd90859a46a47d7cebdb Mon Sep 17 00:00:00 2001 From: Pieter Vander Vennet Date: Mon, 2 Sep 2024 13:09:41 +0200 Subject: [PATCH] Chore: linting --- scripts/osm2pgsql/createNewDatabase.ts | 5 +++-- scripts/osm2pgsql/deleteOldDbs.ts | 1 - scripts/osm2pgsql/osmPoiDatabase.ts | 9 +++------ scripts/osm2pgsql/tilecountServer.ts | 1 - 4 files changed, 6 insertions(+), 10 deletions(-) diff --git a/scripts/osm2pgsql/createNewDatabase.ts b/scripts/osm2pgsql/createNewDatabase.ts index d51533819..b22aa80ef 100644 --- a/scripts/osm2pgsql/createNewDatabase.ts +++ b/scripts/osm2pgsql/createNewDatabase.ts @@ -3,7 +3,9 @@ import { OsmPoiDatabase } from "./osmPoiDatabase" class CreateNewDatabase extends Script { constructor() { - super("Creates a new version of the database. Usage: `createNewDatabase -- YYYY-MM-DD` which will create database `osm-poi.YYYY-MM-DD`") + super( + "Creates a new version of the database. Usage: `createNewDatabase -- YYYY-MM-DD` which will create database `osm-poi.YYYY-MM-DD`" + ) } async main(args: string[]): Promise { @@ -12,5 +14,4 @@ class CreateNewDatabase extends Script { } } - new CreateNewDatabase().run() diff --git a/scripts/osm2pgsql/deleteOldDbs.ts b/scripts/osm2pgsql/deleteOldDbs.ts index 1fa6fd240..32d69bac3 100644 --- a/scripts/osm2pgsql/deleteOldDbs.ts +++ b/scripts/osm2pgsql/deleteOldDbs.ts @@ -12,5 +12,4 @@ class DeleteOldDbs extends Script { } } - new DeleteOldDbs().run() diff --git a/scripts/osm2pgsql/osmPoiDatabase.ts b/scripts/osm2pgsql/osmPoiDatabase.ts index cb7159e9c..d03406ae3 100644 --- a/scripts/osm2pgsql/osmPoiDatabase.ts +++ b/scripts/osm2pgsql/osmPoiDatabase.ts @@ -68,7 +68,6 @@ export class OsmPoiDatabase { const metaclient = this.getMetaClient() await metaclient.connect() try { - const meta = await metaclient.query("SELECT datname FROM pg_database") let latest: string = undefined let latestDate: Date = new Date(0) @@ -104,7 +103,7 @@ export class OsmPoiDatabase { } console.log("Latest database is:", latest) - return "osm-poi."+latest + return "osm-poi." + latest } async createNew(date: string) { @@ -113,7 +112,6 @@ export class OsmPoiDatabase { const metaclient = this.getMetaClient() await metaclient.connect() try { - await metaclient.query(`CREATE DATABASE "${dbname}"`) console.log("Database created - installing extensions") const client = new Client(this._connectionString + "/" + dbname) @@ -129,7 +127,7 @@ export class OsmPoiDatabase { } } - async deleteAllButLatest(){ + async deleteAllButLatest() { const dbs = await this.findSuitableDatabases() for (let i = 0; i < dbs.length - 1; i++) { await this.deleteDatabase(dbs[i]) @@ -152,7 +150,6 @@ export class OsmPoiDatabase { } } - async connectToLatest() { const latest = await this.searchLatest() this._client = new Client(this._connectionString + "/" + latest) @@ -161,7 +158,7 @@ export class OsmPoiDatabase { async getCount( layer: string, - bbox: [[number, number], [number, number]] = undefined, + bbox: [[number, number], [number, number]] = undefined ): Promise<{ count: number; lat: number; lon: number }> { await this.connectIfNeeded() diff --git a/scripts/osm2pgsql/tilecountServer.ts b/scripts/osm2pgsql/tilecountServer.ts index beb0d2d61..15a35c86c 100644 --- a/scripts/osm2pgsql/tilecountServer.ts +++ b/scripts/osm2pgsql/tilecountServer.ts @@ -3,7 +3,6 @@ import { Server } from "../server" import Script from "../Script" import { OsmPoiDatabase } from "./osmPoiDatabase" - class CachedSqlCount { private readonly _cache: Record< string,