-
Notifications
You must be signed in to change notification settings - Fork 64
Sprint2 sign in #13
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
moyeneka
wants to merge
81
commits into
snowcycle:Sprint2Starter
Choose a base branch
from
team-placeholder-software-engineering:Sprint2SignIn
base: Sprint2Starter
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Sprint2 sign in #13
Changes from all commits
Commits
Show all changes
81 commits
Select commit
Hold shift + click to select a range
4ff3530
Initial changes for sprint 2 sign in and main menu functionality, inc…
snowcycle 656e63d
Create MainMenuRouteController.java
moyeneka 4104a9b
define ActiveEmployeeExistsQuery.java class
Chase-Garrett 6543709
define EmployeeSignInCommand.java
Chase-Garrett 0fbae3b
routing class
moyeneka 51bb8c9
update
moyeneka ba4db6c
update
moyeneka 6592a95
Update .project
moyeneka e5034e6
Initial Commit
benhodges65 8c54573
Initial commit
uarkNathanSecrest 574097f
Update ViewModelNames.java
moyeneka de50cc6
Update MainMenuRouteController.java
moyeneka 7be099d
Update MainMenuRouteController.java
moyeneka 5bb9e8d
add method to query database
Chase-Garrett 090ceca
add method to check if any active employees and throw exception if false
Chase-Garrett deb0e6c
Added click event handlers and getters for buttons
benhodges65 1f4a16c
Update MainMenuRouteController.java
moyeneka 6e01ed0
Create mainMenu.html
moyeneka 14eb849
Complete ActiveEmployeeExistsQuery class, ready for testing
Chase-Garrett 8c0c4ec
correting minor error
Chase-Garrett 6cccec9
Cleaned code and imported dependencies
Chase-Garrett 17f6aae
Create mainMenu.html
patrickng99 10a3d1b
Merge branch 'Sprint2Starter' of https://github.com/team-placeholder-…
patrickng99 e3e08ef
Update mainMenu.html
patrickng99 58d8522
Update mainMenu.html
patrickng99 684e30b
Add files via upload
benhodges65 8aaa04a
Re-routing
patrickng99 e8710bd
Style update
patrickng99 e51c663
created ActiveUserDeleteCommand class
Chase-Garrett 88f56e0
Update to dpendencies
Chase-Garrett 30c4115
testing the view
moyeneka f3ba2f7
update to dependencies and begun to build out the class
Chase-Garrett 47f1ec5
added implement statement that was missing from the class
Chase-Garrett 7cf7dd5
mainMenu view and routing
moyeneka 51ce713
Update ProductListingRouteController.java
moyeneka a58bcb8
Update application.properties
moyeneka 8553e77
Update RegisterApplication.java
moyeneka 466de2f
Update ActiveEmployeeExistsQuery.java
Chase-Garrett f8a1bea
Fixed products listing button
patrickng99 7c6b0c2
Fixing errors in product listing button
patrickng99 dbeeeeb
changes to ActiveUserDeleteCommand method
Chase-Garrett babf1cf
corrected formatting
Chase-Garrett 056f216
removing and replacing task 4 stuff
uarkNathanSecrest 8ea2876
Update SignInRouteController.java
pingyhead eaadfdc
Implemented EmployeeSignIn.java
uarkNathanSecrest 168d0bd
Update SignInRestController.java
pingyhead be672ee
Corrected placement of @Transactional
Chase-Garrett 2825e5d
corrected import statement for transactional
Chase-Garrett 1f8aae9
removed unneeded import statements
Chase-Garrett cf94ca2
added missing return statement
Chase-Garrett 3322013
Added employeeId, password, and submit inputs to the sign in page
cw062 746fdd8
Update mainMenu.html
patrickng99 a70343f
added dependencies
Chase-Garrett 077b1bd
Defined primary functions
Chase-Garrett 68488ea
added properties to complete the class
Chase-Garrett 8753963
Update ViewModelNames.java
pingyhead 5764c0c
Add files via upload
cdbridge 56a3d31
help
moyeneka 7b41b06
Merge branch 'Sprint2SignIn' of https://github.com/team-placeholder-s…
moyeneka 9bc6eba
Update signIn.js
cdbridge 9de52e0
Update mainMenu.js
patrickng99 72e856b
Revert "help"
moyeneka 0e1cb9c
Create signIn.html
pingyhead 14dfe35
Update mainMenu.js
patrickng99 16e1198
Update mainMenu.js
patrickng99 34c527d
Merge branch 'Sprint2Starter' of https://github.com/team-placeholder-…
patrickng99 1310e9e
Update ViewModelNames.java
pingyhead c822388
Update mainMenu.js
patrickng99 ac08405
Merge branch 'Sprint2Starter' of https://github.com/team-placeholder-…
patrickng99 4f952d3
Update EmployeeSignIn.java
pingyhead 236c05d
Update EmployeeSignInCommand.java
pingyhead 4f20f8d
Merge branch 'Sprint2Starter' into Sprint2SignIn
moyeneka 0b6168f
Update EmployeeSignIn.java
pingyhead 24b4c2e
Updated implementation
uarkNathanSecrest dbb417c
commented out parts to debug
uarkNathanSecrest 223ddf5
Update ActiveUserDeleteCommand.java
uarkNathanSecrest 126556b
Update ActiveUserDeleteCommand.java
uarkNathanSecrest e6c4575
Create EmployeeCreateCommand.java
uarkNathanSecrest 455d6ad
Create EmployeeDeleteCommand.java
uarkNathanSecrest c250a87
Create EmployeeQuery.java
uarkNathanSecrest 366ce39
Create EmployeeUpdateCommand.java
uarkNathanSecrest File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| <html xmlns:th="https://www.thymeleaf.org"> | ||
|
|
||
| <head> | ||
| <title>Register - Sign In</title> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1"> | ||
|
|
||
| <link rel="stylesheet" type="text/css" href="/styles/master.css"> | ||
|
|
||
| <script type="text/javascript" src="/scripts/master.js" defer></script> | ||
| <script type="text/javascript" src="/scripts/signIn.js" defer></script> | ||
| </head> | ||
|
|
||
| <body> | ||
|
|
||
| <div class="header"> | ||
| <h1 class="primary-message">Sign In</h1> | ||
| </div> | ||
|
|
||
| <div id="main" class="main"> | ||
| <div id="error" th:class="${#strings.isEmpty(errorMessage)} ? hidden : ''"> | ||
| <h4 id="errorMessage" class="error-message" th:text="${errorMessage}"></h4> | ||
| </div> | ||
|
|
||
| <form action="/" method="POST" onsubmit="return validateForm();" class="inputContent"> | ||
| <div> | ||
| <input id="employeeId" type="number" name="employeeId" placeholder="Employee ID" class="update" th:value="${employeeId}" /> | ||
| </div> | ||
| <br /> | ||
| <div> | ||
| <input id="password" type="password" name="password" placeholder="Password" class="update" /> | ||
| </div> | ||
| <br /><br /> | ||
| <div> | ||
| <input type="submit" value="Sign In" class="submit" /> | ||
| </div> | ||
| </form> | ||
| </div> | ||
|
|
||
| </body> | ||
|
|
||
| </html> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| document.addEventListener("DOMContentLoaded", function(event) { | ||
| const employeeIdEditElement = getEmployeeId(); | ||
| employeeIdEditElement.focus(); | ||
| employeeIdEditElement.select(); | ||
| }); | ||
|
|
||
| //Get elements for the Employee Id and Password | ||
| function getEmployeeId() { | ||
| return document.getElementById("employeeId"); | ||
| } | ||
|
|
||
| function getPassword() { | ||
| return document.getElementById("password"); | ||
| } | ||
|
|
||
| //Validates the Id is not blank and is a number; Validates that Password is not null | ||
| function validateForm() { | ||
| const employeeIdEditElement = getEmployeeId(); | ||
| if(isNaN(Number(employeeIdEditElement.value)) || (Number(employeeIdEditElement.value) <= 0)) | ||
| { | ||
| displayError("Employee Id must be a positive numerical value."); | ||
|
|
||
| employeeIdEditElement.focus(); | ||
| employeeIdEditElement.select(); | ||
| return false; | ||
| } | ||
|
|
||
| const passwordEditElement = getPassword(); | ||
| if ((passwordEditElement.value == null) || (passwordEditElement.value.trim() === "")) | ||
| { | ||
| displayError("Password must be valid and cannot be blank."); | ||
|
|
||
| passwordEditElement.focus(); | ||
|
Comment on lines
+19
to
+33
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here |
||
| passwordEditElement.select(); | ||
| return false; | ||
|
|
||
| } | ||
| return true; | ||
| } | ||
|
Comment on lines
+34
to
+39
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here |
||
82 changes: 82 additions & 0 deletions
82
src/main/java/edu/uark/registerapp/commands/activeUsers/ActiveUserDeleteCommand.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,82 @@ | ||
| /*package edu.uark.registerapp.commands.activeUsers; | ||
|
|
||
| import java.util.Optional; | ||
|
|
||
| import org.apache.commons.lang3.StringUtils; | ||
| import org.springframework.stereotype.Service; | ||
| import org.springframework.beans.factory.annotation.Autowired; | ||
| import org.pringframework.transaction.annotation.Transactional; | ||
|
|
||
|
|
||
| import edu.uark.registerapp.commands.VoidCommandInterface; | ||
| import edu.uark.registerapp.nodels.entities.ActiveUserEntity; | ||
| import edu.uark.registerapp.models.repositories.ActiveUserRepository; | ||
|
|
||
| @Service | ||
| public class ActiveUserDeleteCommand implements VoidCommandInterface{ | ||
| @Override | ||
| @Transactional | ||
| public void execute(){ | ||
| final Optional<ActiveUserEntity> activeUserEntity= | ||
| this.activeUserRepository.findBySessionKey(this.sessionKey); | ||
|
|
||
| if(!activeUserEntity.isPresent()){ | ||
| this.activeUserRepository.delete(activeUserEntity.get()); | ||
| } | ||
| } | ||
|
|
||
| private String sessionKey; | ||
|
|
||
| public String getSessionKey(){ | ||
| return this.sessionKey; | ||
| } | ||
|
|
||
| public ActiveUserDeleteCommand setSessionKey(final String sessionKey){ | ||
| this.sessionKey = sessionKey; | ||
| return this; | ||
| } | ||
|
|
||
| @Autowired | ||
| private ActiveUserRepository activeUserRepository; | ||
| } | ||
| */ | ||
|
|
||
|
|
||
| package edu.uark.registerapp.commands.activeUsers; | ||
|
|
||
| import java.util.Optional; | ||
|
|
||
| import org.springframework.beans.factory.annotation.Autowired; | ||
| import org.springframework.stereotype.Service; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
|
|
||
| import edu.uark.registerapp.commands.VoidCommandInterface; | ||
| import edu.uark.registerapp.models.entities.ActiveUserEntity; | ||
| import edu.uark.registerapp.models.repositories.ActiveUserRepository; | ||
|
|
||
| @Service | ||
| public class ActiveUserDeleteCommand implements VoidCommandInterface { | ||
| @Transactional | ||
| @Override | ||
| public void execute() { | ||
| final Optional<ActiveUserEntity> activeUserEntity = | ||
| this.activeUserRepository.findBySessionKey(this.sessionKey); | ||
|
|
||
| if (activeUserEntity.isPresent()) { | ||
| this.activeUserRepository.delete(activeUserEntity.get()); | ||
| } | ||
| } | ||
|
|
||
| // Properties | ||
| private String sessionKey; | ||
| public String getSessionKey() { | ||
| return this.sessionKey; | ||
| } | ||
| public ActiveUserDeleteCommand setSessionKey(final String sessionKey) { | ||
| this.sessionKey = sessionKey; | ||
| return this; | ||
| } | ||
|
|
||
| @Autowired | ||
| private ActiveUserRepository activeUserRepository; | ||
| } |
20 changes: 20 additions & 0 deletions
20
src/main/java/edu/uark/registerapp/commands/employees/ActiveEmployeeExistsQuery.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| package edu.uark.registerapp.commands.employees; | ||
|
|
||
| import org.apache.commons.lang3.StringUtils; | ||
| import edu.uark.registerapp.models.repositories.EmployeeRepository; | ||
| import edu.uark.registerapp.commands.exceptions.NotFoundException; | ||
| import org.springframework.beans.factory.annotation.Autowired; | ||
| import org.springframework.stereotype.Service; | ||
|
|
||
| @Service | ||
| public class ActiveEmployeeExistsQuery implements EmployeeRepository{ | ||
| @Override | ||
| public void ActiveEmployeeExistsQuery(){ | ||
| if(!this.employeeRepository.existsByIsActive(true)){ | ||
| throw new NotFoundException("Employee"); | ||
| } | ||
| } | ||
|
|
||
| @Autowire | ||
| private EmployeeRepository employeeRepository; | ||
| } | ||
|
Comment on lines
+1
to
+20
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. here |
||
89 changes: 89 additions & 0 deletions
89
src/main/java/edu/uark/registerapp/commands/employees/EmployeeCreateCommand.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,89 @@ | ||
| package edu.uark.registerapp.commands.employees; | ||
|
|
||
| import org.apache.commons.lang3.StringUtils; | ||
| import org.springframework.beans.factory.annotation.Autowired; | ||
| import org.springframework.stereotype.Service; | ||
|
|
||
| import edu.uark.registerapp.commands.ResultCommandInterface; | ||
| import edu.uark.registerapp.commands.employees.helpers.EmployeeHelper; | ||
| import edu.uark.registerapp.commands.exceptions.UnprocessableEntityException; | ||
| import edu.uark.registerapp.models.api.Employee; | ||
| import edu.uark.registerapp.models.entities.EmployeeEntity; | ||
| import edu.uark.registerapp.models.enums.EmployeeClassification; | ||
| import edu.uark.registerapp.models.repositories.EmployeeRepository; | ||
|
|
||
| @Service | ||
| public class EmployeeCreateCommand implements ResultCommandInterface<Employee> { | ||
| @Override | ||
| public Employee execute() { | ||
| this.validateProperties(); | ||
|
|
||
| if (this.isInitialEmployee) { | ||
| this.apiEmployee.setClassification( | ||
| EmployeeClassification.GENERAL_MANAGER.getClassification()); | ||
| } | ||
|
|
||
| // Create a new ENTITY object from the API object details. | ||
| final EmployeeEntity employeeEntity = | ||
| this.employeeRepository.save(new EmployeeEntity(this.apiEmployee)); | ||
|
|
||
| // Synchronize information generated by the database upon INSERT. | ||
| this.apiEmployee.setId(employeeEntity.getId()); | ||
| // Only send the password over the network when modifying the database. | ||
| this.apiEmployee.setPassword(StringUtils.EMPTY); | ||
| this.apiEmployee.setCreatedOn(employeeEntity.getCreatedOn()); | ||
| this.apiEmployee.setEmployeeId( | ||
| EmployeeHelper.padEmployeeId( | ||
| employeeEntity.getEmployeeId())); | ||
|
|
||
| return this.apiEmployee; | ||
| } | ||
|
|
||
| // Helper methods | ||
| private void validateProperties() { | ||
| if (StringUtils.isBlank(this.apiEmployee.getFirstName())) { | ||
| throw new UnprocessableEntityException("first name"); | ||
| } | ||
| if (StringUtils.isBlank(this.apiEmployee.getLastName())) { | ||
| throw new UnprocessableEntityException("last name"); | ||
| } | ||
| if (StringUtils.isBlank(this.apiEmployee.getPassword())) { | ||
| throw new UnprocessableEntityException("password"); | ||
| } | ||
|
|
||
| if (!this.isInitialEmployee | ||
| && (EmployeeClassification.map(this.apiEmployee.getClassification()) == EmployeeClassification.NOT_DEFINED)) { | ||
|
|
||
| throw new UnprocessableEntityException("classification"); | ||
| } | ||
| } | ||
|
|
||
| // Properties | ||
| private Employee apiEmployee; | ||
| public Employee getApiEmployee() { | ||
| return this.apiEmployee; | ||
| } | ||
| public EmployeeCreateCommand setApiEmployee(final Employee apiEmployee) { | ||
| this.apiEmployee = apiEmployee; | ||
| return this; | ||
| } | ||
|
|
||
| private boolean isInitialEmployee; | ||
| public boolean getIsInitialEmployee() { | ||
| return this.isInitialEmployee; | ||
| } | ||
| public EmployeeCreateCommand setIsInitialEmployee( | ||
| final boolean isInitialEmployee | ||
| ) { | ||
|
|
||
| this.isInitialEmployee = isInitialEmployee; | ||
| return this; | ||
| } | ||
|
|
||
| @Autowired | ||
| private EmployeeRepository employeeRepository; | ||
|
|
||
| public EmployeeCreateCommand() { | ||
| this.isInitialEmployee = false; | ||
| } | ||
| } |
42 changes: 42 additions & 0 deletions
42
src/main/java/edu/uark/registerapp/commands/employees/EmployeeDeleteCommand.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| package edu.uark.registerapp.commands.employees; | ||
|
|
||
| import java.util.Optional; | ||
| import java.util.UUID; | ||
|
|
||
| import org.springframework.beans.factory.annotation.Autowired; | ||
| import org.springframework.stereotype.Service; | ||
| import org.springframework.transaction.annotation.Transactional; | ||
|
|
||
| import edu.uark.registerapp.commands.VoidCommandInterface; | ||
| import edu.uark.registerapp.commands.exceptions.NotFoundException; | ||
| import edu.uark.registerapp.models.entities.EmployeeEntity; | ||
| import edu.uark.registerapp.models.repositories.EmployeeRepository; | ||
|
|
||
| @Service | ||
| public class EmployeeDeleteCommand implements VoidCommandInterface { | ||
| @Transactional | ||
| @Override | ||
| public void execute() { | ||
| final Optional<EmployeeEntity> employeeEntity = | ||
| this.employeeRepository.findById(this.employeeId); | ||
|
|
||
| if (!employeeEntity.isPresent()) { // No record with the associated record ID exists in the database. | ||
| throw new NotFoundException("Product"); | ||
| } | ||
|
|
||
| this.employeeRepository.delete(employeeEntity.get()); | ||
| } | ||
|
|
||
| // Properties | ||
| private UUID employeeId; | ||
| public UUID getEmployeeId() { | ||
| return this.employeeId; | ||
| } | ||
| public EmployeeDeleteCommand setEmployeeId(final UUID productId) { | ||
| this.employeeId = productId; | ||
| return this; | ||
| } | ||
|
|
||
| @Autowired | ||
| private EmployeeRepository employeeRepository; | ||
| } |
41 changes: 41 additions & 0 deletions
41
src/main/java/edu/uark/registerapp/commands/employees/EmployeeQuery.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,41 @@ | ||
| package edu.uark.registerapp.commands.employees; | ||
|
|
||
| import java.util.Optional; | ||
| import java.util.UUID; | ||
|
|
||
| import org.springframework.beans.factory.annotation.Autowired; | ||
| import org.springframework.stereotype.Service; | ||
|
|
||
| import edu.uark.registerapp.commands.ResultCommandInterface; | ||
| import edu.uark.registerapp.commands.exceptions.NotFoundException; | ||
| import edu.uark.registerapp.models.api.Employee; | ||
| import edu.uark.registerapp.models.entities.EmployeeEntity; | ||
| import edu.uark.registerapp.models.repositories.EmployeeRepository; | ||
|
|
||
| @Service | ||
| public class EmployeeQuery implements ResultCommandInterface<Employee> { | ||
| @Override | ||
| public Employee execute() { | ||
| final Optional<EmployeeEntity> employeeEntity = | ||
| this.employeeRepository.findById(this.employeeId); | ||
|
|
||
| if (employeeEntity.isPresent()) { | ||
| return new Employee(employeeEntity.get()); | ||
| } else { | ||
| throw new NotFoundException("Employee"); | ||
| } | ||
| } | ||
|
|
||
| // Properties | ||
| private UUID employeeId; | ||
| public UUID getEmployeeId() { | ||
| return this.employeeId; | ||
| } | ||
| public EmployeeQuery setEmployeeId(final UUID employeeId) { | ||
| this.employeeId = employeeId; | ||
| return this; | ||
| } | ||
|
|
||
| @Autowired | ||
| private EmployeeRepository employeeRepository; | ||
| } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
change