1
0
Fork 0

Another big refactoring

This commit is contained in:
Julien Dessaux 2023-06-01 01:11:21 +02:00
parent 61b5c8493e
commit 68c457964a
Signed by: adyxax
GPG key ID: F92E51B86E07177E
10 changed files with 79 additions and 83 deletions

View file

@ -1,7 +1,7 @@
import db from './db.js';
const getSystemStatement = db.prepare(`SELECT data from systems where json_extract(data, '$.symbol') = ?;`);
const getSystemUpdatedStatement = db.prepare(`SELECT updated from systems where json_extract(data, '$.symbol') = ?;`);
const getSystemStatement = db.prepare(`SELECT data FROM systems WHERE json_extract(data, '$.symbol') = ?;`);
const getSystemUpdatedStatement = db.prepare(`SELECT updated FROM systems WHERE json_extract(data, '$.symbol') = ?;`);
const setSystemStatement = db.prepare(`INSERT INTO systems(data) VALUES (json(?));`);
const setSystemWaypointsStatement = db.prepare(`UPDATE systems SET data = (SELECT json_set(data, '$.waypoints', json(:waypoints)) FROM systems WHERE json_extract(data, '$.symbol') = :symbol), updated = :date WHERE json_extract(data, '$.symbol') = :symbol;`);
@ -61,7 +61,7 @@ export function setSystemWaypoints(symbol, waypoints) {
date: new Date().toISOString(),
symbol: symbol,
waypoints: JSON.stringify(waypoints),
});
}).changes;
} catch (err) {
console.log(err);
return null;