4 changed files with 39 additions and 29 deletions
@ -1,19 +1,37 @@ |
|||||
import {systemRepo, userRepo, scoreRepo} from './dbInit'; |
import {initDB} from './dbInit'; |
||||
|
|
||||
export function getAllSystemValues() { |
class DbAPI { |
||||
|
constructor(){ |
||||
|
this.systemRepo = null; |
||||
|
this.scoreRepo = null; |
||||
|
this.userRepo = null; |
||||
|
} |
||||
|
|
||||
|
getAllSystemValues() { |
||||
return systemRepo.getAllSystemValues(); |
return systemRepo.getAllSystemValues(); |
||||
} |
} |
||||
|
|
||||
export function createSystemValue(key, value) { |
createSystemValue(key, value) { |
||||
systemRepo.createSystemValue(key, value); |
systemRepo.createSystemValue(key, value); |
||||
return true; |
return true; |
||||
} |
} |
||||
|
|
||||
export function deleteSystemValue(key) { |
deleteSystemValue(key) { |
||||
systemRepo.deleteSystemValue(key); |
systemRepo.deleteSystemValue(key); |
||||
return true; |
return true; |
||||
} |
} |
||||
|
|
||||
export function getSystemValue(key) { |
getSystemValue(key) { |
||||
return systemRepo.getSystemKeyValue(key); |
return systemRepo.getSystemKeyValue(key); |
||||
|
} |
||||
|
|
||||
|
async initDB() { |
||||
|
let repos = await initDB(); |
||||
|
this.systemRepo = repos.systemRepo; |
||||
|
this.scoreRepo = repos.scoreRepo; |
||||
|
this.userRepo = repos.userRepo; |
||||
|
} |
||||
} |
} |
||||
|
|
||||
|
const dbAPI = new DbAPI(); |
||||
|
export default dbAPI; |
Loading…
Reference in new issue