expand Justice
This commit is contained in:
parent
a16f5bb56e
commit
e244da0942
8 changed files with 69 additions and 13 deletions
|
|
@ -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
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue