Update Datastore class

This commit is contained in:
Christer Warén 2021-09-14 17:12:18 +03:00
parent 45e5019b28
commit 81a9d7be7c

View File

@ -67,6 +67,7 @@ module.exports = class {
checkEntry(id){
this.loadEntry(id);
if(!this.map.has(id)){
this.createEntry(id);
//this.showEntry(this.getEntry(id));
@ -85,6 +86,11 @@ module.exports = class {
this.saveEntry(id, newData);
}
loadEntry(id){
const json = require(`../../../datastore/` + id + '.json');
this.map.set(id, json);
}
getEntry(id){
return this.map.get(id);
}