Polad E-commerce has been created to make category and product management according to the logged user`s role.
1 - Clone the project
git clone https://github.com/eroberer/palod-commerce.git
cd palod-commerce
2 - Install docker-compose (for local db)
3 - Install maven (for application build)
1 - Run database
cd database
docker-compose up
2 - Run application
mvn spring-boot:run
- Admin User
Category: find, save, update, delete
Product: find, save, update, delete
- Basic User
Category: find
Product: find, save (just owner), update (just owner), delete (just owner)
- Not Registered User
Category: find
Product: find
{
"email": "admin@admin",
"password": "password"
}
- Request
{
"fullName": "fatih",
"email": "test2@test2",
"password": "password"
}
- Response
HTTP 200 OK
- Request
{
"email": "test2@test2",
"password": "password"
}
- Response
HTTP 200 OK
{
"timestamp": "2020-07-23T00:12:44.378149",
"status": 200,
"token": "eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJ0ZXN0MkB0ZXN0MiIsInJvbGVzIjpbeyJhdXRob3JpdHkiOiJST0xFX0JBU0lDIn1dLCJpYXQiOjE1OTU0NTIzNjQsImV4cCI6MTU5NTQ1NTk2NH0.gWV0ykPqJ2KzuZR-8ZIMZp-LUYSre5do_6s_mzOlbAI"
}
- Response
HTTP 200 OK
[
{
"id": 1,
"createdDate": "2020-07-23T00:14:24.888464",
"name": "Test Category",
"description": "Test Category description"
},
{
"id": 2,
"createdDate": "2020-07-23T00:14:43.66807",
"name": "Test Category 2",
"description": "Test Category 2 description"
}
]
- Header
header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbkBhZG1pbiIsInJvbGVzIjpbeyJhdXRob3JpdHkiOiJST0xFX0FETUlOIn1dLCJpYXQiOjE1OTU0NTE3NDgsImV4cCI6MTU5NTQ1NTM0OH0.Q2oOQjXxm2sSY77STxP6iFglI6LZ-qmIQpaEdTK0D0o'
- Request
{
"name" : "Test Category 3",
"description" : "Test Category 3 description"
}
- Response
If a user has admin role, the category is saved then returns HTTP 200 OK
Otherwise (user has not admin role), the response is HTTP 403 FORBIDDEN
- Response
HTTP 200 OK
{
"id": 2,
"createdDate": "2020-07-23T00:53:58.664344",
"name": "Test Product 1",
"description": null,
"amount": 133.50,
"quantity": 22,
"categoryId": 1,
"productImageList": []
}
- Header
header 'Authorization: Bearer eyJhbGciOiJIUzI1NiJ9.eyJzdWIiOiJhZG1pbkBhZG1pbiIsInJvbGVzIjpbeyJhdXRob3JpdHkiOiJST0xFX0FETUlOIn1dLCJpYXQiOjE1OTU0NTE3NDgsImV4cCI6MTU5NTQ1NTM0OH0.Q2oOQjXxm2sSY77STxP6iFglI6LZ-qmIQpaEdTK0D0o'
- Request
{
"name" : "Test Product 1",
"amount" : 133.5,
"categoryId": 1,
"quantity" : 22
}
- Response
HTTP 200 OK
if there is invalid token or there isn't token, response http code would be HTTP 403 FORBIDDEN