Chore: linting
This commit is contained in:
parent
f5d7686c98
commit
c48827906e
4 changed files with 6 additions and 10 deletions
|
@ -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<void> {
|
||||
|
@ -12,5 +14,4 @@ class CreateNewDatabase extends Script {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
new CreateNewDatabase().run()
|
||||
|
|
|
@ -12,5 +12,4 @@ class DeleteOldDbs extends Script {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
new DeleteOldDbs().run()
|
||||
|
|
|
@ -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()
|
||||
|
||||
|
|
|
@ -3,7 +3,6 @@ import { Server } from "../server"
|
|||
import Script from "../Script"
|
||||
import { OsmPoiDatabase } from "./osmPoiDatabase"
|
||||
|
||||
|
||||
class CachedSqlCount {
|
||||
private readonly _cache: Record<
|
||||
string,
|
||||
|
|
Loading…
Reference in a new issue