|
@ -18,9 +18,9 @@ import { migratev1 } from "./migrations/MigrateV1"; |
|
|
import {generateKey} from '../libs/Random'; |
|
|
import {generateKey} from '../libs/Random'; |
|
|
import * as KeyStore from '../services/Keystore'; |
|
|
import * as KeyStore from '../services/Keystore'; |
|
|
|
|
|
|
|
|
let systemRepo = null; |
|
|
export let systemRepo = null; |
|
|
let scoreRepo = null; |
|
|
export let scoreRepo = null; |
|
|
let userRepo = null; |
|
|
export let userRepo = null; |
|
|
|
|
|
|
|
|
export async function initDB(dbKeyRef = 'squareDB', dbLocation = Realm.defaultPath){ |
|
|
export async function initDB(dbKeyRef = 'squareDB', dbLocation = Realm.defaultPath){ |
|
|
try { |
|
|
try { |
|
@ -65,9 +65,12 @@ export async function initDB(dbKeyRef = 'squareDB', dbLocation = Realm.defaultPa |
|
|
userRepo = new UserRepo(dbRef); |
|
|
userRepo = new UserRepo(dbRef); |
|
|
scoreRepo = new ScoreRepo(dbRef); |
|
|
scoreRepo = new ScoreRepo(dbRef); |
|
|
|
|
|
|
|
|
return dbRef; |
|
|
return { |
|
|
|
|
|
systemRepo: systemRepo, |
|
|
|
|
|
userRepo: userRepo, |
|
|
|
|
|
scoreRepo: scoreRepo |
|
|
|
|
|
}; |
|
|
} catch (err) { |
|
|
} catch (err) { |
|
|
console.log(err); |
|
|
|
|
|
return null; |
|
|
return null; |
|
|
} |
|
|
} |
|
|
} |
|
|
} |