|
2 | 2 |
|
3 | 3 | import entities.chat.Chat;
|
4 | 4 | import interface_adapters.User_search_IA.IRetrieveList;
|
5 |
| -import interface_adapters.user_registration_interface_adapters.UserExists; |
6 | 5 | import entities.user_entities.User;
|
7 | 6 | import interface_adapters.profile_modification_IA.UserModificationGateway;
|
8 |
| -import use_cases.user_registration_use_cases.UserCreator; |
9 | 7 | import entities.user_entities.UserFactory;
|
10 | 8 | import interface_adapters.Chat.UserChatGateway;
|
11 |
| -import interface_adapters.User_search_IA.UserRetriever; |
12 | 9 |
|
13 | 10 | import java.io.*;
|
14 | 11 | import java.util.ArrayList;
|
15 | 12 | import java.util.List;
|
16 |
| -public class UserDatabase implements UserExists, UserRetriever, UserCreator, IRetrieveList, UserModificationGateway, UserChatGateway { |
| 13 | +public class UserDatabase extends Database implements IRetrieveList, UserModificationGateway, UserChatGateway { |
17 | 14 | File accounts;
|
18 | 15 | List<User> accountList;
|
19 | 16 | public UserDatabase(){
|
20 |
| - this.accounts = new File("accounts"); |
| 17 | + this.accounts = new File("user_accounts"); |
21 | 18 | if(!accounts.exists()){
|
22 | 19 | try {
|
23 | 20 | accounts.createNewFile();
|
@@ -146,9 +143,8 @@ public void modifyUser(String oldUsername, User modified){
|
146 | 143 | @Override
|
147 | 144 | public ArrayList<Chat> getUserChats(String username) {
|
148 | 145 | for (User user: accountList){
|
149 |
| - //if(getUser(username).equals(user)){ |
150 | 146 | if(user.getUsername().equals(username)){
|
151 |
| - return user.getUserChats(); |
| 147 | + return user.getChats(); |
152 | 148 | }
|
153 | 149 | }
|
154 | 150 | throw new RuntimeException("Invalid username");
|
|
0 commit comments