Skip to content

eroberer/palod-commerce

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

49 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Palod E-Commerce Application Service

Polad E-commerce has been created to make category and product management according to the logged user`s role.

Installation

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)

Run

1 - Run database

cd database
docker-compose up

2 - Run application

mvn spring-boot:run

Database Diagram

User Endpoint Authority

  • 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

Admin User

{
    "email": "admin@admin",
    "password": "password"
}

Some Api Endpoint Example Request / Response

User

POST api/user/register

  • Request
{
   "fullName": "fatih",
   "email": "test2@test2",
   "password": "password"
}
  • Response HTTP 200 OK

POST api/user/login

  • 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"
}

Category

GET api/category/

  • 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"
   }
]

POST api/category/

  • 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

Product

GET api/product/{productId}

  • 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": []
}

POST api/product/

  • 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

All enpoints

About

Palod E-Commerce Application

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages