diff options
author | Gunther6070 <haydenhartman10@yahoo.com> | 2025-03-07 15:43:17 -0500 |
---|---|---|
committer | Gunther6070 <haydenhartman10@yahoo.com> | 2025-03-07 15:43:17 -0500 |
commit | 94869200a0d2f80f71fcd0efd4f82c0138b5440d (patch) | |
tree | 52eff6463b3cec7c3d6bda18e186f9272f528a2c /ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserFileDAO.java | |
parent | fa1f1140b1e13d495c8e06e80928efb333917d31 (diff) | |
parent | caaf278d1fa69fef69c210edb337fa54102d2737 (diff) | |
download | JellySolutions-94869200a0d2f80f71fcd0efd4f82c0138b5440d.tar.gz JellySolutions-94869200a0d2f80f71fcd0efd4f82c0138b5440d.tar.bz2 JellySolutions-94869200a0d2f80f71fcd0efd4f82c0138b5440d.zip |
Merge branch 'api-auth' of https://github.com/RIT-SWEN-261-02/team-project-2245-swen-261-02-2b into api-auth
Diffstat (limited to 'ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserFileDAO.java')
-rw-r--r-- | ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserFileDAO.java | 40 |
1 files changed, 4 insertions, 36 deletions
diff --git a/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserFileDAO.java b/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserFileDAO.java index 9b206c8..f17f8f2 100644 --- a/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserFileDAO.java +++ b/ufund-api/src/main/java/com/ufund/api/ufundapi/persistence/UserFileDAO.java @@ -58,13 +58,6 @@ public class UserFileDAO implements UserDAO { } } - /** - * Return the user with the String name name or null otherwise - * - * @param username Name of desired user - * - * @return Desired user, null otherwise - */ @Override public User getUser(String username) { synchronized (users) { @@ -72,14 +65,6 @@ public class UserFileDAO implements UserDAO { } } - /** - * Create a User user - * - * @param user User to create - * - * @return Desired created user - * @throws IOException If there was an IO issue saving the file - */ @Override public User addUser(User user) throws IOException { synchronized (users) { @@ -92,36 +77,19 @@ public class UserFileDAO implements UserDAO { } } - /** - * Update a user that matches the supplied name - * - * @param name The name of the user - * @param newUser New user data - * - * @return Desired user, null otherwise - * @throws IOException If there was an IO issue saving the file - */ @Override - public User updateUser(User newUser, String name) throws IOException { + public User updateUser(User user) throws IOException { synchronized (users) { - if (users.containsKey(name)) { - users.put(name, newUser); + if (users.containsKey(user.getUsername())) { + users.put(user.getUsername(), user); save(); - return newUser; + return user; } else { return null; } } } - /** - * Delete a user matching the name - * - * @param username The name of the user - * - * @return True if deleted, false otherwise - * @throws IOException If there was an IO issue saving the file - */ @Override public boolean deleteUser(String username) throws IOException { synchronized (users) { |