expand Justice

This commit is contained in:
KGrzeg 2021-10-18 02:33:29 +02:00
parent a16f5bb56e
commit e244da0942
8 changed files with 69 additions and 13 deletions

View file

@ -28,6 +28,10 @@ class Database {
return user
}
getUserByName(username) {
return this.db.data.users.find(user => user.name === username)
}
getUserByPassword(password) {
return this.db.data.users.find(user => user.password === password)
}
@ -74,6 +78,20 @@ class Database {
return 0
}
getLastPlayed(username) {
const user = this.getUserByName(username)
return user.lastPlayed
}
async setLastPlayedToNow(username) {
const user = this.getUserByName(username)
user.lastPlayed = Date.now()
await this.db.write()
return user.lastPlayed
}
}
export default new Database