Api request #84

Merged
KevinMidboe merged 39 commits from api_request into master 2018-03-19 14:46:19 +00:00
Showing only changes of commit 858f3f5d57 - Show all commits

View File

@@ -9,6 +9,7 @@ class UserRepository {
create: 'insert into user (user_name) values (?)',
change: 'update user set password = ? where user_name = ?',
retrieveHash: 'select * from user where user_name = ?',
getAdminByUser: 'select admin from user where user_name = ?'
};
}
@@ -49,6 +50,12 @@ class UserRepository {
changePassword(user, password) {
return this.database.run(this.queries.change, [password, user.username]);
}
isAdmin(user) {
return this.database.get(this.queries.getAdminByUser, user.username).then((row) => {
return row.admin;
})
}
}
module.exports = UserRepository;