Update SQLite repositories to use awilix container

This commit is contained in:
Starbeamrainbowlabs 2019-07-09 14:05:42 +01:00
parent d494998ff8
commit 489aac2263
3 changed files with 10 additions and 19 deletions

View file

@ -1,11 +1,8 @@
"use strict"; "use strict";
import { get_instance } from '../Helpers/Database.mjs';
class GatewayRepo { class GatewayRepo {
constructor() { constructor({ database }) {
this.db = get_instance(); this.db = database;
} }
add(...gateways) { add(...gateways) {
@ -16,7 +13,7 @@ class GatewayRepo {
altitude altitude
) VALUES ( ) VALUES (
:id, :id,
:lat, :long, :latitude, :longitude,
:altitude :altitude
)`); )`);

View file

@ -1,11 +1,8 @@
"use strict"; "use strict";
import { get_instance } from '../Helpers/Database.mjs';
class RSSIRepo { class RSSIRepo {
constructor() { constructor({ database }) {
this.db = get_instance(); this.db = database;
} }
add(...rssis) { add(...rssis) {

View file

@ -1,12 +1,9 @@
"use strict"; "use strict";
import { get_instance } from '../Helpers/Database.mjs';
class ReadingRepo { class ReadingRepo {
constructor(in_RSSIRepo) { constructor({ database, RSSIRepo }) {
this.db = get_instance(); this.db = database;
this.RSSIRepo = in_RSSIRepo; this.RSSIRepo = RSSIRepo;
} }
add(reading) { add(reading) {
@ -17,8 +14,8 @@ class ReadingRepo {
data_rate_id, code_rate, bit_rate data_rate_id, code_rate, bit_rate
) VALUES ( ) VALUES (
:id, :id,
:lat, :latitude,
:long, :longitude,
:data_rate_id, :code_rate, :bit_rate :data_rate_id, :code_rate, :bit_rate
)`); )`);