diff --git a/src/main/java/org/ntlab/citrusserver/repositories/AccountManager.java b/src/main/java/org/ntlab/citrusserver/repositories/AccountManager.java index e532b24..7ed0764 100644 --- a/src/main/java/org/ntlab/citrusserver/repositories/AccountManager.java +++ b/src/main/java/org/ntlab/citrusserver/repositories/AccountManager.java @@ -1,10 +1,6 @@ package org.ntlab.citrusserver.repositories; -import jakarta.ws.rs.*; -import jakarta.ws.rs.core.MediaType; import org.ntlab.citrusserver.entities.Account; -import org.ntlab.citrusserver.resources.AccountsRest; -import org.springframework.stereotype.Component; import org.springframework.stereotype.Repository; import java.lang.reflect.Array; @@ -14,7 +10,7 @@ @Repository public class AccountManager { - private HashMap accounts = new HashMap(); //keyにaccountId,valueにaccount + private HashMap accounts = new HashMap(); //keyにaccountId,valueにAccount private HashMap accountToken = new HashMap<>(); //keyがaccountId,valueがtoken @@ -46,18 +42,18 @@ } // アカウント情報を全削除する(DELETE) - public void deleteAccount(String accountId, String password, String token) { - if(accountToken.get(accountId).equals(token)) { - if(accounts.get(accountId).getPassword().equals(password)) { + public void deleteAccount(String accountId, String token, String password) { + if(accountToken.get(accountId).equals(token)) { //token比較 + if(accounts.get(accountId).getPassword().equals(password)) { //password比較 accounts.remove(accountId); } } } // 指定されたIDのパスワードを変更する (PUT) - public void changePassword(String accountId, String token, String oldPassword, String newPassword) { - if(accountToken.get(accountId).equals(token)) { - if(accounts.get(accountId).getPassword().equals(oldPassword)) { + public void changePassword(String accountId, String newPassword, String oldPassword, String token) { + if(accountToken.get(accountId).equals(token)) { //token比較 + if(accounts.get(accountId).getPassword().equals(oldPassword)) { //password比較 accounts.get(accountId).setPassword(newPassword); } } @@ -69,8 +65,8 @@ } // 指定されたIDの自己紹介を変更する (PUT) - public void changeIntroduction(String accountId, String token, String introduction) { - if(accountToken.get(accountId).equals(token)) { + public void changeIntroduction(String accountId, String introduction, String token) { + if(accountToken.get(accountId).equals(token)) { //token比較 accounts.get(accountId).setIntroduction(introduction); } } @@ -86,12 +82,12 @@ } // お気に入りの本のbook_idを削除する (DELETE) - public void deleteFavoriteBookId(String accountId, String token, String otherAccountId, Integer bookId) { + public void deleteFavoriteBookId(String token, String accountId, String otherAccountId, Integer bookId) { } // いいねした本のアカウントIDとbook_idを追加する(いいねした側に追加) (PUT) - public void putfavoriteid(String accountId, String token, String otherAccountId, Integer bookId) { + public void putFavoriteId(String accountId, String otherAccountId, Integer bookId, String token) { }