| 1234567891011121314151617181920212223242526272829303132 |
- import { Database } from "bun:sqlite";
- const meteostanicaDB = new Database("./data/meteostanica.sqlite");
- meteostanicaDB.run(`create table if not exists data (
- timestamp datetime default current_timestamp primary key,
- indoorTemp text not null,
- indoorPressure text not null,
- indoorHumidity text not null,
- indoorAltitude text not null,
- outdoorConnected integer not null,
- outdoorTemp text not null,
- outdoorPressure text not null,
- outdoorHumidity text not null,
- outdoorAltitude text not null
- );`)
- export default class Meteostanica {
- static getData() {
- const statement = meteostanicaDB.prepare(`
- SELECT *
- FROM data
- ORDER BY timestamp DESC;
- `)
- const result = statement.all();
- return result
- }
- }
|