diff --git a/seasoned_api/src/user/userRepository.js b/seasoned_api/src/user/userRepository.js index 5a0e9b1..684140e 100644 --- a/seasoned_api/src/user/userRepository.js +++ b/seasoned_api/src/user/userRepository.js @@ -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;