Skip to content

Commit fb38d57

Browse files
committed
Merge remote-tracking branch 'origin/feature-5-flashcard-creator-and-remover' into feature-5-flashcard-creator-and-remover
2 parents e9e7799 + adb7754 commit fb38d57

22 files changed

+384
-206
lines changed

README.md

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,16 @@ This is a flashcard study application inspired by Quizlet.
44

55
# Main Features
66

7-
### 1. Log in or sign up for the application.
7+
### 1a. Sign Up For The Application.
8+
- If the user selects the "Sign Up" option from the welcome screen the user has an option of Signing up as a user with or without admin level access
9+
- The user must select a username that does not previously exist in the database, if the user inputs a previously existing username they shall be warned with a failure in registration and must choose another username.
10+
- The password needs to be greater than or equal to 5 characters in length and not blank.
11+
- The repeat password must match the password entered to ensure coherency and surety.
12+
- If the user does not require admin level they can leave the Admin Key field blank and they shall be registered as a common user that can access teh program.
13+
- If the user does require admin level access they can input the Admin Key in the field, if there is an error in the inputting of the key the user shall be warned accordingly.
14+
15+
### 1b. Log In For The Application.
16+
- If the user selects the "Log In" option from the welcome screen the user may input their respective username and password, if the username does not match an existing username from the database or incorrect password they shall be warned.
817

918
### 2. Create a flashcard or a flashcard set.
1019

src/main/java/login_and_signup_use_case/UserRegisterRequestModel.java

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,11 +47,6 @@ public String getRepeatPassword() {
4747
public String getAdminKeyEntered() {
4848
return adminKeyEntered;
4949
}
50-
// public void setAdmin(boolean isAdmin) {
51-
// this.isAdmin = isAdmin;
52-
// }
53-
54-
5550

5651
}
5752

src/main/java/login_and_signup_use_case/login_and_signup_use_case_screens/UserDataMapper.java

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package login_and_signup_use_case.login_and_signup_use_case_screens;
22

3-
import java.time.LocalDateTime;
43
import java.util.ArrayList;
54

65
/**
@@ -25,7 +24,7 @@ class UserDataMapper {
2524
public UserDataMapper() {
2625
}
2726

28-
public UserDataMapper(String name, String password, boolean isAdmin, ArrayList<Integer> flashcardSetIds, LocalDateTime creationTime) {
27+
public UserDataMapper(String name, String password, boolean isAdmin, ArrayList<Integer> flashcardSetIds) {
2928
super();
3029
this.name = name;
3130
this.password = password;
@@ -37,10 +36,6 @@ public String getName() {
3736
return name;
3837
}
3938

40-
public void setName(String name) {
41-
this.name = name;
42-
}
43-
4439
public String getPassword() {
4540
return password;
4641
}
@@ -53,9 +48,5 @@ public void setPassword(String password) {
5348

5449
public void setIsAdmin(boolean isAdmin){this.isAdmin = isAdmin;}
5550

56-
public ArrayList<Integer> getFlashcardSetIds(){
57-
return flashcardSetIds;
58-
}
59-
6051
}
6152

src/main/java/search_use_case/ResultsScreen.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ public ResultsScreen(SearchResponseModel responseModel, DBGateway gateway, UserL
3636
JPanel result_panel = new JPanel();
3737
result_panel.setLayout(new BoxLayout(result_panel, BoxLayout.Y_AXIS));
3838

39-
// scrollbar if results dont fit on screen
39+
// scrollbar if results don't fit on screen
4040
JScrollPane scrPane = new JScrollPane(result_panel);
4141
scrPane.setPreferredSize(new Dimension(350, 500));
4242
scrPane.getVerticalScrollBar().setUnitIncrement(16);

src/main/java/search_use_case/SearchController.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package search_use_case;
22

3-
import java.io.IOException;
43
/**
54
* Search Controller
65
* <p>
@@ -23,7 +22,7 @@ public SearchController(SearchInputBoundary userInput){
2322
* @param requestModel the request model with search input, tags, and current user
2423
* @return a response model with the result set
2524
*/
26-
public SearchResponseModel create(SearchRequestModel requestModel) throws IOException {
25+
public SearchResponseModel create(SearchRequestModel requestModel) {
2726
return userInput.create(requestModel);
2827
}
2928
}

src/main/java/search_use_case/SearchInputBoundary.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
package search_use_case;
22

3-
import java.io.IOException;
43
/**
54
* The search input boundary.
65
* <p>
@@ -14,5 +13,5 @@ public interface SearchInputBoundary {
1413
* @param requestModel a data-structure containing the user input, search tags, and current user
1514
* @return a data structure with the data required to set up the resultsScreen
1615
*/
17-
SearchResponseModel create(SearchRequestModel requestModel) throws IOException;
16+
SearchResponseModel create(SearchRequestModel requestModel);
1817
}

src/main/java/search_use_case/SearchInteractor.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
import data_access.entity_request_models.FlashcardSetDsRequestModel;
66
import login_and_signup_use_case.UserLoginResponseModel;
77

8-
import java.io.IOException;
98
import java.util.ArrayList;
109
import java.util.Collection;
1110

@@ -37,7 +36,7 @@ public SearchInteractor(SearchOutputBoundary presenter, DBGateway gateway){
3736
* @return SearchResponseModel that contains the result set of FlashcardSets from the user search
3837
*/
3938
@Override
40-
public SearchResponseModel create(SearchRequestModel requestModel) throws IOException {
39+
public SearchResponseModel create(SearchRequestModel requestModel) {
4140

4241
ArrayList<FlashcardSetDsRequestModel> result_set = new ArrayList<>();
4342
ArrayList<Integer> flashcard_set_ids = new ArrayList<>();
@@ -87,8 +86,8 @@ public SearchResponseModel create(SearchRequestModel requestModel) throws IOExce
8786

8887
// Return results if there is at least 1 result
8988
if (result_set.size() > 0){
90-
SearchResponseModel searchResponseModel = new SearchResponseModel(result_set);
91-
return presenter.prepareSuccessView(searchResponseModel);
89+
// SearchResponseModel searchResponseModel = new SearchResponseModel(result_set);
90+
return presenter.prepareSuccessView(result_set);
9291
}
9392
if (tags.size() > 0 && !input.equals("")){
9493
return presenter.prepareFailView("There are currently no FlashcardSets in the database.");

src/main/java/search_use_case/SearchOutputBoundary.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
package search_use_case;
2+
3+
import data_access.entity_request_models.FlashcardSetDsRequestModel;
4+
5+
import java.util.ArrayList;
6+
27
/**
38
* The search Output Boundary.
49
* <p>
@@ -9,10 +14,10 @@ public interface SearchOutputBoundary {
914

1015
/**
1116
* return a Response Model with the results if there are results
12-
* @param results SearchResponseModel containing the result set
17+
* @param result_set the result set of flashcard sets
1318
* @return SearchResponseModel with changes as needed.
1419
*/
15-
SearchResponseModel prepareSuccessView(SearchResponseModel results);
20+
SearchResponseModel prepareSuccessView(ArrayList<FlashcardSetDsRequestModel> result_set);
1621

1722
/**
1823
* display an error if the search was unsuccessful

src/main/java/search_use_case/SearchPresenter.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,9 @@
11
package search_use_case;
2+
3+
import data_access.entity_request_models.FlashcardSetDsRequestModel;
4+
5+
import java.util.ArrayList;
6+
27
/**
38
* The search presenter.
49
* <p>
@@ -8,8 +13,8 @@
813
public class SearchPresenter implements SearchOutputBoundary {
914

1015
@Override
11-
public SearchResponseModel prepareSuccessView(SearchResponseModel results) {
12-
return results;
16+
public SearchResponseModel prepareSuccessView(ArrayList<FlashcardSetDsRequestModel> result_set) {
17+
return new SearchResponseModel(result_set);
1318
}
1419

1520
@Override

src/main/java/search_use_case/SearchResponseModel.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
* @author Winston Chieng
1313
*/
1414
public class SearchResponseModel {
15-
ArrayList<FlashcardSetDsRequestModel> result_set;
15+
final ArrayList<FlashcardSetDsRequestModel> result_set;
1616

1717
/**
1818
* Create a SearchResponseModel

0 commit comments

Comments
 (0)