Foodie is an a discussion forum where people post and comment on a food recipe.
·
User Stories
·
Pivotal Tracker (Back-End REST API)
Application Goals from User Stories are:
- Sign-up and Create Profile Foodie User
- Anyone can See Posts and Comments
- Signed-in user able to post a Post and comment
- Signed-in user able to delete it's own Posts and Comments
- Spring boot is used for the backend Services.
- Zuul Eureka client is used for load-balancing between Services.
- Zuul Gateway for Api-Gateway to forward api requests to Services.
- Postgres is Used for the database.
- Docker to run the services.
- Pivotal Cloud Foundry is used to deploy the application.
We discussed the architecture of the project and decided to use a database for each component. We figured out how to proceed with the development and created the corresponding user stories that will lead us to completion.
We used pair programming and collaborated with each other and tried to stick to our schedule.
- Communication between services.
- Integrity of Data.
Follow these easy step:
-
Clone the repository:
git clone https://github.com/gajjuCoderBoi/cognizant-p3
-
Execute this on command line:
$cd cognizant-p3 $docker-compose up
-
Enjoy
- Requirement Analysis
-
Tuesday(Nov 12, 2019) - user stories
We give our user stories points, so that we could prioritize our development steps.
https://www.pivotaltracker.com/n/projects/2416993
-
Wednesday(Nov 13, 2019) - ERD
Pair mapped Architecture Diagram to include 5 services and their communications.
-
Thursday(Nov 14, 2019) - User, comment, and post Service mapped.
Added user, comment, and post creation functionality.
-
Friday(Nov 15, 2019) - Building.
Running services on the Docker. And Building on the Docker and pushing the Docker images.
-
Saturday(Nov 16, 2019) - Tested all route functionality and began testing.
- All route functionality is working. Recorded results to ReadMe file. - Connect front-end with backend.
-
Sunday(Oct 25, 2019) - Trying to deployee.
*-*-*-*-*-*-*
-
* Visualization Generated by DataGrip.
Base URL: /, Version: 1.1
Default request content-types: application/json
Default response content-types: application/json
Schemes: http
Path | Operation | Description | Controller#Method |
---|---|---|---|
/user/signup | |||
POST |
Create a User (Sign-up) |
UserController#signup |
|
/user/login | |||
POST |
Create a login session. |
UserController#login |
|
/user/reset | |||
PUT |
Reset User Password. |
UserController#reset |
|
/profile | GET |
Retrieve the profile of the User. (Auth Token Required) |
ProfileController#getProfile |
POST |
Create the profile of the User. (Auth Token Required) |
ProfileController#createProfile |
|
PUT |
Update profile of the User. (Auth Token Required) |
ProfileController#updateProfile |
|
/post | GET |
Getting the Posts of the User (Auth Token Required). |
PostController#listPostByUser |
POST |
Create a Posts of the User (Auth Token Required). |
PostController#addPost |
|
/post/list | |||
GET |
Retrieve all the posts. |
PostController#listPost |
|
/post/{postId} | PUT |
Updating a Post. (Auth Token Required). |
PostController#updatePost |
DELETE |
Deleting a Post. (Auth Token Required). |
PostController#deletePost |
|
/post/{postId}/comment/ | GET |
Retrieve all the comments of the a Post. |
PostController#listCommentsByPost |
/comment | GET |
Retrieve all the comments. |
CommentController#listComments |
/comment/list | GET |
Retrieve all the comments of a User. (Auth Token Required). |
CommentController#listCommentsByUser |
/comment/{postId} | POST |
Creating a comment on a post. (Auth Token Required). |
CommentController#addComment |
/comment/{commentId} | PUT |
Updating a comment. (Auth Token Required). |
PostController#updateComment |
DELETE |
Deleting a Comment. (Auth Token Required). |
PostController#deleteComment |
tokenBasedAuth
type: Bearer Token
Description:
Basic HTTP authorization with Bearer Token.
* Bearer Token will be returned after login using 'username' and 'password'.
Request Body
{
"username" : "myUser",
"password" : "myPassword9"
}
Response Header
Status: 200 OK
Response Body
{
"username": "myUser",
"token": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJteVVzZXIiLCJleHAiOjE1NzIwMTkxMzAsImlhdCI6MTU3MTkzMjczMH0.3j4YpkvdiAkLBpW5PI1aBYZw1Uhf97gm67BwcNFFN0_pWIoZgrMt9xga1ximg1Xt-fMq5-v2ifE8B8sWTMP0EA"
}
Authorization
token: Bearer Token
Request Body
{
"username" : "myUser",
"password" : "myPassword9"
}
Response Header
Status: 200 OK
Response Body
{
"username": "myUser",
"token": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJteVVzZXIiLCJleHAiOjE1NzIwMTkyMjcsImlhdCI6MTU3MTkzMjgyN30.Z9fh-cPXaVLAD9_I3k2w9JYn69lup6PrjtuxRIbUCkwUBHmzsIzhKKaO0sF8hkFJM1tWN61KrkQLl3fYhV9ZZQ"
}
Authorization
token: Bearer Token
Request Body
{
"password" : "123"
}
Response Header
Status: 200 OK
Response Body
{
"username": "myUser",
"token": "eyJhbGciOiJIUzUxMiJ9.eyJzdWIiOiJteVVzZXIiLCJleHAiOjE1NzIwMTkyMjcsImlhdCI6MTU3MTkzMjgyN30.Z9fh-cPXaVLAD9_I3k2w9JYn69lup6PrjtuxRIbUCkwUBHmzsIzhKKaO0sF8hkFJM1tWN61KrkQLl3fYhV9ZZQ"
}
Authorization
token: Bearer Token
Response Header
Status: 200 OK
Response Body
{
"email": "[email protected]",
"mobile": "123-123-1234",
"address": "123 Fake Street"
}
Authorization
token: Bearer Token
Response Header
Status: 200 OK
Request Body
{
"address": "123 Fake Street",
"email": "[email protected]",
"mobile": "123-123-1234"
}
Response Body
{
"address": "123 Fake Street",
"email": "[email protected]",
"mobile": "123-123-1234"
}
Authorization
token: Bearer Token
Response Header
Status: 200 OK
Request Body
{
"address": "456 Fake Street",
"email": "[email protected]",
"mobile": "456-123-1234"
}
Response Body
{
"email": "[email protected]",
"mobile": "456-123-1234",
"address": "456 Fake Street"
}
Response Header
Status: 200 OK
Response Body
[
{
"postId": 1,
"title": "1 title for my post",
"postText": "1 My super important post.",
"userName": "might"
},
{
"postId": 2,
"title": "1 title for my post",
"postText": "1 My super important post.",
"userName": "fright"
},
{
"postId": 3,
"title": "1 title for my post",
"postText": "1 My super important post.",
"userName": "fright"
},
{
"postId": 5,
"title": "my post title",
"postText": "my post text",
"userName": "might"
},
{
"postId": 4,
"title": "1 title for my post",
"postText": "my edited post text",
"userName": "fright"
}
]
Authorization
token: Bearer Token
Response Header
Status: 200 OK
Response Body
[
{
"postId": 6,
"title": "myUser Post Title",
"postText": "myUser Post Text",
"userName": "myUser"
}
]
Authorization
token: Bearer Token
Response Header
Status: 200 OK
Request Body
{
"title" : "myUser Post Title",
"postText" : "myUser Post Text"
}
Response Body
{
"postId": 6,
"title": "myUser Post Title",
"postText": "myUser Post Text",
"userName": "myUser"
}
Authorization
token: Bearer Token
Response Header
Status: 200 OK
Request Body
{
"postText" : "my edited post text for might"
}
Response Body
{
"postId": 5,
"title": "my post title",
"postText": "my edited post text for might",
"userName": "might"
}
Authorization
token: Bearer Token
Response Header
Status: 200 OK
Response Body
5
Response Header
Status: 200 OK
Response Body
[
{
"commentId": 1,
"commentText": "Super Post Comment",
"username": "might",
"postTitle": "1 title for my post",
"postid": "1"
},
{
"commentId": 4,
"commentText": "Super Fright Post Comment",
"username": "fright",
"postTitle": "1 title for my post",
"postid": "1"
},
{
"commentId": 2,
"commentText": "Super Re-Edited Comment",
"username": "fright",
"postTitle": "1 title for my post",
"postid": "1"
}
]
Authorization
token: Bearer Token
Response Header
Status: 200 OK
Request Body
{
"commentText" : "Might comment on post"
}
Response Body
{
"commentId": 5,
"commentText": "Might comment on post",
"username": "might",
"postTitle": "1 title for my post",
"postid": "1"
}
Response Header
Status: 200 OK
Response Body
[
{
"commentId": 5,
"commentText": "Might comment on post",
"username": "might",
"postTitle": "1 title for my post",
"postid": "1"
},
{
"commentId": 6,
"commentText": "Lorem ipsum",
"username": "might",
"postTitle": "1 title for my post",
"postid": "1"
},
]
Authorization
token: Bearer Token
Response Header
Status: 200 OK
Response Body
[
{
"commentId": 1,
"commentText": "Some edited text by might",
"username": "might",
"postTitle": "1 title for my post",
"postid": "1"
}
]
Authorization
token: Bearer Token
Response Header
Status: 200 OK
Request Body
{
"commentText" : "Some edited text by might"
}
Response Body
{
"commentId": 1,
"commentText": "Some edited text by might",
"username": "might",
"postTitle": "1 title for my post",
"postid": "1"
}
Authorization
token: Bearer Token
Response Header
Status: 200 OK
Request Body
{
"commentText" : "Some edited text by might"
}
Response Body
{
"commentId": 1,
"commentText": "Some edited text by might",
"username": "might",
"postTitle": "1 title for my post",
"postid": "1"
}
Authorization
token: Bearer Token
Response Header
Status: 200 OK
Response Body
1
User
* Properties
-> userId : integer
-> username : string
-> passsword : string
-> roles : List<Role>
-> profile : UserProfile
-> posts : List<Post>
-> comments : List<Comment>
Role
* Properties
-> roleId : integer
-> name : string
-> users : List<User>
Profile
* Properties
-> profileId : integer
-> email : string
-> mobile : string
-> address : string
-> user : User
Post
* Properties
-> postId : integer
-> title : string
-> postText : string
-> user : User
Comment
* Properties
-> commentId : integer
-> commentText : string
-> user : User
-> post : Post
JwtResponse
* Properties
-> username : string
-> jwt : string
Within the download you'll find the following directories and files, logically grouping common assets and providing both compiled and minified variations. You'll see something like this:
cognizant-p2/
├── API-Gateway
│ ├── Dockerfile
│ ├── manifest.yml
│ ├── mvnw
│ ├── mvnw.cmd
│ ├── pom.xml
│ └── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── APIGateway
│ │ │ ├── TestController.java
│ │ │ └── ZuulGatewayApplication.java
│ │ └── resources
│ │ ├── application-dev.properties
│ │ ├── application-pcf.properties
│ │ └── application.properties
│ └── test
│ └── java
│ └── com
│ └── example
│ └── APIGateway
│ └── ZuulGatewayApplicationTests.java
├── README.md
├── comments-api
│ ├── Dockerfile
│ ├── mvnw
│ ├── mvnw.cmd
│ ├── pom.xml
│ └── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ └── ga
│ │ │ └── commentsapi
│ │ │ ├── CommentsApplication.java
│ │ │ ├── bean
│ │ │ │ ├── Post.java
│ │ │ │ └── User.java
│ │ │ ├── config
│ │ │ │ └── WebSecurityConfig.java
│ │ │ ├── controller
│ │ │ │ └── CommentController.java
│ │ │ ├── model
│ │ │ │ └── Comment.java
│ │ │ ├── repository
│ │ │ │ └── CommentRepository.java
│ │ │ └── service
│ │ │ ├── CommentService.java
│ │ │ └── CommentServiceImpl.java
│ │ └── resources
│ │ ├── application-dev.properties
│ │ ├── application-local.properties
│ │ └── application.properties
│ └── test
│ └── java
│ └── com
│ └── ga
│ └── commentsapi
│ └── CommentsApplicationTests.java
├── deployment.sh
├── docker-compose.yml
├── eureka-server
│ ├── Dockerfile
│ ├── manifest.yml
│ ├── mvnw
│ ├── mvnw.cmd
│ ├── pom.xml
│ └── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ └── example
│ │ │ └── eurekaserver
│ │ │ └── EurekaServerApplication.java
│ │ └── resources
│ │ ├── application-dev.properties
│ │ ├── application-pcf.properties
│ │ └── application.properties
│ └── test
│ └── java
│ └── com
│ └── example
│ └── eurekaserver
│ └── EurekaServerApplicationTests.java
├── front-end
│ ├── css
│ │ ├── bootstrap-grid.css
│ │ ├── bootstrap-grid.css.map
│ │ ├── bootstrap-grid.min.css
│ │ ├── bootstrap-grid.min.css.map
│ │ ├── bootstrap-reboot.css
│ │ ├── bootstrap-reboot.css.map
│ │ ├── bootstrap-reboot.min.css
│ │ ├── bootstrap-reboot.min.css.map
│ │ ├── bootstrap.css
│ │ ├── bootstrap.css.map
│ │ ├── bootstrap.min.css
│ │ ├── bootstrap.min.css.map
│ │ ├── postwidget.css
│ │ └── style.css
│ ├── img
│ │ ├── Scanndit_Wire_Frame.png
│ │ ├── logo.png
│ │ ├── logo2.png
│ │ └── profile-placeholder.png
│ ├── index.html
│ ├── js
│ │ ├── api.js
│ │ ├── bootstrap.bundle.js
│ │ ├── bootstrap.bundle.js.map
│ │ ├── bootstrap.bundle.min.js
│ │ ├── bootstrap.bundle.min.js.map
│ │ ├── bootstrap.js
│ │ ├── bootstrap.js.map
│ │ ├── bootstrap.min.js
│ │ ├── bootstrap.min.js.map
│ │ ├── commentfeed.js
│ │ ├── index.js
│ │ ├── jquery-3.3.1.slim.min.js
│ │ ├── navbar.js
│ │ ├── popper.min.js
│ │ ├── post.js
│ │ ├── postfeed.js
│ │ └── profile.js
│ ├── post
│ │ └── index.html
│ ├── profile
│ │ ├── index.html
│ │ └── style.css
│ └── src
│ └── postwidget
│ └── postwidget.js
├── img
│ ├── ERD_2.png
│ ├── logo.png
│ └── rough_architecture.jpg
├── posts-api
│ ├── Dockerfile
│ ├── mvnw
│ ├── mvnw.cmd
│ ├── pom.xml
│ └── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ └── ga
│ │ │ └── postsapi
│ │ │ ├── PostsApiApplication.java
│ │ │ ├── bean
│ │ │ │ ├── Comment.java
│ │ │ │ └── User.java
│ │ │ ├── cofig
│ │ │ │ └── WebSecurityConfig.java
│ │ │ ├── controller
│ │ │ │ └── PostController.java
│ │ │ ├── model
│ │ │ │ └── Post.java
│ │ │ ├── repository
│ │ │ │ └── PostRepository.java
│ │ │ └── service
│ │ │ ├── PostService.java
│ │ │ └── PostServiceImpl.java
│ │ └── resources
│ │ ├── application-dev.properties
│ │ ├── application-local.properties
│ │ └── application.properties
│ └── test
│ └── java
│ └── com
│ └── ga
│ └── postsapi
│ └── PostsApiApplicationTests.java
├── profile-api
│ ├── mvnw
│ ├── mvnw.cmd
│ ├── pom.xml
│ └── src
│ ├── main
│ │ ├── java
│ │ │ └── com
│ │ │ └── ga
│ │ │ └── profileapi
│ │ │ ├── ProfileAPIApplication.java
│ │ │ ├── config
│ │ │ │ └── WebSecurityConfig.java
│ │ │ ├── controller
│ │ │ │ └── ProfileController.java
│ │ │ ├── model
│ │ │ │ ├── Profile.java
│ │ │ │ └── User.java
│ │ │ ├── repository
│ │ │ │ └── ProfileRepository.java
│ │ │ └── service
│ │ │ ├── ProfileService.java
│ │ │ └── ProfileServiceImpl.java
│ │ └── resources
│ │ ├── application-dev.properties
│ │ ├── application-local.properties
│ │ └── application.properties
│ └── test
│ └── java
│ └── com
│ └── ga
│ └── profileapi
│ └── ProfileAPIApplicationTests.java
└── users-api
├── Dockerfile
├── manifest.yml
├── mvnw
├── mvnw.cmd
├── pom.xml
└── src
├── main
│ ├── java
│ │ └── com
│ │ └── ga
│ │ └── usersapi
│ │ ├── UsersApiApplication.java
│ │ ├── config
│ │ │ ├── JwtRequestFilter.java
│ │ │ ├── JwtUtil.java
│ │ │ ├── SecurityConfig.java
│ │ │ └── SecurityConfigInitializer.java
│ │ ├── controller
│ │ │ └── UserController.java
│ │ ├── model
│ │ │ ├── JwtResponse.java
│ │ │ └── User.java
│ │ ├── repository
│ │ │ └── UserRepository.java
│ │ └── service
│ │ ├── UserService.java
│ │ └── UserServiceImpl.java
│ └── resources
│ ├── application-dev.properties
│ ├── application-local.properties
│ ├── application-pcf.properties
│ └── application.properties
└── test
└── java
└── com
└── ga
└── usersapi
└── UsersApiApplicationTests.java
Carlos Kruger
Mohammad Javed