Lights, Camera, Auction is the name of our API, which pretends to manage an auction's ecosystem where people create an account, create their auctions, and sell their goods to someone who's interested in them.
SECRET=
your secret
💾 First of all you'll need to build a nodejs package with some dependencies, so you must run:
-
npm init -y
-
npm install express body-parser pg-promise jest axios jsonwebtoken dotenv-safe
🏧 Now you may be able to deploy it, do it running node server
.
🚦 You can also test it with npm run test
, however, not all tests are implemented.
🌎 Make it public with ./ngrok http 8080 -host-header="localhost:8080"
-
Each user session has a timeout of 1 hour. Then you have to login once again.
-
Each user has a unique username and email.
-
An auction can be created without a minimum price, in this case, the default value will be 0.
-
Once auctioned, a product cannot be auctioned again, until the auction ends without any bid.
-
Only the seller has the permission to edit his own auctions.
-
Anybody can bid an auction, except the owner.
-
Only bid above maximum bid are accepted.
-
If it's the first bid, the amount must be above minimum price.
-
The owner of an auction receives notifications about all the messages written in his auctions, including his owns.
-
Any user can clear his entire notification inbox.
After the server is deployed, you can now create an account.
POST http://localhost:8080/dbproj/user
body:
{
"username": "John",
"password": "test123",
"email": "john123@gmail.com"
}
An then login.
PUT http://localhost:8080/dbproj/user
body:
{
"username": "John",
"password": "test123"
}
When you're successfully logged in, you may have access to the entire system.
A token is given to you,
- Logout
PUT http://localhost:8080/dbproj/user/logout
headers:
{
"authtoken": "yourtoken123"
}
- Create an Auction
POST http://localhost:8080/dbproj/leilao
headers:
{
"authtoken": "yourtoken123"
}
body:
{
"titulo": "yourtitle",
"descricao": "yourdescription",
"precoMinimo": 1, (is not a must)
"limite": "2020/5/31:22:00",
"artigoId": 1
}
- List All Running Auctions
GET http://localhost:8080/dbproj/leiloes
headers:
{
"authtoken": "yourtoken123"
}
- List All Running Auctions By Product ID Or Product Description
GET http://localhost:8080/dbproj/leiloes/?keyword=
queries:
{
"keyword": "yourkeyword"
}
headers:
{
"authtoken": "yourtoken123"
}
- List Auction By Its ID
GET http://localhost:8080/dbproj/leiloes/?leilaoId=
queries:
{
"leilaoId": "yourauctionId"
}
headers:
{
"authtoken": "yourtoken123"
}
- List All User Activity
GET http://localhost:8080/dbproj/user/atividade
headers:
{
"authtoken": "yourtoken123"
}
- Make a Bid
GET http://localhost:8080/dbproj/leiloes/?leilaoId=&licitacao=
queries:
{
"leilaoId": "yourauctionId",
"licitacao": "yourbid"
}
headers:
{
"authtoken": "yourtoken123"
}
- Edit An Auction
PUT http://localhost:8080/dbproj/leilao/?leilaoId=
queries:
{
"leilaoId": "yourauctionId"
}
headers:
{
"authtoken": "yourtoken123"
}
body:
{
"titulo": "yourtitle",
"descricao": "yourdescription",
"limite": "yourdate",
"precominimo": 19.99
}
- Write a Message In a Auction Mural
POST http://localhost:8080/dbproj/leilao/mural/?leilaoId=
queries:
{
"leilaoId": "yourauctionId"
}
headers:
{
"authtoken": "yourtoken123"
}
body:
{
"message": "yourmessage"
}
- Check User Inbox
GET http://localhost:8080/dbproj/user/inbox
headers:
{
"authtoken": "yourtoken123"
}
- Clear User Inbox
DEL http://localhost:8080/dbproj/user/inbox
headers:
{
"authtoken": "yourtoken123"
}
- List All Products
GET http://localhost:8080/dbproj/artigos
headers:
{
"authtoken": "yourtoken123"
}
Licenciatura em Engenharia Informática - Universidade de Coimbra
Bases de Dados - 2020/2021
Coimbra, 31 de maio de 2021
🎓 Diogo Flórido
🎓 Rodrigo Fernando Henriques Sobral
Have a look at the license file for details