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";
import { get_instance } from '../Helpers/Database.mjs';
class GatewayRepo {
constructor() {
this.db = get_instance();
constructor({ database }) {
this.db = database;
}
add(...gateways) {
@ -16,7 +13,7 @@ class GatewayRepo {
altitude
) VALUES (
:id,
:lat, :long,
:latitude, :longitude,
:altitude
)`);

View file

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

View file

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