34 lines
560 B
JavaScript
34 lines
560 B
JavaScript
"use strict";
|
|
|
|
import { get_instance } from '../Helpers/Database.mjs';
|
|
|
|
|
|
class RSSIRepo {
|
|
constructor() {
|
|
this.db = get_instance();
|
|
}
|
|
|
|
add(...rssis) {
|
|
if(typeof this.query_insert == "undefined")
|
|
this.query_insert = this.db.prepare(`INSERT INTO rssis (
|
|
id,
|
|
reading_id,
|
|
rssi, snr,
|
|
channel
|
|
) VALUES (
|
|
:id,
|
|
:reading_id,
|
|
:rssi, :snr,
|
|
:channel
|
|
)`);
|
|
|
|
for(let rssi of rssis)
|
|
this.insert_query.run(rssi);
|
|
}
|
|
|
|
iterate() {
|
|
return this.db.prepare(`SELECT * FROM rssis`).iterate();
|
|
}
|
|
}
|
|
|
|
export default RSSIRepo;
|