Use maxmind to store node locations

This commit is contained in:
softsimon
2022-07-11 17:52:38 +02:00
parent 926a127f6d
commit f305f4f96f
9 changed files with 171 additions and 3 deletions

View File

@@ -13,6 +13,17 @@ class NodesApi {
}
}
public async $getAllNodes(): Promise<any> {
try {
const query = `SELECT * FROM nodes`;
const [rows]: any = await DB.query(query);
return rows;
} catch (e) {
logger.err('$getAllNodes error: ' + (e instanceof Error ? e.message : e));
throw e;
}
}
public async $getNodeStats(public_key: string): Promise<any> {
try {
const query = `SELECT UNIX_TIMESTAMP(added) AS added, capacity, channels FROM node_stats WHERE public_key = ? ORDER BY added DESC`;