Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
69 commits
Select commit Hold shift + click to select a range
065970d
Initial commit
MelroseDigital May 23, 2022
21089a2
Update README.md
MelroseDigital May 23, 2022
c3339ef
Added models for each package
mmoord May 24, 2022
b0e5056
New Branch TM_p1
MelroseDigital May 25, 2022
bf3dd08
New Branch TM_p1
MelroseDigital May 25, 2022
6b83566
Updated something, not sure what
mmoord May 26, 2022
1a762c8
First Layer in Progress...
MelroseDigital May 26, 2022
a43da7c
Added the model for customer
mmoord May 27, 2022
fb67044
added the ability to add a customer to the database, with authenticat…
mmoord May 27, 2022
cf9e56a
Merge branch 'main' into mmoord
mmoord May 27, 2022
cd50102
Merge pull request #1 from SyntaxError-JARS/mmoord
mmoord May 27, 2022
831b294
First Layer in Progress...
MelroseDigital May 27, 2022
47be3d4
Next Part
MelroseDigital May 27, 2022
989c5e1
message
MelroseDigital May 27, 2022
dde1dbb
Workspace.xml
mmoord May 27, 2022
d4b276a
deleted .idea/workspace.xml so I can merge
mmoord May 27, 2022
8e402cb
Merge branch 'main' of https://github.com/SyntaxError-JARS/Pi2a1000Pl…
MelroseDigital May 27, 2022
675bf5e
removed readme and workspace.xml
MelroseDigital May 27, 2022
9adb25b
Merge branch 'TM_p1' into main
MelroseDigital May 27, 2022
a026a0f
Merge pull request #2 from SyntaxError-JARS/main
MelroseDigital May 27, 2022
53a2604
Fixed file structure issue
mmoord May 27, 2022
27caaac
Credit Card Class Updates
MelroseDigital May 29, 2022
ed6732b
Credit Card Class Updates
MelroseDigital May 29, 2022
e6d823b
Added the order model
mmoord May 29, 2022
dfb60e0
Implemented basic order creation functionality
mmoord May 29, 2022
6d50e75
Dto...Heading into Testing
MelroseDigital May 30, 2022
b298669
Add files via upload
RoLewis367 May 31, 2022
2c3149e
Testing in progress
MelroseDigital Jun 1, 2022
0d3b0ec
Started Customer Authentication
mmoord Jun 1, 2022
8f916a1
An attemot to get hibernate to work, Still getting Unable to locate p…
mmoord Jun 1, 2022
4cc83ed
Hibernate Updates
MelroseDigital Jun 2, 2022
d492bbe
Made changes to the hibernate util, still not working
mmoord Jun 2, 2022
d07f256
Added the ability to Delete an Account, working on Updating Account
mmoord Jun 2, 2022
67e2c5a
Working Hibernate
mmoord Jun 2, 2022
2d6c4c5
Hibernate Updates in Progress
MelroseDigital Jun 2, 2022
b84cec1
Hibernate Updates in Progress
MelroseDigital Jun 2, 2022
b789e74
Added hibernat util
mmoord Jun 2, 2022
6d5a050
Fixed merge conflict
mmoord Jun 2, 2022
cc6f12a
Merge branch 'main' of https://github.com/SyntaxError-JARS/Pi2a1000Pl…
mmoord Jun 2, 2022
fd78706
Accidentally pushed to main
mmoord Jun 2, 2022
79723eb
accidentally pushed to main
mmoord Jun 2, 2022
a6567d0
accidentally pushed to main
mmoord Jun 2, 2022
0084547
accidentally pushed to main
mmoord Jun 2, 2022
94f2ced
accidentally pushed to main
mmoord Jun 2, 2022
f3cfa8d
accidentally pushed to main
mmoord Jun 2, 2022
be71e6b
accidentally pushed to main
mmoord Jun 2, 2022
94e4e32
accidentally pushed to main
mmoord Jun 2, 2022
fed331b
accidentally pushed to main
mmoord Jun 2, 2022
6eccda2
accidentally pushed to main
mmoord Jun 2, 2022
0eee8b0
accidentally pushed to main
mmoord Jun 2, 2022
237e90c
accidentally pushed to main
mmoord Jun 2, 2022
cd13340
accidentally pushed to main
mmoord Jun 2, 2022
f2a9e5f
Merge pull request #5 from SyntaxError-JARS/main
mmoord Jun 2, 2022
d4a3bcb
Merge branch 'TM_p1' into main
MelroseDigital Jun 2, 2022
306e665
Merge branch 'hibernate' into main
mmoord Jun 2, 2022
5570cae
Added the ability to Update Account
mmoord Jun 3, 2022
f260ff9
Made some changes to Customer Dao
mmoord Jun 3, 2022
0902967
Merge branch 'mmoord' into main
mmoord Jun 3, 2022
dd8f169
Update pom.xml
mmoord Jun 3, 2022
4b98c5b
Update CustomerServices.java
mmoord Jun 3, 2022
3b87dd0
Update CustomerServlet.java
mmoord Jun 3, 2022
58620b4
Update CustomerServlet.java
mmoord Jun 3, 2022
9e633d5
Update CustomerServlet.java
mmoord Jun 3, 2022
63c3b8e
Update CustomerServlet.java
MelroseDigital Jun 3, 2022
5e62a8f
Modified
mmoord Jun 3, 2022
56446a2
Merging
mmoord Jun 3, 2022
671a9ce
The path is Pi2a1000Places in tomcat
mmoord Jun 4, 2022
bcbb76a
Create README.md
mmoord Jun 7, 2022
5145ca0
Update README.md
mmoord Jun 7, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .idea/.gitignore

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 3 additions & 0 deletions .idea/misc.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

124 changes: 124 additions & 0 deletions .idea/uiDesigner.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 0 additions & 6 deletions .idea/vcs.xml

This file was deleted.

58 changes: 0 additions & 58 deletions .idea/workspace.xml

This file was deleted.

43 changes: 42 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1 +1,42 @@
This is maxwell moord's read me page, its not done
# Project 1: Pi 2 a 1000 Places

# Desctiption
Our Gourmet Pizza Restaurant app was developed for a small restaurant that is looking to help streamline the ordering process for customers to help reduce costs. Customers can enjoy an seamless means to order directly with an account of their own at the restaurant in question, where Admins are capable of adding and updating the menu items. This RESTful application leverages a tomcat server to handle incoming requests to thoroughly tested services that must be persisted using Hibernate and Azure SQL services. This project includes a front-end that will be developed using ReactJS to handle user requests.

# User Stories

## As A Admin:

- [ ] Add items to the menu
- [ ] Update items to the menu
- [ ] Delete items to the menu


## As A: Customer

- [ ] View all items on the menu without needing to Register or Login
- [ ] Register/Update/Delete an account
- [ ] Add/Update/Delete a credit card to be saved to my account
- [ ] Make an order for a specific menu item
- [ ] Add a comment to the order to request a change, if it is substitutable
- [ ] Favorite an order
- [ ] View past orders by date
- [ ] Pay off your balance with your credit card


## Tech Stack

- [ ] Java 8
- [ ] JUnit
- [ ] Mockito
- [ ] Apache Maven
- [ ] Hibernate
- [ ] Jackson library (for JSON marshalling/unmarshalling)
- [ ] Java EE Servlet API (v4.0+)
- [ ] Azure SQL
- [ ] Git SCM (on GitHub)

## Collaborators
- Maxwell Moord
- Tenyce Melrose
- Rodney Lewis
27 changes: 24 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
<maven.compiler.target>8</maven.compiler.target>
</properties>


<build>
<pluginManagement>
<plugins>
Expand All @@ -32,6 +33,8 @@
</pluginManagement>
</build>



<dependencies>
<!-- this is a comment -->
<!-- https://mvnrepository.com/artifact/org.postgresql/postgresql -->
Expand All @@ -56,7 +59,6 @@
<scope>test</scope>
</dependency>


<!-- https://mvnrepository.com/artifact/javax.servlet/javax.servlet-api -->
<dependency>
<groupId>javax.servlet</groupId>
Expand Down Expand Up @@ -86,7 +88,26 @@
<version>5.4.32.Final</version>
</dependency>

<!-- https://mvnrepository.com/artifact/com.microsoft.sqlserver/mssql-jdbc -->
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>mssql-jdbc</artifactId>
<version>10.2.1.jre8</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>

</dependencies>
</dependencies>

</project>
</project>
63 changes: 63 additions & 0 deletions src/main/java/com/revature/Pi2a1000Places/auth/AuthServlet.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
package com.revature.Pi2a1000Places.auth;

import com.fasterxml.jackson.databind.ObjectMapper;
import com.revature.Pi2a1000Places.customer.Customer;
import com.revature.Pi2a1000Places.customer.CustomerServices;
import com.revature.Pi2a1000Places.util.exceptions.AuthenticationException;
import com.revature.Pi2a1000Places.util.exceptions.InvalidRequestException;
import com.revature.Pi2a1000Places.util.interfaces.Authable;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import java.io.IOException;


public class AuthServlet extends HttpServlet {

private final CustomerServices customerServices;

private final ObjectMapper mapper;

public AuthServlet(CustomerServices customerServices, ObjectMapper mapper){
this.customerServices = customerServices;
this.mapper = mapper;
}

@Override
protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws IOException {

try {

LoginCreds loginCreds = mapper.readValue(req.getInputStream(), LoginCreds.class);

Customer authCustomer = customerServices.authenticateCustomer(loginCreds.getUsername(), loginCreds.getPassword());



HttpSession httpSession = req.getSession(true);
httpSession.setAttribute("authCustomer", authCustomer);


resp.getWriter().write("You have successfully logged in!");
} catch (AuthenticationException | InvalidRequestException e){
resp.setStatus(404);
resp.getWriter().write(e.getMessage());
} catch (Exception e){
resp.setStatus(409);
resp.getWriter().write(e.getMessage());
}
}

@Override
protected void doDelete(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
resp.addHeader("Access-Control-Allow-Origin", "*");
resp.addHeader("Access-Control-Allow-Methods", "GET, PUT, POST, DELETE");
resp.addHeader("Access-Control-Allow-Headers", "Content-Type, Authorization");
req.getSession().invalidate();
resp.getWriter().write("User has logged out!");
}

}
25 changes: 25 additions & 0 deletions src/main/java/com/revature/Pi2a1000Places/auth/LoginCreds.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
package com.revature.Pi2a1000Places.auth;

public class LoginCreds {

private static String username;
private static String password;

// JACKSON REQUIRES A NO ARG CONSTRUCTOR

public static String getUsername() {
return username;
}

public void setUsername(String username) {
this.username = username;
}

public static String getPassword() {
return password;
}

public void setPassword(String password) {
this.password = password;
}
}
Loading