4th semester. Final project on the subject of REST-oriented web services.
This is a prototype auction, which consists of 3 independent REST servers and databases.
Each server is written in spring boot and uses MongoDB.
The project also has a web interface using vue.js. The web interface is for demonstration only.
1.Build Docker images based on the configuration defined in the docker-compose.yml
docker-compose build
2.Download Docker images for all services defined in the docker-compose.yml
docker-compose pull
3.Start containers and run composition for all services defined in the docker-compose.yml
docker-compose up -d
1.Project Setup
npm install
2.Compile and Hot-Reload for Development
npm run dev
Authentication server | Application server | Payment server | Web client app | |
---|---|---|---|---|
Base URL | http://localhost | |||
app ports | 8080 | 8081 | 8082 | 3000 |
DB ports | 27017 | 27018 | 27019 | - |
1.Install the Stripe CLI
https://stripe.com/docs/stripe-cli#install
2.Login in to the CLI
https://stripe.com/docs/stripe-cli#login-account
3.Start webhook listener in terminal
stripe listen --forward-to=localhost:8082/api/payment/webhook
Base Url: http://localhost:8080
POST
/api/user/login
(allows to login, issues a bearer token)
name type data type login required string password required string
http code content-type response 200
application/json
{"type": "Bearer", "accessToken": "eyJhbGciOi..........."}
401
application/json
{"status": "UNAUTHORIZED", "message": "email or password is not valid"}
GET
/api/user/logout
(allows to logout, deactivates the token)
None
http code content-type response 200
text/plain;charset=UTF-8
"User logged out successfully"
401
application/json
{"status": "UNAUTHORIZED", "message": "token is not valid"}
POST
/api/user/create
(allows to create an account)
name type data type login required string password required string firstName required string lastName required string
http code content-type response 200
text/plain;charset=UTF-8
"user added successfully"
400
application/json
{"status": "BAD_REQUEST", "message": "firstName: must not be empty........"
400
application/json
{"status": "BAD_REQUEST", "message": "User already exists"
GET
/api/user
(find all active users)
None
http code content-type response 200
application/json
[{"id": "645e5414830e393ff09ce411", "email": "user1@gmail.com","firstName": "user1","lastName": "user1"}, ]
401
application/json
{"status": "UNAUTHORIZED", "message": "token is not valid"}
GET
/api/user/{ userId }
(find one active user by id)
None
http code content-type response 200
application/json
{"id": "645e5414830e393ff09ce411", "email": "user1@gmail.com","firstName": "user1","lastName": "user1"}
400
application/json
{"status": "BAD_REQUEST", "message": "User not found for id: 214e1423..."}
401
application/json
{"status": "UNAUTHORIZED", "message": "token is not valid"}
GET
/api/user/auth/info
(get only this authorized user)
None
http code content-type response 200
application/json
{"id": "645e5414830e393ff09ce411", "email": "user1@gmail.com","firstName": "user1","lastName": "user1"}
400
application/json
{"status": "BAD_REQUEST", "message": "User does not exist"
401
application/json
{"status": "UNAUTHORIZED", "message": "token is not valid"}
PUT
/api/user
(update only this authorized user)
name type data type firstName required string lastName required string
http code content-type response 200
text/plain;charset=UTF-8
"User successfully changed"
400
application/json
{"status": "BAD_REQUEST", "message": "firstName: must not be empty........"
401
application/json
{"status": "UNAUTHORIZED", "message": "User is not authorized to update this profile"}
401
application/json
{"status": "UNAUTHORIZED", "message": "token is not valid"}
DELETE
/api/user
(delete only this authorized user)
None
http code content-type response 200
text/plain;charset=UTF-8
"User successfully deleted"
401
application/json
{"status": "UNAUTHORIZED", "message": "User is not authorized to delete this profile"}
401
application/json
{"status": "UNAUTHORIZED", "message": "token is not valid"}
Base Url: http://localhost:8081
POST
/api/auction/create
(allows to create a new auction lot)
name type data type name required string description required string startingPrise int string lifeTime required string ("test" OR "one-day" OR "three-days" OR "one-week" )
http code content-type response 200
text/plain;charset=UTF-8
"645e5414830e393ff09ce411"
400
application/json
{"status": "BAD_REQUEST", "message": "description: must not be empty........"
400
application/json
{"status": "BAD_REQUEST", "message": "An active lot with this name already exists"
401
application/json
{"status": "UNAUTHORIZED", "message": "Auth integration exception"}
POST
/api/image/upload/{ auctionId }
(allows to attach an image to your auction)
None
http code content-type response 200
text/plain;charset=UTF-8
"645e5414830e393ff09ce411"
400
application/json
{"status": "BAD_REQUEST", "message": "Image already exist"
401
application/json
{"status": "UNAUTHORIZED", "message": "Auth integration exception"}
GET
/api/image/download/{ auctionId }
(allows you to get an auction image)
None
http code content-type response 200
image/png
image file
400
application/json
{"status": "BAD_REQUEST", "message": "Image not found"
401
application/json
{"status": "UNAUTHORIZED", "message": "Auth integration exception"}
PUT
/api/auction/{ auctionId }
(allows an authorized user to update their auction)
name type data type description required string
http code content-type response 200
text/plain;charset=UTF-8
"Auction id: 645e5414830e393ff09ce411 successfully changed"
400
application/json
{"status": "BAD_REQUEST", "message": "description: must not be empty........"
400
application/json
{"status": "BAD_REQUEST", "message": "Auction not found for id: 645e5414830e393ff09ce411"
401
application/json
{"status": "UNAUTHORIZED", "message": "User is not authorized to update this auction"}
401
application/json
{"status": "UNAUTHORIZED", "message": "Auth integration exception"}
DELETE
/api/user
(allows an authorized user to delete his lot if there aren't participants)
None
http code content-type response 200
text/plain;charset=UTF-8
"Auction id: 645e5414830e393ff09ce411 successfully deleted"
400
application/json
{"status": "BAD_REQUEST", "message": "You can't delete an auction that has participants"
400
application/json
{"status": "BAD_REQUEST", "message": "Auction not found for id: 645e5414830e393ff09ce411"
401
application/json
{"status": "UNAUTHORIZED", "message": "User is not authorized to delete this auction"}
401
application/json
{"status": "UNAUTHORIZED", "message": "Auth integration exception"}
POST
/api/user
(allows to place a bet)
name type data type auctionId required string bet required int
http code content-type response 200
text/plain;charset=UTF-8
"The new bet has been created successfully"
400
application/json
{"status": "BAD_REQUEST", "message": "bet: must not be empty........"
400
application/json
{"status": "BAD_REQUEST", "message": "User is trying to buy his product"
400
application/json
{"status": "BAD_REQUEST", "message": "The auction is outdated"
400
application/json
{"status": "BAD_REQUEST", "message": "The bet is less than the current price"
400
application/json
{"status": "BAD_REQUEST", "message": "Auction lot not fount for id: 645e5414830e393ff09ce411"
401
application/json
{"status": "UNAUTHORIZED", "message": "Auth integration exception"}
GET
/api/auction
(find all active auction lots)
None
http code content-type response 200
application/json
[{"id": "645fa196aa3af742845525bb", "sellerEmail": "test2@gmail.com","sellerName": "test2", "status": "ACTIVE", "participation": {"645e5414830e393ff09ce411": 546,}, "name": "testauction", "description": "testauction", "starting_price": 100, "current_price": 546, "end_time": "2023-06-20T14:41:26.021Z", "winnerId": nul}, ]
401
application/json
{"status": "UNAUTHORIZED", "message": "Auth integration exception"}
GET
/api/auction/auth-user-auctions
(find all auction lots that were created by an authorized user)
None
http code content-type response 200
application/json
[{"id": "645fa196aa3af742845525bb", "sellerEmail": "test2@gmail.com","sellerName": "test2", "status": "ACTIVE", "participation": {"645e5414830e393ff09ce411": 546,}, "name": "testauction", "description": "testauction", "starting_price": 100, "current_price": 546, "end_time": "2023-06-20T14:41:26.021Z", "winnerId": nul}, ]
401
application/json
{"status": "UNAUTHORIZED", "message": "Auth integration exception"}
GET
/api/auction/auth-participant-auctions
(find all active auctions in which the authorized user participates)
None
http code content-type response 200
application/json
[{"id": "645fa196aa3af742845525bb", "sellerEmail": "test2@gmail.com","sellerName": "test2", "status": "ACTIVE", "participation": {"645e5414830e393ff09ce411": 546,}, "name": "testauction", "description": "testauction", "starting_price": 100, "current_price": 546, "end_time": "2023-06-20T14:41:26.021Z", "winnerId": nul}, ]
401
application/json
{"status": "UNAUTHORIZED", "message": "Auth integration exception"}
GET
/api/auction/auth-winner-auctions
(find all finished auctions, where the authorized user is winner)
None
http code content-type response 200
application/json
[{"id": "645fa196aa3af742845525bb", "sellerEmail": "test2@gmail.com","sellerName": "test2", "status": "FINISHED", "participation": {"645e5414830e393ff09ce411": 546,}, "name": "testauction", "description": "testauction", "starting_price": 100, "current_price": 546, "end_time": "2023-04-20T14:41:26.021Z", "winnerId": "645e5414830e393ff09ce411"}, ]
401
application/json
{"status": "UNAUTHORIZED", "message": "Auth integration exception"}
GET
/api/auction/auth-purchased-auctions
(find all auctions paid for by an authorized user)
None
http code content-type response 200
application/json
[{"id": "645fa196aa3af742845525bb", "sellerEmail": "test2@gmail.com","sellerName": "test2", "status": "PAID", "participation": {"645e5414830e393ff09ce411": 546,}, "name": "testauction", "description": "testauction", "starting_price": 100, "current_price": 546, "end_time": "2023-04-20T14:41:26.021Z", "winnerId": "645e5414830e393ff09ce411"}, ]
401
application/json
{"status": "UNAUTHORIZED", "message": "Auth integration exception"}
GET
/api/auction/{ auctionId }
(find one auction lot by id)
None
http code content-type response 200
application/json
{"id": "645fa196aa3af742845525bb", "sellerEmail": "test2@gmail.com","sellerName": "test2", "status": "ACTIVE", "participation": {"645e5414830e393ff09ce411": 546,}, "name": "testauction", "description": "testauction", "starting_price": 100, "current_price": 546, "end_time": "2023-06-20T14:41:26.021Z", "winnerId": nul}
401
application/json
{"status": "UNAUTHORIZED", "message": "Auth integration exception"}
Base Url: http://localhost:8082
GET
/api/payment/{ auctionId }
(initial payment)
None
http code content-type response 200
text/plain;charset=UTF-8
"https://stripe.com/....."
401
application/json
{"status": "UNAUTHORIZED", "message": "Auction integration exception"}
401
application/json
{"status": "UNAUTHORIZED", "message": "Auth integration exception"}
GET
/api/payment/webhook
webhook for validate payment
- Docker how to install Docker
- Docker Compose how to install docker-compose